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

Module to compute the correlations and derivatives used to compute the memory term of the WL parameterization. More...

Functions/Subroutines

subroutine, public init_corr_tensor
 Subroutine to initialise the correlations tensors. More...
 

Variables

type(coolist), dimension(:,:), allocatable, public yy
 Coolist holding the \(\langle Y \otimes Y^s \rangle\) terms. More...
 
type(coolist), dimension(:,:), allocatable, public dy
 Coolist holding the \(\langle \partial_Y \otimes Y^s \rangle\) terms. More...
 
type(coolist), dimension(:,:), allocatable, public ydy
 Coolist holding the \(\langle Y \otimes \partial_Y \otimes Y^s \rangle\) terms. More...
 
type(coolist), dimension(:,:), allocatable, public dyy
 Coolist holding the \(\langle \partial_Y \otimes Y^s \otimes Y^s \rangle\) terms. More...
 
type(coolist4), dimension(:,:), allocatable, public ydyy
 Coolist holding the \(\langle Y \otimes \partial_Y \otimes Y^s \otimes Y^s \rangle\) terms. More...
 
real(kind=8), dimension(:), allocatable dumb_vec
 Dumb vector to be used in the calculation. More...
 
real(kind=8), dimension(:,:), allocatable dumb_mat1
 Dumb matrix to be used in the calculation. More...
 
real(kind=8), dimension(:,:), allocatable dumb_mat2
 Dumb matrix to be used in the calculation. More...
 
real(kind=8), dimension(:,:), allocatable expm
 Matrix holding the product inv_corr_i*corr_ij at time \(s\). More...
 

Detailed Description

Module to compute the correlations and derivatives used to compute the memory term of the WL parameterization.

Remarks

Function/Subroutine Documentation

subroutine, public corr_tensor::init_corr_tensor ( )

Subroutine to initialise the correlations tensors.

Definition at line 45 of file corr_tensor.f90.

45  INTEGER :: i,j,m,allocstat
46 
47  CALL init_corr
48 
49  print*, 'Computing the time correlation tensors...'
50 
51  ALLOCATE(yy(ndim,mems),dy(ndim,mems), dyy(ndim,mems), stat=allocstat)
52  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
53 
54  ALLOCATE(ydy(ndim,mems), ydyy(ndim,mems), stat=allocstat)
55  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
56 
57  ALLOCATE(dumb_vec(ndim), stat=allocstat)
58  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
59 
60  ALLOCATE(dumb_mat1(ndim,ndim), dumb_mat2(ndim,ndim), stat=allocstat)
61  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
62 
63  ALLOCATE(expm(n_unres,n_unres), stat=allocstat)
64  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
65 
66  DO m=1,mems
67  CALL corrcomp((m-1)*muti)
68 
69  ! YY
70  CALL ireduce(dumb_mat2,corr_ij,n_unres,ind,rind)
71  CALL matc_to_coo(dumb_mat2,yy(:,m))
72 
73  ! dY
74  expm=matmul(inv_corr_i,corr_ij)
75  CALL ireduce(dumb_mat2,expm,n_unres,ind,rind)
76  CALL matc_to_coo(dumb_mat2,dy(:,m))
77 
78  ! YdY
79  DO i=1,n_unres
80  CALL ireduce(dumb_mat2,mean(i)*expm,n_unres,ind,rind)
81  CALL add_matc_to_tensor(ind(i),dumb_mat2,ydy(:,m))
82  ENDDO
83 
84  ! dYY
85  dumb_vec(1:n_unres)=matmul(mean,expm)
86  DO i=1,n_unres
87  CALL vector_outer(expm(i,:),dumb_vec(1:n_unres),dumb_mat2(1:n_unres,1:n_unres))
88  CALL ireduce(dumb_mat1,dumb_mat2+transpose(dumb_mat2),n_unres,ind,rind)
89  CALL add_matc_to_tensor(ind(i),dumb_mat1,dyy(:,m))
90  ENDDO
91 
92  ! YdYY
93  DO i=1,n_unres
94  DO j=1,n_unres
95  CALL vector_outer(corr_ij(i,:),expm(j,:),dumb_mat2(1:n_unres,1:n_unres))
96  CALL ireduce(dumb_mat1,dumb_mat2+transpose(dumb_mat2),n_unres,ind,rind)
97  CALL add_matc_to_tensor4(ind(i),ind(j),dumb_mat1,ydyy(:,m))
98  ENDDO
99  ENDDO
100  ENDDO
101 
102  DEALLOCATE(dumb_mat1, dumb_mat2, stat=allocstat)
103  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
104 
105  DEALLOCATE(dumb_vec, stat=allocstat)
106  IF (allocstat /= 0) stop "*** Problem to deallocate ! ***"
107 
108 
Statistics accumulators.
Definition: stat.f90:14

Variable Documentation

real(kind=8), dimension(:,:), allocatable corr_tensor::dumb_mat1
private

Dumb matrix to be used in the calculation.

Definition at line 37 of file corr_tensor.f90.

37  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: dumb_mat1 !< Dumb matrix to be used in the calculation
real(kind=8), dimension(:,:), allocatable corr_tensor::dumb_mat2
private

Dumb matrix to be used in the calculation.

Definition at line 38 of file corr_tensor.f90.

38  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: dumb_mat2 !< Dumb matrix to be used in the calculation
real(kind=8), dimension(:), allocatable corr_tensor::dumb_vec
private

Dumb vector to be used in the calculation.

Definition at line 36 of file corr_tensor.f90.

36  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: dumb_vec !< Dumb vector to be used in the calculation
type(coolist), dimension(:,:), allocatable, public corr_tensor::dy

Coolist holding the \(\langle \partial_Y \otimes Y^s \rangle\) terms.

Definition at line 31 of file corr_tensor.f90.

31  TYPE(coolist), DIMENSION(:,:), ALLOCATABLE, PUBLIC :: dy !< Coolist holding the \f$\langle \partial_Y \otimes Y^s \rangle\f$ terms
type(coolist), dimension(:,:), allocatable, public corr_tensor::dyy

Coolist holding the \(\langle \partial_Y \otimes Y^s \otimes Y^s \rangle\) terms.

Definition at line 33 of file corr_tensor.f90.

33  TYPE(coolist), DIMENSION(:,:), ALLOCATABLE, PUBLIC :: dyy !< Coolist holding the \f$\langle \partial_Y \otimes Y^s \otimes Y^s \rangle\f$ terms
real(kind=8), dimension(:,:), allocatable corr_tensor::expm
private

Matrix holding the product inv_corr_i*corr_ij at time \(s\).

Definition at line 39 of file corr_tensor.f90.

39  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: expm !< Matrix holding the product inv_corr_i*corr_ij at time \f$s\f$
type(coolist), dimension(:,:), allocatable, public corr_tensor::ydy

Coolist holding the \(\langle Y \otimes \partial_Y \otimes Y^s \rangle\) terms.

Definition at line 32 of file corr_tensor.f90.

32  TYPE(coolist), DIMENSION(:,:), ALLOCATABLE, PUBLIC :: ydy !< Coolist holding the \f$\langle Y \otimes \partial_Y \otimes Y^s \rangle\f$ terms
type(coolist4), dimension(:,:), allocatable, public corr_tensor::ydyy

Coolist holding the \(\langle Y \otimes \partial_Y \otimes Y^s \otimes Y^s \rangle\) terms.

Definition at line 34 of file corr_tensor.f90.

34  TYPE(coolist4), DIMENSION(:,:), ALLOCATABLE, PUBLIC :: ydyy !< Coolist holding the \f$\langle Y \otimes \partial_Y \otimes Y^s \otimes Y^s \rangle\f$ terms
type(coolist), dimension(:,:), allocatable, public corr_tensor::yy

Coolist holding the \(\langle Y \otimes Y^s \rangle\) terms.

Definition at line 30 of file corr_tensor.f90.

30  TYPE(coolist), DIMENSION(:,:), ALLOCATABLE, PUBLIC :: yy !< Coolist holding the \f$\langle Y \otimes Y^s \rangle\f$ terms