Neko 1.99.7
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
rhs_maker_sx.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_sx_t
12 contains
13 procedure, nopass :: compute_fluid => rhs_maker_sumab_sx
15
16 type, public, extends(rhs_maker_ext_t) :: rhs_maker_ext_sx_t
17 contains
18 procedure, nopass :: compute_fluid => rhs_maker_ext_sx
19 procedure, nopass :: compute_scalar => scalar_rhs_maker_ext_sx
20 end type rhs_maker_ext_sx_t
21
22 type, public, extends(rhs_maker_bdf_t) :: rhs_maker_bdf_sx_t
23 contains
24 procedure, nopass :: compute_fluid => rhs_maker_bdf_sx
25 procedure, nopass :: compute_scalar => scalar_rhs_maker_bdf_sx
26 end type rhs_maker_bdf_sx_t
27
28 type, public, extends(rhs_maker_oifs_t) :: rhs_maker_oifs_sx_t
29 contains
30 procedure, nopass :: compute_fluid => rhs_maker_oifs_sx
31 procedure, nopass :: compute_scalar => scalar_rhs_maker_oifs_sx
32 end type rhs_maker_oifs_sx_t
33
34contains
35
36 subroutine rhs_maker_sumab_sx(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
47 do i = 1, n
48 u%x(i,1,1,1) = ab(1) * uu%x(i,1,1,1) + ab(2) * uulag%lf(1)%x(i,1,1,1)
49 v%x(i,1,1,1) = ab(1) * vv%x(i,1,1,1) + ab(2) * vvlag%lf(1)%x(i,1,1,1)
50 w%x(i,1,1,1) = ab(1) * ww%x(i,1,1,1) + ab(2) * wwlag%lf(1)%x(i,1,1,1)
51 end do
52
53 if (nab .eq. 3) then
54 do i = 1, n
55 u%x(i,1,1,1) = u%x(i,1,1,1) + ab(3) * uulag%lf(2)%x(i,1,1,1)
56 v%x(i,1,1,1) = v%x(i,1,1,1) + ab(3) * vvlag%lf(2)%x(i,1,1,1)
57 w%x(i,1,1,1) = w%x(i,1,1,1) + ab(3) * wwlag%lf(2)%x(i,1,1,1)
58 end do
59 end if
60
61 end subroutine rhs_maker_sumab_sx
62
63 subroutine rhs_maker_ext_sx(fx_lag, fy_lag, fz_lag, &
64 fx_laglag, fy_laglag, fz_laglag, fx, fy, fz, &
65 rho, ext_coeffs, n)
66 type(field_t), intent(inout) :: fx_lag, fy_lag, fz_lag
67 type(field_t), intent(inout) :: fx_laglag, fy_laglag, fz_laglag
68 real(kind=rp), intent(in) :: rho, ext_coeffs(4)
69 integer, intent(in) :: n
70 real(kind=rp), intent(inout) :: fx(n), fy(n), fz(n)
71 integer :: i
72 type(field_t), pointer :: temp1, temp2, temp3
73 integer :: temp_indices(3)
74
75 call neko_scratch_registry%request_field(temp1, temp_indices(1), .false.)
76 call neko_scratch_registry%request_field(temp2, temp_indices(2), .false.)
77 call neko_scratch_registry%request_field(temp3, temp_indices(3), .false.)
78
79 do i = 1, n
80 temp1%x(i,1,1,1) = ext_coeffs(2) * fx_lag%x(i,1,1,1) + &
81 ext_coeffs(3) * fx_laglag%x(i,1,1,1)
82 temp2%x(i,1,1,1) = ext_coeffs(2) * fy_lag%x(i,1,1,1) + &
83 ext_coeffs(3) * fy_laglag%x(i,1,1,1)
84 temp3%x(i,1,1,1) = ext_coeffs(2) * fz_lag%x(i,1,1,1) + &
85 ext_coeffs(3) * fz_laglag%x(i,1,1,1)
86 end do
87
88 do i = 1, n
89 fx_laglag%x(i,1,1,1) = fx_lag%x(i,1,1,1)
90 fy_laglag%x(i,1,1,1) = fy_lag%x(i,1,1,1)
91 fz_laglag%x(i,1,1,1) = fz_lag%x(i,1,1,1)
92 fx_lag%x(i,1,1,1) = fx(i)
93 fy_lag%x(i,1,1,1) = fy(i)
94 fz_lag%x(i,1,1,1) = fz(i)
95 end do
96
97 do i = 1, n
98 fx(i) = (ext_coeffs(1) * fx(i) + temp1%x(i,1,1,1)) * rho
99 fy(i) = (ext_coeffs(1) * fy(i) + temp2%x(i,1,1,1)) * rho
100 fz(i) = (ext_coeffs(1) * fz(i) + temp3%x(i,1,1,1)) * rho
101 end do
102
103 call neko_scratch_registry%relinquish_field(temp_indices)
104
105 end subroutine rhs_maker_ext_sx
106
107 subroutine scalar_rhs_maker_ext_sx(fs_lag, fs_laglag, fs, ext_coeffs, n)
108 type(field_t), intent(inout) :: fs_lag
109 type(field_t), intent(inout) :: fs_laglag
110 real(kind=rp), intent(in) :: ext_coeffs(4)
111 integer, intent(in) :: n
112 real(kind=rp), intent(inout) :: fs(n)
113 integer :: i
114 type(field_t), pointer :: temp1
115 integer :: temp_index
116
117 call neko_scratch_registry%request_field(temp1, temp_index, .false.)
118
119 do i = 1, n
120 temp1%x(i,1,1,1) = ext_coeffs(2) * fs_lag%x(i,1,1,1) + &
121 ext_coeffs(3) * fs_laglag%x(i,1,1,1)
122 end do
123
124 do i = 1, n
125 fs_laglag%x(i,1,1,1) = fs_lag%x(i,1,1,1)
126 fs_lag%x(i,1,1,1) = fs(i)
127 end do
128
129 do i = 1, n
130 fs(i) = ext_coeffs(1) * fs(i) + temp1%x(i,1,1,1)
131 end do
132
133 call neko_scratch_registry%relinquish_field(temp_index)
134 end subroutine scalar_rhs_maker_ext_sx
135
136 subroutine rhs_maker_bdf_sx(ulag, vlag, wlag, bfx, bfy, bfz, &
137 u, v, w, B, Blag, Blaglag, rho, dt, bd, nbd, n)
138 integer, intent(in) :: n, nbd
139 type(field_t), intent(in) :: u, v, w
140 type(field_series_t), intent(in) :: ulag, vlag, wlag
141 real(kind=rp), intent(inout) :: bfx(n), bfy(n), bfz(n)
142 real(kind=rp), intent(in) :: b(n), blag(n), blaglag(n)
143 real(kind=rp), intent(in) :: dt, rho, bd(4)
144 type(field_t), pointer :: tb1, tb2, tb3
145 type(field_t), pointer :: ta1, ta2, ta3
146 integer :: temp_indices(6)
147 integer :: i, ilag
148
149 call neko_scratch_registry%request_field(ta1, temp_indices(1), .false.)
150 call neko_scratch_registry%request_field(ta2, temp_indices(2), .false.)
151 call neko_scratch_registry%request_field(ta3, temp_indices(3), .false.)
152 call neko_scratch_registry%request_field(tb1, temp_indices(4), .false.)
153 call neko_scratch_registry%request_field(tb2, temp_indices(5), .false.)
154 call neko_scratch_registry%request_field(tb3, temp_indices(6), .false.)
155
156 do i = 1, n
157 tb1%x(i,1,1,1) = u%x(i,1,1,1) * b(i) * bd(2)
158 tb2%x(i,1,1,1) = v%x(i,1,1,1) * b(i) * bd(2)
159 tb3%x(i,1,1,1) = w%x(i,1,1,1) * b(i) * bd(2)
160 end do
161
162 do ilag = 2, nbd
163 do i = 1, n
164 ta1%x(i,1,1,1) = ulag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1)
165 ta2%x(i,1,1,1) = vlag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1)
166 ta3%x(i,1,1,1) = wlag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1)
167 end do
168
169 do i = 1, n
170 tb1%x(i,1,1,1) = tb1%x(i,1,1,1) + ta1%x(i,1,1,1)
171 tb2%x(i,1,1,1) = tb2%x(i,1,1,1) + ta2%x(i,1,1,1)
172 tb3%x(i,1,1,1) = tb3%x(i,1,1,1) + ta3%x(i,1,1,1)
173 end do
174 end do
175
176 do i = 1, n
177 bfx(i) = bfx(i) + tb1%x(i,1,1,1) * (rho / dt)
178 bfy(i) = bfy(i) + tb2%x(i,1,1,1) * (rho / dt)
179 bfz(i) = bfz(i) + tb3%x(i,1,1,1) * (rho / dt)
180 end do
181
182 call neko_scratch_registry%relinquish_field(temp_indices)
183
184 end subroutine rhs_maker_bdf_sx
185
186 subroutine scalar_rhs_maker_bdf_sx(s_lag, fs, s, B, rho_cp, dt, bd, nbd, n)
187 integer, intent(in) :: n, nbd
188 type(field_t), intent(in) :: s, rho_cp
189 type(field_series_t), intent(in) :: s_lag
190 real(kind=rp), intent(inout) :: fs(n)
191 real(kind=rp), intent(in) :: b(n)
192 real(kind=rp), intent(in) :: dt, bd(4)
193 integer :: i, ilag
194 type(field_t), pointer :: temp1, temp2
195 integer :: temp_indices(2)
196
197 call neko_scratch_registry%request_field(temp1, temp_indices(1), .false.)
198 call neko_scratch_registry%request_field(temp2, temp_indices(2), .false.)
199
200 do i = 1, n
201 temp2%x(i,1,1,1) = s%x(i,1,1,1) * b(i) * bd(2)
202 end do
203
204 do ilag = 2, nbd
205 do i = 1, n
206 temp1%x(i,1,1,1) = s_lag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1)
207 end do
208
209 do i = 1, n
210 temp2%x(i,1,1,1) = temp2%x(i,1,1,1) + temp1%x(i,1,1,1)
211 end do
212 end do
213
214 do i = 1, n
215 fs(i) = fs(i) + temp2%x(i,1,1,1) * &
216 (rho_cp%x(i,1,1,1) / dt)
217 end do
218
219 call neko_scratch_registry%relinquish_field(temp_indices)
220 end subroutine scalar_rhs_maker_bdf_sx
221
222 subroutine rhs_maker_oifs_sx(phi_x, phi_y, phi_z, bf_x, bf_y, bf_z, &
223 rho, dt, n)
224 real(kind=rp), intent(in) :: rho, dt
225 integer, intent(in) :: n
226 real(kind=rp), intent(inout) :: bf_x(n), bf_y(n), bf_z(n)
227 real(kind=rp), intent(inout) :: phi_x(n), phi_y(n), phi_z(n)
228 integer :: i
229
230 do i = 1, n
231 bf_x(i) = bf_x(i) + phi_x(i) * (rho / dt)
232 bf_y(i) = bf_y(i) + phi_y(i) * (rho / dt)
233 bf_z(i) = bf_z(i) + phi_z(i) * (rho / dt)
234 end do
235
236 end subroutine rhs_maker_oifs_sx
237
238 subroutine scalar_rhs_maker_oifs_sx(phi_s, bf_s, rho_cp, dt, n)
239 type(field_t), intent(in) :: rho_cp
240 real(kind=rp), intent(in) :: dt
241 integer, intent(in) :: n
242 real(kind=rp), intent(inout) :: bf_s(n)
243 real(kind=rp), intent(inout) :: phi_s(n)
244 integer :: i
245
246 do i = 1, n
247 bf_s(i) = bf_s(i) + phi_s(i) * (rho_cp%x(i,1,1,1) / dt)
248 end do
249
250 end subroutine scalar_rhs_maker_oifs_sx
251
252end module rhs_maker_sx
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_oifs_sx(phi_s, bf_s, rho_cp, dt, n)
subroutine scalar_rhs_maker_bdf_sx(s_lag, fs, s, b, rho_cp, dt, bd, nbd, n)
subroutine scalar_rhs_maker_ext_sx(fs_lag, fs_laglag, fs, ext_coeffs, n)
subroutine rhs_maker_oifs_sx(phi_x, phi_y, phi_z, bf_x, bf_y, bf_z, rho, dt, n)
subroutine rhs_maker_bdf_sx(ulag, vlag, wlag, bfx, bfy, bfz, u, v, w, b, blag, blaglag, rho, dt, bd, nbd, n)
subroutine rhs_maker_ext_sx(fx_lag, fy_lag, fz_lag, fx_laglag, fy_laglag, fz_laglag, fx, fy, fz, rho, ext_coeffs, n)
subroutine rhs_maker_sumab_sx(u, v, w, uu, vv, ww, uulag, vvlag, wwlag, ab, nab)
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