This subroutine specifies the current surface fluxes of buoyancy or temperature and fresh water. It may also be modified to add surface fluxes of user provided tracers.
103 type(surface),
intent(inout) :: sfc_state
105 type(forcing),
intent(inout) :: fluxes
106 type(time_type),
intent(in) :: day
107 real,
intent(in) :: dt
109 type(ocean_grid_type),
intent(in) :: G
110 type(unit_scale_type),
intent(in) :: US
111 type(user_surface_forcing_CS),
pointer :: CS
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))