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

The equation tensor for the coupled ocean-atmosphere model with temperature which allows for an extensible set of modes in the ocean and in the atmosphere. More...

Functions/Subroutines

integer function psi (i)
 Translate the \(\psi_{a,i}\) coefficients into effective coordinates. More...
 
integer function theta (i)
 Translate the \(\theta_{a,i}\) coefficients into effective coordinates. More...
 
integer function a (i)
 Translate the \(\psi_{o,i}\) coefficients into effective coordinates. More...
 
integer function t (i)
 Translate the \(\delta T_{o,i}\) coefficients into effective coordinates. More...
 
integer function kdelta (i, j)
 Kronecker delta function. More...
 
subroutine coeff (i, j, k, v)
 Subroutine to add element in the aotensor \(\mathcal{T}_{i,j,k}\) structure. More...
 
subroutine add_count (i, j, k, v)
 Subroutine to count the elements of the aotensor \(\mathcal{T}_{i,j,k}\). Add +1 to count_elems(i) for each value that is added to the tensor i-th component. More...
 
subroutine compute_aotensor (func)
 Subroutine to compute the tensor aotensor. More...
 
subroutine, public init_aotensor
 Subroutine to initialise the aotensor tensor. More...
 

Variables

integer, dimension(:), allocatable count_elems
 Vector used to count the tensor elements. More...
 
real(kind=8), parameter real_eps = 2.2204460492503131e-16
 Epsilon to test equality with 0. More...
 
type(coolist), dimension(:), allocatable, public aotensor
 \(\mathcal{T}_{i,j,k}\) - Tensor representation of the tendencies. More...
 

Detailed Description

The equation tensor for the coupled ocean-atmosphere model with temperature which allows for an extensible set of modes in the ocean and in the atmosphere.

Remarks
Generated Fortran90/95 code from aotensor.lua

Function/Subroutine Documentation

integer function aotensor_def::a ( integer  i)
private

Translate the \(\psi_{o,i}\) coefficients into effective coordinates.

Definition at line 76 of file aotensor_def.f90.

76  INTEGER :: i,a
77  a = i + 2 * natm
subroutine aotensor_def::add_count ( integer, intent(in)  i,
integer, intent(in)  j,
integer, intent(in)  k,
real(kind=8), intent(in)  v 
)
private

Subroutine to count the elements of the aotensor \(\mathcal{T}_{i,j,k}\). Add +1 to count_elems(i) for each value that is added to the tensor i-th component.

Parameters
itensor \(i\) index
jtensor \(j\) index
ktensor \(k\) index
vvalue that will be added

Definition at line 124 of file aotensor_def.f90.

124  INTEGER, INTENT(IN) :: i,j,k
125  REAL(KIND=8), INTENT(IN) :: v
126  IF (abs(v) .ge. real_eps) count_elems(i)=count_elems(i)+1
subroutine aotensor_def::coeff ( integer, intent(in)  i,
integer, intent(in)  j,
integer, intent(in)  k,
real(kind=8), intent(in)  v 
)
private

Subroutine to add element in the aotensor \(\mathcal{T}_{i,j,k}\) structure.

Parameters
itensor \(i\) index
jtensor \(j\) index
ktensor \(k\) index
vvalue to add

Definition at line 99 of file aotensor_def.f90.

99  INTEGER, INTENT(IN) :: i,j,k
100  REAL(KIND=8), INTENT(IN) :: v
101  INTEGER :: n
102  IF (.NOT. ALLOCATED(aotensor)) stop "*** coeff routine : tensor not yet allocated ***"
103  IF (.NOT. ALLOCATED(aotensor(i)%elems)) stop "*** coeff routine : tensor not yet allocated ***"
104  IF (abs(v) .ge. real_eps) THEN
105  n=(aotensor(i)%nelems)+1
106  IF (j .LE. k) THEN
107  aotensor(i)%elems(n)%j=j
108  aotensor(i)%elems(n)%k=k
109  ELSE
110  aotensor(i)%elems(n)%j=k
111  aotensor(i)%elems(n)%k=j
112  END IF
113  aotensor(i)%elems(n)%v=v
114  aotensor(i)%nelems=n
115  END IF
subroutine aotensor_def::compute_aotensor ( external  func)
private

Subroutine to compute the tensor aotensor.

Parameters
funcExternal function to be used

Definition at line 132 of file aotensor_def.f90.

subroutine, public aotensor_def::init_aotensor ( )

Subroutine to initialise the aotensor tensor.

Remarks
This procedure will also call params::init_params() and inprod_analytic::init_inprod() . It will finally call inprod_analytic::deallocate_inprod() to remove the inner products, which are not needed anymore at this point.

Definition at line 203 of file aotensor_def.f90.

203  INTEGER :: i
204  INTEGER :: allocstat
205 
206  CALL init_params ! Iniatialise the parameter
207 
208  CALL init_inprod ! Initialise the inner product tensors
209 
210  ALLOCATE(aotensor(ndim),count_elems(ndim), stat=allocstat)
211  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
212  count_elems=0
213 
214  CALL compute_aotensor(add_count)
215 
216  DO i=1,ndim
217  ALLOCATE(aotensor(i)%elems(count_elems(i)), stat=allocstat)
218  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
219  END DO
220 
221  DEALLOCATE(count_elems, stat=allocstat)
222  IF (allocstat /= 0) stop "*** Deallocation problem ! ***"
223 
224  CALL compute_aotensor(coeff)
225 
226  CALL simplify(aotensor)
227 
Statistics accumulators.
Definition: stat.f90:14
integer function aotensor_def::kdelta ( integer  i,
integer  j 
)
private

Kronecker delta function.

Definition at line 88 of file aotensor_def.f90.

88  INTEGER :: i,j,kdelta
89  kdelta=0
90  IF (i == j) kdelta = 1
integer function aotensor_def::psi ( integer  i)
private

Translate the \(\psi_{a,i}\) coefficients into effective coordinates.

Definition at line 64 of file aotensor_def.f90.

64  INTEGER :: i,psi
65  psi = i
integer function aotensor_def::t ( integer  i)
private

Translate the \(\delta T_{o,i}\) coefficients into effective coordinates.

Definition at line 82 of file aotensor_def.f90.

82  INTEGER :: i,t
83  t = i + 2 * natm + noc
integer function aotensor_def::theta ( integer  i)
private

Translate the \(\theta_{a,i}\) coefficients into effective coordinates.

Definition at line 70 of file aotensor_def.f90.

70  INTEGER :: i,theta
71  theta = i + natm

Variable Documentation

type(coolist), dimension(:), allocatable, public aotensor_def::aotensor

\(\mathcal{T}_{i,j,k}\) - Tensor representation of the tendencies.

Definition at line 45 of file aotensor_def.f90.

45  TYPE(coolist), DIMENSION(:), ALLOCATABLE, PUBLIC :: aotensor
integer, dimension(:), allocatable aotensor_def::count_elems
private

Vector used to count the tensor elements.

Definition at line 37 of file aotensor_def.f90.

37  INTEGER, DIMENSION(:), ALLOCATABLE :: count_elems
real(kind=8), parameter aotensor_def::real_eps = 2.2204460492503131e-16
private

Epsilon to test equality with 0.

Definition at line 40 of file aotensor_def.f90.

40  REAL(KIND=8), PARAMETER :: real_eps = 2.2204460492503131e-16