22 #include "sll_assert.h"
23 #include "sll_memory.h"
24 #include "sll_working_precision.h"
48 sll_real64 :: eta1_min
49 sll_real64 :: eta1_max
50 sll_real64 :: eta2_min
51 sll_real64 :: eta2_max
53 process_outside_point1
55 process_outside_point2
59 procedure, pass(charac) :: compute_characteristics => &
73 process_outside_point1, &
74 process_outside_point2) &
78 sll_int32,
intent(in) :: npts1
79 sll_int32,
intent(in) :: npts2
80 sll_int32,
intent(in),
optional :: bc_type_1
81 sll_int32,
intent(in),
optional :: bc_type_2
82 sll_real64,
intent(in),
optional :: eta1_min
83 sll_real64,
intent(in),
optional :: eta1_max
84 sll_real64,
intent(in),
optional :: eta2_min
85 sll_real64,
intent(in),
optional :: eta2_max
87 process_outside_point1
89 process_outside_point2
92 sll_allocate(charac, ierr)
103 process_outside_point1, &
104 process_outside_point2)
118 process_outside_point1, &
119 process_outside_point2)
122 sll_int32,
intent(in) :: npts1
123 sll_int32,
intent(in) :: npts2
124 sll_int32,
intent(in),
optional :: bc_type_1
125 sll_int32,
intent(in),
optional :: bc_type_2
126 sll_real64,
intent(in),
optional :: eta1_min
127 sll_real64,
intent(in),
optional :: eta1_max
128 sll_real64,
intent(in),
optional :: eta2_min
129 sll_real64,
intent(in),
optional :: eta2_max
131 process_outside_point1
133 process_outside_point2
138 if (
present(eta1_min))
then
139 charac%eta1_min = eta1_min
141 charac%eta1_min = 0._f64
143 if (
present(eta1_max))
then
144 charac%eta1_max = eta1_max
146 charac%eta1_max = 1._f64
148 if (
present(eta2_min))
then
149 charac%eta2_min = eta2_min
151 charac%eta2_min = 0._f64
154 if (
present(eta2_max))
then
155 charac%eta2_max = eta2_max
157 charac%eta2_max = 1._f64
163 if (
present(process_outside_point1))
then
164 charac%process_outside_point1 => process_outside_point1
165 else if (.not. (
present(bc_type_1)))
then
166 print *,
'#provide boundary condition'
167 print *,
'#bc_type_1 or process_outside_point1 function'
168 print *,
'#in initialize_explicit_euler_2d_charac'
171 select case (bc_type_1)
172 case (sll_p_periodic)
174 case (sll_p_set_to_limit)
177 print *,
'#bad value of boundary condition'
178 print *,
'#in initialize_sll_t_characteristics_2d_explicit_euler_2d'
183 if ((
present(process_outside_point1)) .and. (
present(bc_type_1)))
then
184 print *,
'#provide either process_outside_point1 or bc_type_1'
185 print *,
'#and not both'
186 print *,
'#in initialize_sll_t_characteristics_2d_explicit_euler_2d'
190 if (
present(process_outside_point2))
then
191 charac%process_outside_point2 => process_outside_point2
192 else if (.not. (
present(bc_type_2)))
then
193 print *,
'#provide boundary condition'
194 print *,
'#bc_type_2 or process_outside_point1 function'
197 select case (bc_type_2)
198 case (sll_p_periodic)
200 case (sll_p_set_to_limit)
203 print *,
'#bad value of boundary condition'
204 print *,
'#in initialize_sll_t_characteristics_2d_explicit_euler_2d'
209 if ((
present(process_outside_point2)) .and. (
present(bc_type_2)))
then
210 print *,
'#provide either process_outside_point2 or bc_type_2'
211 print *,
'#and not both'
212 print *,
'#in initialize_sll_t_characteristics_2d_explicit_euler_2d'
229 sll_real64,
dimension(:, :),
intent(in) :: a1
230 sll_real64,
dimension(:, :),
intent(in) :: a2
231 sll_real64,
intent(in) :: dt
232 sll_real64,
dimension(:),
intent(in) :: input1
233 sll_real64,
dimension(:),
intent(in) :: input2
234 sll_real64,
dimension(:, :),
intent(out) :: output1
235 sll_real64,
dimension(:, :),
intent(out) :: output2
240 sll_real64 :: eta1_min
241 sll_real64 :: eta1_max
242 sll_real64 :: eta2_min
243 sll_real64 :: eta2_max
247 eta1_min = charac%eta1_min
248 eta1_max = charac%eta1_max
249 eta2_min = charac%eta2_min
250 eta2_max = charac%eta2_max
252 sll_assert(
size(a1, 1) >= charac%Npts1)
253 sll_assert(
size(a1, 2) >= charac%Npts2)
254 sll_assert(
size(a2, 1) >= charac%Npts1)
255 sll_assert(
size(a2, 2) >= charac%Npts2)
256 sll_assert(
size(input1) >= charac%Npts1)
257 sll_assert(
size(input2) >= charac%Npts2)
258 sll_assert(
size(output1, 1) >= charac%Npts1)
259 sll_assert(
size(output1, 2) >= charac%Npts2)
260 sll_assert(
size(output2, 1) >= charac%Npts1)
261 sll_assert(
size(output2, 2) >= charac%Npts2)
265 output1(i, j) = input1(i) - dt*a1(i, j)
266 if ((output1(i, j) <= eta1_min) .or. (output1(i, j) >= eta1_max))
then
267 output1(i, j) = charac%process_outside_point1(output1(i, j), eta1_min, eta1_max)
269 output2(i, j) = input2(j) - dt*a2(i, j)
270 if ((output2(i, j) <= eta2_min) .or. (output2(i, j) >= eta2_max))
then
271 output2(i, j) = charac%process_outside_point2(output2(i, j), eta2_min, eta2_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 explicit euler scheme
type(sll_t_charac_2d_explicit_euler) function, pointer, public sll_f_new_explicit_euler_2d_charac(Npts1, Npts2, bc_type_1, bc_type_2, eta1_min, eta1_max, eta2_min, eta2_max, process_outside_point1, process_outside_point2)
subroutine initialize_explicit_euler_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)
subroutine compute_explicit_euler_2d_charac(charac, A1, A2, dt, input1, input2, output1, output2)