Allocates and initializes the ocean model vertical grid structure.
72 type(param_file_type),
intent(in) :: param_file
73 type(verticalGrid_type),
pointer :: GV
74 type(unit_scale_type),
intent(in) :: US
79 integer :: nk, H_power
80 real :: H_rescale_factor
82 # include "version_variable.h"
83 character(len=16) :: mdl =
'MOM_verticalGrid'
85 if (
associated(gv))
call mom_error(fatal, &
86 'verticalGridInit: called with an associated GV pointer.')
90 call log_version(param_file, mdl, version, &
91 "Parameters providing information about the vertical grid.")
92 call get_param(param_file, mdl,
"G_EARTH", gv%mks_g_Earth, &
93 "The gravitational acceleration of the Earth.", &
94 units=
"m s-2", default = 9.80)
95 call get_param(param_file, mdl,
"RHO_0", gv%Rho0, &
96 "The mean ocean density used with BOUSSINESQ true to "//&
97 "calculate accelerations and the mass for conservation "//&
98 "properties, or with BOUSSINSEQ false to convert some "//&
99 "parameters from vertical units of m to kg m-2.", &
100 units=
"kg m-3", default=1035.0)
101 call get_param(param_file, mdl,
"BOUSSINESQ", gv%Boussinesq, &
102 "If true, make the Boussinesq approximation.", default=.true.)
103 call get_param(param_file, mdl,
"ANGSTROM", gv%Angstrom_m, &
104 "The minimum layer thickness, usually one-Angstrom.", &
105 units=
"m", default=1.0e-10)
106 call get_param(param_file, mdl,
"H_RESCALE_POWER", h_power, &
107 "An integer power of 2 that is used to rescale the model's "//&
108 "intenal units of thickness. Valid values range from -300 to 300.", &
109 units=
"nondim", default=0, debuggingparam=.true.)
110 if (abs(h_power) > 300)
call mom_error(fatal,
"verticalGridInit: "//&
111 "H_RESCALE_POWER is outside of the valid range of -300 to 300.")
112 h_rescale_factor = 1.0
113 if (h_power /= 0) h_rescale_factor = 2.0**h_power
114 if (.not.gv%Boussinesq)
then
115 call get_param(param_file, mdl,
"H_TO_KG_M2", gv%H_to_kg_m2,&
116 "A constant that translates thicknesses from the model's "//&
117 "internal units of thickness to kg m-2.", units=
"kg m-2 H-1", &
119 gv%H_to_kg_m2 = gv%H_to_kg_m2 * h_rescale_factor
121 call get_param(param_file, mdl,
"H_TO_M", gv%H_to_m, &
122 "A constant that translates the model's internal "//&
123 "units of thickness into m.", units=
"m H-1", default=1.0)
124 gv%H_to_m = gv%H_to_m * h_rescale_factor
126 gv%g_Earth = us%m_to_L**2*us%Z_to_m*us%T_to_s**2 * gv%mks_g_Earth
127 #ifdef STATIC_MEMORY_
129 call get_param(param_file, mdl,
"NK", nk, &
130 "The number of model layers.", units=
"nondim", &
132 if (nk /= nk_)
call mom_error(fatal,
"verticalGridInit: " // &
133 "Mismatched number of layers NK_ between MOM_memory.h and param_file")
136 call get_param(param_file, mdl,
"NK", nk, &
137 "The number of model layers.", units=
"nondim", fail_if_missing=.true.)
141 if (gv%Boussinesq)
then
142 gv%H_to_kg_m2 = gv%Rho0 * gv%H_to_m
143 gv%kg_m2_to_H = 1.0 / gv%H_to_kg_m2
144 gv%m_to_H = 1.0 / gv%H_to_m
145 gv%Angstrom_H = gv%m_to_H * gv%Angstrom_m
147 gv%kg_m2_to_H = 1.0 / gv%H_to_kg_m2
148 gv%m_to_H = gv%Rho0 * gv%kg_m2_to_H
149 gv%H_to_m = gv%H_to_kg_m2 / gv%Rho0
150 gv%Angstrom_H = gv%Angstrom_m*1000.0*gv%kg_m2_to_H
152 gv%H_subroundoff = 1e-20 * max(gv%Angstrom_H,gv%m_to_H*1e-17)
153 gv%H_to_Pa = gv%mks_g_Earth * gv%H_to_kg_m2
155 gv%H_to_Z = gv%H_to_m * us%m_to_Z
156 gv%Z_to_H = us%Z_to_m * gv%m_to_H
157 gv%Angstrom_Z = us%m_to_Z * gv%Angstrom_m
160 call log_param(param_file, mdl,
"M to THICKNESS", gv%m_to_H*h_rescale_factor)
161 call log_param(param_file, mdl,
"M to THICKNESS rescaled by 2^-n", gv%m_to_H)
162 call log_param(param_file, mdl,
"THICKNESS to M rescaled by 2^n", gv%H_to_m)
164 allocate( gv%sInterface(nk+1) )
165 allocate( gv%sLayer(nk) )
166 allocate( gv%g_prime(nk+1) ) ; gv%g_prime(:) = 0.0
168 allocate( gv%Rlay(nk+1) ) ; gv%Rlay(:) = 0.0