22 #include "sll_assert.h"
23 #include "sll_memory.h"
24 #include "sll_working_precision.h"
49 sll_real64 :: eta1_min
50 sll_real64 :: eta1_max
51 sll_real64 :: eta2_min
52 sll_real64 :: eta2_max
54 process_outside_point1
56 process_outside_point2
57 sll_real64,
dimension(:, :, :),
pointer :: buf_3d
58 sll_int32 :: bc_type_1
59 sll_int32 :: bc_type_2
64 procedure, pass(charac) :: initialize => &
66 procedure, pass(charac) :: compute_characteristics => &
80 process_outside_point1, &
81 process_outside_point2) &
85 sll_int32,
intent(in) :: npts1
86 sll_int32,
intent(in) :: npts2
87 sll_int32,
intent(in),
optional :: bc_type_1
88 sll_int32,
intent(in),
optional :: bc_type_2
89 sll_real64,
intent(in),
optional :: eta1_min
90 sll_real64,
intent(in),
optional :: eta1_max
91 sll_real64,
intent(in),
optional :: eta2_min
92 sll_real64,
intent(in),
optional :: eta2_max
94 process_outside_point1
96 process_outside_point2
99 sll_allocate(charac, ierr)
110 process_outside_point1, &
111 process_outside_point2)
125 process_outside_point1, &
126 process_outside_point2)
129 sll_int32,
intent(in) :: npts1
130 sll_int32,
intent(in) :: npts2
131 sll_int32,
intent(in),
optional :: bc_type_1
132 sll_int32,
intent(in),
optional :: bc_type_2
133 sll_real64,
intent(in),
optional :: eta1_min
134 sll_real64,
intent(in),
optional :: eta1_max
135 sll_real64,
intent(in),
optional :: eta2_min
136 sll_real64,
intent(in),
optional :: eta2_max
138 process_outside_point1
140 process_outside_point2
147 sll_allocate(charac%buf_3d(2, 0:npts1, 0:npts2), ierr)
149 if (
present(eta1_min))
then
150 charac%eta1_min = eta1_min
152 charac%eta1_min = 0._f64
154 if (
present(eta1_max))
then
155 charac%eta1_max = eta1_max
157 charac%eta1_max = 1._f64
159 if (
present(eta2_min))
then
160 charac%eta2_min = eta2_min
162 charac%eta2_min = 0._f64
165 if (
present(eta2_max))
then
166 charac%eta2_max = eta2_max
168 charac%eta2_max = 1._f64
174 if (
present(process_outside_point1))
then
175 charac%process_outside_point1 => process_outside_point1
176 charac%bc_type_1 = sll_p_user_defined
177 else if (.not. (
present(bc_type_1)))
then
178 print *,
'#provide boundary condition'
179 print *,
'#bc_type_1 or process_outside_point1 function'
180 print *,
'#in initialize_explicit_euler_conservative_2d_charac'
183 charac%bc_type_1 = bc_type_1
184 select case (bc_type_1)
185 case (sll_p_periodic)
187 case (sll_p_set_to_limit)
190 print *,
'#bad value of boundary condition'
191 print *,
'#in initialize_explicit_euler_conservative_2d_charac_computer'
196 if ((
present(process_outside_point1)) .and. (
present(bc_type_1)))
then
197 print *,
'#provide either process_outside_point1 or bc_type_1'
198 print *,
'#and not both'
199 print *,
'#in initialize_explicit_euler_conservative_2d_charac_computer'
203 if (
present(process_outside_point2))
then
204 charac%process_outside_point2 => process_outside_point2
205 charac%bc_type_2 = sll_p_user_defined
206 else if (.not. (
present(bc_type_2)))
then
207 print *,
'#provide boundary condition'
208 print *,
'#bc_type_2 or process_outside_point1 function'
211 charac%bc_type_2 = bc_type_2
212 select case (bc_type_2)
213 case (sll_p_periodic)
215 case (sll_p_set_to_limit)
218 print *,
'#bad value of boundary condition'
219 print *,
'#in initialize_explicit_euler_conservative_2d_charac_computer'
224 if ((
present(process_outside_point2)) .and. (
present(bc_type_2)))
then
225 print *,
'#provide either process_outside_point2 or bc_type_2'
226 print *,
'#and not both'
227 print *,
'#in initialize_explicit_euler_conservative_2d_charac_computer'
244 sll_real64,
dimension(:, :),
intent(in) :: a1
245 sll_real64,
dimension(:, :),
intent(in) :: a2
246 sll_real64,
intent(in) :: dt
247 sll_real64,
dimension(:),
intent(in) :: input1
248 sll_real64,
dimension(:),
intent(in) :: input2
249 sll_real64,
dimension(:, :),
intent(out) :: output1
250 sll_real64,
dimension(:, :),
intent(out) :: output2
255 sll_real64 :: eta1_min
256 sll_real64 :: eta1_max
257 sll_real64 :: eta2_min
258 sll_real64 :: eta2_max
262 eta1_min = charac%eta1_min
263 eta1_max = charac%eta1_max
264 eta2_min = charac%eta2_min
265 eta2_max = charac%eta2_max
267 sll_assert(
size(a1, 1) >= charac%Npts1 - 1)
268 sll_assert(
size(a1, 2) >= charac%Npts2 - 1)
269 sll_assert(
size(a2, 1) >= charac%Npts1 - 1)
270 sll_assert(
size(a2, 2) >= charac%Npts2 - 1)
271 sll_assert(
size(input1) >= charac%Npts1)
272 sll_assert(
size(input2) >= charac%Npts2)
273 sll_assert(
size(output1, 1) >= charac%Npts1)
274 sll_assert(
size(output1, 2) >= charac%Npts2)
275 sll_assert(
size(output2, 1) >= charac%Npts1)
276 sll_assert(
size(output2, 2) >= charac%Npts2)
280 charac%buf_3d(1, i, j) = 0.5_f64*(input1(i) + input1(i + 1)) - dt*a1(i, j)
284 charac%buf_3d(2, i, j) = 0.5_f64*(input2(j) + input2(j + 1)) - dt*a2(i, j)
291 select case (charac%bc_type_1)
292 case (sll_p_periodic)
294 charac%buf_3d(1, 0, j) = charac%buf_3d(1, npts1 - 1, j) - (eta1_max - eta1_min)
295 charac%buf_3d(2, 0, j) = charac%buf_3d(2, npts1 - 1, j)
296 charac%buf_3d(1, npts1, j) = charac%buf_3d(1, 1, j) + (eta1_max - eta1_min)
297 charac%buf_3d(2, npts1, j) = charac%buf_3d(2, 1, j)
299 case (sll_p_set_to_limit)
301 charac%buf_3d(1, 0, j) = 2._f64*eta1_min - charac%buf_3d(1, 1, j)
302 charac%buf_3d(2, 0, j) = charac%buf_3d(2, 1, j)
303 charac%buf_3d(1, npts1, j) = 2._f64*eta1_max - charac%buf_3d(1, npts1 - 1, j)
304 charac%buf_3d(2, npts1, j) = charac%buf_3d(2, npts1 - 1, j)
307 print *,
'#bad value for charac%bc_type_1'
311 select case (charac%bc_type_2)
312 case (sll_p_periodic)
314 charac%buf_3d(2, i, 0) = charac%buf_3d(2, i, npts2 - 1) - (eta2_max - eta2_min)
315 charac%buf_3d(1, i, 0) = charac%buf_3d(1, i, npts2 - 1)
316 charac%buf_3d(2, i, npts1) = charac%buf_3d(2, i, 1) + (eta2_max - eta2_min)
317 charac%buf_3d(1, i, npts1) = charac%buf_3d(1, i, 1)
319 case (sll_p_set_to_limit)
321 charac%buf_3d(2, i, 0) = 2._f64*eta2_min - charac%buf_3d(2, i, 1)
322 charac%buf_3d(1, i, 0) = charac%buf_3d(1, i, 1)
323 charac%buf_3d(2, i, npts1) = 2._f64*eta2_max - charac%buf_3d(2, i, npts1 - 1)
324 charac%buf_3d(1, i, npts1) = charac%buf_3d(1, i, npts1 - 1)
327 print *,
'#bad value for charac%bc_type_2'
334 0.25_f64*(charac%buf_3d(1, i, j) &
335 + charac%buf_3d(1, i - 1, j) &
336 + charac%buf_3d(1, i - 1, j - 1) &
337 + charac%buf_3d(1, i, j - 1))
339 0.25_f64*(charac%buf_3d(2, i, j) &
340 + charac%buf_3d(2, i - 1, j) &
341 + charac%buf_3d(2, i - 1, j - 1) &
342 + charac%buf_3d(2, i, j - 1))
Describe different boundary conditions.
Abstract class to compute the characteristic in two dimensions.
real(kind=f64) function, public sll_f_process_outside_point_periodic(eta, eta_min, eta_max)
real(kind=f64) function, public sll_f_process_outside_point_set_to_limit(eta, eta_min, eta_max)
computes the characteristic with explicit euler conservative scheme
subroutine compute_explicit_euler_conservative_2d_charac(charac, A1, A2, dt, input1, input2, output1, output2)
subroutine initialize_explicit_euler_conservative_2d_charac(charac, Npts1, Npts2, bc_type_1, bc_type_2, eta1_min, eta1_max, eta2_min, eta2_max, process_outside_point1, process_outside_point2)
type(explicit_euler_conservative_2d_charac_computer) function, pointer, public sll_f_new_explicit_euler_conservative_2d_charac(Npts1, Npts2, bc_type_1, bc_type_2, eta1_min, eta1_max, eta2_min, eta2_max, process_outside_point1, process_outside_point2)