Neko 1.99.5
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
rhs_maker_cpu.f90
Go to the documentation of this file.
5 use field, only : field_t
6 use num_types, only : rp
8 implicit none
9 private
10
11 type, public, extends(rhs_maker_sumab_t) :: rhs_maker_sumab_cpu_t
12 contains
13 procedure, nopass :: compute_fluid => rhs_maker_sumab_cpu
15
16 type, public, extends(rhs_maker_ext_t) :: rhs_maker_ext_cpu_t
17 contains
18 procedure, nopass :: compute_fluid => rhs_maker_ext_cpu
19 procedure, nopass :: compute_scalar => scalar_rhs_maker_ext_cpu
20 end type rhs_maker_ext_cpu_t
21
22 type, public, extends(rhs_maker_bdf_t) :: rhs_maker_bdf_cpu_t
23 contains
24 procedure, nopass :: compute_fluid => rhs_maker_bdf_cpu
25 procedure, nopass :: compute_scalar => scalar_rhs_maker_bdf_cpu
26 end type rhs_maker_bdf_cpu_t
27
28 type, public, extends(rhs_maker_oifs_t) :: rhs_maker_oifs_cpu_t
29 contains
30 procedure, nopass :: compute_fluid => rhs_maker_oifs_cpu
31 procedure, nopass :: compute_scalar => scalar_rhs_maker_oifs_cpu
33
34contains
35
36 subroutine rhs_maker_sumab_cpu(u, v, w, uu, vv, ww, uulag, vvlag, wwlag, &
37 ab, nab)
38 type(field_t), intent(inout) :: u,v, w
39 type(field_t), intent(inout) :: uu, vv, ww
40 type(field_series_t), intent(inout) :: uulag, vvlag, wwlag
41 real(kind=rp), dimension(3), intent(in) :: ab
42 integer, intent(in) :: nab
43 integer :: i, n
44
45 n = uu%dof%size()
46 !$omp parallel private(i)
47 if (nab .eq. 3) then
48 !OCL NORECURRENCE, NOVREC, NOALIAS
49 !DIR$ CONCURRENT
50 !GCC$ ivdep
51 !$omp do
52 do i = 1, n
53 u%x(i,1,1,1) = ab(1) * uu%x(i,1,1,1) + &
54 ab(2) * uulag%lf(1)%x(i,1,1,1) + ab(3) * uulag%lf(2)%x(i,1,1,1)
55 v%x(i,1,1,1) = ab(1) * vv%x(i,1,1,1) + &
56 ab(2) * vvlag%lf(1)%x(i,1,1,1) + ab(3) * vvlag%lf(2)%x(i,1,1,1)
57 w%x(i,1,1,1) = ab(1) * ww%x(i,1,1,1) + &
58 ab(2) * wwlag%lf(1)%x(i,1,1,1) + ab(3) * wwlag%lf(2)%x(i,1,1,1)
59 end do
60 !$omp end do
61 else
62 !OCL NORECURRENCE, NOVREC, NOALIAS
63 !DIR$ CONCURRENT
64 !GCC$ ivdep
65 !$omp do
66 do i = 1, n
67 u%x(i,1,1,1) = ab(1) * uu%x(i,1,1,1) + ab(2) * uulag%lf(1)%x(i,1,1,1)
68 v%x(i,1,1,1) = ab(1) * vv%x(i,1,1,1) + ab(2) * vvlag%lf(1)%x(i,1,1,1)
69 w%x(i,1,1,1) = ab(1) * ww%x(i,1,1,1) + ab(2) * wwlag%lf(1)%x(i,1,1,1)
70 end do
71 !$omp end do
72 end if
73 !$omp end parallel
74
75 end subroutine rhs_maker_sumab_cpu
76
77 subroutine rhs_maker_ext_cpu(fx_lag, fy_lag, fz_lag, &
78 fx_laglag, fy_laglag, fz_laglag, fx, fy, fz, &
79 rho, ext_coeffs, n)
80 type(field_t), intent(inout) :: fx_lag, fy_lag, fz_lag
81 type(field_t), intent(inout) :: fx_laglag, fy_laglag, fz_laglag
82 real(kind=rp), intent(in) :: rho, ext_coeffs(4)
83 integer, intent(in) :: n
84 real(kind=rp), intent(inout) :: fx(n), fy(n), fz(n)
85 integer :: i
86 type(field_t), pointer :: temp1, temp2, temp3
87 integer :: temp_indices(3)
88
89 call neko_scratch_registry%request_field(temp1, temp_indices(1), .false.)
90 call neko_scratch_registry%request_field(temp2, temp_indices(2), .false.)
91 call neko_scratch_registry%request_field(temp3, temp_indices(3), .false.)
92
93 !$omp parallel private(i)
94 !OCL NORECURRENCE, NOVREC, NOALIAS
95 !DIR$ CONCURRENT
96 !GCC$ ivdep
97 !$omp do
98 do i = 1, n
99 temp1%x(i,1,1,1) = ext_coeffs(2) * fx_lag%x(i,1,1,1) + &
100 ext_coeffs(3) * fx_laglag%x(i,1,1,1)
101 temp2%x(i,1,1,1) = ext_coeffs(2) * fy_lag%x(i,1,1,1) + &
102 ext_coeffs(3) * fy_laglag%x(i,1,1,1)
103 temp3%x(i,1,1,1) = ext_coeffs(2) * fz_lag%x(i,1,1,1) + &
104 ext_coeffs(3) * fz_laglag%x(i,1,1,1)
105 end do
106 !$omp end do
107
108 !OCL NORECURRENCE, NOVREC, NOALIAS
109 !DIR$ CONCURRENT
110 !GCC$ ivdep
111 !$omp do
112 do i = 1, n
113 fx_laglag%x(i,1,1,1) = fx_lag%x(i,1,1,1)
114 fy_laglag%x(i,1,1,1) = fy_lag%x(i,1,1,1)
115 fz_laglag%x(i,1,1,1) = fz_lag%x(i,1,1,1)
116 fx_lag%x(i,1,1,1) = fx(i)
117 fy_lag%x(i,1,1,1) = fy(i)
118 fz_lag%x(i,1,1,1) = fz(i)
119 end do
120 !$omp end do
121
122 !OCL NORECURRENCE, NOVREC, NOALIAS
123 !DIR$ CONCURRENT
124 !GCC$ ivdep
125 !$omp do
126 do i = 1, n
127 fx(i) = (ext_coeffs(1) * fx(i) + temp1%x(i,1,1,1)) * rho
128 fy(i) = (ext_coeffs(1) * fy(i) + temp2%x(i,1,1,1)) * rho
129 fz(i) = (ext_coeffs(1) * fz(i) + temp3%x(i,1,1,1)) * rho
130 end do
131 !$omp end do
132 !$omp end parallel
133 call neko_scratch_registry%relinquish_field(temp_indices)
134
135 end subroutine rhs_maker_ext_cpu
136
137 subroutine scalar_rhs_maker_ext_cpu(fs_lag, fs_laglag, fs, rho, &
138 ext_coeffs, n)
139 type(field_t), intent(inout) :: fs_lag
140 type(field_t), intent(inout) :: fs_laglag
141 real(kind=rp), intent(in) :: rho, ext_coeffs(4)
142 integer, intent(in) :: n
143 real(kind=rp), intent(inout) :: fs(n)
144 integer :: i
145 type(field_t), pointer :: temp1
146 integer :: temp_index
147
148 call neko_scratch_registry%request_field(temp1, temp_index, .false.)
149
150 !$omp parallel private(i)
151 !OCL NORECURRENCE, NOVREC, NOALIAS
152 !DIR$ CONCURRENT
153 !GCC$ ivdep
154 !$omp do
155 do i = 1, n
156 temp1%x(i,1,1,1) = ext_coeffs(2) * fs_lag%x(i,1,1,1) + &
157 ext_coeffs(3) * fs_laglag%x(i,1,1,1)
158 end do
159 !$omp end do
160
161 !OCL NORECURRENCE, NOVREC, NOALIAS
162 !DIR$ CONCURRENT
163 !GCC$ ivdep
164 !$omp do
165 do i = 1, n
166 fs_laglag%x(i,1,1,1) = fs_lag%x(i,1,1,1)
167 fs_lag%x(i,1,1,1) = fs(i)
168 end do
169 !$omp end do
170
171 !OCL NORECURRENCE, NOVREC, NOALIAS
172 !DIR$ CONCURRENT
173 !GCC$ ivdep
174 !$omp do
175 do i = 1, n
176 fs(i) = (ext_coeffs(1) * fs(i) + temp1%x(i,1,1,1)) * rho
177 end do
178 !$omp end do
179 !$omp end parallel
180
181 call neko_scratch_registry%relinquish_field(temp_index)
182 end subroutine scalar_rhs_maker_ext_cpu
183
184 subroutine rhs_maker_bdf_cpu(ulag, vlag, wlag, bfx, bfy, bfz, &
185 u, v, w, B, Blag, Blaglag, rho, dt, bd, nbd, n)
186 integer, intent(in) :: n, nbd
187 type(field_t), intent(in) :: u, v, w
188 type(field_series_t), intent(in) :: ulag, vlag, wlag
189 real(kind=rp), intent(inout) :: bfx(n), bfy(n), bfz(n)
190 real(kind=rp), intent(in) :: b(n), blag(n), blaglag(n)
191 real(kind=rp), intent(in) :: dt, rho, bd(4)
192 type(field_t), pointer :: tb1, tb2, tb3
193 integer :: temp_indices(3)
194 integer :: i, ilag
195
196 call neko_scratch_registry%request_field(tb1, temp_indices(1), .false.)
197 call neko_scratch_registry%request_field(tb2, temp_indices(2), .false.)
198 call neko_scratch_registry%request_field(tb3, temp_indices(3), .false.)
199
200 !$omp parallel private(ilag, i)
201 !OCL NORECURRENCE, NOVREC, NOALIAS
202 !DIR$ CONCURRENT
203 !GCC$ ivdep
204 !$omp do
205 do i = 1, n
206 tb1%x(i,1,1,1) = u%x(i,1,1,1) * b(i) * bd(2)
207 tb2%x(i,1,1,1) = v%x(i,1,1,1) * b(i) * bd(2)
208 tb3%x(i,1,1,1) = w%x(i,1,1,1) * b(i) * bd(2)
209 end do
210 !$omp end do
211
212 do ilag = 2, nbd
213 if (ilag .eq. 2) then
214 !OCL NORECURRENCE, NOVREC, NOALIAS
215 !DIR$ CONCURRENT
216 !GCC$ ivdep
217 !$omp do
218 do i = 1, n
219 tb1%x(i,1,1,1) = tb1%x(i,1,1,1) + &
220 (ulag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
221 tb2%x(i,1,1,1) = tb2%x(i,1,1,1) + &
222 (vlag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
223 tb3%x(i,1,1,1) = tb3%x(i,1,1,1) + &
224 (wlag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
225 end do
226 !$omp end do
227 else if (ilag .eq. 3) then
228 !OCL NORECURRENCE, NOVREC, NOALIAS
229 !DIR$ CONCURRENT
230 !GCC$ ivdep
231 !$omp do
232 do i = 1, n
233 tb1%x(i,1,1,1) = tb1%x(i,1,1,1) + &
234 (ulag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
235 tb2%x(i,1,1,1) = tb2%x(i,1,1,1) + &
236 (vlag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
237 tb3%x(i,1,1,1) = tb3%x(i,1,1,1) + &
238 (wlag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
239 end do
240 !$omp end do
241 end if
242 end do
243
244 !OCL NORECURRENCE, NOVREC, NOALIAS
245 !DIR$ CONCURRENT
246 !GCC$ ivdep
247 !$omp do
248 do i = 1, n
249 bfx(i) = bfx(i) + tb1%x(i,1,1,1) * (rho / dt)
250 bfy(i) = bfy(i) + tb2%x(i,1,1,1) * (rho / dt)
251 bfz(i) = bfz(i) + tb3%x(i,1,1,1) * (rho / dt)
252 end do
253 !$omp end do
254 !$omp end parallel
255
256 call neko_scratch_registry%relinquish_field(temp_indices)
257
258 end subroutine rhs_maker_bdf_cpu
259
260 subroutine scalar_rhs_maker_bdf_cpu(s_lag, fs, s, B, rho, dt, bd, nbd, n)
261 integer, intent(in) :: n, nbd
262 type(field_t), intent(in) :: s
263 type(field_series_t), intent(in) :: s_lag
264 real(kind=rp), intent(inout) :: fs(n)
265 real(kind=rp), intent(in) :: b(n)
266 real(kind=rp), intent(in) :: dt, rho, bd(4)
267 integer :: i, ilag
268 type(field_t), pointer :: temp1
269 integer :: temp_indices
270
271 call neko_scratch_registry%request_field(temp1, temp_indices, .false.)
272
273 !$omp parallel private(i, ilag)
274 !OCL NORECURRENCE, NOVREC, NOALIAS
275 !DIR$ CONCURRENT
276 !GCC$ ivdep
277 !$omp do
278 do i = 1, n
279 temp1%x(i,1,1,1) = s%x(i,1,1,1) * b(i) * bd(2)
280 end do
281 !$omp end do
282
283 do ilag = 2, nbd
284 !OCL NORECURRENCE, NOVREC, NOALIAS
285 !DIR$ CONCURRENT
286 !GCC$ ivdep
287 !$omp do
288 do i = 1, n
289 temp1%x(i,1,1,1) = temp1%x(i,1,1,1) + &
290 (s_lag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1))
291 end do
292 !$omp end do
293 end do
294
295 !OCL NORECURRENCE, NOVREC, NOALIAS
296 !DIR$ CONCURRENT
297 !GCC$ ivdep
298 !$omp do
299 do i = 1, n
300 fs(i) = fs(i) + temp1%x(i,1,1,1) * (rho / dt)
301 end do
302 !$omp end do
303 !$omp end parallel
304
305 call neko_scratch_registry%relinquish_field(temp_indices)
306 end subroutine scalar_rhs_maker_bdf_cpu
307
308 subroutine rhs_maker_oifs_cpu(phi_x, phi_y, phi_z, bf_x, bf_y, bf_z, &
309 rho, dt, n)
310 real(kind=rp), intent(in) :: rho, dt
311 integer, intent(in) :: n
312 real(kind=rp), intent(inout) :: bf_x(n), bf_y(n), bf_z(n)
313 real(kind=rp), intent(inout) :: phi_x(n), phi_y(n), phi_z(n)
314 integer :: i
315
316 !OCL NORECURRENCE, NOVREC, NOALIAS
317 !DIR$ CONCURRENT
318 !GCC$ ivdep
319 !$omp parallel do
320 do i = 1, n
321 bf_x(i) = bf_x(i) + phi_x(i) * (rho / dt)
322 bf_y(i) = bf_y(i) + phi_y(i) * (rho / dt)
323 bf_z(i) = bf_z(i) + phi_z(i) * (rho / dt)
324 end do
325 !$omp end parallel do
326
327 end subroutine rhs_maker_oifs_cpu
328
329 subroutine scalar_rhs_maker_oifs_cpu(phi_s, bf_s, rho, dt, n)
330 real(kind=rp), intent(in) :: rho, dt
331 integer, intent(in) :: n
332 real(kind=rp), intent(inout) :: bf_s(n)
333 real(kind=rp), intent(inout) :: phi_s(n)
334 integer :: i
335
336 !OCL NORECURRENCE, NOVREC, NOALIAS
337 !DIR$ CONCURRENT
338 !GCC$ ivdep
339 !$omp parallel do
340 do i = 1, n
341 bf_s(i) = bf_s(i) + phi_s(i) * (rho / dt)
342 end do
343 !$omp end parallel do
344
345 end subroutine scalar_rhs_maker_oifs_cpu
346
347end module rhs_maker_cpu
Contains the field_serties_t type.
Defines a field.
Definition field.f90:34
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
subroutine scalar_rhs_maker_ext_cpu(fs_lag, fs_laglag, fs, rho, ext_coeffs, n)
subroutine rhs_maker_sumab_cpu(u, v, w, uu, vv, ww, uulag, vvlag, wwlag, ab, nab)
subroutine scalar_rhs_maker_oifs_cpu(phi_s, bf_s, rho, dt, n)
subroutine rhs_maker_oifs_cpu(phi_x, phi_y, phi_z, bf_x, bf_y, bf_z, rho, dt, n)
subroutine rhs_maker_bdf_cpu(ulag, vlag, wlag, bfx, bfy, bfz, u, v, w, b, blag, blaglag, rho, dt, bd, nbd, n)
subroutine scalar_rhs_maker_bdf_cpu(s_lag, fs, s, b, rho, dt, bd, nbd, n)
subroutine rhs_maker_ext_cpu(fx_lag, fy_lag, fz_lag, fx_laglag, fy_laglag, fz_laglag, fx, fy, fz, rho, ext_coeffs, n)
Routines to generate the right-hand sides for the convection-diffusion equation. Employs the EXT/BDF ...
Definition rhs_maker.f90:38
Defines a registry for storing and requesting temporary objects This can be used when you have a func...
type(scratch_registry_t), target, public neko_scratch_registry
Global scratch registry.
Stores a series (sequence) of fields, logically connected to a base field, and arranged according to ...
Abstract type to add contributions to F from lagged BD terms.
Definition rhs_maker.f90:59
Abstract type to sum up contributions to kth order extrapolation scheme.
Definition rhs_maker.f90:52
Abstract type to add contributions of kth order OIFS scheme.
Definition rhs_maker.f90:66
Abstract type to compute extrapolated velocity field for the pressure equation.
Definition rhs_maker.f90:46