Neko 1.99.3
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, rho, &
108 ext_coeffs, n)
109 type(field_t), intent(inout) :: fs_lag
110 type(field_t), intent(inout) :: fs_laglag
111 real(kind=rp), intent(in) :: rho, ext_coeffs(4)
112 integer, intent(in) :: n
113 real(kind=rp), intent(inout) :: fs(n)
114 integer :: i
115 type(field_t), pointer :: temp1
116 integer :: temp_index
117
118 call neko_scratch_registry%request_field(temp1, temp_index, .false.)
119
120 do i = 1, n
121 temp1%x(i,1,1,1) = ext_coeffs(2) * fs_lag%x(i,1,1,1) + &
122 ext_coeffs(3) * fs_laglag%x(i,1,1,1)
123 end do
124
125 do i = 1, n
126 fs_laglag%x(i,1,1,1) = fs_lag%x(i,1,1,1)
127 fs_lag%x(i,1,1,1) = fs(i)
128 end do
129
130 do i = 1, n
131 fs(i) = (ext_coeffs(1) * fs(i) + temp1%x(i,1,1,1)) * rho
132 end do
133
134 call neko_scratch_registry%relinquish_field(temp_index)
135 end subroutine scalar_rhs_maker_ext_sx
136
137 subroutine rhs_maker_bdf_sx(ulag, vlag, wlag, bfx, bfy, bfz, &
138 u, v, w, B, rho, dt, bd, nbd, n, Blag, Blaglag)
139 integer, intent(in) :: n, nbd
140 type(field_t), intent(in) :: u, v, w
141 type(field_series_t), intent(in) :: ulag, vlag, wlag
142 real(kind=rp), intent(in) :: blag(n), blaglag(n)
143 real(kind=rp), intent(inout) :: bfx(n), bfy(n), bfz(n)
144 real(kind=rp), intent(in) :: b(n)
145 real(kind=rp), intent(in) :: dt, rho, bd(4)
146 type(field_t), pointer :: tb1, tb2, tb3
147 type(field_t), pointer :: ta1, ta2, ta3
148 integer :: temp_indices(6)
149 integer :: i, ilag
150
151 call neko_scratch_registry%request_field(ta1, temp_indices(1), .false.)
152 call neko_scratch_registry%request_field(ta2, temp_indices(2), .false.)
153 call neko_scratch_registry%request_field(ta3, temp_indices(3), .false.)
154 call neko_scratch_registry%request_field(tb1, temp_indices(4), .false.)
155 call neko_scratch_registry%request_field(tb2, temp_indices(5), .false.)
156 call neko_scratch_registry%request_field(tb3, temp_indices(6), .false.)
157
158 do i = 1, n
159 tb1%x(i,1,1,1) = u%x(i,1,1,1) * b(i) * bd(2)
160 tb2%x(i,1,1,1) = v%x(i,1,1,1) * b(i) * bd(2)
161 tb3%x(i,1,1,1) = w%x(i,1,1,1) * b(i) * bd(2)
162 end do
163
164 do ilag = 2, nbd
165 do i = 1, n
166 ta1%x(i,1,1,1) = ulag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1)
167 ta2%x(i,1,1,1) = vlag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1)
168 ta3%x(i,1,1,1) = wlag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1)
169 end do
170
171 do i = 1, n
172 tb1%x(i,1,1,1) = tb1%x(i,1,1,1) + ta1%x(i,1,1,1)
173 tb2%x(i,1,1,1) = tb2%x(i,1,1,1) + ta2%x(i,1,1,1)
174 tb3%x(i,1,1,1) = tb3%x(i,1,1,1) + ta3%x(i,1,1,1)
175 end do
176 end do
177
178 do i = 1, n
179 bfx(i) = bfx(i) + tb1%x(i,1,1,1) * (rho / dt)
180 bfy(i) = bfy(i) + tb2%x(i,1,1,1) * (rho / dt)
181 bfz(i) = bfz(i) + tb3%x(i,1,1,1) * (rho / dt)
182 end do
183
184 call neko_scratch_registry%relinquish_field(temp_indices)
185
186 end subroutine rhs_maker_bdf_sx
187
188 subroutine scalar_rhs_maker_bdf_sx(s_lag, fs, s, B, rho, dt, bd, nbd, n)
189 integer, intent(in) :: n, nbd
190 type(field_t), intent(in) :: s
191 type(field_series_t), intent(in) :: s_lag
192 real(kind=rp), intent(inout) :: fs(n)
193 real(kind=rp), intent(in) :: b(n)
194 real(kind=rp), intent(in) :: dt, rho, bd(4)
195 integer :: i, ilag
196 type(field_t), pointer :: temp1, temp2
197 integer :: temp_indices(2)
198
199 call neko_scratch_registry%request_field(temp1, temp_indices(1), .false.)
200 call neko_scratch_registry%request_field(temp2, temp_indices(2), .false.)
201
202 do i = 1, n
203 temp2%x(i,1,1,1) = s%x(i,1,1,1) * b(i) * bd(2)
204 end do
205
206 do ilag = 2, nbd
207 do i = 1, n
208 temp1%x(i,1,1,1) = s_lag%lf(ilag-1)%x(i,1,1,1) * b(i) * bd(ilag+1)
209 end do
210
211 do i = 1, n
212 temp2%x(i,1,1,1) = temp2%x(i,1,1,1) + temp1%x(i,1,1,1)
213 end do
214 end do
215
216 do i = 1, n
217 fs(i) = fs(i) + temp2%x(i,1,1,1) * (rho / dt)
218 end do
219
220 call neko_scratch_registry%relinquish_field(temp_indices)
221 end subroutine scalar_rhs_maker_bdf_sx
222
223 subroutine rhs_maker_oifs_sx(phi_x, phi_y, phi_z, bf_x, bf_y, bf_z, &
224 rho, dt, n)
225 real(kind=rp), intent(in) :: rho, dt
226 integer, intent(in) :: n
227 real(kind=rp), intent(inout) :: bf_x(n), bf_y(n), bf_z(n)
228 real(kind=rp), intent(inout) :: phi_x(n), phi_y(n), phi_z(n)
229 integer :: i
230
231 do i = 1, n
232 bf_x(i) = bf_x(i) + phi_x(i) * (rho / dt)
233 bf_y(i) = bf_y(i) + phi_y(i) * (rho / dt)
234 bf_z(i) = bf_z(i) + phi_z(i) * (rho / dt)
235 end do
236
237 end subroutine rhs_maker_oifs_sx
238
239 subroutine scalar_rhs_maker_oifs_sx(phi_s, bf_s, rho, dt, n)
240 real(kind=rp), intent(in) :: rho, 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 / dt)
248 end do
249
250 end subroutine scalar_rhs_maker_oifs_sx
251
252end module rhs_maker_sx
253
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_oifs_sx(phi_x, phi_y, phi_z, bf_x, bf_y, bf_z, rho, dt, n)
subroutine scalar_rhs_maker_oifs_sx(phi_s, bf_s, rho, dt, 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)
subroutine rhs_maker_bdf_sx(ulag, vlag, wlag, bfx, bfy, bfz, u, v, w, b, rho, dt, bd, nbd, n, blag, blaglag)
subroutine scalar_rhs_maker_bdf_sx(s_lag, fs, s, b, rho, dt, bd, nbd, n)
subroutine scalar_rhs_maker_ext_sx(fs_lag, fs_laglag, fs, 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