Neko 1.99.7
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, ext_coeffs, n)
143 type(field_t), intent(inout) :: fs_lag
144 type(field_t), intent(inout) :: fs_laglag
145 real(kind=rp), intent(in) :: ext_coeffs(4)
146 integer, intent(in) :: n
147 real(kind=rp), intent(inout) :: fs(n)
148 integer :: i
149 type(field_t), pointer :: temp1
150 integer :: temp_index
151
152 call neko_scratch_registry%request_field(temp1, temp_index, .false.)
153
154 !$omp parallel private(i)
155 !OCL NORECURRENCE, NOVREC, NOALIAS
156 !DIR$ CONCURRENT
157 !DIR$ IVDEP
158 !GCC$ ivdep
159 !$omp do
160 do i = 1, n
161 temp1%x(i,1,1,1) = ext_coeffs(2) * fs_lag%x(i,1,1,1) + &
162 ext_coeffs(3) * fs_laglag%x(i,1,1,1)
163 end do
164 !$omp end do
165
166 !OCL NORECURRENCE, NOVREC, NOALIAS
167 !DIR$ CONCURRENT
168 !DIR$ IVDEP
169 !GCC$ ivdep
170 !$omp do
171 do i = 1, n
172 fs_laglag%x(i,1,1,1) = fs_lag%x(i,1,1,1)
173 fs_lag%x(i,1,1,1) = fs(i)
174 end do
175 !$omp end do
176
177 !OCL NORECURRENCE, NOVREC, NOALIAS
178 !DIR$ CONCURRENT
179 !DIR$ IVDEP
180 !GCC$ ivdep
181 !$omp do
182 do i = 1, n
183 fs(i) = ext_coeffs(1) * fs(i) + temp1%x(i,1,1,1)
184 end do
185 !$omp end do
186 !$omp end parallel
187
188 call neko_scratch_registry%relinquish_field(temp_index)
189 end subroutine scalar_rhs_maker_ext_cpu
190
191 subroutine rhs_maker_bdf_cpu(ulag, vlag, wlag, bfx, bfy, bfz, &
192 u, v, w, B, Blag, Blaglag, rho, dt, bd, nbd, n)
193 integer, intent(in) :: n, nbd
194 type(field_t), intent(in) :: u, v, w
195 type(field_series_t), intent(in) :: ulag, vlag, wlag
196 real(kind=rp), intent(inout) :: bfx(n), bfy(n), bfz(n)
197 real(kind=rp), intent(in) :: b(n), blag(n), blaglag(n)
198 real(kind=rp), intent(in) :: dt, rho, bd(4)
199 type(field_t), pointer :: tb1, tb2, tb3
200 integer :: temp_indices(3)
201 integer :: i, ilag
202
203 call neko_scratch_registry%request_field(tb1, temp_indices(1), .false.)
204 call neko_scratch_registry%request_field(tb2, temp_indices(2), .false.)
205 call neko_scratch_registry%request_field(tb3, temp_indices(3), .false.)
206
207 !$omp parallel private(ilag, i)
208 !OCL NORECURRENCE, NOVREC, NOALIAS
209 !DIR$ CONCURRENT
210 !DIR$ IVDEP
211 !GCC$ ivdep
212 !$omp do
213 do i = 1, n
214 tb1%x(i,1,1,1) = u%x(i,1,1,1) * b(i) * bd(2)
215 tb2%x(i,1,1,1) = v%x(i,1,1,1) * b(i) * bd(2)
216 tb3%x(i,1,1,1) = w%x(i,1,1,1) * b(i) * bd(2)
217 end do
218 !$omp end do
219
220 do ilag = 2, nbd
221 if (ilag .eq. 2) then
222 !OCL NORECURRENCE, NOVREC, NOALIAS
223 !DIR$ CONCURRENT
224 !DIR$ IVDEP
225 !GCC$ ivdep
226 !$omp do
227 do i = 1, n
228 tb1%x(i,1,1,1) = tb1%x(i,1,1,1) + &
229 (ulag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
230 tb2%x(i,1,1,1) = tb2%x(i,1,1,1) + &
231 (vlag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
232 tb3%x(i,1,1,1) = tb3%x(i,1,1,1) + &
233 (wlag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
234 end do
235 !$omp end do
236 else if (ilag .eq. 3) then
237 !OCL NORECURRENCE, NOVREC, NOALIAS
238 !DIR$ CONCURRENT
239 !DIR$ IVDEP
240 !GCC$ ivdep
241 !$omp do
242 do i = 1, n
243 tb1%x(i,1,1,1) = tb1%x(i,1,1,1) + &
244 (ulag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
245 tb2%x(i,1,1,1) = tb2%x(i,1,1,1) + &
246 (vlag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
247 tb3%x(i,1,1,1) = tb3%x(i,1,1,1) + &
248 (wlag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
249 end do
250 !$omp end do
251 end if
252 end do
253
254 !OCL NORECURRENCE, NOVREC, NOALIAS
255 !DIR$ CONCURRENT
256 !DIR$ IVDEP
257 !GCC$ ivdep
258 !$omp do
259 do i = 1, n
260 bfx(i) = bfx(i) + tb1%x(i,1,1,1) * (rho / dt)
261 bfy(i) = bfy(i) + tb2%x(i,1,1,1) * (rho / dt)
262 bfz(i) = bfz(i) + tb3%x(i,1,1,1) * (rho / dt)
263 end do
264 !$omp end do
265 !$omp end parallel
266
267 call neko_scratch_registry%relinquish_field(temp_indices)
268
269 end subroutine rhs_maker_bdf_cpu
270
271 subroutine scalar_rhs_maker_bdf_cpu(s_lag, fs, s, B, rho_cp, dt, bd, nbd, n)
272 integer, intent(in) :: n, nbd
273 type(field_t), intent(in) :: s, rho_cp
274 type(field_series_t), intent(in) :: s_lag
275 real(kind=rp), intent(inout) :: fs(n)
276 real(kind=rp), intent(in) :: b(n)
277 real(kind=rp), intent(in) :: dt, bd(4)
278 integer :: i, ilag
279 type(field_t), pointer :: temp1
280 integer :: temp_indices
281
282 call neko_scratch_registry%request_field(temp1, temp_indices, .false.)
283
284 !$omp parallel private(i, ilag)
285 !OCL NORECURRENCE, NOVREC, NOALIAS
286 !DIR$ CONCURRENT
287 !DIR$ IVDEP
288 !GCC$ ivdep
289 !$omp do
290 do i = 1, n
291 temp1%x(i,1,1,1) = s%x(i,1,1,1) * b(i) * bd(2)
292 end do
293 !$omp end do
294
295 do ilag = 2, nbd
296 !OCL NORECURRENCE, NOVREC, NOALIAS
297 !DIR$ CONCURRENT
298 !DIR$ IVDEP
299 !GCC$ ivdep
300 !$omp do
301 do i = 1, n
302 temp1%x(i,1,1,1) = temp1%x(i,1,1,1) + &
303 (s_lag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1))
304 end do
305 !$omp end do
306 end do
307
308 !OCL NORECURRENCE, NOVREC, NOALIAS
309 !DIR$ CONCURRENT
310 !DIR$ IVDEP
311 !GCC$ ivdep
312 !$omp do
313 do i = 1, n
314 fs(i) = fs(i) + temp1%x(i,1,1,1) * &
315 (rho_cp%x(i,1,1,1) / 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_cp, dt, n)
346 type(field_t), intent(in) :: rho_cp
347 real(kind=rp), intent(in) :: dt
348 integer, intent(in) :: n
349 real(kind=rp), intent(inout) :: bf_s(n)
350 real(kind=rp), intent(inout) :: phi_s(n)
351 integer :: i
352
353 !OCL NORECURRENCE, NOVREC, NOALIAS
354 !DIR$ CONCURRENT
355 !DIR$ IVDEP
356 !GCC$ ivdep
357 !$omp parallel do
358 do i = 1, n
359 bf_s(i) = bf_s(i) + phi_s(i) * (rho_cp%x(i,1,1,1) / dt)
360 end do
361 !$omp end parallel do
362
363 end subroutine scalar_rhs_maker_oifs_cpu
364
365end 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 rhs_maker_sumab_cpu(u, v, w, uu, vv, ww, uulag, vvlag, wwlag, ab, nab)
subroutine scalar_rhs_maker_ext_cpu(fs_lag, fs_laglag, fs, ext_coeffs, n)
subroutine scalar_rhs_maker_oifs_cpu(phi_s, bf_s, rho_cp, dt, n)
subroutine scalar_rhs_maker_bdf_cpu(s_lag, fs, s, b, rho_cp, dt, bd, nbd, 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 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