11 #include "sll_memory.h"
12 #include "sll_working_precision.h"
36 procedure, pass(this) :: operatort =>
push_x
37 procedure, pass(this) :: operatorv =>
push_v
41 sll_real64,
parameter ::
omega = 2.0_f64
42 sll_real64,
parameter ::
x0 = 1.0_f64
43 sll_real64,
parameter ::
v0 = 2.0_f64
44 sll_real64,
parameter ::
t_final = 1.0_f64
50 sll_real64,
intent(in) :: dt
52 this%x = this%x + this%v*dt
58 sll_real64,
intent(in) :: dt
60 this%v = this%v -
omega**2*this%x*dt
66 sll_int32,
intent(in) :: method
68 sll_real64,
intent(in) :: steps_fine
69 sll_int32,
intent(in) :: expected_order
70 logical,
intent(inout) :: test_passed
74 sll_int32 :: number_time_steps
75 sll_real64 :: x_exact, v_exact
76 sll_real64 :: error0, error1, error2, order1, order2
96 number_time_steps = int(steps_fine, i32)
101 error0 = sqrt((my_pendulum%x - x_exact)**2 + (my_pendulum%v - v_exact)**2)
107 number_time_steps = number_time_steps/2
111 error1 = sqrt((my_pendulum%x - x_exact)**2 + (my_pendulum%v - v_exact)**2)
117 number_time_steps = number_time_steps/2
121 error2 = sqrt((my_pendulum%x - x_exact)**2 + (my_pendulum%v - v_exact)**2)
125 order1 = log(error1/error0)/log(2.0_f64)
126 order2 = log(error2/error1)/log(2.0_f64)
127 if ((abs(order1 - expected_order) > 5.e-2) .or. (abs(order2 - expected_order) > 5.e-2))
then
128 test_passed = .false.
129 print *,
'error coarse =', error2
130 print *,
'error middle =', error1
131 print *,
' order (coarse/middle) =', order2
132 print *,
'error fine =', error0
133 print *,
' order (middle/fine) =', order1
Implements split operators for linear pendulum.
real(kind=f64), parameter omega
frequency
subroutine, public sll_s_check_order(method, steps_fine, expected_order, test_passed)
checks the order of a splitting method on the linear pendulum. used for unit testing.
real(kind=f64), parameter t_final
final time for order checking
subroutine push_v(this, dt)
Implements the second operator of splitting for linear pendulum.
real(kind=f64), parameter v0
initial v for order checking
subroutine push_x(this, dt)
Implements the first operator of splitting for linear pendulum.
real(kind=f64), parameter x0
initial x for order checking
Base class of operator splitting library. It is only used with particle-in-cell method.
subroutine, public sll_s_do_split_steps(split, dt, number_time_steps)
Apply the composition method for given number of times steps.
subroutine, public sll_s_operator_splitting_init(split, split_case, split_step, nb_split_step, split_begin_T, dt)
Initialises data for operator splitting.
Simple operator splitting type for linear pendulum Extends operator splitting.
operator splitting object