Bouyancy forcing for the boundary-forced-basin (BFB) configuration.
51 type(surface),
intent(inout) :: state
53 type(forcing),
intent(inout) :: fluxes
56 type(time_type),
intent(in) :: day
57 real,
intent(in) :: dt
59 type(ocean_grid_type),
intent(in) :: G
60 type(unit_scale_type),
intent(in) :: US
61 type(BFB_surface_forcing_CS),
pointer :: CS
67 real :: density_restore
70 real :: buoy_rest_const
72 integer :: i, j, is, ie, js, je
73 integer :: isd, ied, jsd, jed
75 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
76 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
80 if (cs%use_temperature)
then
81 call safe_alloc_ptr(fluxes%evap, isd, ied, jsd, jed)
82 call safe_alloc_ptr(fluxes%lprec, isd, ied, jsd, jed)
83 call safe_alloc_ptr(fluxes%fprec, isd, ied, jsd, jed)
84 call safe_alloc_ptr(fluxes%lrunoff, isd, ied, jsd, jed)
85 call safe_alloc_ptr(fluxes%frunoff, isd, ied, jsd, jed)
86 call safe_alloc_ptr(fluxes%vprec, isd, ied, jsd, jed)
88 call safe_alloc_ptr(fluxes%sw, isd, ied, jsd, jed)
89 call safe_alloc_ptr(fluxes%lw, isd, ied, jsd, jed)
90 call safe_alloc_ptr(fluxes%latent, isd, ied, jsd, jed)
91 call safe_alloc_ptr(fluxes%sens, isd, ied, jsd, jed)
93 call safe_alloc_ptr(fluxes%buoy, isd, ied, jsd, jed)
96 if ( cs%use_temperature )
then
99 do j=js,je ;
do i=is,ie
102 fluxes%evap(i,j) = -0.0 * g%mask2dT(i,j)
103 fluxes%lprec(i,j) = 0.0 * g%mask2dT(i,j)
106 fluxes%vprec(i,j) = 0.0
109 fluxes%lw(i,j) = 0.0 * g%mask2dT(i,j)
110 fluxes%latent(i,j) = 0.0 * g%mask2dT(i,j)
111 fluxes%sens(i,j) = 0.0 * g%mask2dT(i,j)
112 fluxes%sw(i,j) = 0.0 * g%mask2dT(i,j)
115 do j=js,je ;
do i=is,ie
118 fluxes%buoy(i,j) = 0.0 * g%mask2dT(i,j)
122 if (cs%restorebuoy)
then
123 if (cs%use_temperature)
then
124 call safe_alloc_ptr(fluxes%heat_added, isd, ied, jsd, jed)
127 call mom_error(fatal,
"User_buoyancy_surface_forcing: " // &
128 "Temperature and salinity restoring used without modification." )
130 rhoxcp = cs%Rho0 * fluxes%C_p
131 do j=js,je ;
do i=is,ie
137 fluxes%heat_added(i,j) = (g%mask2dT(i,j) * (rhoxcp * cs%Flux_const)) * &
138 (temp_restore - state%SST(i,j))
139 fluxes%vprec(i,j) = - (g%mask2dT(i,j) * (cs%Rho0*cs%Flux_const)) * &
140 ((salin_restore - state%SSS(i,j)) / &
141 (0.5 * (salin_restore + state%SSS(i,j))))
150 buoy_rest_const = -1.0 * (cs%G_Earth * us%m_to_Z*us%T_to_s*cs%Flux_const) / cs%Rho0
152 do j=js,je ;
do i=is,ie
155 if (g%geoLatT(i,j) < cs%lfrslat)
then
156 temp_restore = cs%SST_s
157 elseif (g%geoLatT(i,j) > cs%lfrnlat)
then
158 temp_restore = cs%SST_n
160 temp_restore = (cs%SST_s - cs%SST_n)/(cs%lfrslat - cs%lfrnlat) * &
161 (g%geoLatT(i,j) - cs%lfrslat) + cs%SST_s
164 density_restore = temp_restore*cs%drho_dt + cs%Rho0
166 fluxes%buoy(i,j) = g%mask2dT(i,j) * buoy_rest_const * &
167 (density_restore - state%sfc_density(i,j))