22 #include "sll_assert.h"
23 #include "sll_memory.h"
24 #include "sll_working_precision.h"
51 logical :: feet_inside
55 procedure, pass(charac) :: compute_characteristics => &
65 process_outside_point, &
70 sll_int32,
intent(in) :: npts
71 sll_int32,
intent(in),
optional :: bc_type
72 sll_real64,
intent(in),
optional :: eta_min
73 sll_real64,
intent(in),
optional :: eta_max
76 logical,
optional :: feet_inside
79 sll_allocate(charac, ierr)
86 process_outside_point, &
97 process_outside_point, &
101 sll_int32,
intent(in) :: npts
102 sll_int32,
intent(in),
optional :: bc_type
103 sll_real64,
intent(in),
optional :: eta_min
104 sll_real64,
intent(in),
optional :: eta_max
106 process_outside_point
107 logical,
optional :: feet_inside
111 if (
present(eta_min))
then
112 charac%eta_min = eta_min
114 charac%eta_min = 0._f64
116 if (
present(eta_max))
then
117 charac%eta_max = eta_max
119 charac%eta_max = 1._f64
122 if (
present(process_outside_point))
then
123 charac%process_outside_point => process_outside_point
124 else if (.not. (
present(bc_type)))
then
125 print *,
'#provide boundary condition'
126 print *,
'#bc_type or process_outside_point function'
127 print *,
'#in initialize_charac_1d_explicit_euler'
130 select case (bc_type)
131 case (sll_p_periodic)
133 case (sll_p_set_to_limit)
136 print *,
'#bad value of boundary condition'
137 print *,
'#in initialize_charac_1d_explicit_euler'
142 if ((
present(process_outside_point)) .and. (
present(bc_type)))
then
143 print *,
'#provide either process_outside_point or bc_type'
144 print *,
'#and not both'
145 print *,
'#in initialize_explicit_euler_2d_charac'
149 if (
present(feet_inside))
then
150 charac%feet_inside = feet_inside
152 charac%feet_inside = .true.
165 sll_real64,
dimension(:),
intent(in) :: a
166 sll_real64,
intent(in) :: dt
167 sll_real64,
dimension(:),
intent(in) :: input
168 sll_real64,
dimension(:),
intent(out) :: output
171 sll_real64 :: eta_min
172 sll_real64 :: eta_max
175 eta_min = charac%eta_min
176 eta_max = charac%eta_max
178 sll_assert(
size(a) >= charac%Npts)
179 sll_assert(
size(input) >= charac%Npts)
180 sll_assert(
size(output) >= charac%Npts)
183 output(i) = input(i) - dt*a(i)
184 if (((output(i) <= eta_min) .or. (output(i) >= eta_max)) .and. (charac%feet_inside))
then
185 output(i) = charac%process_outside_point(output(i), eta_min, eta_max)
Describe different boundary conditions.
Abstract class for characteristic derived type.
function, public sll_f_process_outside_point_set_to_limit(eta, eta_min, eta_max)
function, public sll_f_process_outside_point_periodic(eta, eta_min, eta_max)
computes the characteristic with explicit euler scheme
subroutine initialize_charac_1d_explicit_euler(charac, Npts, bc_type, eta_min, eta_max, process_outside_point, feet_inside)
type(sll_t_charac_1d_explicit_euler) function, pointer, public sll_f_new_charac_1d_explicit_euler(Npts, bc_type, eta_min, eta_max, process_outside_point, feet_inside)
subroutine compute_charac_1d_explicit_euler(charac, A, dt, input, output)