Allocates and initializes the ocean model vertical grid structure.
76 type(param_file_type),
intent(in) :: param_file
77 type(verticalgrid_type),
pointer :: gv
78 type(unit_scale_type),
intent(in) :: us
83 integer :: nk, h_power
84 real :: h_rescale_factor
86 # include "version_variable.h" 87 character(len=16) :: mdl =
'MOM_verticalGrid' 89 if (
associated(gv))
call mom_error(fatal, &
90 'verticalGridInit: called with an associated GV pointer.')
94 call log_version(param_file, mdl, version, &
95 "Parameters providing information about the vertical grid.", &
96 log_to_all=.true., debugging=.true.)
97 call get_param(param_file, mdl,
"G_EARTH", gv%g_Earth, &
98 "The gravitational acceleration of the Earth.", &
99 units=
"m s-2", default = 9.80, scale=us%Z_to_m*us%m_s_to_L_T**2)
100 call get_param(param_file, mdl,
"RHO_0", gv%Rho0, &
101 "The mean ocean density used with BOUSSINESQ true to "//&
102 "calculate accelerations and the mass for conservation "//&
103 "properties, or with BOUSSINSEQ false to convert some "//&
104 "parameters from vertical units of m to kg m-2.", &
105 units=
"kg m-3", default=1035.0, scale=us%kg_m3_to_R)
106 call get_param(param_file, mdl,
"BOUSSINESQ", gv%Boussinesq, &
107 "If true, make the Boussinesq approximation.", default=.true.)
108 call get_param(param_file, mdl,
"ANGSTROM", gv%Angstrom_m, &
109 "The minimum layer thickness, usually one-Angstrom.", &
110 units=
"m", default=1.0e-10)
111 call get_param(param_file, mdl,
"H_RESCALE_POWER", h_power, &
112 "An integer power of 2 that is used to rescale the model's "//&
113 "intenal units of thickness. Valid values range from -300 to 300.", &
114 units=
"nondim", default=0, debuggingparam=.true.)
115 if (abs(h_power) > 300)
call mom_error(fatal,
"verticalGridInit: "//&
116 "H_RESCALE_POWER is outside of the valid range of -300 to 300.")
117 h_rescale_factor = 1.0
118 if (h_power /= 0) h_rescale_factor = 2.0**h_power
119 if (.not.gv%Boussinesq)
then 120 call get_param(param_file, mdl,
"H_TO_KG_M2", gv%H_to_kg_m2,&
121 "A constant that translates thicknesses from the model's "//&
122 "internal units of thickness to kg m-2.", units=
"kg m-2 H-1", &
124 gv%H_to_kg_m2 = gv%H_to_kg_m2 * h_rescale_factor
126 call get_param(param_file, mdl,
"H_TO_M", gv%H_to_m, &
127 "A constant that translates the model's internal "//&
128 "units of thickness into m.", units=
"m H-1", default=1.0)
129 gv%H_to_m = gv%H_to_m * h_rescale_factor
131 gv%mks_g_Earth = us%L_T_to_m_s**2*us%m_to_Z * gv%g_Earth
132 #ifdef STATIC_MEMORY_ 134 call get_param(param_file, mdl,
"NK", nk, &
135 "The number of model layers.", units=
"nondim", &
137 if (nk /= nk_)
call mom_error(fatal,
"verticalGridInit: " // &
138 "Mismatched number of layers NK_ between MOM_memory.h and param_file")
141 call get_param(param_file, mdl,
"NK", nk, &
142 "The number of model layers.", units=
"nondim", fail_if_missing=.true.)
146 if (gv%Boussinesq)
then 147 gv%H_to_kg_m2 = us%R_to_kg_m3*gv%Rho0 * gv%H_to_m
148 gv%kg_m2_to_H = 1.0 / gv%H_to_kg_m2
149 gv%m_to_H = 1.0 / gv%H_to_m
150 gv%Angstrom_H = gv%m_to_H * gv%Angstrom_m
151 gv%H_to_MKS = gv%H_to_m
153 gv%kg_m2_to_H = 1.0 / gv%H_to_kg_m2
154 gv%m_to_H = us%R_to_kg_m3*gv%Rho0 * gv%kg_m2_to_H
155 gv%H_to_m = gv%H_to_kg_m2 / (us%R_to_kg_m3*gv%Rho0)
156 gv%Angstrom_H = gv%Angstrom_m*1000.0*gv%kg_m2_to_H
157 gv%H_to_MKS = gv%H_to_kg_m2
159 gv%H_subroundoff = 1e-20 * max(gv%Angstrom_H,gv%m_to_H*1e-17)
160 gv%H_to_Pa = us%L_T_to_m_s**2*us%m_to_Z * gv%g_Earth * gv%H_to_kg_m2
162 gv%H_to_Z = gv%H_to_m * us%m_to_Z
163 gv%Z_to_H = us%Z_to_m * gv%m_to_H
164 gv%Angstrom_Z = us%m_to_Z * gv%Angstrom_m
166 gv%H_to_RZ = gv%H_to_kg_m2 * us%kg_m3_to_R * us%m_to_Z
167 gv%RZ_to_H = gv%kg_m2_to_H * us%R_to_kg_m3 * us%Z_to_m
170 call log_param(param_file, mdl,
"M to THICKNESS", gv%m_to_H*h_rescale_factor)
171 call log_param(param_file, mdl,
"M to THICKNESS rescaled by 2^-n", gv%m_to_H)
172 call log_param(param_file, mdl,
"THICKNESS to M rescaled by 2^n", gv%H_to_m)
174 allocate( gv%sInterface(nk+1) )
175 allocate( gv%sLayer(nk) )
176 allocate( gv%g_prime(nk+1) ) ; gv%g_prime(:) = 0.0
177 allocate( gv%Rlay(nk) ) ; gv%Rlay(:) = 0.0