Module with the stochastic rk2 integration routines.
More...
|
subroutine, public | init_integrator (force) |
| Subroutine to initialize the integrator. More...
|
|
subroutine | tendencies (t, y, res) |
| Routine computing the tendencies of the selected model. More...
|
|
subroutine, public | step (y, t, dt, dtn, res, tend) |
| Routine to perform a stochastic step of the selected dynamics (Heun algorithm). The incremented time is returned. More...
|
|
|
real(kind=8), dimension(:), allocatable | dwar |
|
real(kind=8), dimension(:), allocatable | dwau |
|
real(kind=8), dimension(:), allocatable | dwor |
|
real(kind=8), dimension(:), allocatable | dwou |
| Standard gaussian noise buffers. More...
|
|
real(kind=8), dimension(:), allocatable | buf_y1 |
|
real(kind=8), dimension(:), allocatable | buf_f0 |
|
real(kind=8), dimension(:), allocatable | buf_f1 |
| Integration buffers. More...
|
|
real(kind=8), dimension(:), allocatable | anoise |
| Additive noise term. More...
|
|
type(coolist), dimension(:), allocatable | int_tensor |
| Dummy tensor that will hold the tendencies tensor. More...
|
|
Module with the stochastic rk2 integration routines.
- Copyright
- 2018 Jonathan Demaeyer. See LICENSE.txt for license information.
subroutine, public rk2_stoch_integrator::init_integrator |
( |
character*4, intent(in), optional |
force | ) |
|
Subroutine to initialize the integrator.
- Parameters
-
force | Parameter to force the mode of the integrator |
Definition at line 48 of file rk2_stoch_integrator.f90.
49 CHARACTER*4,
INTENT(IN),
OPTIONAL :: force
53 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 55 ALLOCATE(anoise(0:
ndim),
stat=allocstat)
56 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 59 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 61 ALLOCATE(int_tensor(
ndim),
stat=allocstat)
62 IF (allocstat /= 0) stop
"*** Not enough memory ! ***" 69 IF (
PRESENT(force))
THEN 85 stop
'*** MODE variable not properly defined ***' integer ndim
Number of variables (dimension of the model)
subroutine, public copy_coo(src, dst)
Routine to copy a coolist.
type(coolist), dimension(:), allocatable, public aotensor
- Tensor representation of the tendencies.
character(len=4) mode
Stochastic mode parameter.
subroutine, public rk2_stoch_integrator::step |
( |
real(kind=8), dimension(0:ndim), intent(in) |
y, |
|
|
real(kind=8), intent(inout) |
t, |
|
|
real(kind=8), intent(in) |
dt, |
|
|
real(kind=8), intent(in) |
dtn, |
|
|
real(kind=8), dimension(0:ndim), intent(out) |
res, |
|
|
real(kind=8), dimension(0:ndim), intent(out) |
tend |
|
) |
| |
Routine to perform a stochastic step of the selected dynamics (Heun algorithm). The incremented time is returned.
- Parameters
-
y | Initial point. |
t | Actual integration time |
dt | Integration timestep. |
dtn | Stochastic integration timestep (normally square-root of dt). |
res | Final point after the step. |
tend | Partial or full tendencies used to perform the step (used for debugging). |
Definition at line 112 of file rk2_stoch_integrator.f90.
112 REAL(KIND=8),
DIMENSION(0:ndim),
INTENT(IN) :: y
113 REAL(KIND=8),
INTENT(INOUT) :: t
114 REAL(KIND=8),
INTENT(IN) :: dt,dtn
115 REAL(KIND=8),
DIMENSION(0:ndim),
INTENT(OUT) :: res,tend
117 CALL stoch_atm_res_vec(dwar)
118 CALL stoch_atm_unres_vec(dwau)
119 CALL stoch_oc_res_vec(dwor)
120 CALL stoch_oc_unres_vec(dwou)
121 anoise=(q_ar*dwar+q_au*dwau+q_or*dwor+q_ou*dwou)*dtn
122 CALL tendencies(t,y,buf_f0)
123 CALL sparse_mul3(int_tensor,y,y,tend)
124 buf_y1 = y+dt*buf_f0+anoise
125 CALL sparse_mul3(int_tensor,buf_y1,buf_y1,buf_f1)
126 tend=0.5*(tend+buf_f1)
127 CALL tendencies(t,buf_y1,buf_f1)
128 res=y+0.5*(buf_f0+buf_f1)*dt+anoise
subroutine rk2_stoch_integrator::tendencies |
( |
real(kind=8), intent(in) |
t, |
|
|
real(kind=8), dimension(0:ndim), intent(in) |
y, |
|
|
real(kind=8), dimension(0:ndim), intent(out) |
res |
|
) |
| |
|
private |
Routine computing the tendencies of the selected model.
- Parameters
-
t | Time at which the tendencies have to be computed. Actually not needed for autonomous systems. |
y | Point at which the tendencies have to be computed. |
res | vector to store the result. |
Definition at line 97 of file rk2_stoch_integrator.f90.
97 REAL(KIND=8),
INTENT(IN) :: t
98 REAL(KIND=8),
DIMENSION(0:ndim),
INTENT(IN) :: y
99 REAL(KIND=8),
DIMENSION(0:ndim),
INTENT(OUT) :: res
100 CALL sparse_mul3(int_tensor, y, y, res)
real(kind=8), dimension(:), allocatable rk2_stoch_integrator::anoise |
|
private |
real(kind=8), dimension(:), allocatable rk2_stoch_integrator::buf_f0 |
|
private |
real(kind=8), dimension(:), allocatable rk2_stoch_integrator::buf_f1 |
|
private |
real(kind=8), dimension(:), allocatable rk2_stoch_integrator::buf_y1 |
|
private |
real(kind=8), dimension(:), allocatable rk2_stoch_integrator::dwar |
|
private |
real(kind=8), dimension(:), allocatable rk2_stoch_integrator::dwau |
|
private |
real(kind=8), dimension(:), allocatable rk2_stoch_integrator::dwor |
|
private |
real(kind=8), dimension(:), allocatable rk2_stoch_integrator::dwou |
|
private |
type(coolist), dimension(:), allocatable rk2_stoch_integrator::int_tensor |
|
private |
Dummy tensor that will hold the tendencies tensor.
Definition at line 39 of file rk2_stoch_integrator.f90.
39 TYPE(
coolist),
DIMENSION(:),
ALLOCATABLE :: int_tensor
Coordinate list. Type used to represent the sparse tensor.