A Modular Arbitrary-Order Ocean-Atmosphere Model -- Stochastic implementation
test_corr.f90
Go to the documentation of this file.
1 
2 ! test_corr.f90
3 !
4 !> Small program to print the correlation and covariance matrices
5 !
6 !> @copyright
7 !> 2018 Jonathan Demaeyer.
8 !> See LICENSE.txt for license information.
9 !
10 !---------------------------------------------------------------------------!
11 
12 PROGRAM test_corr
13 
14  USE params, only: ndim
15  USE aotensor_def, only: init_aotensor
16  USE dec_tensor, only: init_dec_tensor
17  USE int_corr
18  USE corrmod
19  USE tensor, only: print_tensor4
20  USE util, only: printmat,reduce
21 
22  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: dumb
23 
24  INTEGER, DIMENSION(:), ALLOCATABLE :: ind,rind
25  INTEGER :: n
26 
27  CALL init_aotensor ! Initialize the aotensor
28  CALL init_dec_tensor
29 
30  CALL init_corrint
31 
32  CALL comp_corrint
33 
34  ALLOCATE(dumb(ndim,ndim),ind(ndim),rind(ndim))
35 
36  print*, 'full version'
37  print*, 'mean_full'
38  print*, mean_full
39 
40  print*, 'corr_i_full'
41  CALL printmat(corr_i_full)
42 
43  print*, 'inv_corr_i_full'
45 
46  print*, 'inversion test'
48 
49  print*, 'corrint full'
50  CALL printmat(corrint)
51 
52  print*, 'inv_corr_i_full*corrint full'
53  CALL printmat(matmul(inv_corr_i_full,corrint))
54 
55  print*, 'corr2int'
57 
58 
59  print*, 'reduced part'
60  print*, 'mean'
61  print*, mean
62 
63  print*, 'corr_i'
64  CALL printmat(corr_i)
65 
66  print*, 'inv_corr_i'
67  CALL printmat(inv_corr_i)
68 
69  print*, 'inversion test'
70  CALL printmat(matmul(corr_i,inv_corr_i))
71 
72  print*, 'corrint'
73  CALL reduce(corrint,dumb,n,ind,rind)
74  CALL printmat(dumb(1:n,1:n))
75 
76  print*, 'inv_corr_i*corrint'
77  CALL printmat(matmul(inv_corr_i,dumb(1:n,1:n)))
78 
79  print*, 'corr2int'
81 
82 
83 END PROGRAM test_corr
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
real(kind=8), dimension(:,:), allocatable, public corr_i_full
Covariance matrix of the unresolved variables (full version)
Definition: corrmod.f90:28
Utility module.
Definition: util.f90:12
subroutine, public comp_corrint
Routine that actually compute or load the integrals.
Definition: int_corr.f90:75
real(kind=8), dimension(:,:), allocatable, public corrint
Matrix holding the integral of the correlation matrix.
Definition: int_corr.f90:29
The resolved-unresolved components decomposition of the tensor.
Definition: dec_tensor.f90:16
real(kind=8), dimension(:), allocatable, public mean_full
Vector holding the mean of the unresolved dynamics (full version)
Definition: corrmod.f90:27
subroutine, public printmat(A)
Definition: util.f90:200
The equation tensor for the coupled ocean-atmosphere model with temperature which allows for an exten...
Tensor utility module.
Definition: tensor.f90:18
real(kind=8), dimension(:), allocatable, public mean
Vector holding the mean of the unresolved dynamics (reduced version)
Definition: corrmod.f90:26
type(coolist4), dimension(:), allocatable, public corr2int
Tensor holding the integral of the correlation outer product with itself.
Definition: int_corr.f90:30
subroutine, public reduce(A, Ared, n, ind, rind)
Definition: util.f90:286
subroutine, public init_corrint
Subroutine to initialise the integrated matrices and tensors.
Definition: int_corr.f90:38
program test_corr
Small program to print the correlation and covariance matrices.
Definition: test_corr.f90:12
real(kind=8), dimension(:,:), allocatable, public inv_corr_i_full
Inverse of the covariance matrix of the unresolved variables (full version)
Definition: corrmod.f90:29
subroutine, public print_tensor4(t)
Routine to print a rank-4 tensor coolist.
Definition: tensor.f90:922
Module to initialize the correlation matrix of the unresolved variables.
Definition: corrmod.f90:16
real(kind=8), dimension(:,:), allocatable, public corr_i
Covariance matrix of the unresolved variables (reduced version)
Definition: corrmod.f90:30
The model parameters module.
Definition: params.f90:18
real(kind=8), dimension(:,:), allocatable, public inv_corr_i
Inverse of the covariance matrix of the unresolved variables (reduced version)
Definition: corrmod.f90:31
subroutine, public init_dec_tensor
Subroutine that initialize and compute the decomposed tensors.
Definition: dec_tensor.f90:195
Module to compute or load the integrals of the correlation matrices.
Definition: int_corr.f90:16
subroutine, public init_aotensor
Subroutine to initialise the aotensor tensor.