21 implicit none ;
private 23 public user_wind_forcing, user_buoyancy_forcing, user_surface_forcing_init
34 logical :: use_temperature
35 logical :: restorebuoy
51 subroutine user_wind_forcing(sfc_state, forces, day, G, US, CS)
55 type(time_type),
intent(in) :: day
62 integer :: i, j, is, ie, js, je, Isq, Ieq, Jsq, Jeq
66 call mom_error(fatal,
"User_wind_surface_forcing: " // &
67 "User forcing routine called without modification." )
69 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
70 isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
80 do j=js,je ;
do i=is-1,ieq
82 forces%taux(i,j) = g%mask2dCu(i,j) * 0.0*us%kg_m3_to_R*us%m_s_to_L_T**2*us%L_to_Z
84 do j=js-1,jeq ;
do i=is,ie
85 forces%tauy(i,j) = g%mask2dCv(i,j) * 0.0
90 if (
associated(forces%ustar))
then ;
do j=js,je ;
do i=is,ie
92 forces%ustar(i,j) = g%mask2dT(i,j) * sqrt((cs%gust_const + &
93 sqrt(0.5*(forces%taux(i-1,j)**2 + forces%taux(i,j)**2) + &
94 0.5*(forces%tauy(i,j-1)**2 + forces%tauy(i,j)**2))) * (us%L_to_Z/cs%Rho0))
97 end subroutine user_wind_forcing
102 subroutine user_buoyancy_forcing(sfc_state, fluxes, day, dt, G, US, CS)
105 type(
forcing),
intent(inout) :: fluxes
106 type(time_type),
intent(in) :: day
107 real,
intent(in) :: dt
130 real :: Salin_restore
131 real :: density_restore
134 real :: buoy_rest_const
137 integer :: i, j, is, ie, js, je
138 integer :: isd, ied, jsd, jed
140 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
141 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
145 call mom_error(fatal,
"User_buoyancy_surface_forcing: " // &
146 "User forcing routine called without modification." )
150 if (cs%use_temperature)
then 151 call safe_alloc_ptr(fluxes%evap, isd, ied, jsd, jed)
152 call safe_alloc_ptr(fluxes%lprec, isd, ied, jsd, jed)
153 call safe_alloc_ptr(fluxes%fprec, isd, ied, jsd, jed)
154 call safe_alloc_ptr(fluxes%lrunoff, isd, ied, jsd, jed)
155 call safe_alloc_ptr(fluxes%frunoff, isd, ied, jsd, jed)
156 call safe_alloc_ptr(fluxes%vprec, isd, ied, jsd, jed)
158 call safe_alloc_ptr(fluxes%sw, isd, ied, jsd, jed)
159 call safe_alloc_ptr(fluxes%lw, isd, ied, jsd, jed)
160 call safe_alloc_ptr(fluxes%latent, isd, ied, jsd, jed)
161 call safe_alloc_ptr(fluxes%sens, isd, ied, jsd, jed)
163 call safe_alloc_ptr(fluxes%buoy, isd, ied, jsd, jed)
169 if ( cs%use_temperature )
then 172 do j=js,je ;
do i=is,ie
175 fluxes%evap(i,j) = -0.0 * g%mask2dT(i,j)
176 fluxes%lprec(i,j) = 0.0 * g%mask2dT(i,j)
179 fluxes%vprec(i,j) = 0.0
182 fluxes%lw(i,j) = 0.0 * g%mask2dT(i,j)
183 fluxes%latent(i,j) = 0.0 * g%mask2dT(i,j)
184 fluxes%sens(i,j) = 0.0 * g%mask2dT(i,j)
185 fluxes%sw(i,j) = 0.0 * g%mask2dT(i,j)
188 do j=js,je ;
do i=is,ie
191 fluxes%buoy(i,j) = 0.0 * g%mask2dT(i,j)
195 if (cs%restorebuoy)
then 196 if (cs%use_temperature)
then 197 call safe_alloc_ptr(fluxes%heat_added, isd, ied, jsd, jed)
200 call mom_error(fatal,
"User_buoyancy_surface_forcing: " // &
201 "Temperature and salinity restoring used without modification." )
203 rhoxcp = cs%Rho0 * fluxes%C_p
204 do j=js,je ;
do i=is,ie
210 fluxes%heat_added(i,j) = (g%mask2dT(i,j) * (rhoxcp * cs%Flux_const)) * &
211 (temp_restore - sfc_state%SST(i,j))
212 fluxes%vprec(i,j) = - (g%mask2dT(i,j) * (cs%Rho0*cs%Flux_const)) * &
213 ((salin_restore - sfc_state%SSS(i,j)) / (0.5 * (salin_restore + sfc_state%SSS(i,j))))
218 call mom_error(fatal,
"User_buoyancy_surface_forcing: " // &
219 "Buoyancy restoring used without modification." )
222 buoy_rest_const = -1.0 * (cs%G_Earth * cs%Flux_const) / cs%Rho0
223 do j=js,je ;
do i=is,ie
226 density_restore = 1030.0*us%kg_m3_to_R
228 fluxes%buoy(i,j) = g%mask2dT(i,j) * buoy_rest_const * &
229 (density_restore - sfc_state%sfc_density(i,j))
234 end subroutine user_buoyancy_forcing
237 subroutine user_surface_forcing_init(Time, G, US, param_file, diag, CS)
238 type(time_type),
intent(in) :: Time
242 type(
diag_ctrl),
target,
intent(in) :: diag
247 #include "version_variable.h" 248 character(len=40) :: mdl =
"user_surface_forcing" 250 if (
associated(cs))
then 251 call mom_error(warning,
"USER_surface_forcing_init called with an associated "// &
252 "control structure.")
260 call get_param(param_file, mdl,
"ENABLE_THERMODYNAMICS", cs%use_temperature, &
261 "If true, Temperature and salinity are used as state "//&
262 "variables.", default=.true.)
264 call get_param(param_file, mdl,
"G_EARTH", cs%G_Earth, &
265 "The gravitational acceleration of the Earth.", &
266 units=
"m s-2", default = 9.80, scale=us%m_to_L**2*us%Z_to_m*us%T_to_s**2)
267 call get_param(param_file, mdl,
"RHO_0", cs%Rho0, &
268 "The mean ocean density used with BOUSSINESQ true to "//&
269 "calculate accelerations and the mass for conservation "//&
270 "properties, or with BOUSSINSEQ false to convert some "//&
271 "parameters from vertical units of m to kg m-2.", &
272 units=
"kg m-3", default=1035.0, scale=us%kg_m3_to_R)
273 call get_param(param_file, mdl,
"GUST_CONST", cs%gust_const, &
274 "The background gustiness in the winds.", &
275 units=
"Pa", default=0.0, scale=us%kg_m3_to_R*us%m_s_to_L_T**2*us%L_to_Z)
277 call get_param(param_file, mdl,
"RESTOREBUOY", cs%restorebuoy, &
278 "If true, the buoyancy fluxes drive the model back "//&
279 "toward some specified surface state with a rate "//&
280 "given by FLUXCONST.", default= .false.)
281 if (cs%restorebuoy)
then 282 call get_param(param_file, mdl,
"FLUXCONST", cs%Flux_const, &
283 "The constant that relates the restoring surface fluxes to the relative "//&
284 "surface anomalies (akin to a piston velocity). Note the non-MKS units.", &
285 default=0.0, units=
"m day-1", scale=us%m_to_Z/(86400.0*us%s_to_T))
288 end subroutine user_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 ...
Make a diagnostic available for averaging or output.
This control structure should be used to store any run-time variables associated with the user-specif...
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.
Template for user to code up surface forcing.
Provides transparent structures with groups of MOM6 variables and supporting routines.
Do a halo update on an array.
An overloaded interface to read and log the values of various types of parameters.