21 implicit none ;
private 23 public meso_buoyancy_forcing, meso_surface_forcing_init
28 logical :: use_temperature
29 logical :: restorebuoy
35 real,
dimension(:,:),
pointer :: &
36 t_restore(:,:) => null(), &
37 s_restore(:,:) => null(), &
40 real,
dimension(:,:),
pointer :: heat(:,:) => null()
42 character(len=200) :: inputdir
43 character(len=200) :: salinityrestore_file
44 character(len=200) :: sstrestore_file
45 character(len=200) :: solar_file
46 character(len=200) :: heating_file
47 character(len=200) :: pme_file
52 logical :: first_call = .true.
58 subroutine meso_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)
61 type(
forcing),
intent(inout) :: fluxes
62 type(time_type),
intent(in) :: day
63 real,
intent(in) :: dt
82 real :: density_restore
84 real :: buoy_rest_const
87 integer :: i, j, is, ie, js, je
88 integer :: isd, ied, jsd, jed
90 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
91 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
98 if (cs%use_temperature)
then 99 call safe_alloc_ptr(fluxes%evap, isd, ied, jsd, jed)
100 call safe_alloc_ptr(fluxes%lprec, isd, ied, jsd, jed)
101 call safe_alloc_ptr(fluxes%fprec, isd, ied, jsd, jed)
102 call safe_alloc_ptr(fluxes%lrunoff, isd, ied, jsd, jed)
103 call safe_alloc_ptr(fluxes%frunoff, isd, ied, jsd, jed)
104 call safe_alloc_ptr(fluxes%vprec, isd, ied, jsd, jed)
106 call safe_alloc_ptr(fluxes%sw, isd, ied, jsd, jed)
107 call safe_alloc_ptr(fluxes%lw, isd, ied, jsd, jed)
108 call safe_alloc_ptr(fluxes%latent, isd, ied, jsd, jed)
109 call safe_alloc_ptr(fluxes%sens, isd, ied, jsd, jed)
110 call safe_alloc_ptr(fluxes%heat_content_lprec, isd, ied, jsd, jed)
112 call safe_alloc_ptr(fluxes%buoy, isd, ied, jsd, jed)
117 if (cs%restorebuoy .and. first_call)
then 118 call safe_alloc_ptr(cs%T_Restore, isd, ied, jsd, jed)
119 call safe_alloc_ptr(cs%S_Restore, isd, ied, jsd, jed)
120 call safe_alloc_ptr(cs%Heat, isd, ied, jsd, jed)
121 call safe_alloc_ptr(cs%PmE, isd, ied, jsd, jed)
122 call safe_alloc_ptr(cs%Solar, isd, ied, jsd, jed)
124 call mom_read_data(trim(cs%inputdir)//trim(cs%SSTrestore_file),
"SST", &
125 cs%T_Restore(:,:), g%Domain)
126 call mom_read_data(trim(cs%inputdir)//trim(cs%salinityrestore_file),
"SAL", &
127 cs%S_Restore(:,:), g%Domain)
128 call mom_read_data(trim(cs%inputdir)//trim(cs%heating_file),
"Heat", &
129 cs%Heat(:,:), g%Domain, scale=us%W_m2_to_QRZ_T)
130 call mom_read_data(trim(cs%inputdir)//trim(cs%PmE_file),
"PmE", &
131 cs%PmE(:,:), g%Domain, scale=us%m_to_Z*us%T_to_s)
132 call mom_read_data(trim(cs%inputdir)//trim(cs%Solar_file),
"NET_SOL", &
133 cs%Solar(:,:), g%Domain, scale=us%W_m2_to_QRZ_T)
137 if ( cs%use_temperature )
then 140 do j=js,je ;
do i=is,ie
143 fluxes%evap(i,j) = -0.0 * g%mask2dT(i,j)
144 fluxes%lprec(i,j) = cs%PmE(i,j) * cs%Rho0 * g%mask2dT(i,j)
147 fluxes%vprec(i,j) = 0.0
150 fluxes%lw(i,j) = 0.0 * g%mask2dT(i,j)
151 fluxes%latent(i,j) = 0.0 * g%mask2dT(i,j)
152 fluxes%sens(i,j) = cs%Heat(i,j) * g%mask2dT(i,j)
153 fluxes%sw(i,j) = cs%Solar(i,j) * g%mask2dT(i,j)
156 do j=js,je ;
do i=is,ie
159 fluxes%buoy(i,j) = 0.0 * g%mask2dT(i,j)
163 if (cs%restorebuoy)
then 164 if (cs%use_temperature)
then 165 call safe_alloc_ptr(fluxes%heat_added, isd, ied, jsd, jed)
171 rhoxcp = cs%Rho0 * fluxes%C_p
172 do j=js,je ;
do i=is,ie
175 if (g%mask2dT(i,j) > 0)
then 176 fluxes%heat_added(i,j) = g%mask2dT(i,j) * &
177 ((cs%T_Restore(i,j) - sfc_state%SST(i,j)) * rhoxcp * cs%Flux_const)
178 fluxes%vprec(i,j) = - (cs%Rho0 * cs%Flux_const) * &
179 (cs%S_Restore(i,j) - sfc_state%SSS(i,j)) / &
180 (0.5*(sfc_state%SSS(i,j) + cs%S_Restore(i,j)))
182 fluxes%heat_added(i,j) = 0.0
183 fluxes%vprec(i,j) = 0.0
189 call mom_error(fatal,
"MESO_buoyancy_surface_forcing: " // &
190 "Buoyancy restoring used without modification." )
193 buoy_rest_const = -1.0 * (cs%G_Earth * cs%Flux_const) / cs%Rho0
194 do j=js,je ;
do i=is,ie
197 density_restore = 1030.0 * us%kg_m3_to_R
199 fluxes%buoy(i,j) = g%mask2dT(i,j) * buoy_rest_const * &
200 (density_restore - sfc_state%sfc_density(i,j))
205 end subroutine meso_buoyancy_forcing
208 subroutine meso_surface_forcing_init(Time, G, US, param_file, diag, CS)
210 type(time_type),
intent(in) :: Time
214 type(
diag_ctrl),
target,
intent(inout) :: diag
219 #include "version_variable.h" 220 character(len=40) :: mdl =
"MESO_surface_forcing" 222 if (
associated(cs))
then 223 call mom_error(warning,
"MESO_surface_forcing_init called with an associated "// &
224 "control structure.")
232 call get_param(param_file, mdl,
"ENABLE_THERMODYNAMICS", cs%use_temperature, &
233 "If true, Temperature and salinity are used as state "//&
234 "variables.", default=.true.)
236 call get_param(param_file, mdl,
"G_EARTH", cs%G_Earth, &
237 "The gravitational acceleration of the Earth.", &
238 units=
"m s-2", default = 9.80, scale=us%m_to_L**2*us%Z_to_m*us%T_to_s**2)
239 call get_param(param_file, mdl,
"RHO_0", cs%Rho0, &
240 "The mean ocean density used with BOUSSINESQ true to "//&
241 "calculate accelerations and the mass for conservation "//&
242 "properties, or with BOUSSINSEQ false to convert some "//&
243 "parameters from vertical units of m to kg m-2.", &
244 units=
"kg m-3", default=1035.0, scale=us%kg_m3_to_R)
245 call get_param(param_file, mdl,
"GUST_CONST", cs%gust_const, &
246 "The background gustiness in the winds.", units=
"Pa", default=0.0)
248 call get_param(param_file, mdl,
"RESTOREBUOY", cs%restorebuoy, &
249 "If true, the buoyancy fluxes drive the model back "//&
250 "toward some specified surface state with a rate "//&
251 "given by FLUXCONST.", default= .false.)
253 if (cs%restorebuoy)
then 254 call get_param(param_file, mdl,
"FLUXCONST", cs%Flux_const, &
255 "The constant that relates the restoring surface fluxes to the relative "//&
256 "surface anomalies (akin to a piston velocity). Note the non-MKS units.", &
257 default=0.0, units=
"m day-1", scale=us%m_to_Z/(86400.0*us%s_to_T))
259 call get_param(param_file, mdl,
"SSTRESTORE_FILE", cs%SSTrestore_file, &
260 "The file with the SST toward which to restore in "//&
261 "variable TEMP.", fail_if_missing=.true.)
262 call get_param(param_file, mdl,
"SALINITYRESTORE_FILE", cs%salinityrestore_file, &
263 "The file with the surface salinity toward which to "//&
264 "restore in variable SALT.", fail_if_missing=.true.)
265 call get_param(param_file, mdl,
"SENSIBLEHEAT_FILE", cs%heating_file, &
266 "The file with the non-shortwave heat flux in "//&
267 "variable Heat.", fail_if_missing=.true.)
268 call get_param(param_file, mdl,
"PRECIP_FILE", cs%PmE_file, &
269 "The file with the net precipiation minus evaporation "//&
270 "in variable PmE.", fail_if_missing=.true.)
271 call get_param(param_file, mdl,
"SHORTWAVE_FILE", cs%Solar_file, &
272 "The file with the shortwave heat flux in "//&
273 "variable NET_SOL.", fail_if_missing=.true.)
274 call get_param(param_file, mdl,
"INPUTDIR", cs%inputdir, default=
".")
275 cs%inputdir = slasher(cs%inputdir)
279 end subroutine meso_surface_forcing_init
Pointers to various fields which may be used describe the surface state of MOM, and which will be ret...
Wraps the FMS time manager functions.
This module implements boundary forcing for MOM6.
Ocean grid type. See mom_grid for details.
Allocate the fields of a mechanical forcing type, based on either a set of input flags for each group...
A structure that can be parsed to read and document run-time parameters.
Provides the ocean grid type.
This module contains I/O framework code.
The MOM6 facility to parse input files for runtime parameters.
Do a halo update on a pair of arrays representing the two components of a vector. ...
Orchestrates the registration and calling of tracer packages.
Structure that contains pointers to the mechanical forcing at the surface used to drive the liquid oc...
Allocate the fields of a (flux) forcing type, based on either a set of input flags for each group of ...
This control structure is used to store parameters associated with the MESO forcing.
Make a diagnostic available for averaging or output.
Describes various unit conversion factors.
Provides a transparent unit rescaling type to facilitate dimensional consistency testing.
Describes the decomposed MOM domain and has routines for communications across PEs.
Routines for error handling and I/O management.
The control structure for orchestrating the calling of tracer packages.
Structure that contains pointers to the boundary forcing used to drive the liquid ocean simulated by ...
An overloaded interface to log version information about modules.
Indicate whether a file exists, perhaps with domain decomposition.
Provides transparent structures with groups of MOM6 variables and supporting routines.
Sets forcing for the MESO configuration.
Do a halo update on an array.
Read a data field from a file.
An overloaded interface to read and log the values of various types of parameters.