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

Tangent Linear (TL) and Adjoint (AD) model versions of MAOOAM. Integrators module. More...

Functions/Subroutines

subroutine, public init_tl_ad_integrator
 Routine to initialise the integration buffers. More...
 
subroutine, public ad_step (y, ystar, t, dt, res)
 Routine to perform an integration step (Heun algorithm) of the adjoint model. The incremented time is returned. More...
 
subroutine, public tl_step (y, ystar, t, dt, res)
 Routine to perform an integration step (Heun algorithm) of the tangent linear model. The incremented time is returned. More...
 

Variables

real(kind=8), dimension(:), allocatable buf_y1
 Buffer to hold the intermediate position (Heun algorithm) of the tangent linear model. More...
 
real(kind=8), dimension(:), allocatable buf_f0
 Buffer to hold tendencies at the initial position of the tangent linear model. More...
 
real(kind=8), dimension(:), allocatable buf_f1
 Buffer to hold tendencies at the intermediate position of the tangent linear model. More...
 
real(kind=8), dimension(:), allocatable buf_ka
 Buffer to hold tendencies in the RK4 scheme for the tangent linear model. More...
 
real(kind=8), dimension(:), allocatable buf_kb
 Buffer to hold tendencies in the RK4 scheme for the tangent linear model. More...
 

Detailed Description

Tangent Linear (TL) and Adjoint (AD) model versions of MAOOAM. Integrators module.

Remarks
This module actually contains the Heun algorithm routines. The user can modify it according to its preferred integration scheme. For higher-order schemes, additional buffers will probably have to be defined.
Remarks
This module actually contains the RK4 algorithm routines. The user can modify it according to its preferred integration scheme. For higher-order schemes, additional bufers will probably have to be defined.

Function/Subroutine Documentation

subroutine public tl_ad_integrator::ad_step ( real(kind=8), dimension(0:ndim), intent(in)  y,
real(kind=8), dimension(0:ndim), intent(in)  ystar,
real(kind=8), intent(inout)  t,
real(kind=8), intent(in)  dt,
real(kind=8), dimension(0:ndim), intent(out)  res 
)

Routine to perform an integration step (Heun algorithm) of the adjoint model. The incremented time is returned.

Routine to perform an integration step (RK4 algorithm) of the adjoint model. The incremented time is returned.

Parameters
yInitial point.
ystarAdjoint model at the point ystar.
tActual integration time
dtIntegration timestep.
resFinal point after the step.

Definition at line 61 of file rk2_tl_ad_integrator.f90.

61  REAL(KIND=8), DIMENSION(0:ndim), INTENT(IN) :: y,ystar
62  REAL(KIND=8), INTENT(INOUT) :: t
63  REAL(KIND=8), INTENT(IN) :: dt
64  REAL(KIND=8), DIMENSION(0:ndim), INTENT(OUT) :: res
65 
66  CALL ad(t,ystar,y,buf_f0)
67  buf_y1 = y+dt*buf_f0
68  CALL ad(t+dt,ystar,buf_y1,buf_f1)
69  res=y+0.5*(buf_f0+buf_f1)*dt
70  t=t+dt
subroutine public tl_ad_integrator::init_tl_ad_integrator ( )

Routine to initialise the integration buffers.

Routine to initialise the TL-AD integration bufers.

Definition at line 41 of file rk2_tl_ad_integrator.f90.

41  INTEGER :: allocstat
42  ALLOCATE(buf_y1(0:ndim),buf_f0(0:ndim),buf_f1(0:ndim),stat=allocstat)
43  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
Statistics accumulators.
Definition: stat.f90:14
subroutine public tl_ad_integrator::tl_step ( real(kind=8), dimension(0:ndim), intent(in)  y,
real(kind=8), dimension(0:ndim), intent(in)  ystar,
real(kind=8), intent(inout)  t,
real(kind=8), intent(in)  dt,
real(kind=8), dimension(0:ndim), intent(out)  res 
)

Routine to perform an integration step (Heun algorithm) of the tangent linear model. The incremented time is returned.

Routine to perform an integration step (RK4 algorithm) of the tangent linear model. The incremented time is returned.

Parameters
yInitial point.
ystarAdjoint model at the point ystar.
tActual integration time
dtIntegration timestep.
resFinal point after the step.

Definition at line 86 of file rk2_tl_ad_integrator.f90.

86  REAL(KIND=8), DIMENSION(0:ndim), INTENT(IN) :: y,ystar
87  REAL(KIND=8), INTENT(INOUT) :: t
88  REAL(KIND=8), INTENT(IN) :: dt
89  REAL(KIND=8), DIMENSION(0:ndim), INTENT(OUT) :: res
90 
91  CALL tl(t,ystar,y,buf_f0)
92  buf_y1 = y+dt*buf_f0
93  CALL tl(t+dt,ystar,buf_y1,buf_f1)
94  res=y+0.5*(buf_f0+buf_f1)*dt
95  t=t+dt

Variable Documentation

real(kind=8), dimension(:), allocatable tl_ad_integrator::buf_f0
private

Buffer to hold tendencies at the initial position of the tangent linear model.

Definition at line 31 of file rk2_tl_ad_integrator.f90.

31  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: buf_f0 !< Buffer to hold tendencies at the initial position of the tangent linear model
real(kind=8), dimension(:), allocatable tl_ad_integrator::buf_f1
private

Buffer to hold tendencies at the intermediate position of the tangent linear model.

Definition at line 32 of file rk2_tl_ad_integrator.f90.

32  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: buf_f1 !< Buffer to hold tendencies at the intermediate position of the tangent linear model
real(kind=8), dimension(:), allocatable tl_ad_integrator::buf_ka
private

Buffer to hold tendencies in the RK4 scheme for the tangent linear model.

Definition at line 33 of file rk4_tl_ad_integrator.f90.

33  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: buf_ka !< Buffer to hold tendencies in the RK4 scheme for the tangent linear model
real(kind=8), dimension(:), allocatable tl_ad_integrator::buf_kb
private

Buffer to hold tendencies in the RK4 scheme for the tangent linear model.

Definition at line 34 of file rk4_tl_ad_integrator.f90.

34  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: buf_kb !< Buffer to hold tendencies in the RK4 scheme for the tangent linear model
real(kind=8), dimension(:), allocatable tl_ad_integrator::buf_y1
private

Buffer to hold the intermediate position (Heun algorithm) of the tangent linear model.

Buffer to hold the intermediate position of the tangent linear model.

Definition at line 30 of file rk2_tl_ad_integrator.f90.

30  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: buf_y1 !< Buffer to hold the intermediate position (Heun algorithm) of the tangent linear model