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) :: nua=0.d0 !< Dissipation in the atmosphere
70  REAL(KIND=8) :: nuo=0.d0 !< Dissipation in the ocean
71 
72  REAL(KIND=8) :: nuap !< Non-dimensional dissipation in the atmosphere
73  REAL(KIND=8) :: nuop !< Non-dimensional dissipation in the ocean
74 
75  REAL(KIND=8) :: t_trans !< Transient time period
76  REAL(KIND=8) :: t_run !< Effective intergration time (length of the generated trajectory)
77  REAL(KIND=8) :: dt !< Integration time step
78  REAL(KIND=8) :: tw !< Write all variables every tw time units
79  LOGICAL :: writeout !< Write to file boolean
80 
81  INTEGER :: nboc !< Number of atmospheric blocks
82  INTEGER :: nbatm !< Number of oceanic blocks
83  INTEGER :: natm=0 !< Number of atmospheric basis functions
84  INTEGER :: noc=0 !< Number of oceanic basis functions
85  INTEGER :: ndim !< Number of variables (dimension of the model)
86  INTEGER, DIMENSION(:,:), ALLOCATABLE :: oms !< Ocean mode selection array
87  INTEGER, DIMENSION(:,:), ALLOCATABLE :: ams !< Atmospheric mode selection array
88 
89  PRIVATE :: init_nml
90 
91 
92 CONTAINS
93 
94 
95  !> Read the basic parameters and mode selection from the namelist.
96  SUBROUTINE init_nml
97  INTEGER :: AllocStat
98 
99  namelist /aoscale/ scale,f0,n,rra,phi0_npi
100  namelist /oparams/ gp,r,h,d,nuo
101  namelist /aparams/ k,kp,sig0,nua
102  namelist /toparams/ go,co,to0
103  namelist /taparams/ ga,ca,epsa,ta0
104  namelist /otparams/ sc,lambda,rr,sb
105 
106  namelist /modeselection/ oms,ams
107  namelist /numblocs/ nboc,nbatm
108 
109  namelist /int_params/ t_trans,t_run,dt,tw,writeout
110 
111  OPEN(8, file="params.nml", status='OLD', recl=80, delim='APOSTROPHE')
112 
113  READ(8,nml=aoscale)
114  READ(8,nml=oparams)
115  READ(8,nml=aparams)
116  READ(8,nml=toparams)
117  READ(8,nml=taparams)
118  READ(8,nml=otparams)
119 
120  CLOSE(8)
121 
122  OPEN(8, file="modeselection.nml", status='OLD', recl=80, delim='APOSTROPHE')
123  READ(8,nml=numblocs)
124 
125  ALLOCATE(oms(nboc,2),ams(nbatm,2), stat=allocstat)
126  IF (allocstat /= 0) stop "*** Not enough memory ! ***"
127 
128  READ(8,nml=modeselection)
129  CLOSE(8)
130 
131  OPEN(8, file="int_params.nml", status='OLD', recl=80, delim='APOSTROPHE')
132  READ(8,nml=int_params)
133 
134  END SUBROUTINE init_nml
135 
136  !> Parameters initialisation routine
137  SUBROUTINE init_params
138  INTEGER, DIMENSION(2) :: s
139  INTEGER :: i
140  CALL init_nml
141 
142  !---------------------------------------------------------!
143  ! !
144  ! Computation of the dimension of the atmospheric !
145  ! and oceanic components !
146  ! !
147  !---------------------------------------------------------!
148 
149  natm=0
150  DO i=1,nbatm
151  IF (ams(i,1)==1) THEN
152  natm=natm+3
153  ELSE
154  natm=natm+2
155  ENDIF
156  ENDDO
157  s=shape(oms)
158  noc=s(1)
159 
160  ndim=2*natm+2*noc
161 
162  !---------------------------------------------------------!
163  ! !
164  ! Some general parameters (Domain, beta, gamma, coupling) !
165  ! !
166  !---------------------------------------------------------!
167 
168  pi=dacos(-1.d0)
169  l=scale/pi
171  lr=sqrt(gp*h)/f0
172  g=-l**2/lr**2
173  betp=l/rra*cos(phi0)/sin(phi0)
174  rp=r/f0
175  dp=d/f0
176  kd=k*2
177  kdp=kp
178 
179  !-----------------------------------------------------!
180  ! !
181  ! DERIVED QUANTITIES !
182  ! !
183  !-----------------------------------------------------!
184 
185  cpo=co/(go*f0) * rr/(f0**2*l**2)
186  lpo=lambda/(go*f0)
187  cpa=ca/(ga*f0) * rr/(f0**2*l**2)/2 ! Cpa acts on psi1-psi3, not on theta
188  lpa=lambda/(ga*f0)
189  sbpo=4*sb*to0**3/(go*f0) ! long wave radiation lost by ocean to atmosphere space
190  sbpa=8*epsa*sb*ta0**3/(go*f0) ! long wave radiation from atmosphere absorbed by ocean
191  lsbpo=2*epsa*sb*to0**3/(ga*f0) ! long wave radiation from ocean absorbed by atmosphere
192  lsbpa=8*epsa*sb*ta0**3/(ga*f0) ! long wave radiation lost by atmosphere to space & ocea
193  nuap=nua/(f0*l**2)
194  nuop=nuo/(f0*l**2)
195 
196  END SUBROUTINE init_params
197 END MODULE params
real(kind=8) phi0_npi
Latitude exprimed in fraction of pi.
Definition: params.f90:35
real(kind=8) nuap
Non-dimensional dissipation in the atmosphere.
Definition: params.f90:72
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:85
real(kind=8) go
- Specific heat capacity of the ocean.
Definition: params.f90:39
integer noc
Number of oceanic basis functions.
Definition: params.f90:84
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:82
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:78
Statistics accumulators.
Definition: stat.f90:14
subroutine, private init_nml
Read the basic parameters and mode selection from the namelist.
Definition: params.f90:97
real(kind=8) nuop
Non-dimensional dissipation in the ocean.
Definition: params.f90:73
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:79
real(kind=8) t_run
Effective intergration time (length of the generated trajectory)
Definition: params.f90:76
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:83
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:81
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:138
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:77
real(kind=8) gp
Reduced gravity
Definition: params.f90:33
integer, dimension(:,:), allocatable ams
Atmospheric mode selection array.
Definition: params.f90:87
real(kind=8) rp
- Frictional coefficient at the bottom of the ocean.
Definition: params.f90:51
real(kind=8) nua
Dissipation in the atmosphere.
Definition: params.f90:69
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:75
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:86
real(kind=8) n
- Aspect ratio
Definition: params.f90:24
real(kind=8) nuo
Dissipation in the ocean.
Definition: params.f90:70
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