Skip to content

Commit

Permalink
Merge pull request mom-ocean#944 from Hallberg-NOAA/fix_line_lengths
Browse files Browse the repository at this point in the history
MOM6: Corrected line lengths and Travis testing
  • Loading branch information
adcroft authored Jul 8, 2019
2 parents 67dadc5 + 85939c3 commit 4cb18ac
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- stage: check and compile
env: JOB="Code style compliance"
script:
- ./.testing/trailer.py -e TEOS10 src config_src
- ./.testing/trailer.py -e TEOS10 -l 120 src config_src
- stage: check and compile
env: JOB="Doxygen"
script:
Expand Down
7 changes: 4 additions & 3 deletions src/parameterizations/lateral/MOM_hor_visc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, US,
grad_vort_mag_q_2d, & ! Magnitude of 2d vorticity gradient at q-points [m-1 s-1]
grad_div_mag_q, & ! Magnitude of divergence gradient at q-points [m-1 s-1]
grad_vel_mag_q, & ! Magnitude of the velocity gradient tensor squared at q-points [s-2]
hq, & ! harmonic mean of the harmonic means of the u- & v point thicknesses, in H; This form guarantees that hq/hu < 4.
hq, & ! harmonic mean of the harmonic means of the u- & v point thicknesses [H ~> m or kg m-2]
! This form guarantees that hq/hu < 4.
grad_vel_mag_bt_q ! Magnitude of the barotropic velocity gradient tensor squared at q-points [s-2]

real, dimension(SZIB_(G),SZJB_(G),SZK_(G)) :: &
Expand Down Expand Up @@ -1900,8 +1901,8 @@ subroutine hor_visc_init(Time, G, US, param_file, diag, CS)
if (CS%Smagorinsky_Ah) then
CS%Biharm_const_xx(i,j) = Smag_bi_const * (grid_sp_h2 * grid_sp_h2)
if (CS%bound_Coriolis) then
fmax = MAX(abs(G%CoriolisBu(I-1,J-1)), abs(G%CoriolisBu(I,J-1)), &
abs(G%CoriolisBu(I-1,J)), abs(G%CoriolisBu(I,J)))
fmax = US%s_to_T*MAX(abs(G%CoriolisBu(I-1,J-1)), abs(G%CoriolisBu(I,J-1)), &
abs(G%CoriolisBu(I-1,J)), abs(G%CoriolisBu(I,J)))
CS%Biharm_const2_xx(i,j) = (grid_sp_h2 * grid_sp_h2 * grid_sp_h2) * &
(fmax * BoundCorConst)
endif
Expand Down
71 changes: 40 additions & 31 deletions src/parameterizations/lateral/MOM_lateral_mixing_coeffs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ subroutine calc_resoln_function(h, tv, G, GV, US, CS)
call wave_speed(h, tv, G, GV, US, CS%cg1, CS%wave_speed_CSp, modal_structure=CS%ebt_struct)
else
! Use EBT to get vertical structure first and then re-calculate cg1 using first baroclinic mode
call wave_speed(h, tv, G, GV, US, CS%cg1, CS%wave_speed_CSp, modal_structure=CS%ebt_struct, use_ebt_mode=.true.)
call wave_speed(h, tv, G, GV, US, CS%cg1, CS%wave_speed_CSp, modal_structure=CS%ebt_struct, &
use_ebt_mode=.true.)
call wave_speed(h, tv, G, GV, US, CS%cg1, CS%wave_speed_CSp)
endif
call pass_var(CS%ebt_struct, G%Domain)
Expand Down Expand Up @@ -729,43 +730,51 @@ end subroutine calc_slope_functions_using_just_e
!> Calculates the Leith Laplacian and bi-harmonic viscosity coefficients
subroutine calc_QG_Leith_viscosity(CS, G, GV, h, k, div_xx_dx, div_xx_dy, vort_xy_dx, vort_xy_dy)
type(VarMix_CS), pointer :: CS !< Variable mixing coefficients
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
! real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), intent(in) :: u !< Zonal flow (m s-1)
! real, dimension(SZI_(G),SZJB_(G),SZK_(G)), intent(in) :: v !< Meridional flow (m s-1)
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), intent(inout) :: h !< Layer thickness (m or kg m-2)
integer, intent(in) :: k !< Layer for which to calculate vorticity magnitude
real, dimension(SZIB_(G),SZJ_(G)), intent(in) :: div_xx_dx !< x-derivative of horizontal divergence (d/dx(du/dx + dv/dy)) (m-1 s-1)
real, dimension(SZI_(G),SZJB_(G)), intent(in) :: div_xx_dy !< y-derivative of horizontal divergence (d/dy(du/dx + dv/dy)) (m-1 s-1)
real, dimension(SZI_(G),SZJB_(G)), intent(inout) :: vort_xy_dx !< x-derivative of vertical vorticity (d/dx(dv/dx - du/dy)) (m-1 s-1)
real, dimension(SZIB_(G),SZJ_(G)), intent(inout) :: vort_xy_dy !< y-derivative of vertical vorticity (d/dy(dv/dx - du/dy)) (m-1 s-1)
! real, dimension(SZI_(G),SZJ_(G)), intent(out) :: Leith_Kh_h !< Leith Laplacian viscosity at h-points (m2 s-1)
! real, dimension(SZIB_(G),SZJB_(G)), intent(out) :: Leith_Kh_q !< Leith Laplacian viscosity at q-points (m2 s-1)
! real, dimension(SZI_(G),SZJ_(G)), intent(out) :: Leith_Ah_h !< Leith bi-harmonic viscosity at h-points (m4 s-1)
! real, dimension(SZIB_(G),SZJB_(G)), intent(out) :: Leith_Ah_q !< Leith bi-harmonic viscosity at q-points (m4 s-1)
! real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), intent(in) :: u !< Zonal flow [m s-1]
! real, dimension(SZI_(G),SZJB_(G),SZK_(G)), intent(in) :: v !< Meridional flow [m s-1]
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), intent(inout) :: h !< Layer thickness [H ~> m or kg m-2]
integer, intent(in) :: k !< Layer for which to calculate vorticity magnitude
real, dimension(SZIB_(G),SZJ_(G)), intent(in) :: div_xx_dx !< x-derivative of horizontal divergence
!! (d/dx(du/dx + dv/dy)) [m-1 s-1]
real, dimension(SZI_(G),SZJB_(G)), intent(in) :: div_xx_dy !< y-derivative of horizontal divergence
!! (d/dy(du/dx + dv/dy)) [m-1 s-1]
real, dimension(SZI_(G),SZJB_(G)), intent(inout) :: vort_xy_dx !< x-derivative of vertical vorticity
!! (d/dx(dv/dx - du/dy)) [m-1 s-1]
real, dimension(SZIB_(G),SZJ_(G)), intent(inout) :: vort_xy_dy !< y-derivative of vertical vorticity
!! (d/dy(dv/dx - du/dy)) [m-1 s-1]
! real, dimension(SZI_(G),SZJ_(G)), intent(out) :: Leith_Kh_h !< Leith Laplacian viscosity
!! at h-points [m2 s-1]
! real, dimension(SZIB_(G),SZJB_(G)), intent(out) :: Leith_Kh_q !< Leith Laplacian viscosity
!! at q-points [m2 s-1]
! real, dimension(SZI_(G),SZJ_(G)), intent(out) :: Leith_Ah_h !< Leith bi-harmonic viscosity
!! at h-points [m4 s-1]
! real, dimension(SZIB_(G),SZJB_(G)), intent(out) :: Leith_Ah_q !< Leith bi-harmonic viscosity
!! at q-points [m4 s-1]

! Local variables
! real, dimension(SZIB_(G),SZJB_(G)) :: vort_xy, & ! Vertical vorticity (dv/dx - du/dy) (s-1)
! dudy, & ! Meridional shear of zonal velocity (s-1)
! dvdx ! Zonal shear of meridional velocity (s-1)
! real, dimension(SZIB_(G),SZJB_(G)) :: vort_xy, & ! Vertical vorticity (dv/dx - du/dy) [s-1]
! dudy, & ! Meridional shear of zonal velocity [s-1]
! dvdx ! Zonal shear of meridional velocity [s-1]
real, dimension(SZI_(G),SZJB_(G)) :: &
! vort_xy_dx, & ! x-derivative of vertical vorticity (d/dx(dv/dx - du/dy)) (m-1 s-1)
! div_xx_dy, & ! y-derivative of horizontal divergence (d/dy(du/dx + dv/dy)) (m-1 s-1)
dslopey_dz, & ! z-derivative of y-slope at v-points (m-1)
h_at_v, & ! Thickness at v-points (m or kg m-2)
beta_v, & ! Beta at v-points (m-1 s-1)
grad_vort_mag_v, & ! mag. of vort. grad. at v-points (s-1)
grad_div_mag_v ! mag. of div. grad. at v-points (s-1)
! vort_xy_dx, & ! x-derivative of vertical vorticity (d/dx(dv/dx - du/dy)) [m-1 s-1]
! div_xx_dy, & ! y-derivative of horizontal divergence (d/dy(du/dx + dv/dy)) [m-1 s-1]
dslopey_dz, & ! z-derivative of y-slope at v-points [m-1]
h_at_v, & ! Thickness at v-points [H ~> m or kg m-2]
beta_v, & ! Beta at v-points [m-1 s-1]
grad_vort_mag_v, & ! mag. of vort. grad. at v-points [s-1]
grad_div_mag_v ! mag. of div. grad. at v-points [s-1]

real, dimension(SZIB_(G),SZJ_(G)) :: &
! vort_xy_dy, & ! y-derivative of vertical vorticity (d/dy(dv/dx - du/dy)) (m-1 s-1)
! div_xx_dx, & ! x-derivative of horizontal divergence (d/dx(du/dx + dv/dy)) (m-1 s-1)
! vort_xy_dy, & ! y-derivative of vertical vorticity (d/dy(dv/dx - du/dy)) [m-1 s-1]
! div_xx_dx, & ! x-derivative of horizontal divergence (d/dx(du/dx + dv/dy)) [m-1 s-1]
dslopex_dz, & ! z-derivative of x-slope at u-points (m-1)
h_at_u, & ! Thickness at u-points (m or kg m-2)
beta_u, & ! Beta at u-points (m-1 s-1)
grad_vort_mag_u, & ! mag. of vort. grad. at u-points (s-1)
grad_div_mag_u ! mag. of div. grad. at u-points (s-1)
! real, dimension(SZI_(G),SZJ_(G)) :: div_xx ! Estimate of horizontal divergence at h-points (s-1)
h_at_u, & ! Thickness at u-points [H ~> m or kg m-2]
beta_u, & ! Beta at u-points [m-1 s-1]
grad_vort_mag_u, & ! mag. of vort. grad. at u-points [s-1]
grad_div_mag_u ! mag. of div. grad. at u-points [s-1]
! real, dimension(SZI_(G),SZJ_(G)) :: div_xx ! Estimate of horizontal divergence at h-points [s-1]
! real :: mod_Leith, DY_dxBu, DX_dyBu, vert_vort_mag
real :: h_at_slope_above, h_at_slope_below, Ih, f
integer :: i, j, is, ie, js, je, Isq, Ieq, Jsq, Jeq,nz
Expand Down
28 changes: 15 additions & 13 deletions src/parameterizations/lateral/MOM_thickness_diffuse.F90
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ subroutine thickness_diffuse(h, uhtr, vhtr, tv, dt, G, GV, US, MEKE, VarMix, CDp
!$OMP do
if (CS%MEKE_GEOMETRIC) then
do j=js,je ; do I=is-1,ie
Khth_Loc_u(I,j) = Khth_Loc_u(I,j) + G%mask2dCu(I,j) * CS%MEKE_GEOMETRIC_alpha * 0.5*(MEKE%MEKE(i,j)+MEKE%MEKE(i+1,j)) / &
Khth_Loc_u(I,j) = Khth_Loc_u(I,j) + &
G%mask2dCu(I,j) * CS%MEKE_GEOMETRIC_alpha * 0.5*(MEKE%MEKE(i,j)+MEKE%MEKE(i+1,j)) / &
(VarMix%SN_u(I,j) + CS%MEKE_GEOMETRIC_epsilon)
enddo ; enddo
else
Expand Down Expand Up @@ -293,8 +294,9 @@ subroutine thickness_diffuse(h, uhtr, vhtr, tv, dt, G, GV, US, MEKE, VarMix, CDp
!$OMP do
if (CS%MEKE_GEOMETRIC) then
do j=js-1,je ; do I=is,ie
Khth_Loc(I,j) = Khth_Loc(I,j) + G%mask2dCv(i,J) * CS%MEKE_GEOMETRIC_alpha * 0.5*(MEKE%MEKE(i,j)+MEKE%MEKE(i,j+1)) / &
(VarMix%SN_v(i,J) + CS%MEKE_GEOMETRIC_epsilon)
Khth_Loc(I,j) = Khth_Loc(I,j) + &
G%mask2dCv(i,J) * CS%MEKE_GEOMETRIC_alpha * 0.5*(MEKE%MEKE(i,j)+MEKE%MEKE(i,j+1)) / &
(VarMix%SN_v(i,J) + CS%MEKE_GEOMETRIC_epsilon)
enddo ; enddo
else
do J=js-1,je ; do i=is,ie
Expand Down Expand Up @@ -525,12 +527,12 @@ subroutine thickness_diffuse_full(h, e, Kh_u, Kh_v, tv, uhD, vhD, cg1, dt, G, GV
type(MEKE_type), pointer :: MEKE !< MEKE control structure
type(thickness_diffuse_CS), pointer :: CS !< Control structure for thickness diffusion
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)+1), optional, intent(in) :: int_slope_u !< Ratio that determine how much of
!! the isopycnal slopes are taken directly from the
!! interface slopes without consideration of
!! the isopycnal slopes are taken directly from
!! the interface slopes without consideration of
!! density gradients.
real, dimension(SZI_(G),SZJB_(G),SZK_(G)+1), optional, intent(in) :: int_slope_v !< Ratio that determine how much of
!! the isopycnal slopes are taken directly from the
!! interface slopes without consideration of
!! the isopycnal slopes are taken directly from
!! the interface slopes without consideration of
!! density gradients.
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)+1), optional, intent(in) :: slope_x !< Isopycnal slope at u-points
real, dimension(SZI_(G),SZJB_(G),SZK_(G)+1), optional, intent(in) :: slope_y !< Isopycnal slope at v-points
Expand Down Expand Up @@ -1344,13 +1346,13 @@ subroutine add_detangling_Kh(h, e, Kh_u, Kh_v, KH_u_CFL, KH_v_CFL, tv, dt, G, GV
real, intent(in) :: dt !< Time increment [s]
type(thickness_diffuse_CS), pointer :: CS !< Control structure for thickness diffusion
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)+1), intent(inout) :: int_slope_u !< Ratio that determine how much of
!! the isopycnal slopes are taken directly from the
!! interface slopes without consideration of
!! density gradients.
!! the isopycnal slopes are taken directly from
!! the interface slopes without consideration
!! of density gradients.
real, dimension(SZI_(G),SZJB_(G),SZK_(G)+1), intent(inout) :: int_slope_v !< Ratio that determine how much of
!! the isopycnal slopes are taken directly from the
!! interface slopes without consideration of
!! density gradients.
!! the isopycnal slopes are taken directly from
!! the interface slopes without consideration
!! of density gradients.
! Local variables
real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: &
de_top ! The distances between the top of a layer and the top of the
Expand Down
Loading

0 comments on commit 4cb18ac

Please sign in to comment.