76 implicit none ;
private 88 logical :: use_temperature
90 logical :: restorebuoy
97 real,
dimension(:,:),
pointer :: &
98 t_restore(:,:) => null(), &
99 s_restore(:,:) => null(), &
101 pme(:,:) => null(), &
102 solar(:,:) => null(), &
105 character(len=200) :: inputdir
106 character(len=200) :: salinityrestore_file, sstrestore_file
107 character(len=200) :: solar_file, heating_file, pme_file
118 type(
forcing),
intent(inout) :: fluxes
119 type(time_type),
intent(in) :: day
138 integer :: i, j, is, ie, js, je, Isq, Ieq, Jsq, Jeq
139 integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB
143 call mom_error(fatal,
"MESO_wind_surface_forcing: " // &
144 "User forcing routine called without modification." )
146 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
147 isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
148 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
149 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
159 do j=js,je ;
do i=is-1,ieq
160 fluxes%taux(i,j) = g%mask2dCu(i,j) * 0.0
162 do j=js-1,jeq ;
do i=is,ie
163 fluxes%tauy(i,j) = g%mask2dCv(i,j) * 0.0
168 if (
associated(fluxes%ustar))
then ;
do j=js,je ;
do i=is,ie
170 fluxes%ustar(i,j) = g%mask2dT(i,j) * sqrt(cs%gust_const/cs%Rho0 + &
171 sqrt(0.5*(fluxes%taux(i-1,j)**2 + fluxes%taux(i,j)**2) + &
172 0.5*(fluxes%tauy(i,j-1)**2 + fluxes%tauy(i,j)**2))/cs%Rho0)
173 enddo ;
enddo ;
endif 179 type(
forcing),
intent(inout) :: fluxes
180 type(time_type),
intent(in) :: day
181 real,
intent(in) :: dt
212 real :: Salin_restore
213 real :: density_restore
216 real :: buoy_rest_const
219 integer :: i, j, is, ie, js, je
220 integer :: isd, ied, jsd, jed
222 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
223 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
230 if (cs%use_temperature)
then 256 call read_data(trim(cs%inputdir)//trim(cs%SSTrestore_file),
"SST", &
257 cs%T_Restore(:,:), domain=g%Domain%mpp_domain)
258 call read_data(trim(cs%inputdir)//trim(cs%salinityrestore_file),
"SAL", &
259 cs%S_Restore(:,:), domain=g%Domain%mpp_domain)
260 call read_data(trim(cs%inputdir)//trim(cs%heating_file),
"Heat", &
261 cs%Heat(:,:), domain=g%Domain%mpp_domain)
262 call read_data(trim(cs%inputdir)//trim(cs%PmE_file),
"PmE", &
263 cs%PmE(:,:), domain=g%Domain%mpp_domain)
264 call read_data(trim(cs%inputdir)//trim(cs%Solar_file),
"NET_SOL", &
265 cs%Solar(:,:), domain=g%Domain%mpp_domain)
269 if ( cs%use_temperature )
then 272 do j=js,je ;
do i=is,ie
275 fluxes%evap(i,j) = -0.0 * g%mask2dT(i,j)
276 fluxes%lprec(i,j) = cs%PmE(i,j) * cs%Rho0 * g%mask2dT(i,j)
279 fluxes%vprec(i,j) = 0.0
282 fluxes%lw(i,j) = 0.0 * g%mask2dT(i,j)
283 fluxes%latent(i,j) = 0.0 * g%mask2dT(i,j)
284 fluxes%sens(i,j) = cs%Heat(i,j) * g%mask2dT(i,j)
285 fluxes%sw(i,j) = cs%Solar(i,j) * g%mask2dT(i,j)
288 do j=js,je ;
do i=is,ie
291 fluxes%buoy(i,j) = 0.0 * g%mask2dT(i,j)
295 if (cs%restorebuoy)
then 296 if (cs%use_temperature)
then 303 rhoxcp = cs%Rho0 * fluxes%C_p
304 do j=js,je ;
do i=is,ie
307 if (g%mask2dT(i,j) > 0)
then 308 fluxes%heat_added(i,j) = g%mask2dT(i,j) * &
309 ((cs%T_Restore(i,j) - state%SST(i,j)) * rhoxcp * cs%Flux_const)
310 fluxes%vprec(i,j) = - (cs%Rho0*cs%Flux_const) * &
311 (cs%S_Restore(i,j) - state%SSS(i,j)) / &
312 (0.5*(state%SSS(i,j) + cs%S_Restore(i,j)))
314 fluxes%heat_added(i,j) = 0.0
315 fluxes%vprec(i,j) = 0.0
321 call mom_error(fatal,
"MESO_buoyancy_surface_forcing: " // &
322 "Buoyancy restoring used without modification." )
325 buoy_rest_const = -1.0 * (cs%G_Earth * cs%Flux_const) / cs%Rho0
326 do j=js,je ;
do i=is,ie
329 density_restore = 1030.0
331 fluxes%buoy(i,j) = g%mask2dT(i,j) * buoy_rest_const * &
332 (density_restore - state%sfc_density(i,j))
343 real,
pointer :: ptr(:,:)
344 integer :: isd, ied, jsd, jed
345 if (.not.
ASSOCIATED(ptr))
then 346 allocate(ptr(isd:ied,jsd:jed))
352 type(time_type),
intent(in) :: Time
355 type(
diag_ctrl),
target,
intent(in) :: diag
366 #include "version_variable.h" 367 character(len=40) :: mdl =
"MESO_surface_forcing" 369 if (
associated(cs))
then 370 call mom_error(warning,
"MESO_surface_forcing_init called with an associated "// &
371 "control structure.")
379 call get_param(param_file, mdl,
"ENABLE_THERMODYNAMICS", cs%use_temperature, &
380 "If true, Temperature and salinity are used as state \n"//&
381 "variables.", default=.true.)
383 call get_param(param_file, mdl,
"G_EARTH", cs%G_Earth, &
384 "The gravitational acceleration of the Earth.", &
385 units=
"m s-2", default = 9.80)
386 call get_param(param_file, mdl,
"RHO_0", cs%Rho0, &
387 "The mean ocean density used with BOUSSINESQ true to \n"//&
388 "calculate accelerations and the mass for conservation \n"//&
389 "properties, or with BOUSSINSEQ false to convert some \n"//&
390 "parameters from vertical units of m to kg m-2.", &
391 units=
"kg m-3", default=1035.0)
392 call get_param(param_file, mdl,
"GUST_CONST", cs%gust_const, &
393 "The background gustiness in the winds.", units=
"Pa", &
396 call get_param(param_file, mdl,
"RESTOREBUOY", cs%restorebuoy, &
397 "If true, the buoyancy fluxes drive the model back \n"//&
398 "toward some specified surface state with a rate \n"//&
399 "given by FLUXCONST.", default= .false.)
401 if (cs%restorebuoy)
then 402 call get_param(param_file, mdl,
"FLUXCONST", cs%Flux_const, &
403 "The constant that relates the restoring surface fluxes \n"//&
404 "to the relative surface anomalies (akin to a piston \n"//&
405 "velocity). Note the non-MKS units.", units=
"m day-1", &
406 fail_if_missing=.true.)
408 cs%Flux_const = cs%Flux_const / 86400.0
410 call get_param(param_file, mdl,
"SSTRESTORE_FILE", cs%SSTrestore_file, &
411 "The file with the SST toward which to restore in \n"//&
412 "variable TEMP.", fail_if_missing=.true.)
413 call get_param(param_file, mdl,
"SALINITYRESTORE_FILE", cs%salinityrestore_file, &
414 "The file with the surface salinity toward which to \n"//&
415 "restore in variable SALT.", fail_if_missing=.true.)
416 call get_param(param_file, mdl,
"SENSIBLEHEAT_FILE", cs%heating_file, &
417 "The file with the non-shortwave heat flux in \n"//&
418 "variable Heat.", fail_if_missing=.true.)
419 call get_param(param_file, mdl,
"PRECIP_FILE", cs%PmE_file, &
420 "The file with the net precipiation minus evaporation \n"//&
421 "in variable PmE.", fail_if_missing=.true.)
422 call get_param(param_file, mdl,
"SHORTWAVE_FILE", cs%Solar_file, &
423 "The file with the shortwave heat flux in \n"//&
424 "variable NET_SOL.", fail_if_missing=.true.)
425 call get_param(param_file, mdl,
"INPUTDIR", cs%inputdir, default=
".")
426 cs%inputdir = slasher(cs%inputdir)
The following structure contains pointers to various fields which may be used describe the surface st...
This module implements boundary forcing for MOM6.
Ocean grid type. See mom_grid for details.
subroutine, public meso_buoyancy_forcing(state, fluxes, day, dt, G, CS)
Provides the ocean grid type.
subroutine alloc_if_needed(ptr, isd, ied, jsd, jed)
subroutine, public allocate_forcing_type(G, fluxes, stress, ustar, water, heat, shelf, press, iceberg)
Conditionally allocate fields within the forcing type.
This module contains I/O framework code.
subroutine, public call_tracer_set_forcing(state, fluxes, day_start, day_interval, G, CS)
This subroutine calls the individual tracer modules' subroutines to specify or read quantities relate...
logical function, public is_root_pe()
Structure that contains pointers to the boundary forcing used to drive the liquid ocean simulated by ...
subroutine, public meso_surface_forcing_init(Time, G, param_file, diag, CS)
subroutine, public meso_wind_forcing(state, fluxes, day, G, CS)
subroutine, public mom_error(level, message, all_print)