A Modular Arbitrary-Order Ocean-Atmosphere Model -- Stochastic implementation
params.f90
Go to the documentation of this file.
1 
2 ! params.f90
3 !
4 !> The model parameters module.
5 !
6 !> @copyright
7 !> 2015 Lesley De Cruz & Jonathan Demaeyer.
8 !> See LICENSE.txt for license information.
9 !
10 !---------------------------------------------------------------------------
11 !
12 !> @remark
13 !> Once the init_params() subroutine is called, the parameters are loaded
14 !> globally in the main program and its subroutines and function
15 !
16 !---------------------------------------------------------------------------
17 
18 MODULE params
19 
20  IMPLICIT NONE
21 
22  PUBLIC
23 
24  REAL(KIND=8) :: n !< \f$n = 2 L_y / L_x\f$ - Aspect ratio
25  REAL(KIND=8) :: phi0 !< Latitude in radian
26  REAL(KIND=8) :: rra !< Earth radius
27  REAL(KIND=8) :: sig0 !< \f$\sigma_0\f$ - Non-dimensional static stability of the atmosphere.
28  REAL(KIND=8) :: k !< Bottom atmospheric friction coefficient.
29  REAL(KIND=8) :: kp !< \f$k'\f$ - Internal atmospheric friction coefficient.
30  REAL(KIND=8) :: r !< Frictional coefficient at the bottom of the ocean.
31  REAL(KIND=8) :: d !< Merchanical coupling parameter between the ocean and the atmosphere.
32  REAL(KIND=8) :: f0 !< \f$f_0\f$ - Coriolis parameter
33  REAL(KIND=8) :: gp !< \f$g'\f$Reduced gravity
34  REAL(KIND=8) :: h !< Depth of the active water layer of the ocean.
35  REAL(KIND=8) :: phi0_npi !< Latitude exprimed in fraction of pi.
36 
37  REAL(KIND=8) :: lambda !< \f$\lambda\f$ - Sensible + turbulent heat exchange between the ocean and the atmosphere.
38  REAL(KIND=8) :: co !< \f$C_a\f$ - Constant short-wave radiation of the ocean.
39  REAL(KIND=8) :: go !< \f$\gamma_o\f$ - Specific heat capacity of the ocean.
40  REAL(KIND=8) :: ca !< \f$C_a\f$ - Constant short-wave radiation of the atmosphere.
41  REAL(KIND=8) :: to0 !< \f$T_o^0\f$ - Stationary solution for the 0-th order ocean temperature.
42  REAL(KIND=8) :: ta0 !< \f$T_a^0\f$ - Stationary solution for the 0-th order atmospheric temperature.
43  REAL(KIND=8) :: epsa !< \f$\epsilon_a\f$ - Emissivity coefficient for the grey-body atmosphere.
44  REAL(KIND=8) :: ga !< \f$\gamma_a\f$ - Specific heat capacity of the atmosphere.
45  REAL(KIND=8) :: rr !< \f$R\f$ - Gas constant of dry air
46 
47  REAL(KIND=8) :: scale !< \f$L_y = L \, \pi\f$ - The characteristic space scale.
48  REAL(KIND=8) :: pi !< \f$\pi\f$
49  REAL(KIND=8) :: lr !< \f$L_R\f$ - Rossby deformation radius
50  REAL(KIND=8) :: g !< \f$\gamma\f$
51  REAL(KIND=8) :: rp !< \f$r'\f$ - Frictional coefficient at the bottom of the ocean.
52  REAL(KIND=8) :: dp !< \f$d'\f$ - Non-dimensional mechanical coupling parameter between the ocean and the atmosphere.
53  REAL(KIND=8) :: kd !< \f$k_d\f$ - Non-dimensional bottom atmospheric friction coefficient.
54  REAL(KIND=8) :: kdp !< \f$k'_d\f$ - Non-dimensional internal atmospheric friction coefficient.
55 
56  REAL(KIND=8) :: cpo !< \f$C'_a\f$ - Non-dimensional constant short-wave radiation of the ocean.
57  REAL(KIND=8) :: lpo !< \f$\lambda'_o\f$ - Non-dimensional sensible + turbulent heat exchange from ocean to atmosphere.
58  REAL(KIND=8) :: cpa !< \f$C'_a\f$ - Non-dimensional constant short-wave radiation of the atmosphere. @remark Cpa acts on psi1-psi3, not on theta.
59  REAL(KIND=8) :: lpa !< \f$\lambda'_a\f$ - Non-dimensional sensible + turbulent heat exchange from atmosphere to ocean.
60  REAL(KIND=8) :: sbpo !< \f$\sigma'_{B,o}\f$ - Long wave radiation lost by ocean to atmosphere & space.
61  REAL(KIND=8) :: sbpa !< \f$\sigma'_{B,a}\f$ - Long wave radiation from atmosphere absorbed by ocean.
62  REAL(KIND=8) :: lsbpo !< \f$S'_{B,o}\f$ - Long wave radiation from ocean absorbed by atmosphere.
63  REAL(KIND=8) :: lsbpa !< \f$S'_{B,a}\f$ - Long wave radiation lost by atmosphere to space & ocean.
64  REAL(KIND=8) :: l !< \f$L\f$ - Domain length scale
65  REAL(KIND=8) :: sc !< Ratio of surface to atmosphere temperature.
66  REAL(KIND=8) :: sb !< Stefan–Boltzmann constant
67  REAL(KIND=8) :: betp !< \f$\beta'\f$ - Non-dimensional beta parameter
68 
69  REAL(KIND=8) :: t_trans !< Transient time period
70  REAL(KIND=8) :: t_run !< Effective intergration time (length of the generated trajectory)
71  REAL(KIND=8) :: dt !< Integration time step
72  REAL(KIND=8) :: tw !< Write all variables every tw time units
73  LOGICAL :: writeout !< Write to file boolean
74 
75  INTEGER :: nboc !< Number of atmospheric blocks
76  INTEGER :: nbatm !< Number of oceanic blocks
77  INTEGER :: natm=0 !< Number of atmospheric basis functions
78  INTEGER :: noc=0 !< Number of oceanic basis functions
79  INTEGER :: ndim !< Number of variables (dimension of the model)
80  INTEGER, DIMENSION(:,:), ALLOCATABLE :: oms !< Ocean mode selection array
81  INTEGER, DIMENSION(:,:), ALLOCATABLE :: ams !< Atmospheric mode selection array
82 
83  PRIVATE :: init_nml
84 
85 
86 CONTAINS
87 
88 
89  !> Read the basic parameters and mode selection from the namelist.
90  SUBROUTINE init_nml
91  INTEGER :: AllocStat
92 
93  namelist /aoscale/ scale,f0,n,rra,phi0_npi
94  namelist /oparams/ gp,r,h,d
95  namelist /aparams/ k,kp,sig0
96  namelist /toparams/ go,co,to0
97  namelist /taparams/ ga,ca,epsa,ta0
98  namelist /otparams/ sc,lambda,rr,sb
99 
100  namelist /modeselection/ oms,ams
101  namelist /numblocs/ nboc,nbatm
102 
103  namelist /int_params/ t_trans,t_run,dt,tw,writeout
104 
105  OPEN(8, file="params.nml", status='OLD', recl=80, delim='APOSTROPHE')
106 
107  READ(8,nml=aoscale)
108  READ(8,nml=oparams)
109  READ(8,nml=aparams)
110  READ(8,nml=toparams)
111  READ(8,nml=taparams)
112  READ(8,nml=otparams)
113 
114  CLOSE(8)
115 
116  OPEN(8, file="modeselection.nml", status='OLD', recl=80, delim='APOSTROPHE')
117  READ(8,nml=numblocs)
118 
119  ALLOCATE(oms(nboc,2),ams(nbatm,2), stat=allocstat)
120  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
121 
122  READ(8,nml=modeselection)
123  CLOSE(8)
124 
125  OPEN(8, file="int_params.nml", status='OLD', recl=80, delim='APOSTROPHE')
126  READ(8,nml=int_params)
127 
128 
129  END SUBROUTINE init_nml
130 
131  !> Parameters initialisation routine
132  SUBROUTINE init_params
133  INTEGER, DIMENSION(2) :: s
134  INTEGER :: i
135  CALL init_nml
136 
137  !---------------------------------------------------------!
138  ! !
139  ! Computation of the dimension of the atmospheric !
140  ! and oceanic components !
141  ! !
142  !---------------------------------------------------------!
143 
144  natm=0
145  DO i=1,nbatm
146  IF (ams(i,1)==1) THEN
147  natm=natm+3
148  ELSE
149  natm=natm+2
150  ENDIF
151  ENDDO
152  s=shape(oms)
153  noc=s(1)
154 
155  ndim=2*natm+2*noc
156 
157  !---------------------------------------------------------!
158  ! !
159  ! Some general parameters (Domain, beta, gamma, coupling) !
160  ! !
161  !---------------------------------------------------------!
162 
163  pi=dacos(-1.d0)
164  l=scale/pi
166  lr=sqrt(gp*h)/f0
167  g=-l**2/lr**2
168  betp=l/rra*cos(phi0)/sin(phi0)
169  rp=r/f0
170  dp=d/f0
171  kd=k*2
172  kdp=kp
173 
174  !-----------------------------------------------------!
175  ! !
176  ! DERIVED QUANTITIES !
177  ! !
178  !-----------------------------------------------------!
179 
180  cpo=co/(go*f0) * rr/(f0**2*l**2)
181  lpo=lambda/(go*f0)
182  cpa=ca/(ga*f0) * rr/(f0**2*l**2)/2 ! Cpa acts on psi1-psi3, not on theta
183  lpa=lambda/(ga*f0)
184  sbpo=4*sb*to0**3/(go*f0) ! long wave radiation lost by ocean to atmosphere space
185  sbpa=8*epsa*sb*ta0**3/(go*f0) ! long wave radiation from atmosphere absorbed by ocean
186  lsbpo=2*epsa*sb*to0**3/(ga*f0) ! long wave radiation from ocean absorbed by atmosphere
187  lsbpa=8*epsa*sb*ta0**3/(ga*f0) ! long wave radiation lost by atmosphere to space & ocea
188 
189 
190  END SUBROUTINE init_params
191 END MODULE params
real(kind=8) phi0_npi
Latitude exprimed in fraction of pi.
Definition: params.f90:35
real(kind=8) sb
Stefan–Boltzmann constant.
Definition: params.f90:66
real(kind=8) cpa
- Non-dimensional constant short-wave radiation of the atmosphere.
Definition: params.f90:58
integer ndim
Number of variables (dimension of the model)
Definition: params.f90:79
real(kind=8) go
- Specific heat capacity of the ocean.
Definition: params.f90:39
integer noc
Number of oceanic basis functions.
Definition: params.f90:78
real(kind=8) ta0
- Stationary solution for the 0-th order atmospheric temperature.
Definition: params.f90:42
integer nbatm
Number of oceanic blocks.
Definition: params.f90:76
real(kind=8) sig0
- Non-dimensional static stability of the atmosphere.
Definition: params.f90:27
real(kind=8) betp
- Non-dimensional beta parameter
Definition: params.f90:67
real(kind=8) tw
Write all variables every tw time units.
Definition: params.f90:72
Statistics accumulators.
Definition: stat.f90:14
subroutine, private init_nml
Read the basic parameters and mode selection from the namelist.
Definition: params.f90:91
real(kind=8) kdp
- Non-dimensional internal atmospheric friction coefficient.
Definition: params.f90:54
real(kind=8) lambda
- Sensible + turbulent heat exchange between the ocean and the atmosphere.
Definition: params.f90:37
logical writeout
Write to file boolean.
Definition: params.f90:73
real(kind=8) t_run
Effective intergration time (length of the generated trajectory)
Definition: params.f90:70
real(kind=8) epsa
- Emissivity coefficient for the grey-body atmosphere.
Definition: params.f90:43
real(kind=8) kd
- Non-dimensional bottom atmospheric friction coefficient.
Definition: params.f90:53
real(kind=8) pi
Definition: params.f90:48
real(kind=8) sc
Ratio of surface to atmosphere temperature.
Definition: params.f90:65
real(kind=8) g
Definition: params.f90:50
real(kind=8) sbpo
- Long wave radiation lost by ocean to atmosphere & space.
Definition: params.f90:60
real(kind=8) kp
- Internal atmospheric friction coefficient.
Definition: params.f90:29
real(kind=8) dp
- Non-dimensional mechanical coupling parameter between the ocean and the atmosphere.
Definition: params.f90:52
real(kind=8) to0
- Stationary solution for the 0-th order ocean temperature.
Definition: params.f90:41
real(kind=8) co
- Constant short-wave radiation of the ocean.
Definition: params.f90:38
real(kind=8) f0
- Coriolis parameter
Definition: params.f90:32
real(kind=8) rr
- Gas constant of dry air
Definition: params.f90:45
integer natm
Number of atmospheric basis functions.
Definition: params.f90:77
real(kind=8) h
Depth of the active water layer of the ocean.
Definition: params.f90:34
real(kind=8) ca
- Constant short-wave radiation of the atmosphere.
Definition: params.f90:40
real(kind=8) ga
- Specific heat capacity of the atmosphere.
Definition: params.f90:44
real(kind=8) k
Bottom atmospheric friction coefficient.
Definition: params.f90:28
real(kind=8) lpo
- Non-dimensional sensible + turbulent heat exchange from ocean to atmosphere.
Definition: params.f90:57
real(kind=8) scale
- The characteristic space scale.
Definition: params.f90:47
real(kind=8) l
- Domain length scale
Definition: params.f90:64
real(kind=8) sbpa
- Long wave radiation from atmosphere absorbed by ocean.
Definition: params.f90:61
integer nboc
Number of atmospheric blocks.
Definition: params.f90:75
The model parameters module.
Definition: params.f90:18
real(kind=8) r
Frictional coefficient at the bottom of the ocean.
Definition: params.f90:30
subroutine init_params
Parameters initialisation routine.
Definition: params.f90:133
real(kind=8) lr
- Rossby deformation radius
Definition: params.f90:49
real(kind=8) rra
Earth radius.
Definition: params.f90:26
real(kind=8) lsbpa
- Long wave radiation lost by atmosphere to space & ocean.
Definition: params.f90:63
real(kind=8) lpa
- Non-dimensional sensible + turbulent heat exchange from atmosphere to ocean.
Definition: params.f90:59
real(kind=8) dt
Integration time step.
Definition: params.f90:71
real(kind=8) gp
Reduced gravity
Definition: params.f90:33
integer, dimension(:,:), allocatable ams
Atmospheric mode selection array.
Definition: params.f90:81
real(kind=8) rp
- Frictional coefficient at the bottom of the ocean.
Definition: params.f90:51
real(kind=8) cpo
- Non-dimensional constant short-wave radiation of the ocean.
Definition: params.f90:56
real(kind=8) t_trans
Transient time period.
Definition: params.f90:69
real(kind=8) lsbpo
- Long wave radiation from ocean absorbed by atmosphere.
Definition: params.f90:62
integer, dimension(:,:), allocatable oms
Ocean mode selection array.
Definition: params.f90:80
real(kind=8) n
- Aspect ratio
Definition: params.f90:24
real(kind=8) phi0
Latitude in radian.
Definition: params.f90:25
real(kind=8) d
Merchanical coupling parameter between the ocean and the atmosphere.
Definition: params.f90:31