-
Notifications
You must be signed in to change notification settings - Fork 334
/
mpas_ocn_constants.F
283 lines (246 loc) · 11.9 KB
/
mpas_ocn_constants.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
! Copyright (c) 2013, Los Alamos National Security, LLC (LANS)
! and the University Corporation for Atmospheric Research (UCAR).
!
! Unless noted otherwise source code is licensed under the BSD license.
! Additional copyright and license information can be found in the LICENSE file
! distributed with this code, or at http://mpas-dev.github.io/license.html
!
!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
!
! ocn_constants
!
!> \brief MPAS ocean specific constants
!> \author Doug Jacobsen
!> \date 04/25/12
!> \details
!> This module contains constants specific to the ocean model.
!
!-----------------------------------------------------------------------
module ocn_constants
use mpas_derived_types
use mpas_pool_routines
use mpas_kind_types
#ifdef MPAS_ESM_SHR_CONST
use shr_kind_mod, only: SHR_KIND_R8
use shr_const_mod
#endif
implicit none
private
save
public :: ocn_constants_init
type (mpas_pool_type), public, pointer :: ocnConfigs
type (mpas_pool_type), public, pointer :: ocnPackages
character (len=*), public, parameter :: statsAlarmID = 'stats'
character (len=*), public, parameter :: coupleAlarmID = 'coupling'
real (kind=RKIND), public :: &
rho_air ,&! ambient air density (kg/m^3)
rho_fw ,&! density of fresh water (kg/m^3)
rho_sw ,&! density of salt water (kg/m^3)
rho_ice ,&! density of sea ice (kg/m^3)
cp_sw ,&! specific heat salt water (J/kg/K)
cp_air ,&! heat capacity of air (J/kg/K)
sound ,&! speed of sound (m/s)
vonkar ,&! von Karman constant
emissivity ,&!
stefan_boltzmann ,&! W/m^2/K^4
latent_heat_vapor ,&! lat heat of vaporization (erg/g)
latent_heat_vapor_mks ,&! lat heat of vaporization (J/kg)
latent_heat_fusion ,&! lat heat of fusion (erg/g)
latent_heat_fusion_mks,&! lat heat of fusion (J/kg)
sea_ice_salinity ,&! salinity of sea ice formed (psu)
ocn_ref_salinity ,&! ocean reference salinity (psu)
atm_ref_pressure ,&! standard sea level pressure (Pa)
molecular_weight_C ,&! molecular weight carbon
molecular_weight_O2 ! molecular weight oxygen
! conversion factors
real (kind=RKIND), public :: &
T0_Kelvin ,&! zero point for Celsius
mpercm ,&! meters per m
cmperm ,&! m per meter
days_per_second ,&! days per second
salt_to_ppt ,&! salt (kg/kg) to ppt
ppt_to_salt ,&! salt ppt to kg/kg
mass_to_Sv ,&! mass flux to Sverdrups
heat_to_PW ,&! heat flux to Petawatts
salt_to_Svppt ,&! salt flux to Sv*ppt
salt_to_mmday ,&! salt to water (mm/day)
hflux_factor ,&! heat flux (W/m^2) to temp flux (C*m/s)
fwflux_factor ,&! fw flux (kg/m^2/s) to salt((msu/psu)*m/s)
salinity_factor ,&! fw flux (kg/m^2/s) to salt flux (msu*m/s)
sflux_factor ,&! salt flux (kg/m^2/s) to salt flux (msu*m/s)
fwmass_to_fwflux ,&! fw flux (kg/m^2/s) to fw flux (m/s)
mmol_to_kg_C ,&! mmol-C to kg-C
mmol_to_kg_O2 ! mmol-O2 to kg-O2
!***********************************************************************
contains
!***********************************************************************
!
! routine ocn_constants_init
!
!> \brief Initializes the ocean constants
!> \author Doug Jacobsen
!> \date 04/25/12
!> \details
!> This routine sets up constants for use in the ocean model.
!
!-----------------------------------------------------------------------
subroutine ocn_constants_init(configPool, packagePool)!{{{
type (mpas_pool_type), pointer :: configPool
type (mpas_pool_type), pointer :: packagePool
real (kind=RKIND), pointer :: config_density0
ocnConfigs => configPool
ocnPackages => packagePool
call mpas_pool_get_config(configPool, 'config_density0', config_density0)
!-----------------------------------------------------------------------
!
! physical constants
! some of these constants may be over-ridden by CSM-defined
! constants if the CSM shared constants are available
!
!-----------------------------------------------------------------------
T0_Kelvin = 273.16_RKIND ! zero point for Celsius
rho_air = 1.2_RKIND ! ambient air density (kg/m^3)
rho_sw = config_density0 ! density of salt water (kg/m^3)
rho_fw = 1.0e3_RKIND ! avg. water density (kg/m^3)
rho_ice = 0.917e3_RKIND ! density of ice (kg/m^3)
cp_sw = 3.996e3_RKIND ! specific heat salt water
cp_air = 1005.0_RKIND ! heat capacity of air (J/kg/K)
sound = 1.5e2_RKIND ! speed of sound (m/s)
vonkar = 0.4_RKIND ! von Karman constant
emissivity = 1.0_RKIND !
stefan_boltzmann = 567.0e-10_RKIND ! W/m^2/K^4
latent_heat_vapor_mks = 2.5e6_RKIND ! lat heat of vaporization (J/kg)
latent_heat_fusion = 3.34e6_RKIND ! lat heat of fusion (erg/kg)
latent_heat_fusion_mks = 3.337e5_RKIND ! lat heat of fusion (J/kg)
sea_ice_salinity = 4.0_RKIND ! (psu)
ocn_ref_salinity = 34.7_RKIND ! (psu)
atm_ref_pressure = 101325.0_RKIND ! (Pa)
molecular_weight_C = 12.0107_RKIND ! molecular weight carbon
molecular_weight_O2 = 15.9994_RKIND ! molecular weight oxygen
!-----------------------------------------------------------------------
!
! conversion factors
!
!-----------------------------------------------------------------------
days_per_second = 1._RKIND/86400._RKIND ! days per second
salt_to_ppt = 1000._RKIND ! salt (kg/kg) to ppt
ppt_to_salt = 1.e-3_RKIND ! salt ppt to kg/kg
mass_to_Sv = 1.0e-12_RKIND ! mass flux to Sverdrups
heat_to_PW = 4.186e-15_RKIND ! heat flux to Petawatts
salt_to_Svppt = 1.0e-9_RKIND ! salt flux to Sv*ppt
salt_to_mmday = 3.1536e+5_RKIND ! salt to water (mm/day)
!-----------------------------------------------------------------------
!
! physical constants -- E3SM override
!
!-----------------------------------------------------------------------
#ifdef MPAS_ESM_SHR_CONST
T0_Kelvin = SHR_CONST_TKFRZ ! zero point for Celsius
cp_sw = SHR_CONST_CPSW ! erg/g/K
cp_air = SHR_CONST_CPDAIR ! J/kg/K
rho_air = SHR_CONST_RHODAIR ! kg/m^3
rho_sw = SHR_CONST_RHOSW ! kg/m^3
rho_fw = SHR_CONST_RHOFW ! kg/m^3
rho_ice = SHR_CONST_RHOICE ! kg/m^3
vonkar = SHR_CONST_KARMAN
stefan_boltzmann = SHR_CONST_STEBOL ! W/m^2/K^4
latent_heat_vapor_mks = SHR_CONST_LATVAP ! J/kg
latent_heat_fusion_mks = SHR_CONST_LATICE ! J/kg
ocn_ref_salinity = SHR_CONST_OCN_REF_SAL ! psu
sea_ice_salinity = SHR_CONST_ICE_REF_SAL ! psu
molecular_weight_C = SHR_CONST_MWC ! molecular weight carbon
molecular_weight_O2 = SHR_CONST_MWO ! molecular weight oxygen
#endif
!#ifdef ZERO_SEA_ICE_REF_SAL
! sea_ice_salinity = c0
!#endif
!-----------------------------------------------------------------------
!
! convert heat, solar flux (W/m^2) to temperature flux (C*cm/s):
! --------------------------------------------------------------
! heat_flux in (W/m^2) = (J/s/m^2) = 1(kg/s^3)
! density of seawater rho_sw in (kg/m^3)
! specific heat of seawater cp_sw in (erg/kg/C) = (m^2/s^2/C)
!
! temp_flux = heat_flux / (rho_sw*cp_sw)
! temp_flux (C*cm/s) = heat_flux (W/m^2)
! * 1 (kg/s^3)/(W/m^2)
! / [(rho_sw*cp_sw) (kg/m/s^2/C)]
!
! = heat_flux (W/m^2)
! * hflux_factor (C*m/s)/(W/m^2)
!
! ==> hflux_factor = 1/(rho_sw*cp_sw)
!
!-----------------------------------------------------------------------
hflux_factor = 1.0_RKIND/(rho_sw*cp_sw)
!-----------------------------------------------------------------------
!
! convert fresh water flux (kg/m^2/s) to virtual salt flux (msu*cm/s):
! --------------------------------------------------------------------
! ocean reference salinity in (o/oo=psu)
! density of freshwater rho_fw = 1.0e3 (kg/m^3)
! h2o_flux in (kg/m^2/s) = 1.0e2 (kg/m^2/s)
!
! salt_flux = - h2o_flux * ocn_ref_salinity / rho_fw
! salt_flux (msu*cm/s) = - h2o_flux (kg/m^2/s)
! * ocn_ref_salinity (psu)
! * 1.e-3 (msu/psu)
! * 1.0e2 (kg/m^2/s)/(kg/m^2/s)
! / 1.0e3 (kg/m^3)
! = - h2o_flux (kg/m^2/s)
! * ocn_ref_salinity (psu)
! * fwflux_factor (m/s)(msu/psu)/(kg/m^2/s)
!
! ==> fwflux_factor = 1.e-6
!
! salt_flux(msu*cm/s) = h2oflux(kg/m^2/s) * salinity_factor
!
! ==> salinity_factor = - ocn_ref_salinity(psu) * fwflux_factor
!
!-----------------------------------------------------------------------
fwflux_factor = 1.e-6_RKIND
salinity_factor = -ocn_ref_salinity*fwflux_factor
!-----------------------------------------------------------------------
!
! convert salt flux (kg/m^2/s) to salt flux (psu*m/s):
! -----------------------------------------------------
! density of freshwater rho_fw = 1.0e3 (kg/m^3)
! salt_flux_kg in (kg/m^2/s) = 1.0e2 (kg/m^2/s)
!
! salt_flux = - h2o_flux * ocn_ref_salinity / rho_fw
! salt_flux (msu*cm/s) = salt_flux_kg (kg/m^2/s)
! * 1.0e2 (kg/m^2/s)/(kg/m^2/s)
! / 1.0e3 (kg/m^3)
! = salt_flux_kg (kg/m^2/s)
! * sflux_factor (psu*m/s)/(kg/m^2/s)
!
! ==> sflux_factor = 1.0
!
!-----------------------------------------------------------------------
sflux_factor = 1.0_RKIND
!-----------------------------------------------------------------------
!
! convert fresh water mass flux (kg/m^2/s) to fresh water flux (m/s):
! --------------------------------------------------------------------
! density of freshwater rho_fw = 1.0e3 (kg/m^3)
! h2o_flux in (kg/m^2/s) = 1.0e2 (kg/m^2/s)
!
! fw_flux = h2o_flux / rho_fw
! fw_flux (cm/s) = h2o_flux (kg/m^2/s)
! * 1.0e2 (kg/m^2/s)
! / 1.0e3 (kg/m^3)
! = h2o_flux (kg/m^2/s)
! * fwmass_to_fwflux (m/s)/(kg/m^2/s)
!
! ==> fwmass_to_fwflux = 0.1
!
!-----------------------------------------------------------------------
fwmass_to_fwflux = 0.1_RKIND
mmol_to_kg_C = molecular_weight_C * 1.e-6_RKIND
mmol_to_kg_O2 = molecular_weight_O2 * 1.e-6_RKIND
end subroutine ocn_constants_init!}}}
!***********************************************************************
end module ocn_constants
!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
! vim: foldmethod=marker