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  ! print*, oi,oj
96  CALL integrate(func_ij,ss)
97  corrint(ind(i),ind(j))=ss
98  END DO
99  END DO
100 
101  OPEN(30,file='corrint.def')
102  WRITE(30,*) corrint
103  CLOSE(30)
104  END SELECT
105 
106 
107  INQUIRE(file='corr2int.def',exist=ex)
108  SELECT CASE (int_corr_mode)
109  CASE ('file')
110  IF (ex) THEN
111  CALL load_tensor4_from_file("corr2int.def",corr2int)
112  ELSE
113  stop "*** File corr2int.def not found ! ***"
114  END IF
115  CASE ('prog')
116  DO i = 1,n_unres
117  n=0
118  DO j= 1,n_unres
119  DO k= 1,n_unres
120  DO l = 1,n_unres
121  oi=i
122  oj=j
123  ok=k
124  ol=l
125 
126  CALL integrate(func_ijkl,ss)
127  IF (abs(ss)>real_eps) n=n+1
128  ENDDO
129  ENDDO
130  ENDDO
131  IF (n/=0) THEN
132  ALLOCATE(corr2int(ind(i))%elems(n), stat=allocstat)
133  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
134 
135  n=0
136  DO j= 1,n_unres
137  DO k= 1,n_unres
138  DO l = 1,n_unres
139  oi=i
140  oj=j
141  ok=k
142  ol=l
143 
144  CALL integrate(func_ijkl,ss)
145  IF (abs(ss)>real_eps) THEN
146  n=n+1
147  corr2int(ind(i))%elems(n)%j=ind(j)
148  corr2int(ind(i))%elems(n)%k=ind(k)
149  corr2int(ind(i))%elems(n)%l=ind(l)
150  corr2int(ind(i))%elems(n)%v=ss
151  END IF
152  ENDDO
153  ENDDO
154  ENDDO
155  corr2int(ind(i))%nelems=n
156  END IF
157  ENDDO
158 
159  CALL write_tensor4_to_file("corr2int.def",corr2int)
160  CASE DEFAULT
161  stop '*** INT_CORR_MODE variable not properly defined in corrmod.nml ***'
162  END SELECT
163 
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:79
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