A Modular Arbitrary-Order Ocean-Atmosphere Model -- Stochastic implementation
test_MTV_sigma_tensor.f90
Go to the documentation of this file.
1 
2 ! test_MTV_sigma_tensor.f90
3 !
4 !> Small program to test the MTV noise sigma matrices
5 !
6 !> @copyright
7 !> 2018 Jonathan Demaeyer.
8 !> See LICENSE.txt for license information.
9 !
10 !---------------------------------------------------------------------------!
11 
12 PROGRAM test_sigma
13 
14  USE params, only: ndim
15  USE sigma
16  USE aotensor_def, only: init_aotensor
18  USE util, only: printmat,init_random_seed
19  USE sqrt_mod, only: init_sqrt,sqrtm
20 
21  REAL(KIND=8), DIMENSION(5,5) :: A,B,sqB
22  LOGICAL :: mult,Q1fill
23  REAL(KIND=8), DIMENSION(:), ALLOCATABLE :: y
24  INTEGER :: info,info2
25 
26  ! A=0
27  ! A(1,:)=(/5,-4,1,0,0/)
28  ! A(2,:)=(/-4,6,-4,1,0/)
29  ! A(3,:)=(/ 1,-4,6,-4,1/)
30  ! A(4,:)=(/ 0 ,1,-4,6,-4/)
31  ! A(5,:)=(/ 0 ,0,1,-4,6/)
32 
33  ! B=matmul(A,A)
34 
35  CALL init_aotensor ! Initialize the aotensor
37  CALL init_sigma(mult,q1fill)
38  CALL init_random_seed
39  ! CALL init_sqrt
40 
41  ! CALL sqrtm(B,sqB,info,info2,2)
42 
43  ! print*, info,info2
44 
45  ! print*, 'A'
46  ! CALL printmat(A)
47 
48 
49  ! print*, 'B'
50  ! CALL printmat(B)
51 
52  ! print*, 'sqB'
53  ! CALL printmat(sqB)
54  ! print*, 'sqB*sqB'
55  ! CALL printmat(matmul(sqB,sqB))
56 
57  print*, 'sig1'
58  IF (mult) THEN
59  ALLOCATE(y(0:ndim))
60  DO i=1,100
61  CALL random_number(y)
62  y=2*y-1.d0
63  y(0)=1.d0
64  CALL compute_mult_sigma(y)
65  print*, i,y
66  CALL printmat(sig1)
67  ENDDO
68  ELSE
69  CALL printmat(sig1)
70  ENDIF
71 
72  print*, 'sig2'
73  CALL printmat(sig2)
74 
75  print*, 'mult',mult
76  print*, 'Q1fill',q1fill
77 
78 END PROGRAM test_sigma
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
Utility module.
Definition: util.f90:12
The MTV tensors used to integrate the MTV model.
subroutine, public init_sigma(mult, Q1fill)
Subroutine to initialize the sigma matices.
subroutine, public init_random_seed()
Random generator initialization routine.
Definition: util.f90:64
subroutine, public sqrtm(A, sqA, info, info_triu, bs)
Routine to compute a real square-root of a matrix.
Definition: sqrt_mod.f90:63
subroutine, public printmat(A)
Definition: util.f90:200
The equation tensor for the coupled ocean-atmosphere model with temperature which allows for an exten...
The MTV noise sigma matrices used to integrate the MTV model.
subroutine, public compute_mult_sigma(y)
Routine to actualize the matrix based on the state y of the MTV system.
real(kind=8), dimension(:,:), allocatable, public sig1
state-dependent noise matrix
program test_sigma
Small program to test the MTV noise sigma matrices.
subroutine, public init_mtv_int_tensor
Subroutine to initialise the MTV tensor.
subroutine, public init_sqrt
Definition: sqrt_mod.f90:39
The model parameters module.
Definition: params.f90:18
real(kind=8), dimension(:,:), allocatable, public sig2
state-independent noise matrix
Utility module with various routine to compute matrix square root.
Definition: sqrt_mod.f90:20
subroutine, public init_aotensor
Subroutine to initialise the aotensor tensor.