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

The MTV noise sigma matrices used to integrate the MTV model. More...

Functions/Subroutines

subroutine, public init_sigma (mult, Q1fill)
 Subroutine to initialize the sigma matices. More...
 
subroutine, public compute_mult_sigma (y)
 Routine to actualize the matrix \(\sigma_1\) based on the state y of the MTV system. More...
 

Variables

real(kind=8), dimension(:,:), allocatable, public sig1
 \(\sigma_1(X)\) state-dependent noise matrix More...
 
real(kind=8), dimension(:,:), allocatable, public sig2
 \(\sigma_2\) state-independent noise matrix More...
 
real(kind=8), dimension(:,:), allocatable, public sig1r
 Reduced \(\sigma_1(X)\) state-dependent noise matrix. More...
 
real(kind=8), dimension(:,:), allocatable dumb_mat1
 Dummy matrix. More...
 
real(kind=8), dimension(:,:), allocatable dumb_mat2
 Dummy matrix. More...
 
real(kind=8), dimension(:,:), allocatable dumb_mat3
 Dummy matrix. More...
 
real(kind=8), dimension(:,:), allocatable dumb_mat4
 Dummy matrix. More...
 
integer, dimension(:), allocatable ind1
 
integer, dimension(:), allocatable rind1
 
integer, dimension(:), allocatable ind2
 
integer, dimension(:), allocatable rind2
 Reduction indices. More...
 
integer n1
 
integer n2
 

Detailed Description

The MTV noise sigma matrices used to integrate the MTV model.

Remarks
See : Franzke, C., Majda, A. J., & Vanden-Eijnden, E. (2005). Low-order stochastic mode reduction for a realistic barotropic model climate. Journal of the atmospheric sciences, 62(6), 1722-1745.

Function/Subroutine Documentation

subroutine, public sigma::compute_mult_sigma ( real(kind=8), dimension(0:ndim), intent(in)  y)

Routine to actualize the matrix \(\sigma_1\) based on the state y of the MTV system.

Parameters
yState of the MTV system

Definition at line 93 of file MTV_sigma_tensor.f90.

93  REAL(KIND=8), DIMENSION(0:ndim), INTENT(IN) :: y
94  INTEGER :: info,info2
95  CALL sparse_mul3_mat(utot,y,dumb_mat1)
96  CALL sparse_mul4_mat(vtot,y,y,dumb_mat2)
97  dumb_mat3=dumb_mat1+dumb_mat2+q1
98  CALL reduce(dumb_mat3,dumb_mat1,n1,ind1,rind1)
99  IF (n1 /= 0) THEN
100  CALL sqrtm_svd(dumb_mat1(1:n1,1:n1),dumb_mat2(1:n1,1:n1),info,info2,min(max(n1/2,2),64))
101  ! dumb_mat2=0.D0
102  ! CALL chol(0.5*(dumb_mat1(1:n1,1:n1)+transpose(dumb_mat1(1:n1,1:n1))),dumb_mat2(1:n1,1:n1),info)
103  IF ((.not.any(isnan(dumb_mat2))).and.(info.eq.0).and.(.not.any(dumb_mat2>huge(0.d0)))) THEN
104  CALL ireduce(sig1,dumb_mat2,n1,ind1,rind1)
105  ELSE
106  sig1=sig1r
107  ENDIF
108  ELSE
109  sig1=sig1r
110  ENDIF
subroutine, public sigma::init_sigma ( logical, intent(out)  mult,
logical, intent(out)  Q1fill 
)

Subroutine to initialize the sigma matices.

Definition at line 48 of file MTV_sigma_tensor.f90.

48  LOGICAL, INTENT(OUT) :: mult,q1fill
49  INTEGER :: allocstat,info1,info2
50 
51  CALL init_sqrt
52 
53  ALLOCATE(sig1(ndim,ndim), sig2(ndim,ndim), sig1r(ndim,ndim),stat=allocstat)
54  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
55 
56  ALLOCATE(ind1(ndim), rind1(ndim), ind2(ndim), rind2(ndim), stat=allocstat)
57  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
58 
59  ALLOCATE(dumb_mat1(ndim,ndim), dumb_mat2(ndim,ndim), stat=allocstat)
60  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
61 
62  ALLOCATE(dumb_mat3(ndim,ndim), dumb_mat4(ndim,ndim), stat=allocstat)
63  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
64 
65  print*, "Initializing the sigma matrices"
66 
67  CALL reduce(q2,dumb_mat1,n2,ind2,rind2)
68  IF (n2 /= 0) THEN
69  CALL sqrtm_svd(dumb_mat1(1:n2,1:n2),dumb_mat2(1:n2,1:n2),info1,info2,min(max(n2/2,2),64))
70  CALL ireduce(sig2,dumb_mat2,n2,ind2,rind2)
71  ELSE
72  sig2=0.d0
73  ENDIF
74 
75  mult=(.not.((tensor_empty(utot)).and.(tensor4_empty(vtot))))
76  q1fill=.true.
77  CALL reduce(q1,dumb_mat1,n1,ind1,rind1)
78  IF (n1 /= 0) THEN
79 
80  CALL sqrtm_svd(dumb_mat1(1:n1,1:n1),dumb_mat2(1:n1,1:n1),info1,info2,min(max(n1/2,2),64))
81  CALL ireduce(sig1,dumb_mat2,n1,ind1,rind1)
82  ELSE
83  q1fill=.false.
84  sig1=0.d0
85  ENDIF
86  sig1r=sig1
87 
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
Statistics accumulators.
Definition: stat.f90:14

Variable Documentation

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

Dummy matrix.

Definition at line 35 of file MTV_sigma_tensor.f90.

35  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: dumb_mat1 !< Dummy matrix
real(kind=8), dimension(:,:), allocatable sigma::dumb_mat2
private

Dummy matrix.

Definition at line 36 of file MTV_sigma_tensor.f90.

36  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: dumb_mat2 !< Dummy matrix
real(kind=8), dimension(:,:), allocatable sigma::dumb_mat3
private

Dummy matrix.

Definition at line 37 of file MTV_sigma_tensor.f90.

37  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: dumb_mat3 !< Dummy matrix
real(kind=8), dimension(:,:), allocatable sigma::dumb_mat4
private

Dummy matrix.

Definition at line 38 of file MTV_sigma_tensor.f90.

38  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE :: dumb_mat4 !< Dummy matrix
integer, dimension(:), allocatable sigma::ind1
private

Definition at line 39 of file MTV_sigma_tensor.f90.

39  INTEGER, DIMENSION(:), ALLOCATABLE :: ind1,rind1,ind2,rind2 !< Reduction indices
integer, dimension(:), allocatable sigma::ind2
private

Definition at line 39 of file MTV_sigma_tensor.f90.

integer sigma::n1
private

Definition at line 41 of file MTV_sigma_tensor.f90.

41  INTEGER :: n1,n2
integer sigma::n2
private

Definition at line 41 of file MTV_sigma_tensor.f90.

integer, dimension(:), allocatable sigma::rind1
private

Definition at line 39 of file MTV_sigma_tensor.f90.

integer, dimension(:), allocatable sigma::rind2
private

Reduction indices.

Definition at line 39 of file MTV_sigma_tensor.f90.

real(kind=8), dimension(:,:), allocatable, public sigma::sig1

\(\sigma_1(X)\) state-dependent noise matrix

Definition at line 31 of file MTV_sigma_tensor.f90.

31  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE, PUBLIC :: sig1 !< \f$\sigma_1(X)\f$ state-dependent noise matrix
real(kind=8), dimension(:,:), allocatable, public sigma::sig1r

Reduced \(\sigma_1(X)\) state-dependent noise matrix.

Definition at line 33 of file MTV_sigma_tensor.f90.

33  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE, PUBLIC :: sig1r !< Reduced \f$\sigma_1(X)\f$ state-dependent noise matrix
real(kind=8), dimension(:,:), allocatable, public sigma::sig2

\(\sigma_2\) state-independent noise matrix

Definition at line 32 of file MTV_sigma_tensor.f90.

32  REAL(KIND=8), DIMENSION(:,:), ALLOCATABLE, PUBLIC :: sig2 !< \f$\sigma_2\f$ state-independent noise matrix