Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into SIS2_infra_support
Browse files Browse the repository at this point in the history
  • Loading branch information
Hallberg-NOAA authored Apr 2, 2021
2 parents 3c1cb2e + 2b6d3e1 commit ad372fd
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 54 deletions.
80 changes: 41 additions & 39 deletions src/parameterizations/lateral/MOM_hor_visc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,6 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, US,
grad_d2vel_mag_h, & ! Magnitude of the Laplacian of the velocity vector, squared [L-2 T-2 ~> m-2 s-2]
boundary_mask_h ! A mask that zeroes out cells with at least one land edge [nondim]

real, allocatable, dimension(:,:) :: hf_diffu_2d, hf_diffv_2d ! Depth sum of hf_diffu, hf_diffv [L T-2 ~> m s-2]
real, dimension(SZIB_(G),SZJ_(G)) :: intz_diffu_2d ! Depth-integral of diffu [L2 T-2 ~> m2 s-2]
real, dimension(SZI_(G),SZJB_(G)) :: intz_diffv_2d ! Depth-integral of diffv [L2 T-2 ~> m2 s-2]

real, dimension(SZIB_(G),SZJB_(G)) :: &
dvdx, dudy, & ! components in the shearing strain [T-1 ~> s-1]
dDel2vdx, dDel2udy, & ! Components in the biharmonic equivalent of the shearing strain [L-2 T-1 ~> m-2 s-1]
Expand Down Expand Up @@ -309,7 +305,6 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, US,
vort_xy_q, & ! vertical vorticity at corner points [T-1 ~> s-1]
sh_xy_q, & ! horizontal shearing strain at corner points [T-1 ~> s-1]
GME_coeff_q, & !< GME coeff. at q-points [L2 T-1 ~> m2 s-1]
max_diss_rate_q, & ! maximum possible energy dissipated by lateral friction [L2 T-3 ~> m2 s-3]
ShSt ! A diagnostic array of shear stress [T-1 ~> s-1].
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)+1) :: &
KH_u_GME !< interface height diffusivities in u-columns [L2 T-1 ~> m2 s-1]
Expand All @@ -318,7 +313,6 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, US,
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)) :: &
Ah_h, & ! biharmonic viscosity at thickness points [L4 T-1 ~> m4 s-1]
Kh_h, & ! Laplacian viscosity at thickness points [L2 T-1 ~> m2 s-1]
max_diss_rate_h, & ! maximum possible energy dissipated by lateral friction [L2 T-3 ~> m2 s-3]
FrictWork, & ! work done by MKE dissipation mechanisms [R L2 T-3 ~> W m-2]
FrictWork_GME, & ! work done by GME [R L2 T-3 ~> W m-2]
div_xx_h, & ! horizontal divergence [T-1 ~> s-1]
Expand Down Expand Up @@ -389,6 +383,14 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, US,
hrat_min, & ! h_min divided by the thickness at the stress point (h or q) [nondim]
visc_bound_rem ! fraction of overall viscous bounds that remain to be applied [nondim]

real, dimension(SZIB_(G),SZJ_(G)) :: &
hf_diffu_2d, & ! Depth sum of hf_diffu, hf_diffv [L T-2 ~> m s-2]
intz_diffu_2d ! Depth-integral of diffu [L2 T-2 ~> m2 s-2]

real, dimension(SZI_(G),SZJB_(G)) :: &
hf_diffv_2d, & ! Depth sum of hf_diffu, hf_diffv [L T-2 ~> m s-2]
intz_diffv_2d ! Depth-integral of diffv [L2 T-2 ~> m2 s-2]

is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke
Isq = G%IscB ; Ieq = G%IecB ; Jsq = G%JscB ; Jeq = G%JecB

Expand Down Expand Up @@ -505,8 +507,7 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, US,
!$OMP use_MEKE_Ku, use_MEKE_Au, boundary_mask_h, boundary_mask_q, &
!$OMP backscat_subround, GME_coeff_limiter, &
!$OMP h_neglect, h_neglect3, FWfrac, inv_PI3, inv_PI6, H0_GME, &
!$OMP diffu, diffv, max_diss_rate_h, max_diss_rate_q, &
!$OMP Kh_h, Kh_q, Ah_h, Ah_q, FrictWork, FrictWork_GME, &
!$OMP diffu, diffv, Kh_h, Kh_q, Ah_h, Ah_q, FrictWork, FrictWork_GME, &
!$OMP div_xx_h, sh_xx_h, vort_xy_q, sh_xy_q, GME_coeff_h, GME_coeff_q, &
!$OMP TD, KH_u_GME, KH_v_GME, grid_Re_Kh, grid_Re_Ah, NoSt, ShSt &
!$OMP ) &
Expand Down Expand Up @@ -1645,38 +1646,39 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, US,
! enddo ; enddo ; enddo
! call post_data(CS%id_hf_diffv, CS%hf_diffv, CS%diag)
!endif
if (present(ADp) .and. (CS%id_hf_diffu_2d > 0)) then
allocate(hf_diffu_2d(G%IsdB:G%IedB,G%jsd:G%jed))
hf_diffu_2d(:,:) = 0.0
do k=1,nz ; do j=js,je ; do I=Isq,Ieq
hf_diffu_2d(I,j) = hf_diffu_2d(I,j) + diffu(I,j,k) * ADp%diag_hfrac_u(I,j,k)
enddo ; enddo ; enddo
call post_data(CS%id_hf_diffu_2d, hf_diffu_2d, CS%diag)
deallocate(hf_diffu_2d)
endif
if (present(ADp) .and. (CS%id_hf_diffv_2d > 0)) then
allocate(hf_diffv_2d(G%isd:G%ied,G%JsdB:G%JedB))
hf_diffv_2d(:,:) = 0.0
do k=1,nz ; do J=Jsq,Jeq ; do i=is,ie
hf_diffv_2d(i,J) = hf_diffv_2d(i,J) + diffv(i,J,k) * ADp%diag_hfrac_v(i,J,k)
enddo ; enddo ; enddo
call post_data(CS%id_hf_diffv_2d, hf_diffv_2d, CS%diag)
deallocate(hf_diffv_2d)
endif

if (present(ADp) .and. (CS%id_intz_diffu_2d > 0)) then
intz_diffu_2d(:,:) = 0.0
do k=1,nz ; do j=js,je ; do I=Isq,Ieq
intz_diffu_2d(I,j) = intz_diffu_2d(I,j) + diffu(I,j,k) * ADp%diag_hu(I,j,k)
enddo ; enddo ; enddo
call post_data(CS%id_intz_diffu_2d, intz_diffu_2d, CS%diag)
endif
if (present(ADp) .and. (CS%id_intz_diffv_2d > 0)) then
intz_diffv_2d(:,:) = 0.0
do k=1,nz ; do J=Jsq,Jeq ; do i=is,ie
intz_diffv_2d(i,J) = intz_diffv_2d(i,J) + diffv(i,J,k) * ADp%diag_hv(i,J,k)
enddo ; enddo ; enddo
call post_data(CS%id_intz_diffv_2d, intz_diffv_2d, CS%diag)
if (present(ADp)) then
if (CS%id_hf_diffu_2d > 0) then
hf_diffu_2d(:,:) = 0.0
do k=1,nz ; do j=js,je ; do I=Isq,Ieq
hf_diffu_2d(I,j) = hf_diffu_2d(I,j) + diffu(I,j,k) * ADp%diag_hfrac_u(I,j,k)
enddo ; enddo ; enddo
call post_data(CS%id_hf_diffu_2d, hf_diffu_2d, CS%diag)
endif

if (CS%id_hf_diffv_2d > 0) then
hf_diffv_2d(:,:) = 0.0
do k=1,nz ; do J=Jsq,Jeq ; do i=is,ie
hf_diffv_2d(i,J) = hf_diffv_2d(i,J) + diffv(i,J,k) * ADp%diag_hfrac_v(i,J,k)
enddo ; enddo ; enddo
call post_data(CS%id_hf_diffv_2d, hf_diffv_2d, CS%diag)
endif

if (CS%id_intz_diffu_2d > 0) then
intz_diffu_2d(:,:) = 0.0
do k=1,nz ; do j=js,je ; do I=Isq,Ieq
intz_diffu_2d(I,j) = intz_diffu_2d(I,j) + diffu(I,j,k) * ADp%diag_hu(I,j,k)
enddo ; enddo ; enddo
call post_data(CS%id_intz_diffu_2d, intz_diffu_2d, CS%diag)
endif

if (CS%id_intz_diffv_2d > 0) then
intz_diffv_2d(:,:) = 0.0
do k=1,nz ; do J=Jsq,Jeq ; do i=is,ie
intz_diffv_2d(i,J) = intz_diffv_2d(i,J) + diffv(i,J,k) * ADp%diag_hv(i,J,k)
enddo ; enddo ; enddo
call post_data(CS%id_intz_diffv_2d, intz_diffv_2d, CS%diag)
endif
endif

end subroutine horizontal_viscosity
Expand Down
19 changes: 9 additions & 10 deletions src/parameterizations/lateral/MOM_internal_tides.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2317,7 +2317,7 @@ subroutine internal_tides_init(Time, G, GV, US, param_file, diag, CS)
fail_if_missing=.true.)
filename = trim(CS%inputdir) // trim(h2_file)
call log_param(param_file, mdl, "INPUTDIR/H2_FILE", filename)
call MOM_read_data(filename, 'h2', h2, G%domain, timelevel=1, scale=US%m_to_Z)
call MOM_read_data(filename, 'h2', h2, G%domain, scale=US%m_to_Z)
do j=G%jsc,G%jec ; do i=G%isc,G%iec
! Restrict rms topo to 10 percent of column depth.
h2(i,j) = min(0.01*(G%bathyT(i,j))**2, h2(i,j))
Expand All @@ -2337,8 +2337,7 @@ subroutine internal_tides_init(Time, G, GV, US, param_file, diag, CS)
allocate(CS%refl_angle(isd:ied,jsd:jed)) ; CS%refl_angle(:,:) = CS%nullangle
if (file_exists(filename, G%domain)) then
call log_param(param_file, mdl, "INPUTDIR/REFL_ANGLE_FILE", filename)
call MOM_read_data(filename, 'refl_angle', CS%refl_angle, &
G%domain, timelevel=1)
call MOM_read_data(filename, 'refl_angle', CS%refl_angle, G%domain)
else
if (trim(refl_angle_file) /= '' ) call MOM_error(FATAL, &
"REFL_ANGLE_FILE: "//trim(filename)//" not found")
Expand All @@ -2357,7 +2356,7 @@ subroutine internal_tides_init(Time, G, GV, US, param_file, diag, CS)
allocate(CS%refl_pref(isd:ied,jsd:jed)) ; CS%refl_pref(:,:) = 1.0
if (file_exists(filename, G%domain)) then
call log_param(param_file, mdl, "INPUTDIR/REFL_PREF_FILE", filename)
call MOM_read_data(filename, 'refl_pref', CS%refl_pref, G%domain, timelevel=1)
call MOM_read_data(filename, 'refl_pref', CS%refl_pref, G%domain)
else
if (trim(refl_pref_file) /= '' ) call MOM_error(FATAL, &
"REFL_PREF_FILE: "//trim(filename)//" not found")
Expand Down Expand Up @@ -2385,7 +2384,7 @@ subroutine internal_tides_init(Time, G, GV, US, param_file, diag, CS)
allocate(ridge_temp(isd:ied,jsd:jed)) ; ridge_temp(:,:) = 0.0
if (file_exists(filename, G%domain)) then
call log_param(param_file, mdl, "INPUTDIR/REFL_DBL_FILE", filename)
call MOM_read_data(filename, 'refl_dbl', ridge_temp, G%domain, timelevel=1)
call MOM_read_data(filename, 'refl_dbl', ridge_temp, G%domain)
else
if (trim(refl_dbl_file) /= '' ) call MOM_error(FATAL, &
"REFL_DBL_FILE: "//trim(filename)//" not found")
Expand All @@ -2406,9 +2405,9 @@ subroutine internal_tides_init(Time, G, GV, US, param_file, diag, CS)
!filename = trim(CS%inputdir) // trim(land_mask_file)
!call log_param(param_file, mdl, "INPUTDIR/LAND_MASK_FILE", filename)
!G%mask2dCu(:,:) = 1 ; G%mask2dCv(:,:) = 1 ; G%mask2dT(:,:) = 1
!call MOM_read_data(filename, 'land_mask', G%mask2dCu, G%domain, timelevel=1)
!call MOM_read_data(filename, 'land_mask', G%mask2dCv, G%domain, timelevel=1)
!call MOM_read_data(filename, 'land_mask', G%mask2dT, G%domain, timelevel=1)
!call MOM_read_data(filename, 'land_mask', G%mask2dCu, G%domain)
!call MOM_read_data(filename, 'land_mask', G%mask2dCv, G%domain)
!call MOM_read_data(filename, 'land_mask', G%mask2dT, G%domain)
!call pass_vector(G%mask2dCu, G%mask2dCv, G%domain, To_All+Scalar_Pair, CGRID_NE)
!call pass_var(G%mask2dT,G%domain)

Expand All @@ -2419,7 +2418,7 @@ subroutine internal_tides_init(Time, G, GV, US, param_file, diag, CS)
!filename = trim(CS%inputdir) // trim(dy_Cu_file)
!call log_param(param_file, mdl, "INPUTDIR/dy_Cu_FILE", filename)
!G%dy_Cu(:,:) = 0.0
!call MOM_read_data(filename, 'dy_Cu', G%dy_Cu, G%domain, timelevel=1, scale=US%m_to_L)
!call MOM_read_data(filename, 'dy_Cu', G%dy_Cu, G%domain, scale=US%m_to_L)

! Read in prescribed partial north face blockages from file (if overwriting -BDM)
!call get_param(param_file, mdl, "dx_Cv_FILE", dx_Cv_file, &
Expand All @@ -2428,7 +2427,7 @@ subroutine internal_tides_init(Time, G, GV, US, param_file, diag, CS)
!filename = trim(CS%inputdir) // trim(dx_Cv_file)
!call log_param(param_file, mdl, "INPUTDIR/dx_Cv_FILE", filename)
!G%dx_Cv(:,:) = 0.0
!call MOM_read_data(filename, 'dx_Cv', G%dx_Cv, G%domain, timelevel=1, scale=US%m_to_L)
!call MOM_read_data(filename, 'dx_Cv', G%dx_Cv, G%domain, scale=US%m_to_L)
!call pass_vector(G%dy_Cu, G%dx_Cv, G%domain, To_All+Scalar_Pair, CGRID_NE)

! Register maps of reflection parameters
Expand Down
4 changes: 2 additions & 2 deletions src/parameterizations/vertical/MOM_internal_tide_input.F90
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ subroutine int_tide_input_init(Time, G, GV, US, param_file, diag, CS, itide)
"tidal amplitudes with INT_TIDE_DISSIPATION.", default="tideamp.nc")
filename = trim(CS%inputdir) // trim(tideamp_file)
call log_param(param_file, mdl, "INPUTDIR/TIDEAMP_FILE", filename)
call MOM_read_data(filename, 'tideamp', itide%tideamp, G%domain, timelevel=1, scale=US%m_s_to_L_T)
call MOM_read_data(filename, 'tideamp', itide%tideamp, G%domain, scale=US%m_s_to_L_T)
endif

call get_param(param_file, mdl, "H2_FILE", h2_file, &
Expand All @@ -377,7 +377,7 @@ subroutine int_tide_input_init(Time, G, GV, US, param_file, diag, CS, itide)
fail_if_missing=.true.)
filename = trim(CS%inputdir) // trim(h2_file)
call log_param(param_file, mdl, "INPUTDIR/H2_FILE", filename)
call MOM_read_data(filename, 'h2', itide%h2, G%domain, timelevel=1, scale=US%m_to_Z**2)
call MOM_read_data(filename, 'h2', itide%h2, G%domain, scale=US%m_to_Z**2)

call get_param(param_file, mdl, "FRACTIONAL_ROUGHNESS_MAX", max_frac_rough, &
"The maximum topographic roughness amplitude as a fraction of the mean depth, "//&
Expand Down
2 changes: 1 addition & 1 deletion src/parameterizations/vertical/MOM_set_viscosity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,7 @@ subroutine set_visc_init(Time, G, GV, US, param_file, diag, visc, CS, restart_CS
allocate(CS%tideamp(isd:ied,jsd:jed)) ; CS%tideamp(:,:) = 0.0
filename = trim(CS%inputdir) // trim(tideamp_file)
call log_param(param_file, mdl, "INPUTDIR/TIDEAMP_FILE", filename)
call MOM_read_data(filename, 'tideamp', CS%tideamp, G%domain, timelevel=1, scale=US%m_to_Z*US%T_to_s)
call MOM_read_data(filename, 'tideamp', CS%tideamp, G%domain, scale=US%m_to_Z*US%T_to_s)
call pass_var(CS%tideamp,G%domain)
endif
endif
Expand Down
4 changes: 2 additions & 2 deletions src/parameterizations/vertical/MOM_tidal_mixing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ logical function tidal_mixing_init(Time, G, GV, US, param_file, diag, CS)
"tidal amplitudes with INT_TIDE_DISSIPATION.", default="tideamp.nc")
filename = trim(CS%inputdir) // trim(tideamp_file)
call log_param(param_file, mdl, "INPUTDIR/TIDEAMP_FILE", filename)
call MOM_read_data(filename, 'tideamp', CS%tideamp, G%domain, timelevel=1, scale=US%m_to_Z*US%T_to_s)
call MOM_read_data(filename, 'tideamp', CS%tideamp, G%domain, scale=US%m_to_Z*US%T_to_s)
endif

call get_param(param_file, mdl, "H2_FILE", h2_file, &
Expand All @@ -469,7 +469,7 @@ logical function tidal_mixing_init(Time, G, GV, US, param_file, diag, CS)
fail_if_missing=(.not.CS%use_CVMix_tidal))
filename = trim(CS%inputdir) // trim(h2_file)
call log_param(param_file, mdl, "INPUTDIR/H2_FILE", filename)
call MOM_read_data(filename, 'h2', CS%h2, G%domain, timelevel=1, scale=US%m_to_Z**2)
call MOM_read_data(filename, 'h2', CS%h2, G%domain, scale=US%m_to_Z**2)

call get_param(param_file, mdl, "FRACTIONAL_ROUGHNESS_MAX", max_frac_rough, &
"The maximum topographic roughness amplitude as a fraction of the mean depth, "//&
Expand Down

0 comments on commit ad372fd

Please sign in to comment.