Neko 1.99.3
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, rho, dt, bd, nbd, n, Blag, Blaglag)
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(in) :: blag(n), blaglag(n)
190 real(kind=rp), intent(inout) :: bfx(n), bfy(n), bfz(n)
191 real(kind=rp), intent(in) :: b(n)
192 real(kind=rp), intent(in) :: dt, rho, bd(4)
193 type(field_t), pointer :: tb1, tb2, tb3
194 integer :: temp_indices(3)
195 integer :: i, ilag
196
197 call neko_scratch_registry%request_field(tb1, temp_indices(1), .false.)
198 call neko_scratch_registry%request_field(tb2, temp_indices(2), .false.)
199 call neko_scratch_registry%request_field(tb3, temp_indices(3), .false.)
200
201 !$omp parallel private(ilag, i)
202 !OCL NORECURRENCE, NOVREC, NOALIAS
203 !DIR$ CONCURRENT
204 !GCC$ ivdep
205 !$omp do
206 do i = 1, n
207 tb1%x(i,1,1,1) = u%x(i,1,1,1) * b(i) * bd(2)
208 tb2%x(i,1,1,1) = v%x(i,1,1,1) * b(i) * bd(2)
209 tb3%x(i,1,1,1) = w%x(i,1,1,1) * b(i) * bd(2)
210 end do
211 !$omp end do
212
213 do ilag = 2, nbd
214 if (ilag .eq. 2) then
215 !OCL NORECURRENCE, NOVREC, NOALIAS
216 !DIR$ CONCURRENT
217 !GCC$ ivdep
218 !$omp do
219 do i = 1, n
220 tb1%x(i,1,1,1) = tb1%x(i,1,1,1) + &
221 (ulag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
222 tb2%x(i,1,1,1) = tb2%x(i,1,1,1) + &
223 (vlag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
224 tb3%x(i,1,1,1) = tb3%x(i,1,1,1) + &
225 (wlag%lf(ilag-1)%x(i,1,1,1) * blag(i) * bd(ilag+1))
226 end do
227 !$omp end do
228 else if (ilag .eq. 3) then
229 !OCL NORECURRENCE, NOVREC, NOALIAS
230 !DIR$ CONCURRENT
231 !GCC$ ivdep
232 !$omp do
233 do i = 1, n
234 tb1%x(i,1,1,1) = tb1%x(i,1,1,1) + &
235 (ulag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
236 tb2%x(i,1,1,1) = tb2%x(i,1,1,1) + &
237 (vlag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
238 tb3%x(i,1,1,1) = tb3%x(i,1,1,1) + &
239 (wlag%lf(ilag-1)%x(i,1,1,1) * blaglag(i) * bd(ilag+1))
240 end do
241 !$omp end do
242 end if
243 end do
244
245 !OCL NORECURRENCE, NOVREC, NOALIAS
246 !DIR$ CONCURRENT
247 !GCC$ ivdep
248 !$omp do
249 do i = 1, n
250 bfx(i) = bfx(i) + tb1%x(i,1,1,1) * (rho / dt)
251 bfy(i) = bfy(i) + tb2%x(i,1,1,1) * (rho / dt)
252 bfz(i) = bfz(i) + tb3%x(i,1,1,1) * (rho / dt)
253 end do
254 !$omp end do
255 !$omp end parallel
256
257 call neko_scratch_registry%relinquish_field(temp_indices)
258
259 end subroutine rhs_maker_bdf_cpu
260
261 subroutine scalar_rhs_maker_bdf_cpu(s_lag, fs, s, B, rho, dt, bd, nbd, n)
262 integer, intent(in) :: n, nbd
263 type(field_t), intent(in) :: s
264 type(field_series_t), intent(in) :: s_lag
265 real(kind=rp), intent(inout) :: fs(n)
266 real(kind=rp), intent(in) :: b(n)
267 real(kind=rp), intent(in) :: dt, rho, bd(4)
268 integer :: i, ilag
269 type(field_t), pointer :: temp1
270 integer :: temp_indices
271
272 call neko_scratch_registry%request_field(temp1, temp_indices, .false.)
273
274 !$omp parallel private(i, ilag)
275 !OCL NORECURRENCE, NOVREC, NOALIAS
276 !DIR$ CONCURRENT
277 !GCC$ ivdep
278 !$omp do
279 do i = 1, n
280 temp1%x(i,1,1,1) = s%x(i,1,1,1) * b(i) * bd(2)
281 end do
282 !$omp end do
283
284 do ilag = 2, nbd
285 !OCL NORECURRENCE, NOVREC, NOALIAS
286 !DIR$ CONCURRENT
287 !GCC$ ivdep
288 !$omp do
289 do i = 1, n
290 temp1%x(i,1,1,1) = temp1%x(i,1,1,1) + &
291 (s_lag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1))
292 end do
293 !$omp end do
294 end do
295
296 !OCL NORECURRENCE, NOVREC, NOALIAS
297 !DIR$ CONCURRENT
298 !GCC$ ivdep
299 !$omp do
300 do i = 1, n
301 fs(i) = fs(i) + temp1%x(i,1,1,1) * (rho / dt)
302 end do
303 !$omp end do
304 !$omp end parallel
305
306 call neko_scratch_registry%relinquish_field(temp_indices)
307 end subroutine scalar_rhs_maker_bdf_cpu
308
309 subroutine rhs_maker_oifs_cpu(phi_x, phi_y, phi_z, bf_x, bf_y, bf_z, &
310 rho, dt, n)
311 real(kind=rp), intent(in) :: rho, dt
312 integer, intent(in) :: n
313 real(kind=rp), intent(inout) :: bf_x(n), bf_y(n), bf_z(n)
314 real(kind=rp), intent(inout) :: phi_x(n), phi_y(n), phi_z(n)
315 integer :: i
316
317 !OCL NORECURRENCE, NOVREC, NOALIAS
318 !DIR$ CONCURRENT
319 !GCC$ ivdep
320 !$omp parallel do
321 do i = 1, n
322 bf_x(i) = bf_x(i) + phi_x(i) * (rho / dt)
323 bf_y(i) = bf_y(i) + phi_y(i) * (rho / dt)
324 bf_z(i) = bf_z(i) + phi_z(i) * (rho / dt)
325 end do
326 !$omp end parallel do
327
328 end subroutine rhs_maker_oifs_cpu
329
330 subroutine scalar_rhs_maker_oifs_cpu(phi_s, bf_s, rho, dt, n)
331 real(kind=rp), intent(in) :: rho, dt
332 integer, intent(in) :: n
333 real(kind=rp), intent(inout) :: bf_s(n)
334 real(kind=rp), intent(inout) :: phi_s(n)
335 integer :: i
336
337 !OCL NORECURRENCE, NOVREC, NOALIAS
338 !DIR$ CONCURRENT
339 !GCC$ ivdep
340 !$omp parallel do
341 do i = 1, n
342 bf_s(i) = bf_s(i) + phi_s(i) * (rho / dt)
343 end do
344 !$omp end parallel do
345
346 end subroutine scalar_rhs_maker_oifs_cpu
347
348end 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 rhs_maker_bdf_cpu(ulag, vlag, wlag, bfx, bfy, bfz, u, v, w, b, rho, dt, bd, nbd, n, blag, blaglag)
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 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