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.
102 type(surface),
intent(inout) :: sfc_state
104 type(forcing),
intent(inout) :: fluxes
105 type(time_type),
intent(in) :: day
106 real,
intent(in) :: dt
108 type(ocean_grid_type),
intent(in) :: G
109 type(unit_scale_type),
intent(in) :: US
110 type(user_surface_forcing_CS),
pointer :: CS
129 real :: Salin_restore
130 real :: density_restore
133 real :: buoy_rest_const
136 integer :: i, j, is, ie, js, je
137 integer :: isd, ied, jsd, jed
139 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
140 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
144 call mom_error(fatal,
"User_buoyancy_surface_forcing: " // &
145 "User forcing routine called without modification." )
149 if (cs%use_temperature)
then
150 call safe_alloc_ptr(fluxes%evap, isd, ied, jsd, jed)
151 call safe_alloc_ptr(fluxes%lprec, isd, ied, jsd, jed)
152 call safe_alloc_ptr(fluxes%fprec, isd, ied, jsd, jed)
153 call safe_alloc_ptr(fluxes%lrunoff, isd, ied, jsd, jed)
154 call safe_alloc_ptr(fluxes%frunoff, isd, ied, jsd, jed)
155 call safe_alloc_ptr(fluxes%vprec, isd, ied, jsd, jed)
157 call safe_alloc_ptr(fluxes%sw, isd, ied, jsd, jed)
158 call safe_alloc_ptr(fluxes%lw, isd, ied, jsd, jed)
159 call safe_alloc_ptr(fluxes%latent, isd, ied, jsd, jed)
160 call safe_alloc_ptr(fluxes%sens, isd, ied, jsd, jed)
162 call safe_alloc_ptr(fluxes%buoy, isd, ied, jsd, jed)
168 if ( cs%use_temperature )
then
171 do j=js,je ;
do i=is,ie
174 fluxes%evap(i,j) = -0.0 * g%mask2dT(i,j)
175 fluxes%lprec(i,j) = 0.0 * g%mask2dT(i,j)
178 fluxes%vprec(i,j) = 0.0
181 fluxes%lw(i,j) = 0.0 * g%mask2dT(i,j)
182 fluxes%latent(i,j) = 0.0 * g%mask2dT(i,j)
183 fluxes%sens(i,j) = 0.0 * g%mask2dT(i,j)
184 fluxes%sw(i,j) = 0.0 * g%mask2dT(i,j)
187 do j=js,je ;
do i=is,ie
190 fluxes%buoy(i,j) = 0.0 * g%mask2dT(i,j)
194 if (cs%restorebuoy)
then
195 if (cs%use_temperature)
then
196 call safe_alloc_ptr(fluxes%heat_added, isd, ied, jsd, jed)
199 call mom_error(fatal,
"User_buoyancy_surface_forcing: " // &
200 "Temperature and salinity restoring used without modification." )
202 rhoxcp = cs%Rho0 * fluxes%C_p
203 do j=js,je ;
do i=is,ie
209 fluxes%heat_added(i,j) = (g%mask2dT(i,j) * (rhoxcp * cs%Flux_const)) * &
210 (temp_restore - sfc_state%SST(i,j))
211 fluxes%vprec(i,j) = - (g%mask2dT(i,j) * (cs%Rho0*cs%Flux_const)) * &
212 ((salin_restore - sfc_state%SSS(i,j)) / &
213 (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 * us%m_to_Z*us%T_to_s*cs%Flux_const) / cs%Rho0
223 do j=js,je ;
do i=is,ie
226 density_restore = 1030.0
228 fluxes%buoy(i,j) = g%mask2dT(i,j) * buoy_rest_const * &
229 (density_restore - sfc_state%sfc_density(i,j))