22 #include "sll_assert.h"
23 #include "sll_memory.h"
24 #include "sll_working_precision.h"
54 procedure, pass(charac) :: initialize => &
56 procedure, pass(charac) :: compute_characteristics => &
66 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
78 sll_allocate(charac, ierr)
85 process_outside_point)
95 process_outside_point)
98 sll_int32,
intent(in) :: npts
99 sll_int32,
intent(in),
optional :: bc_type
100 sll_real64,
intent(in),
optional :: eta_min
101 sll_real64,
intent(in),
optional :: eta_max
103 process_outside_point
107 if (
present(eta_min))
then
108 charac%eta_min = eta_min
110 charac%eta_min = 0._f64
112 if (
present(eta_max))
then
113 charac%eta_max = eta_max
115 charac%eta_max = 1._f64
118 if (
present(process_outside_point))
then
119 charac%process_outside_point => process_outside_point
120 charac%bc_type = sll_p_user_defined
121 else if (.not. (
present(bc_type)))
then
122 print *,
'#provide boundary condition'
123 print *,
'#bc_type or process_outside_point function'
124 print *,
'#in initialize_charac_1d_explicit_euler'
127 charac%bc_type = bc_type
128 select case (bc_type)
129 case (sll_p_periodic)
131 case (sll_p_set_to_limit)
134 print *,
'#bad value of boundary condition'
135 print *,
'#in initialize_charac_1d_explicit_euler'
140 if ((
present(process_outside_point)) .and. (
present(bc_type)))
then
141 print *,
'#provide either process_outside_point or bc_type'
142 print *,
'#and not both'
143 print *,
'#in initialize_explicit_euler_2d_charac'
157 sll_real64,
dimension(:),
intent(in) :: a
158 sll_real64,
intent(in) :: dt
159 sll_real64,
dimension(:),
intent(in) :: input
160 sll_real64,
dimension(:),
intent(out) :: output
163 sll_real64 :: eta_min
164 sll_real64 :: eta_max
165 sll_real64 :: output_min
166 sll_real64 :: output_max
169 eta_min = charac%eta_min
170 eta_max = charac%eta_max
172 sll_assert(
size(a) >= charac%Npts - 1)
173 sll_assert(
size(input) >= charac%Npts)
174 sll_assert(
size(output) >= charac%Npts)
177 output(i) = 0.5_f64*(input(i) + input(i + 1)) - dt*a(i)
179 select case (charac%bc_type)
180 case (sll_p_periodic)
181 output_min = output(npts - 1) - (eta_max - eta_min)
182 output_max = output(1) + (eta_max - eta_min)
186 case (sll_p_set_to_limit)
187 output_min = 2._f64*eta_min - output(1)
188 output_max = 2._f64*eta_max - output(npts - 1)
190 print *,
'#bad value for charac%bc_type'
194 output(npts) = 0.5_f64*(output(npts - 1) + output_max)
196 do i = npts - 1, 2, -1
197 output(i) = 0.5_f64*(output(i) + output(i - 1))
199 output(1) = 0.5_f64*(output(1) + output_min)
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 conservative scheme
subroutine initialize_explicit_euler_conservative_1d_charac(charac, Npts, bc_type, eta_min, eta_max, process_outside_point)
type(explicit_euler_conservative_1d_charac_computer) function, pointer, public sll_f_new_explicit_euler_conservative_1d_charac(Npts, bc_type, eta_min, eta_max, process_outside_point)
subroutine compute_explicit_euler_conservative_1d_charac(charac, A, dt, input, output)