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

Module with the integration routines. More...

Functions/Subroutines

subroutine, public init_integrator
 Routine to initialise the integration buffers. More...
 
subroutine tendencies (t, y, res)
 Routine computing the tendencies of the model. More...
 
subroutine, public step (y, t, dt, res)
 Routine to perform an integration step (Heun algorithm). The incremented time is returned. More...
 

Variables

real(kind=8), dimension(:), allocatable buf_y1
 Buffer to hold the intermediate position (Heun algorithm) More...
 
real(kind=8), dimension(:), allocatable buf_f0
 Buffer to hold tendencies at the initial position. More...
 
real(kind=8), dimension(:), allocatable buf_f1
 Buffer to hold tendencies at the intermediate position. More...
 
real(kind=8), dimension(:), allocatable buf_ka
 Buffer A to hold tendencies. More...
 
real(kind=8), dimension(:), allocatable buf_kb
 Buffer B to hold tendencies. More...
 

Detailed Description

Module with the integration routines.

Module with the RK4 integration routines.

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 buffers will probably have to be defined.

Function/Subroutine Documentation

subroutine public integrator::init_integrator ( )

Routine to initialise the integration buffers.

Definition at line 37 of file rk2_integrator.f90.

37  INTEGER :: allocstat
38  ALLOCATE(buf_y1(0:ndim),buf_f0(0:ndim),buf_f1(0:ndim) ,stat=allocstat)
39  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 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), dimension(0:ndim), intent(out)  res 
)

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

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

Parameters
yInitial point.
tActual integration time
dtIntegration timestep.
resFinal point after the step.

Definition at line 61 of file rk2_integrator.f90.

61  REAL(KIND=8), DIMENSION(0:ndim), INTENT(IN) :: y
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 tendencies(t,y,buf_f0)
67  buf_y1 = y+dt*buf_f0
68  CALL tendencies(t+dt,buf_y1,buf_f1)
69  res=y+0.5*(buf_f0+buf_f1)*dt
70  t=t+dt
subroutine 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 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 49 of file rk2_integrator.f90.

49  REAL(KIND=8), INTENT(IN) :: t
50  REAL(KIND=8), DIMENSION(0:ndim), INTENT(IN) :: y
51  REAL(KIND=8), DIMENSION(0:ndim), INTENT(OUT) :: res
52  CALL sparse_mul3(aotensor, y, y, res)
type(coolist), dimension(:), allocatable, public aotensor
- Tensor representation of the tendencies.

Variable Documentation

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

Buffer to hold tendencies at the initial position.

Definition at line 28 of file rk2_integrator.f90.

28  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: buf_f0 !< Buffer to hold tendencies at the initial position
real(kind=8), dimension(:), allocatable integrator::buf_f1
private

Buffer to hold tendencies at the intermediate position.

Definition at line 29 of file rk2_integrator.f90.

29  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: buf_f1 !< Buffer to hold tendencies at the intermediate position
real(kind=8), dimension(:), allocatable integrator::buf_ka
private

Buffer A to hold tendencies.

Definition at line 28 of file rk4_integrator.f90.

28  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: buf_ka !< Buffer A to hold tendencies
real(kind=8), dimension(:), allocatable integrator::buf_kb
private

Buffer B to hold tendencies.

Definition at line 29 of file rk4_integrator.f90.

29  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: buf_kb !< Buffer B to hold tendencies
real(kind=8), dimension(:), allocatable integrator::buf_y1
private

Buffer to hold the intermediate position (Heun algorithm)

Definition at line 27 of file rk2_integrator.f90.

27  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: buf_y1 !< Buffer to hold the intermediate position (Heun algorithm)