A Modular Arbitrary-Order Ocean-Atmosphere Model -- Stochastic implementation
Functions/Subroutines | Variables
rk2_ss_integrator Module Reference

Module with the stochastic uncoupled resolved nonlinear and tangent linear rk2 dynamics integration routines. More...

Functions/Subroutines

subroutine, public init_ss_integrator
 Subroutine to initialize the uncoupled resolved rk2 integrator. More...
 
subroutine, public tendencies (t, y, res)
 Routine computing the tendencies of the uncoupled resolved model. More...
 
subroutine, public tl_tendencies (t, y, ys, res)
 Tendencies for the tangent linear model of the uncoupled resolved dynamics in point ystar for perturbation deltay. More...
 
subroutine, public ss_step (y, ys, t, dt, dtn, res)
 Routine to perform a stochastic integration step of the unresolved uncoupled dynamics (Heun algorithm). The incremented time is returned. More...
 
subroutine, public ss_tl_step (y, ys, t, dt, dtn, res)
 Routine to perform a stochastic integration step of the unresolved uncoupled tangent linear dynamics (Heun algorithm). The incremented time is returned. More...
 

Variables

real(kind=8), dimension(:), allocatable dwar
 
real(kind=8), dimension(:), allocatable dwor
 Standard gaussian noise buffers. More...
 
real(kind=8), dimension(:), allocatable anoise
 Additive noise term. 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...
 

Detailed Description

Module with the stochastic uncoupled resolved nonlinear and tangent linear rk2 dynamics integration routines.

Remarks
This module actually contains the Heun algorithm routines.

Function/Subroutine Documentation

subroutine, public rk2_ss_integrator::init_ss_integrator ( )

Subroutine to initialize the uncoupled resolved rk2 integrator.

Definition at line 40 of file rk2_ss_integrator.f90.

40  INTEGER :: allocstat
41 
42  ALLOCATE(buf_y1(0:ndim),buf_f0(0:ndim),buf_f1(0:ndim),stat=allocstat)
43  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
44 
45  ALLOCATE(anoise(0:ndim),stat=allocstat)
46  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
47 
48  ALLOCATE(dwar(0:ndim),dwor(0:ndim),stat=allocstat)
49  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
50 
51  dwar=0.d0
52  dwor=0.d0
53 
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
Statistics accumulators.
Definition: stat.f90:14
subroutine, public rk2_ss_integrator::ss_step ( real(kind=8), dimension(0:ndim), intent(in)  y,
real(kind=8), dimension(0:ndim), intent(in)  ys,
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 
)

Routine to perform a stochastic integration step of the unresolved uncoupled dynamics (Heun algorithm). The incremented time is returned.

Parameters
yInitial point.
ysDummy argument for compatibility.
tActual integration time
dtIntegration timestep.
dtnStochastic integration timestep (normally square-root of dt).
resFinal point after the step.

Definition at line 92 of file rk2_ss_integrator.f90.

92  REAL(KIND=8), DIMENSION(0:ndim), INTENT(IN) :: y,ys
93  REAL(KIND=8), INTENT(INOUT) :: t
94  REAL(KIND=8), INTENT(IN) :: dt,dtn
95  REAL(KIND=8), DIMENSION(0:ndim), INTENT(OUT) :: res
96 
97  CALL stoch_atm_res_vec(dwar)
98  CALL stoch_oc_res_vec(dwor)
99  anoise=(q_ar*dwar+q_or*dwor)*dtn
100  CALL tendencies(t,y,buf_f0)
101  buf_y1 = y+dt*buf_f0+anoise
102  CALL tendencies(t,buf_y1,buf_f1)
103  res=y+0.5*(buf_f0+buf_f1)*dt+anoise
104  t=t+dt
subroutine, public rk2_ss_integrator::ss_tl_step ( real(kind=8), dimension(0:ndim), intent(in)  y,
real(kind=8), dimension(0:ndim), intent(in)  ys,
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 
)

Routine to perform a stochastic integration step of the unresolved uncoupled tangent linear dynamics (Heun algorithm). The incremented time is returned.

Parameters
yInitial point.
yspoint in trajectory to which the tangent space belongs.
tActual integration time
dtIntegration timestep.
dtnStochastic integration timestep (normally square-root of dt).
resFinal point after the step.

Definition at line 117 of file rk2_ss_integrator.f90.

117  REAL(KIND=8), DIMENSION(0:ndim), INTENT(IN) :: y,ys
118  REAL(KIND=8), INTENT(INOUT) :: t
119  REAL(KIND=8), INTENT(IN) :: dt,dtn
120  REAL(KIND=8), DIMENSION(0:ndim), INTENT(OUT) :: res
121 
122  CALL stoch_atm_res_vec(dwar)
123  CALL stoch_oc_res_vec(dwor)
124  anoise=(q_ar*dwar+q_or*dwor)*dtn
125  CALL tl_tendencies(t,y,ys,buf_f0)
126  buf_y1 = y+dt*buf_f0+anoise
127  CALL tl_tendencies(t,buf_y1,ys,buf_f1)
128  res=y+0.5*(buf_f0+buf_f1)*dt+anoise
129  t=t+dt
subroutine, public rk2_ss_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 
)

Routine computing the tendencies of the uncoupled resolved model.

Parameters
tTime at which the tendencies have to be computed. Actually not needed for autonomous systems.
yPoint at which the tendencies have to be computed.
resvector to store the result.
Remarks
Note that it is NOT safe to pass y as a result buffer, as this operation does multiple passes.

Definition at line 63 of file rk2_ss_integrator.f90.

63  REAL(KIND=8), INTENT(IN) :: t
64  REAL(KIND=8), DIMENSION(0:ndim), INTENT(IN) :: y
65  REAL(KIND=8), DIMENSION(0:ndim), INTENT(OUT) :: res
66  CALL sparse_mul3(ss_tensor, y, y, res)
subroutine, public rk2_ss_integrator::tl_tendencies ( real(kind=8), intent(in)  t,
real(kind=8), dimension(0:ndim), intent(in)  y,
real(kind=8), dimension(0:ndim), intent(in)  ys,
real(kind=8), dimension(0:ndim), intent(out)  res 
)

Tendencies for the tangent linear model of the uncoupled resolved dynamics in point ystar for perturbation deltay.

Parameters
ttime
ypoint of the tangent space at which the tendencies have to be computed.
yspoint in trajectory to which the tangent space belongs.
resvector to store the result.

Definition at line 76 of file rk2_ss_integrator.f90.

76  REAL(KIND=8), INTENT(IN) :: t
77  REAL(KIND=8), DIMENSION(0:ndim), INTENT(IN) :: y,ys
78  REAL(KIND=8), DIMENSION(0:ndim), INTENT(OUT) :: res
79  CALL sparse_mul3(ss_tl_tensor, y, ys, res)

Variable Documentation

real(kind=8), dimension(:), allocatable rk2_ss_integrator::anoise
private

Additive noise term.

Definition at line 30 of file rk2_ss_integrator.f90.

30  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: anoise !< Additive noise term
real(kind=8), dimension(:), allocatable rk2_ss_integrator::buf_f0
private

Definition at line 32 of file rk2_ss_integrator.f90.

real(kind=8), dimension(:), allocatable rk2_ss_integrator::buf_f1
private

Integration buffers.

Definition at line 32 of file rk2_ss_integrator.f90.

real(kind=8), dimension(:), allocatable rk2_ss_integrator::buf_y1
private

Definition at line 32 of file rk2_ss_integrator.f90.

32  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: buf_y1,buf_f0,buf_f1 !< Integration buffers
real(kind=8), dimension(:), allocatable rk2_ss_integrator::dwar
private

Definition at line 28 of file rk2_ss_integrator.f90.

28  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: dwar,dwor !< Standard gaussian noise buffers
real(kind=8), dimension(:), allocatable rk2_ss_integrator::dwor
private

Standard gaussian noise buffers.

Definition at line 28 of file rk2_ss_integrator.f90.