Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 16 additions & 27 deletions src/core/MOM_forcing_type.F90
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ subroutine extractFluxes1d(G, GV, US, fluxes, optics, nsw, j, dt, &
FluxRescaleDepth, useRiverHeatContent, useCalvingHeatContent, &
h, T, netMassInOut, netMassOut, net_heat, net_salt, pen_SW_bnd, tv, &
aggregate_FW, nonpenSW, netmassInOut_rate, net_Heat_Rate, &
net_salt_rate, pen_sw_bnd_Rate, skip_diags)
net_salt_rate, pen_sw_bnd_Rate)

type(ocean_grid_type), intent(in) :: G !< ocean grid structure
type(verticalGrid_type), intent(in) :: GV !< ocean vertical grid structure
Expand Down Expand Up @@ -452,7 +452,6 @@ subroutine extractFluxes1d(G, GV, US, fluxes, optics, nsw, j, dt, &
real, dimension(max(1,nsw),G%isd:G%ied), &
optional, intent(out) :: pen_sw_bnd_rate !< Rate of penetrative shortwave heating
!! [degC H T-1 ~> degC m s-1 or degC kg m-2 s-1].
logical, optional, intent(in) :: skip_diags !< If present and true, skip calculating diagnostics

! local
real :: htot(SZI_(G)) ! total ocean depth [H ~> m or kg m-2]
Expand Down Expand Up @@ -492,7 +491,6 @@ subroutine extractFluxes1d(G, GV, US, fluxes, optics, nsw, j, dt, &
is = G%isc ; ie = G%iec ; nz = GV%ke

calculate_diags = .true.
if (present(skip_diags)) calculate_diags = .not. skip_diags

! error checking

Expand Down Expand Up @@ -914,7 +912,7 @@ end subroutine extractFluxes2d
!! extractFluxes routine allows us to get "stuf per time" rather than the time integrated
!! fluxes needed in other routines that call extractFluxes.
subroutine calculateBuoyancyFlux1d(G, GV, US, fluxes, optics, nsw, h, Temp, Salt, tv, j, &
buoyancyFlux, netHeatMinusSW, netSalt, skip_diags)
buoyancyFlux, netHeatMinusSW, netSalt)
type(ocean_grid_type), intent(in) :: G !< ocean grid
type(verticalGrid_type), intent(in) :: GV !< ocean vertical grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
Expand All @@ -928,12 +926,11 @@ subroutine calculateBuoyancyFlux1d(G, GV, US, fluxes, optics, nsw, h, Temp, Salt
type(thermo_var_ptrs), intent(inout) :: tv !< thermodynamics type
integer, intent(in) :: j !< j-row to work on
real, dimension(SZI_(G),SZK_(GV)+1), intent(inout) :: buoyancyFlux !< buoyancy fluxes [L2 T-3 ~> m2 s-3]
real, dimension(SZI_(G)), intent(inout) :: netHeatMinusSW !< surf Heat flux
real, dimension(SZI_(G)), intent(inout) :: netHeatMinusSW !< Surface heat flux excluding shortwave
!! [degC H s-1 ~> degC m s-1 or degC kg m-2 s-1]
real, dimension(SZI_(G)), intent(inout) :: netSalt !< surf salt flux
real, dimension(SZI_(G)), intent(inout) :: netSalt !< surface salt flux
!! [ppt H s-1 ~> ppt m s-1 or ppt kg m-2 s-1]
logical, optional, intent(in) :: skip_diags !< If present and true, skip calculating
!! diagnostics inside extractFluxes1d()

! local variables
integer :: k
real, parameter :: dt = 1. ! to return a rate from extractFluxes1d
Expand All @@ -942,12 +939,12 @@ subroutine calculateBuoyancyFlux1d(G, GV, US, fluxes, optics, nsw, h, Temp, Salt
! [H s-1 ~> m s-1 or kg m-2 s-1]
real, dimension(SZI_(G)) :: netHeat ! net temp flux [degC H s-1 ~> degC m s-2 or degC kg m-2 s-1]
real, dimension(max(nsw,1), SZI_(G)) :: penSWbnd ! penetrating SW radiation by band
! [degC H ~> degC m or degC kg m-2]
! [degC H s-1 ~> degC m s-1 or degC kg m-2 s-1]
real, dimension(SZI_(G)) :: pressure ! pressure at the surface [R L2 T-2 ~> Pa]
real, dimension(SZI_(G)) :: dRhodT ! density partial derivative wrt temp [R degC-1 ~> kg m-3 degC-1]
real, dimension(SZI_(G)) :: dRhodS ! density partial derivative wrt saln [R ppt-1 ~> kg m-3 ppt-1]
real, dimension(SZI_(G),SZK_(GV)+1) :: netPen ! The net penetrating shortwave radiation at each level
! [degC H ~> degC m or degC kg m-2]
! [degC H s-1 ~> degC m s-1 or degC kg m-2 s-1]

logical :: useRiverHeatContent
logical :: useCalvingHeatContent
Expand Down Expand Up @@ -978,7 +975,7 @@ subroutine calculateBuoyancyFlux1d(G, GV, US, fluxes, optics, nsw, h, Temp, Salt
call extractFluxes1d(G, GV, US, fluxes, optics, nsw, j, dt*US%s_to_T, &
depthBeforeScalingFluxes, useRiverHeatContent, useCalvingHeatContent, &
h(:,j,:), Temp(:,j,:), netH, netEvap, netHeatMinusSW, &
netSalt, penSWbnd, tv, .false., skip_diags=skip_diags)
netSalt, penSWbnd, tv, .false.)

! Sum over bands and attenuate as a function of depth
! netPen is the netSW as a function of depth
Expand Down Expand Up @@ -1011,7 +1008,7 @@ end subroutine calculateBuoyancyFlux1d
!> Calculates surface buoyancy flux by adding up the heat, FW and salt fluxes,
!! for 2d arrays. This is a wrapper for calculateBuoyancyFlux1d.
subroutine calculateBuoyancyFlux2d(G, GV, US, fluxes, optics, h, Temp, Salt, tv, &
buoyancyFlux, netHeatMinusSW, netSalt, skip_diags)
buoyancyFlux, netHeatMinusSW, netSalt)
type(ocean_grid_type), intent(in) :: G !< ocean grid
type(verticalGrid_type), intent(in) :: GV !< ocean vertical grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
Expand All @@ -1021,26 +1018,18 @@ subroutine calculateBuoyancyFlux2d(G, GV, US, fluxes, optics, h, Temp, Salt, tv,
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(in) :: Temp !< temperature [degC]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(in) :: Salt !< salinity [ppt]
type(thermo_var_ptrs), intent(inout) :: tv !< thermodynamics type
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1), intent(inout) :: buoyancyFlux !< buoyancy fluxes [L2 T-3 ~> m2 s-3]
real, dimension(SZI_(G),SZJ_(G)), optional, intent(inout) :: netHeatMinusSW !< surf temp flux
!! [degC H ~> degC m or degC kg m-2]
real, dimension(SZI_(G),SZJ_(G)), optional, intent(inout) :: netSalt !< surf salt flux
!! [ppt H ~> ppt m or ppt kg m-2]
logical, optional, intent(in) :: skip_diags !< If present and true, skip calculating
!! diagnostics inside extractFluxes1d()
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1), intent(inout) :: buoyancyFlux !< buoyancy fluxes [L2 T-3 ~> m2 s-3]
real, dimension(SZI_(G),SZJ_(G)), intent(inout) :: netHeatMinusSW !< surface heat flux excluding shortwave
!! [degC H s-1 ~> degC m s-1 or degC kg m-2 s-1]
real, dimension(SZI_(G),SZJ_(G)), intent(inout) :: netSalt !< Net surface salt flux
!! [ppt H s-1 ~> ppt m s-1 or ppt kg m-2 s-1]
! local variables
real, dimension( SZI_(G) ) :: netT ! net temperature flux [degC H s-1 ~> degC m s-2 or degC kg m-2 s-1]
real, dimension( SZI_(G) ) :: netS ! net saln flux !! [ppt H s-1 ~> ppt m s-1 or ppt kg m-2 s-1]
integer :: j

netT(G%isc:G%iec) = 0. ; netS(G%isc:G%iec) = 0.

!$OMP parallel do default(shared) firstprivate(netT,netS)
!$OMP parallel do default(shared)
do j=G%jsc,G%jec
call calculateBuoyancyFlux1d(G, GV, US, fluxes, optics, optics_nbands(optics), h, Temp, Salt, &
tv, j, buoyancyFlux(:,j,:), netT, netS, skip_diags=skip_diags)
if (present(netHeatMinusSW)) netHeatMinusSW(G%isc:G%iec,j) = netT(G%isc:G%iec)
if (present(netSalt)) netSalt(G%isc:G%iec,j) = netS(G%isc:G%iec)
tv, j, buoyancyFlux(:,j,:), netHeatMinusSW(:,j), netSalt(:,j))
enddo

end subroutine calculateBuoyancyFlux2d
Expand Down
7 changes: 1 addition & 6 deletions src/parameterizations/vertical/MOM_ALE_sponge.F90
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ subroutine apply_ALE_sponge(h, dt, G, GV, US, CS, Time)
real, intent(in) :: dt !< The amount of time covered by this call [T ~> s].
type(ALE_sponge_CS), pointer :: CS !< A pointer to the control structure for this module
!! that is set by a previous call to initialize_ALE_sponge (in).
type(time_type), optional, intent(in) :: Time !< The current model date
type(time_type), intent(in) :: Time !< The current model date

real :: damp ! The timestep times the local damping coefficient [nondim].
real :: I1pdamp ! I1pdamp is 1/(1 + damp). [nondim].
Expand Down Expand Up @@ -885,8 +885,6 @@ subroutine apply_ALE_sponge(h, dt, G, GV, US, CS, Time)
endif

if (CS%time_varying_sponges) then
if (.not. present(Time)) &
call MOM_error(FATAL,"apply_ALE_sponge: No time information provided")
do m=1,CS%fldno
nz_data = CS%Ref_val(m)%nz_data
call horiz_interp_and_extrap_tracer(CS%Ref_val(m)%id, Time, 1.0, G, sp_val, mask_z, z_in, &
Expand Down Expand Up @@ -971,9 +969,6 @@ subroutine apply_ALE_sponge(h, dt, G, GV, US, CS, Time)
if (CS%sponge_uv) then

if (CS%time_varying_sponges) then
if (.not. present(Time)) &
call MOM_error(FATAL,"apply_ALE_sponge: No time information provided")

nz_data = CS%Ref_val_u%nz_data
! Interpolate from the external horizontal grid and in time
call horiz_interp_and_extrap_tracer(CS%Ref_val_u%id, Time, 1.0, G, sp_val, mask_z, z_in, &
Expand Down
8 changes: 4 additions & 4 deletions src/parameterizations/vertical/MOM_CVMix_KPP.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1389,8 +1389,8 @@ subroutine KPP_NonLocalTransport_temp(CS, G, GV, h, nonLocalTrans, surfFlux, &
type(verticalGrid_type), intent(in) :: GV !< Ocean vertical grid
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(in) :: h !< Layer/level thickness [H ~> m or kg m-2]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1), intent(in) :: nonLocalTrans !< Non-local transport [nondim]
real, dimension(SZI_(G),SZJ_(G)), intent(in) :: surfFlux !< Surface flux of scalar
!! [conc H s-1 ~> conc m s-1 or conc kg m-2 s-1]
real, dimension(SZI_(G),SZJ_(G)), intent(in) :: surfFlux !< Surface flux of temperature
!! [degC H s-1 ~> degC m s-1 or degC kg m-2 s-1]
real, intent(in) :: dt !< Time-step [s]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(inout) :: scalar !< temperature
real, intent(in) :: C_p !< Seawater specific heat capacity [J kg-1 degC-1]
Expand Down Expand Up @@ -1451,8 +1451,8 @@ subroutine KPP_NonLocalTransport_saln(CS, G, GV, h, nonLocalTrans, surfFlux, dt,
type(verticalGrid_type), intent(in) :: GV !< Ocean vertical grid
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(in) :: h !< Layer/level thickness [H ~> m or kg m-2]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1), intent(in) :: nonLocalTrans !< Non-local transport [nondim]
real, dimension(SZI_(G),SZJ_(G)), intent(in) :: surfFlux !< Surface flux of scalar
!! [conc H s-1 ~> conc m s-1 or conc kg m-2 s-1]
real, dimension(SZI_(G),SZJ_(G)), intent(in) :: surfFlux !< Surface flux of salt
!! [ppt H s-1 ~> ppt m s-1 or ppt kg m-2 s-1]
real, intent(in) :: dt !< Time-step [s]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(inout) :: scalar !< Scalar (scalar units [conc])

Expand Down
28 changes: 12 additions & 16 deletions src/parameterizations/vertical/MOM_CVMix_conv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ subroutine calculate_CVMix_conv(h, tv, G, GV, US, CS, hbl, Kd, Kv, Kd_aux)
!! by a previous call to CVMix_conv_init.
real, dimension(SZI_(G),SZJ_(G)), intent(in) :: hbl !< Depth of ocean boundary layer [Z ~> m]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1), &
optional, intent(inout) :: Kd !< Diapycnal diffusivity at each interface that
intent(inout) :: Kd !< Diapycnal diffusivity at each interface that
!! will be incremented here [Z2 T-1 ~> m2 s-1].
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1), &
optional, intent(inout) :: KV !< Viscosity at each interface that will be
intent(inout) :: KV !< Viscosity at each interface that will be
!! incremented here [Z2 T-1 ~> m2 s-1].
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1), &
optional, intent(inout) :: Kd_aux !< A second diapycnal diffusivity at each
Expand Down Expand Up @@ -243,25 +243,21 @@ subroutine calculate_CVMix_conv(h, tv, G, GV, US, CS, hbl, Kd, Kv, Kd_aux)
max_nlev=GV%ke, &
OBL_ind=kOBL)

if (present(Kd)) then
! Increment the diffusivity outside of the boundary layer.
do K=max(1,kOBL+1),GV%ke+1
Kd(i,j,K) = Kd(i,j,K) + US%m2_s_to_Z2_T * kd_col(K)
enddo
endif
! Increment the diffusivity outside of the boundary layer.
do K=max(1,kOBL+1),GV%ke+1
Kd(i,j,K) = Kd(i,j,K) + US%m2_s_to_Z2_T * kd_col(K)
enddo
if (present(Kd_aux)) then
! Increment the other diffusivity outside of the boundary layer.
do K=max(1,kOBL+1),GV%ke+1
Kd_aux(i,j,K) = Kd_aux(i,j,K) + US%m2_s_to_Z2_T * kd_col(K)
enddo
endif

if (present(Kv)) then
! Increment the viscosity outside of the boundary layer.
do K=max(1,kOBL+1),GV%ke+1
Kv(i,j,K) = Kv(i,j,K) + US%m2_s_to_Z2_T * kv_col(K)
enddo
endif
! Increment the viscosity outside of the boundary layer.
do K=max(1,kOBL+1),GV%ke+1
Kv(i,j,K) = Kv(i,j,K) + US%m2_s_to_Z2_T * kv_col(K)
enddo

! Store 3-d arrays for diagnostics.
if (CS%id_kv_conv > 0) then
Expand All @@ -288,8 +284,8 @@ subroutine calculate_CVMix_conv(h, tv, G, GV, US, CS, hbl, Kd, Kv, Kd_aux)
! call hchksum(Kd_conv, "MOM_CVMix_conv: Kd_conv", G%HI, haloshift=0, scale=US%Z2_T_to_m2_s)
! if (CS%id_kv_conv > 0) &
! call hchksum(Kv_conv, "MOM_CVMix_conv: Kv_conv", G%HI, haloshift=0, scale=US%m2_s_to_Z2_T)
if (present(Kd)) call hchksum(Kd, "MOM_CVMix_conv: Kd", G%HI, haloshift=0, scale=US%Z2_T_to_m2_s)
if (present(Kv)) call hchksum(Kv, "MOM_CVMix_conv: Kv", G%HI, haloshift=0, scale=US%Z2_T_to_m2_s)
call hchksum(Kd, "MOM_CVMix_conv: Kd", G%HI, haloshift=0, scale=US%Z2_T_to_m2_s)
call hchksum(Kv, "MOM_CVMix_conv: Kv", G%HI, haloshift=0, scale=US%Z2_T_to_m2_s)
endif

! send diagnostics to post_data
Expand Down
8 changes: 2 additions & 6 deletions src/parameterizations/vertical/MOM_diabatic_aux.F90
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ end subroutine differential_diffuse_T_S
!> This subroutine keeps salinity from falling below a small but positive threshold.
!! This usually occurs when the ice model attempts to extract more salt then
!! is actually available to it from the ocean.
subroutine adjust_salt(h, tv, G, GV, CS, halo)
subroutine adjust_salt(h, tv, G, GV, CS)
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
Expand All @@ -327,7 +327,6 @@ subroutine adjust_salt(h, tv, G, GV, CS, halo)
!! available thermodynamic fields.
type(diabatic_aux_CS), intent(in) :: CS !< The control structure returned by a previous
!! call to diabatic_aux_init.
integer, optional, intent(in) :: halo !< Halo width over which to work

! local variables
real :: salt_add_col(SZI_(G),SZJ_(G)) !< The accumulated salt requirement [ppt R Z ~> gSalt m-2]
Expand All @@ -336,9 +335,6 @@ subroutine adjust_salt(h, tv, G, GV, CS, halo)
integer :: i, j, k, is, ie, js, je, nz

is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke
if (present(halo)) then
is = G%isc-halo ; ie = G%iec+halo ; js = G%jsc-halo ; je = G%jec+halo
endif

! call cpu_clock_begin(id_clock_adjust_salt)

Expand Down Expand Up @@ -1024,7 +1020,7 @@ subroutine applyBoundaryFluxesInOut(CS, G, GV, US, dt, fluxes, optics, nsw, h, t
optional, intent(out) :: dSV_dS !< Partial derivative of specific volume with
!! salinity [R-1 ppt-1 ~> m3 kg-1 ppt-1].
real, dimension(SZI_(G),SZJ_(G)), &
optional, intent(out) :: SkinBuoyFlux !< Buoyancy flux at surface [Z2 T-3 ~> m2 s-3].
optional, intent(out) :: SkinBuoyFlux !< Buoyancy flux at surface [Z2 T-3 ~> m2 s-3].

! Local variables
integer, parameter :: maxGroundings = 5
Expand Down
Loading