Neko 1.99.6
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 !DIR$ IVDEP
51 !GCC$ ivdep
52 !$omp do
53 do i = 1, n
54 u%x(i,1,1,1) = ab(1) * uu%x(i,1,1,1) + &
55 ab(2) * uulag%lf(1)%x(i,1,1,1) + ab(3) * uulag%lf(2)%x(i,1,1,1)
56 v%x(i,1,1,1) = ab(1) * vv%x(i,1,1,1) + &
57 ab(2) * vvlag%lf(1)%x(i,1,1,1) + ab(3) * vvlag%lf(2)%x(i,1,1,1)
58 w%x(i,1,1,1) = ab(1) * ww%x(i,1,1,1) + &
59 ab(2) * wwlag%lf(1)%x(i,1,1,1) + ab(3) * wwlag%lf(2)%x(i,1,1,1)
60 end do
61 !$omp end do
62 else
63 !OCL NORECURRENCE, NOVREC, NOALIAS
64 !DIR$ CONCURRENT
65 !DIR$ IVDEP
66 !GCC$ ivdep
67 !$omp do
68 do i = 1, n
69 u%x(i,1,1,1) = ab(1) * uu%x(i,1,1,1) + ab(2) * uulag%lf(1)%x(i,1,1,1)
70 v%x(i,1,1,1) = ab(1) * vv%x(i,1,1,1) + ab(2) * vvlag%lf(1)%x(i,1,1,1)
71 w%x(i,1,1,1) = ab(1) * ww%x(i,1,1,1) + ab(2) * wwlag%lf(1)%x(i,1,1,1)
72 end do
73 !$omp end do
74 end if
75 !$omp end parallel
76
77 end subroutine rhs_maker_sumab_cpu
78
79 subroutine rhs_maker_ext_cpu(fx_lag, fy_lag, fz_lag, &
80 fx_laglag, fy_laglag, fz_laglag, fx, fy, fz, &
81 rho, ext_coeffs, n)
82 type(field_t), intent(inout) :: fx_lag, fy_lag, fz_lag
83 type(field_t), intent(inout) :: fx_laglag, fy_laglag, fz_laglag
84 real(kind=rp), intent(in) :: rho, ext_coeffs(4)
85 integer, intent(in) :: n
86 real(kind=rp), intent(inout) :: fx(n), fy(n), fz(n)
87 integer :: i
88 type(field_t), pointer :: temp1, temp2, temp3
89 integer :: temp_indices(3)
90
91 call neko_scratch_registry%request_field(temp1, temp_indices(1), .false.)
92 call neko_scratch_registry%request_field(temp2, temp_indices(2), .false.)
93 call neko_scratch_registry%request_field(temp3, temp_indices(3), .false.)
94
95 !$omp parallel private(i)
96 !OCL NORECURRENCE, NOVREC, NOALIAS
97 !DIR$ CONCURRENT
98 !DIR$ IVDEP
99 !GCC$ ivdep
100 !$omp do
101 do i = 1, n
102 temp1%x(i,1,1,1) = ext_coeffs(2) * fx_lag%x(i,1,1,1) + &
103 ext_coeffs(3) * fx_laglag%x(i,1,1,1)
104 temp2%x(i,1,1,1) = ext_coeffs(2) * fy_lag%x(i,1,1,1) + &
105 ext_coeffs(3) * fy_laglag%x(i,1,1,1)
106 temp3%x(i,1,1,1) = ext_coeffs(2) * fz_lag%x(i,1,1,1) + &
107 ext_coeffs(3) * fz_laglag%x(i,1,1,1)
108 end do
109 !$omp end do
110
111 !OCL NORECURRENCE, NOVREC, NOALIAS
112 !DIR$ CONCURRENT
113 !DIR$ IVDEP
114 !GCC$ ivdep
115 !$omp do
116 do i = 1, n
117 fx_laglag%x(i,1,1,1) = fx_lag%x(i,1,1,1)
118 fy_laglag%x(i,1,1,1) = fy_lag%x(i,1,1,1)
119 fz_laglag%x(i,1,1,1) = fz_lag%x(i,1,1,1)
120 fx_lag%x(i,1,1,1) = fx(i)
121 fy_lag%x(i,1,1,1) = fy(i)
122 fz_lag%x(i,1,1,1) = fz(i)
123 end do
124 !$omp end do
125
126 !OCL NORECURRENCE, NOVREC, NOALIAS
127 !DIR$ CONCURRENT
128 !DIR$ IVDEP
129 !GCC$ ivdep
130 !$omp do
131 do i = 1, n
132 fx(i) = (ext_coeffs(1) * fx(i) + temp1%x(i,1,1,1)) * rho
133 fy(i) = (ext_coeffs(1) * fy(i) + temp2%x(i,1,1,1)) * rho
134 fz(i) = (ext_coeffs(1) * fz(i) + temp3%x(i,1,1,1)) * rho
135 end do
136 !$omp end do
137 !$omp end parallel
138 call neko_scratch_registry%relinquish_field(temp_indices)
139
140 end subroutine rhs_maker_ext_cpu
141
142 subroutine scalar_rhs_maker_ext_cpu(fs_lag, fs_laglag, fs, rho, &
143 ext_coeffs, n)
144 type(field_t), intent(inout) :: fs_lag
145 type(field_t), intent(inout) :: fs_laglag
146 real(kind=rp), intent(in) :: rho, ext_coeffs(4)
147 integer, intent(in) :: n
148 real(kind=rp), intent(inout) :: fs(n)
149 integer :: i
150 type(field_t), pointer :: temp1
151 integer :: temp_index
152
153 call neko_scratch_registry%request_field(temp1, temp_index, .false.)
154
155 !$omp parallel private(i)
156 !OCL NORECURRENCE, NOVREC, NOALIAS
157 !DIR$ CONCURRENT
158 !DIR$ IVDEP
159 !GCC$ ivdep
160 !$omp do
161 do i = 1, n
162 temp1%x(i,1,1,1) = ext_coeffs(2) * fs_lag%x(i,1,1,1) + &
163 ext_coeffs(3) * fs_laglag%x(i,1,1,1)
164 end do
165 !$omp end do
166
167 !OCL NORECURRENCE, NOVREC, NOALIAS
168 !DIR$ CONCURRENT
169 !DIR$ IVDEP
170 !GCC$ ivdep
171 !$omp do
172 do i = 1, n
173 fs_laglag%x(i,1,1,1) = fs_lag%x(i,1,1,1)
174 fs_lag%x(i,1,1,1) = fs(i)
175 end do
176 !$omp end do
177
178 !OCL NORECURRENCE, NOVREC, NOALIAS
179 !DIR$ CONCURRENT
180 !DIR$ IVDEP
181 !GCC$ ivdep
182 !$omp do
183 do i = 1, n
184 fs(i) = (ext_coeffs(1) * fs(i) + temp1%x(i,1,1,1)) * rho
185 end do
186 !$omp end do
187 !$omp end parallel
188
189 call neko_scratch_registry%relinquish_field(temp_index)
190 end subroutine scalar_rhs_maker_ext_cpu
191
192 subroutine rhs_maker_bdf_cpu(ulag, vlag, wlag, bfx, bfy, bfz, &
193 u, v, w, B, Blag, Blaglag, rho, dt, bd, nbd, n)
194 integer, intent(in) :: n, nbd
195 type(field_t), intent(in) :: u, v, w
196 type(field_series_t), intent(in) :: ulag, vlag, wlag
197 real(kind=rp), intent(inout) :: bfx(n), bfy(n), bfz(n)
198 real(kind=rp), intent(in) :: b(n), blag(n), blaglag(n)
199 real(kind=rp), intent(in) :: dt, rho, bd(4)
200 type(field_t), pointer :: tb1, tb2, tb3
201 integer :: temp_indices(3)
202 integer :: i, ilag
203
204 call neko_scratch_registry%request_field(tb1, temp_indices(1), .false.)
205 call neko_scratch_registry%request_field(tb2, temp_indices(2), .false.)
206 call neko_scratch_registry%request_field(tb3, temp_indices(3), .false.)
207
208 !$omp parallel private(ilag, i)
209 !OCL NORECURRENCE, NOVREC, NOALIAS
210 !DIR$ CONCURRENT
211 !DIR$ IVDEP
212 !GCC$ ivdep
213 !$omp do
214 do i = 1, n
215 tb1%x(i,1,1,1) = u%x(i,1,1,1) * b(i) * bd(2)
216 tb2%x(i,1,1,1) = v%x(i,1,1,1) * b(i) * bd(2)
217 tb3%x(i,1,1,1) = w%x(i,1,1,1) * b(i) * bd(2)
218 end do
219 !$omp end do
220
221 do ilag = 2, nbd
222 if (ilag .eq. 2) then
223 !OCL NORECURRENCE, NOVREC, NOALIAS
224 !DIR$ CONCURRENT
225 !DIR$ IVDEP
226 !GCC$ ivdep
227 !$omp do
228 do i = 1, n
229 tb1%x(i,1,1,1) = tb1%x(i,1,1,1) + &
230 (ulag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
231 tb2%x(i,1,1,1) = tb2%x(i,1,1,1) + &
232 (vlag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
233 tb3%x(i,1,1,1) = tb3%x(i,1,1,1) + &
234 (wlag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
235 end do
236 !$omp end do
237 else if (ilag .eq. 3) then
238 !OCL NORECURRENCE, NOVREC, NOALIAS
239 !DIR$ CONCURRENT
240 !DIR$ IVDEP
241 !GCC$ ivdep
242 !$omp do
243 do i = 1, n
244 tb1%x(i,1,1,1) = tb1%x(i,1,1,1) + &
245 (ulag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
246 tb2%x(i,1,1,1) = tb2%x(i,1,1,1) + &
247 (vlag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
248 tb3%x(i,1,1,1) = tb3%x(i,1,1,1) + &
249 (wlag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
250 end do
251 !$omp end do
252 end if
253 end do
254
255 !OCL NORECURRENCE, NOVREC, NOALIAS
256 !DIR$ CONCURRENT
257 !DIR$ IVDEP
258 !GCC$ ivdep
259 !$omp do
260 do i = 1, n
261 bfx(i) = bfx(i) + tb1%x(i,1,1,1) * (rho / dt)
262 bfy(i) = bfy(i) + tb2%x(i,1,1,1) * (rho / dt)
263 bfz(i) = bfz(i) + tb3%x(i,1,1,1) * (rho / dt)
264 end do
265 !$omp end do
266 !$omp end parallel
267
268 call neko_scratch_registry%relinquish_field(temp_indices)
269
270 end subroutine rhs_maker_bdf_cpu
271
272 subroutine scalar_rhs_maker_bdf_cpu(s_lag, fs, s, B, rho, dt, bd, nbd, n)
273 integer, intent(in) :: n, nbd
274 type(field_t), intent(in) :: s
275 type(field_series_t), intent(in) :: s_lag
276 real(kind=rp), intent(inout) :: fs(n)
277 real(kind=rp), intent(in) :: b(n)
278 real(kind=rp), intent(in) :: dt, rho, bd(4)
279 integer :: i, ilag
280 type(field_t), pointer :: temp1
281 integer :: temp_indices
282
283 call neko_scratch_registry%request_field(temp1, temp_indices, .false.)
284
285 !$omp parallel private(i, ilag)
286 !OCL NORECURRENCE, NOVREC, NOALIAS
287 !DIR$ CONCURRENT
288 !DIR$ IVDEP
289 !GCC$ ivdep
290 !$omp do
291 do i = 1, n
292 temp1%x(i,1,1,1) = s%x(i,1,1,1) * b(i) * bd(2)
293 end do
294 !$omp end do
295
296 do ilag = 2, nbd
297 !OCL NORECURRENCE, NOVREC, NOALIAS
298 !DIR$ CONCURRENT
299 !DIR$ IVDEP
300 !GCC$ ivdep
301 !$omp do
302 do i = 1, n
303 temp1%x(i,1,1,1) = temp1%x(i,1,1,1) + &
304 (s_lag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1))
305 end do
306 !$omp end do
307 end do
308
309 !OCL NORECURRENCE, NOVREC, NOALIAS
310 !DIR$ CONCURRENT
311 !DIR$ IVDEP
312 !GCC$ ivdep
313 !$omp do
314 do i = 1, n
315 fs(i) = fs(i) + temp1%x(i,1,1,1) * (rho / dt)
316 end do
317 !$omp end do
318 !$omp end parallel
319
320 call neko_scratch_registry%relinquish_field(temp_indices)
321 end subroutine scalar_rhs_maker_bdf_cpu
322
323 subroutine rhs_maker_oifs_cpu(phi_x, phi_y, phi_z, bf_x, bf_y, bf_z, &
324 rho, dt, n)
325 real(kind=rp), intent(in) :: rho, dt
326 integer, intent(in) :: n
327 real(kind=rp), intent(inout) :: bf_x(n), bf_y(n), bf_z(n)
328 real(kind=rp), intent(inout) :: phi_x(n), phi_y(n), phi_z(n)
329 integer :: i
330
331 !OCL NORECURRENCE, NOVREC, NOALIAS
332 !DIR$ CONCURRENT
333 !DIR$ IVDEP
334 !GCC$ ivdep
335 !$omp parallel do
336 do i = 1, n
337 bf_x(i) = bf_x(i) + phi_x(i) * (rho / dt)
338 bf_y(i) = bf_y(i) + phi_y(i) * (rho / dt)
339 bf_z(i) = bf_z(i) + phi_z(i) * (rho / dt)
340 end do
341 !$omp end parallel do
342
343 end subroutine rhs_maker_oifs_cpu
344
345 subroutine scalar_rhs_maker_oifs_cpu(phi_s, bf_s, rho, dt, n)
346 real(kind=rp), intent(in) :: rho, dt
347 integer, intent(in) :: n
348 real(kind=rp), intent(inout) :: bf_s(n)
349 real(kind=rp), intent(inout) :: phi_s(n)
350 integer :: i
351
352 !OCL NORECURRENCE, NOVREC, NOALIAS
353 !DIR$ CONCURRENT
354 !DIR$ IVDEP
355 !GCC$ ivdep
356 !$omp parallel do
357 do i = 1, n
358 bf_s(i) = bf_s(i) + phi_s(i) * (rho / dt)
359 end do
360 !$omp end parallel do
361
362 end subroutine scalar_rhs_maker_oifs_cpu
363
364end 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