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

Module to compute or load the integrals of the correlation matrices. More...

Functions/Subroutines

subroutine, public init_corrint
 Subroutine to initialise the integrated matrices and tensors. More...
 
real(kind=8) function func_ij (s)
 Function that returns the component oi and oj of the correlation matrix at time s. More...
 
real(kind=8) function func_ijkl (s)
 Function that returns the component oi,oj,ok and ol of the outer product of the correlation matrix with itself at time s. More...
 
subroutine, public comp_corrint
 Routine that actually compute or load the integrals. More...
 

Variables

integer oi
 
integer oj
 
integer ok
 
integer ol
 Integers that specify the matrices and tensor component considered as a function of time. More...
 
real(kind=8), parameter real_eps = 2.2204460492503131e-16
 Small epsilon constant to determine equality with zero. More...
 
real(kind=8), dimension(:,:), allocatable, public corrint
 Matrix holding the integral of the correlation matrix. More...
 
type(coolist4), dimension(:), allocatable, public corr2int
 Tensor holding the integral of the correlation outer product with itself. More...
 

Detailed Description

Module to compute or load the integrals of the correlation matrices.

Remarks

Function/Subroutine Documentation

subroutine, public int_corr::comp_corrint ( )

Routine that actually compute or load the integrals.

Definition at line 75 of file int_corr.f90.

75  IMPLICIT NONE
76  INTEGER :: i,j,k,l,n,allocstat
77  REAL(KIND=8) :: ss
78  LOGICAL :: ex
79 
80  INQUIRE(file='corrint.def',exist=ex)
81  SELECT CASE (int_corr_mode)
82  CASE ('file')
83  IF (ex) THEN
84  OPEN(30,file='corrint.def',status='old')
85  READ(30,*) corrint
86  CLOSE(30)
87  ELSE
88  stop "*** File corrint.def not found ! ***"
89  END IF
90  CASE ('prog')
91  DO i = 1,n_unres
92  DO j= 1,n_unres
93  oi=i
94  oj=j
95  CALL integrate(func_ij,ss)
96  corrint(ind(i),ind(j))=ss
97  END DO
98  END DO
99 
100  OPEN(30,file='corrint.def')
101  WRITE(30,*) corrint
102  CLOSE(30)
103  END SELECT
104 
105 
106  INQUIRE(file='corr2int.def',exist=ex)
107  SELECT CASE (int_corr_mode)
108  CASE ('file')
109  IF (ex) THEN
110  CALL load_tensor4_from_file("corr2int.def",corr2int)
111  ELSE
112  stop "*** File corr2int.def not found ! ***"
113  END IF
114  CASE ('prog')
115  DO i = 1,n_unres
116  n=0
117  DO j= 1,n_unres
118  DO k= 1,n_unres
119  DO l = 1,n_unres
120  oi=i
121  oj=j
122  ok=k
123  ol=l
124 
125  CALL integrate(func_ijkl,ss)
126  IF (abs(ss)>real_eps) n=n+1
127  ENDDO
128  ENDDO
129  ENDDO
130  IF (n/=0) THEN
131  ALLOCATE(corr2int(ind(i))%elems(n), stat=allocstat)
132  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
133 
134  n=0
135  DO j= 1,n_unres
136  DO k= 1,n_unres
137  DO l = 1,n_unres
138  oi=i
139  oj=j
140  ok=k
141  ol=l
142 
143  CALL integrate(func_ijkl,ss)
144  IF (abs(ss)>real_eps) THEN
145  n=n+1
146  corr2int(ind(i))%elems(n)%j=ind(j)
147  corr2int(ind(i))%elems(n)%k=ind(k)
148  corr2int(ind(i))%elems(n)%l=ind(l)
149  corr2int(ind(i))%elems(n)%v=ss
150  END IF
151  ENDDO
152  ENDDO
153  ENDDO
154  corr2int(ind(i))%nelems=n
155  END IF
156  ENDDO
157 
158  CALL write_tensor4_to_file("corr2int.def",corr2int)
159  CASE DEFAULT
160  stop '*** INT_CORR_MODE variable not properly defined in corrmod.nml ***'
161  END SELECT
162 
Statistics accumulators.
Definition: stat.f90:14
real(kind=8) function int_corr::func_ij ( real(kind=8)  s)
private

Function that returns the component oi and oj of the correlation matrix at time s.

Parameters
stime at which the function is evaluated

Definition at line 55 of file int_corr.f90.

55  IMPLICIT NONE
56  REAL(KIND=8) :: s,func_ij
57  CALL corrcomp(s)
58  func_ij=corr_ij(oi,oj)
59  RETURN
real(kind=8) function int_corr::func_ijkl ( real(kind=8)  s)
private

Function that returns the component oi,oj,ok and ol of the outer product of the correlation matrix with itself at time s.

Parameters
stime at which the function is evaluated

Definition at line 66 of file int_corr.f90.

66  IMPLICIT NONE
67  REAL(KIND=8) :: s,func_ijkl
68  CALL corrcomp(s)
69  func_ijkl=corr_ij(oi,oj)*corr_ij(ok,ol)
70  RETURN
subroutine, public int_corr::init_corrint ( )

Subroutine to initialise the integrated matrices and tensors.

Definition at line 38 of file int_corr.f90.

38  INTEGER :: allocstat
39 
40  ALLOCATE(corrint(ndim,ndim), stat=allocstat)
41  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
42 
43  ALLOCATE(corr2int(ndim), stat=allocstat)
44  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
45 
46  CALL init_corr ! Initialize the correlation matrix function
47 
48  corrint=0.d0
49 
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
Statistics accumulators.
Definition: stat.f90:14

Variable Documentation

type(coolist4), dimension(:), allocatable, public int_corr::corr2int

Tensor holding the integral of the correlation outer product with itself.

Definition at line 30 of file int_corr.f90.

30  TYPE(coolist4), DIMENSION(:), ALLOCATABLE, PUBLIC :: corr2int !< Tensor holding the integral of the correlation outer product with itself
4d coordinate list. Type used to represent the rank-4 sparse tensor.
Definition: tensor.f90:44
real(kind=8), dimension(:,:), allocatable, public int_corr::corrint

Matrix holding the integral of the correlation matrix.

Definition at line 29 of file int_corr.f90.

29  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE, PUBLIC :: corrint !< Matrix holding the integral of the correlation matrix
integer int_corr::oi
private

Definition at line 26 of file int_corr.f90.

26  INTEGER :: oi,oj,ok,ol !< Integers that specify the matrices and tensor component considered as a function of time
integer int_corr::oj
private

Definition at line 26 of file int_corr.f90.

integer int_corr::ok
private

Definition at line 26 of file int_corr.f90.

integer int_corr::ol
private

Integers that specify the matrices and tensor component considered as a function of time.

Definition at line 26 of file int_corr.f90.

real(kind=8), parameter int_corr::real_eps = 2.2204460492503131e-16
private

Small epsilon constant to determine equality with zero.

Definition at line 27 of file int_corr.f90.

27  REAL(KIND=8), PARAMETER :: real_eps = 2.2204460492503131e-16 !< Small epsilon constant to determine equality with zero