22 #include "sll_assert.h"
23 #include "sll_memory.h"
24 #include "sll_working_precision.h"
54 sll_real64 :: eta1_min
55 sll_real64 :: eta1_max
56 sll_real64 :: eta2_min
57 sll_real64 :: eta2_max
59 process_outside_point1
61 process_outside_point2
66 sll_int32 :: x1_maxiter
67 sll_int32 :: x2_maxiter
90 process_outside_point1, &
91 process_outside_point2, &
99 sll_int32,
intent(in) :: npts1
100 sll_int32,
intent(in) :: npts2
101 sll_int32,
intent(in),
optional :: bc_type_1
102 sll_int32,
intent(in),
optional :: bc_type_2
103 sll_real64,
intent(in),
optional :: eta1_min
104 sll_real64,
intent(in),
optional :: eta1_max
105 sll_real64,
intent(in),
optional :: eta2_min
106 sll_real64,
intent(in),
optional :: eta2_max
108 process_outside_point1
110 process_outside_point2
115 sll_int32,
intent(in),
optional :: x1_maxiter
116 sll_int32,
intent(in),
optional :: x2_maxiter
117 sll_real64,
intent(in),
optional :: x1_tol
118 sll_real64,
intent(in),
optional :: x2_tol
121 sll_allocate(charac, ierr)
136 process_outside_point1, &
137 process_outside_point2, &
158 process_outside_point1, &
159 process_outside_point2, &
166 sll_int32,
intent(in) :: npts1
167 sll_int32,
intent(in) :: npts2
168 sll_int32,
intent(in),
optional :: bc_type_1
169 sll_int32,
intent(in),
optional :: bc_type_2
170 sll_real64,
intent(in),
optional :: eta1_min
171 sll_real64,
intent(in),
optional :: eta1_max
172 sll_real64,
intent(in),
optional :: eta2_min
173 sll_real64,
intent(in),
optional :: eta2_max
175 process_outside_point1
177 process_outside_point2
182 sll_int32,
intent(in),
optional :: x1_maxiter
183 sll_int32,
intent(in),
optional :: x2_maxiter
184 sll_real64,
intent(in),
optional :: x1_tol
185 sll_real64,
intent(in),
optional :: x2_tol
190 if (
present(eta1_min))
then
191 charac%eta1_min = eta1_min
193 charac%eta1_min = 0._f64
195 if (
present(eta1_max))
then
196 charac%eta1_max = eta1_max
198 charac%eta1_max = 1._f64
200 if (
present(eta2_min))
then
201 charac%eta2_min = eta2_min
203 charac%eta2_min = 0._f64
206 if (
present(eta2_max))
then
207 charac%eta2_max = eta2_max
209 charac%eta2_max = 1._f64
215 if (
present(process_outside_point1))
then
216 charac%process_outside_point1 => process_outside_point1
217 else if (.not. (
present(bc_type_1)))
then
218 print *,
'#provide boundary condition'
219 print *,
'#bc_type_1 or process_outside_point1 function'
220 print *,
'#in initialize_sll_t_charac_2d_verlet'
223 select case (bc_type_1)
224 case (sll_p_periodic)
226 case (sll_p_set_to_limit)
229 print *,
'#bad value of boundary condition'
230 print *,
'#in initialize_sll_t_charac_2d_verlet'
235 if ((
present(process_outside_point1)) .and. (
present(bc_type_1)))
then
236 print *,
'#provide either process_outside_point1 or bc_type_1'
237 print *,
'#and not both'
238 print *,
'#in initialize_sll_t_charac_2d_verlet'
242 if (
present(process_outside_point2))
then
243 charac%process_outside_point2 => process_outside_point2
244 else if (.not. (
present(bc_type_2)))
then
245 print *,
'#provide boundary condition'
246 print *,
'#bc_type_2 or process_outside_point1 function'
247 print *,
'#in initialize_sll_t_charac_2d_verlet'
250 select case (bc_type_2)
251 case (sll_p_periodic)
253 case (sll_p_set_to_limit)
256 print *,
'#bad value of boundary condition'
257 print *,
'#in initialize_sll_t_charac_2d_verlet'
262 if ((
present(process_outside_point2)) .and. (
present(bc_type_2)))
then
263 print *,
'#provide either process_outside_point2 or bc_type_2'
264 print *,
'#and not both'
265 print *,
'#in initialize_sll_t_charac_2d_verlet'
269 charac%A1_interp_x1x2 => a1_interp_x1x2
270 charac%A2_interp_x1x2 => a2_interp_x1x2
271 charac%A1_interp_x1 => a1_interp_x1
272 charac%A2_interp_x1 => a2_interp_x1
274 if (
present(x1_maxiter))
then
275 charac%x1_maxiter = x1_maxiter
277 charac%x1_maxiter = 1000
279 if (
present(x2_maxiter))
then
280 charac%x2_maxiter = x2_maxiter
282 charac%x2_maxiter = charac%x1_maxiter
285 if (
present(x1_tol))
then
286 charac%x1_tol = x1_tol
288 charac%x1_tol = 1.e-12_f64
290 if (
present(x2_tol))
then
291 charac%x2_tol = x2_tol
293 charac%x2_tol = charac%x1_tol
309 sll_real64,
dimension(:, :),
intent(in) :: a1
310 sll_real64,
dimension(:, :),
intent(in) :: a2
311 sll_real64,
intent(in) :: dt
312 sll_real64,
dimension(:),
intent(in) :: input1
313 sll_real64,
dimension(:),
intent(in) :: input2
314 sll_real64,
dimension(:, :),
intent(out) :: output1
315 sll_real64,
dimension(:, :),
intent(out) :: output2
327 sll_real64 :: eta1_min
328 sll_real64 :: eta1_max
329 sll_real64 :: eta2_min
330 sll_real64 :: eta2_max
334 eta1_min = charac%eta1_min
335 eta1_max = charac%eta1_max
336 eta2_min = charac%eta2_min
337 eta2_max = charac%eta2_max
339 sll_assert(
size(a1, 1) >= npts1)
340 sll_assert(
size(a1, 2) >= npts2)
341 sll_assert(
size(a2, 1) >= npts1)
342 sll_assert(
size(a2, 2) >= npts2)
343 sll_assert(
size(input1) >= npts1)
344 sll_assert(
size(input2) >= npts2)
345 sll_assert(
size(output1, 1) >= npts1)
346 sll_assert(
size(output1, 2) >= npts2)
347 sll_assert(
size(output2, 1) >= npts1)
348 sll_assert(
size(output2, 2) >= npts2)
355 call charac%A1_interp_x1x2%compute_interpolants(a1)
356 call charac%A2_interp_x1x2%compute_interpolants(a2)
370 do j = 1, charac%Npts2
377 call charac%A1_interp_x1%compute_interpolants(a1(:, j))
378 call charac%A2_interp_x1%compute_interpolants(a2(:, j))
382 do i = 1, charac%Npts1
387 x1 = input1(i) - 0.5_f64*dt*a1(i, j)
388 if ((x1 <= charac%eta1_min) .or. (x1 >= charac%eta1_max))
then
389 x1 = charac%process_outside_point1(x1, charac%eta1_min, charac%eta1_max)
393 do while (iter < charac%x1_maxiter .and. abs(x1_old - x1) > charac%x1_tol)
395 if ((x1 <= charac%eta1_min) .or. (x1 >= charac%eta1_max))
then
396 x1_i = charac%process_outside_point1(x1, charac%eta1_min, charac%eta1_max)
400 x1 = input1(i) - 0.5_f64*dt*charac%A1_interp_x1%interpolate_from_interpolant_value(x1_i)
403 if (iter == charac%x1_maxiter .and. abs(x1_old - x1) > charac%x1_tol)
then
408 if ((x1 <= charac%eta1_min) .or. (x1 >= charac%eta1_max))
then
409 x1 = charac%process_outside_point1(x1, charac%eta1_min, charac%eta1_max)
413 x2 = input2(j) - dt*a2(i, j)
416 do while (iter < charac%x2_maxiter .and. abs(x2_old - x2) > charac%x2_tol)
419 if ((x2 <= charac%eta2_min) .or. (x2 >= charac%eta2_max))
then
420 x2_i = charac%process_outside_point2(x2, charac%eta2_min, charac%eta2_max)
424 x2 = input2(j) - 0.5_f64*dt*(charac%A2_interp_x1x2%interpolate_from_interpolant_value(x1, x2_i) &
425 + charac%A2_interp_x1%interpolate_from_interpolant_value(x1))
428 if (iter == charac%x2_maxiter .and. abs(x2_old - x2) > charac%x2_tol)
then
433 if ((x2 <= charac%eta2_min) .or. (x2 >= charac%eta2_max))
then
434 x2 = charac%process_outside_point2(x2, charac%eta2_min, charac%eta2_max)
438 x1 = x1 - 0.5_f64*dt*charac%A1_interp_x1x2%interpolate_from_interpolant_value(x1, x2)
439 if ((x1 <= charac%eta1_min) .or. (x1 >= charac%eta1_max))
then
440 x1 = charac%process_outside_point1(x1, charac%eta1_min, charac%eta1_max)
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 verlet method
subroutine initialize_verlet_2d_charac(charac, Npts1, Npts2, A1_interp_x1x2, A2_interp_x1x2, A1_interp_x1, A2_interp_x1, bc_type_1, bc_type_2, eta1_min, eta1_max, eta2_min, eta2_max, process_outside_point1, process_outside_point2, x1_maxiter, x2_maxiter, x1_tol, x2_tol)
subroutine compute_verlet_2d_charac(charac, A1, A2, dt, input1, input2, output1, output2)
type(sll_t_charac_2d_verlet) function, pointer, public sll_f_new_verlet_2d_charac(Npts1, Npts2, A1_interp_x1x2, A2_interp_x1x2, A1_interp_x1, A2_interp_x1, bc_type_1, bc_type_2, eta1_min, eta1_max, eta2_min, eta2_max, process_outside_point1, process_outside_point2, x1_maxiter, x2_maxiter, x1_tol, x2_tol)
Module for 1D interpolation and reconstruction.
abstract data type for 2d interpolation
Abstract class for 1D interpolation and reconstruction.
Base class/basic interface for 2D interpolators.