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

Utility module containing the stochastic related routines. More...

Functions/Subroutines

real(kind=8) function, public gasdev ()
 
subroutine, public stoch_vec (dW)
 Routine to fill a vector with standard Gaussian noise process values. More...
 
subroutine, public stoch_atm_vec (dW)
 routine to fill the atmospheric component of a vector with standard gaussian noise process values More...
 
subroutine, public stoch_atm_res_vec (dW)
 routine to fill the resolved atmospheric component of a vector with standard gaussian noise process values More...
 
subroutine, public stoch_atm_unres_vec (dW)
 routine to fill the unresolved atmospheric component of a vector with standard gaussian noise process values More...
 
subroutine, public stoch_oc_vec (dW)
 routine to fill the oceanic component of a vector with standard gaussian noise process values More...
 
subroutine, public stoch_oc_res_vec (dW)
 routine to fill the resolved oceanic component of a vector with standard gaussian noise process values More...
 
subroutine, public stoch_oc_unres_vec (dW)
 routine to fill the unresolved oceanic component of a vector with standard gaussian noise process values More...
 

Variables

integer iset =0
 
real(kind=8) gset
 

Detailed Description

Utility module containing the stochastic related routines.

Remarks

Function/Subroutine Documentation

real(kind=8) function, public stoch_mod::gasdev ( )

Definition at line 32 of file stoch_mod.f90.

32  REAL(KIND=8) :: gasdev
33  REAL(KIND=8) :: fac,rsq,v1,v2,r
34  IF (iset.eq.0) THEN
35  DO
36  CALL random_number(r)
37  v1=2.d0*r-1.
38  CALL random_number(r)
39  v2=2.d0*r-1.
40  rsq=v1**2+v2**2
41  IF (rsq.lt.1.d0.and.rsq.ne.0.d0) EXIT
42  ENDDO
43  fac=sqrt(-2.*log(rsq)/rsq)
44  gset=v1*fac
45  gasdev=v2*fac
46  iset=1
47  ELSE
48  gasdev=gset
49  iset=0
50  ENDIF
51  RETURN
subroutine, public stoch_mod::stoch_atm_res_vec ( real(kind=8), dimension(0:ndim), intent(inout)  dW)

routine to fill the resolved atmospheric component of a vector with standard gaussian noise process values

Parameters
dWvector to fill

Definition at line 77 of file stoch_mod.f90.

77  real(kind=8), dimension(0:ndim), intent(inout) :: dw
78  integer :: i
79  dw=0.d0
80  do i=1,2*natm
81  IF (sf(i)==0) dw(i)=gasdev()
82  enddo
integer, dimension(:), allocatable, public sf
Unresolved variable definition vector.
Definition: sf_def.f90:23
subroutine, public stoch_mod::stoch_atm_unres_vec ( real(kind=8), dimension(0:ndim), intent(inout)  dW)

routine to fill the unresolved atmospheric component of a vector with standard gaussian noise process values

Parameters
dWvector to fill

Definition at line 88 of file stoch_mod.f90.

88  real(kind=8), dimension(0:ndim), intent(inout) :: dw
89  integer :: i
90  dw=0.d0
91  do i=1,2*natm
92  IF (sf(i)==1) dw(i)=gasdev()
93  enddo
integer, dimension(:), allocatable, public sf
Unresolved variable definition vector.
Definition: sf_def.f90:23
subroutine, public stoch_mod::stoch_atm_vec ( real(kind=8), dimension(0:ndim), intent(inout)  dW)

routine to fill the atmospheric component of a vector with standard gaussian noise process values

Parameters
dWvector to fill

Definition at line 67 of file stoch_mod.f90.

67  real(kind=8), dimension(0:ndim), intent(inout) :: dw
68  integer :: i
69  do i=1,2*natm
70  dw(i)=gasdev()
71  enddo
subroutine, public stoch_mod::stoch_oc_res_vec ( real(kind=8), dimension(0:ndim), intent(inout)  dW)

routine to fill the resolved oceanic component of a vector with standard gaussian noise process values

Parameters
dWvector to fill

Definition at line 109 of file stoch_mod.f90.

109  real(kind=8), dimension(0:ndim), intent(inout) :: dw
110  integer :: i
111  dw=0.d0
112  do i=2*natm+1,ndim
113  IF (sf(i)==0) dw(i)=gasdev()
114  enddo
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
integer, dimension(:), allocatable, public sf
Unresolved variable definition vector.
Definition: sf_def.f90:23
subroutine, public stoch_mod::stoch_oc_unres_vec ( real(kind=8), dimension(0:ndim), intent(inout)  dW)

routine to fill the unresolved oceanic component of a vector with standard gaussian noise process values

Parameters
dWvector to fill

Definition at line 120 of file stoch_mod.f90.

120  real(kind=8), dimension(0:ndim), intent(inout) :: dw
121  integer :: i
122  dw=0.d0
123  do i=2*natm+1,ndim
124  IF (sf(i)==1) dw(i)=gasdev()
125  enddo
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
integer, dimension(:), allocatable, public sf
Unresolved variable definition vector.
Definition: sf_def.f90:23
subroutine, public stoch_mod::stoch_oc_vec ( real(kind=8), dimension(0:ndim), intent(inout)  dW)

routine to fill the oceanic component of a vector with standard gaussian noise process values

Parameters
dWvector to fill

Definition at line 99 of file stoch_mod.f90.

99  real(kind=8), dimension(0:ndim), intent(inout) :: dw
100  integer :: i
101  do i=2*natm+1,ndim
102  dw(i)=gasdev()
103  enddo
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85
subroutine, public stoch_mod::stoch_vec ( real(kind=8), dimension(0:ndim), intent(inout)  dW)

Routine to fill a vector with standard Gaussian noise process values.

Parameters
dWVector to fill

Definition at line 57 of file stoch_mod.f90.

57  REAL(KIND=8), DIMENSION(0:ndim), INTENT(INOUT) :: dw
58  INTEGER :: i
59  DO i=1,ndim
60  dw(i)=gasdev()
61  ENDDO
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:85

Variable Documentation

real(kind=8) stoch_mod::gset
private

Definition at line 24 of file stoch_mod.f90.

24  REAL(KIND=8) :: gset
integer stoch_mod::iset =0
private

Definition at line 23 of file stoch_mod.f90.

23  INTEGER :: iset=0