Skip to content

Commit

Permalink
Remove centered layerThickEdge computation from vmix
Browse files Browse the repository at this point in the history
  • Loading branch information
cbegeman committed Feb 23, 2022
1 parent b573c14 commit d0389d9
Showing 1 changed file with 12 additions and 31 deletions.
43 changes: 12 additions & 31 deletions components/mpas-ocean/src/shared/mpas_ocn_vmix.F
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ subroutine ocn_vel_vmix_tend_implicit_rayleigh(dt, kineticEnergyCell, vertViscTo
real (kind=RKIND), dimension(:,:), intent(in) :: &
layerThickness !< Input: thickness at cell center

real (kind=RKIND), dimension(:,:), intent(in) :: &
layerThicknessEdge !< Input: centered thickness at edge

!-----------------------------------------------------------------
!
! input/output variables
Expand All @@ -242,9 +245,6 @@ subroutine ocn_vel_vmix_tend_implicit_rayleigh(dt, kineticEnergyCell, vertViscTo
real (kind=RKIND), dimension(:,:), intent(inout) :: &
normalVelocity !< Input: velocity

real (kind=RKIND), dimension(:,:), intent(inout) :: &
layerThicknessEdge !< Input: thickness at edge

!-----------------------------------------------------------------
!
! output variables
Expand Down Expand Up @@ -288,13 +288,10 @@ subroutine ocn_vel_vmix_tend_implicit_rayleigh(dt, kineticEnergyCell, vertViscTo
N = maxLevelEdgeTop(iEdge)
if (N .gt. 0) then

! layerThicknessEdge is computed in compute_solve_diag, and is not available yet,
! so recompute layerThicknessEdge here.
cell1 = cellsOnEdge(1,iEdge)
cell2 = cellsOnEdge(2,iEdge)
edgeThicknessTotal = 0.0_RKIND
do k = Nsurf, N
layerThicknessEdge(k,iEdge) = 0.5_RKIND * (layerThickness(k,cell1) + layerThickness(k,cell2))
edgeThicknessTotal = edgeThicknessTotal + layerThicknessEdge(k,iEdge)
enddo

Expand Down Expand Up @@ -396,6 +393,9 @@ subroutine ocn_vel_vmix_tend_implicit(dt, kineticEnergyCell, vertViscTopOfEdge,
real (kind=RKIND), dimension(:,:), intent(in) :: &
layerThickness !< Input: thickness at cell center

real (kind=RKIND), dimension(:,:), intent(in) :: &
layerThicknessEdge !< Input: centered thickness at edge

!-----------------------------------------------------------------
!
! input/output variables
Expand All @@ -405,9 +405,6 @@ subroutine ocn_vel_vmix_tend_implicit(dt, kineticEnergyCell, vertViscTopOfEdge,
real (kind=RKIND), dimension(:,:), intent(inout) :: &
normalVelocity !< Input: velocity

real (kind=RKIND), dimension(:,:), intent(inout) :: &
layerThicknessEdge !< Input: thickness at edge

!-----------------------------------------------------------------
!
! output variables
Expand Down Expand Up @@ -449,13 +446,8 @@ subroutine ocn_vel_vmix_tend_implicit(dt, kineticEnergyCell, vertViscTopOfEdge,
Nsurf = minLevelEdgeBot(iEdge)
if (N .gt. 0) then

! layerThicknessEdge is computed in compute_solve_diag, and is not available yet,
! so recompute layerThicknessEdge here.
cell1 = cellsOnEdge(1,iEdge)
cell2 = cellsOnEdge(2,iEdge)
do k = Nsurf, N
layerThicknessEdge(k,iEdge) = 0.5_RKIND * (layerThickness(k,cell1) + layerThickness(k,cell2))
enddo

! tridiagonal matrix algorithm
C(Nsurf) = -2.0_RKIND*dt*vertViscTopOfEdge(Nsurf+1,iEdge) &
Expand Down Expand Up @@ -551,6 +543,9 @@ subroutine ocn_vel_vmix_tend_implicit_spatially_variable(bottomDrag, dt, kinetic
real (kind=RKIND), dimension(:,:), intent(in) :: &
layerThickness !< Input: thickness at cell center

real (kind=RKIND), dimension(:,:), intent(in) :: &
layerThicknessEdge !< Input: centered thickness at edge

real (kind=RKIND), dimension(:), intent(in) :: &
bottomDrag !< Input: bottomDrag at cell centeres

Expand All @@ -563,9 +558,6 @@ subroutine ocn_vel_vmix_tend_implicit_spatially_variable(bottomDrag, dt, kinetic
real (kind=RKIND), dimension(:,:), intent(inout) :: &
normalVelocity !< Input: velocity

real (kind=RKIND), dimension(:,:), intent(inout) :: &
layerThicknessEdge !< Input: thickness at edge

!-----------------------------------------------------------------
!
! output variables
Expand Down Expand Up @@ -608,14 +600,8 @@ subroutine ocn_vel_vmix_tend_implicit_spatially_variable(bottomDrag, dt, kinetic
N = maxLevelEdgeTop(iEdge)
if (N .gt. 0) then

! layerThicknessEdge is computed in compute_solve_diag, and is not available yet,
! so recompute layerThicknessEdge here.
cell1 = cellsOnEdge(1,iEdge)
cell2 = cellsOnEdge(2,iEdge)
do k = Nsurf, N
layerThicknessEdge(k,iEdge) = 0.5_RKIND * (layerThickness(k,cell1) + layerThickness(k,cell2))
end do

! average cell-based implicit bottom drag to edges
implicitCd = 0.5_RKIND*(bottomDrag(cell1) + bottomDrag(cell2))

Expand Down Expand Up @@ -717,6 +703,9 @@ subroutine ocn_vel_vmix_tend_implicit_spatially_variable_mannings(forcingPool, b
real (kind=RKIND), dimension(:,:), intent(in) :: &
layerThickness !< Input: thickness at cell center
real (kind=RKIND), dimension(:,:), intent(in) :: &
layerThicknessEdge !< Input: centered thickness at edge
real (kind=RKIND), dimension(:), intent(in) :: &
bottomDrag !< Input: bottomDrag at cell centeres
Expand All @@ -731,9 +720,6 @@ subroutine ocn_vel_vmix_tend_implicit_spatially_variable_mannings(forcingPool, b
real (kind=RKIND), dimension(:,:), intent(inout) :: &
normalVelocity !< Input: velocity
real (kind=RKIND), dimension(:,:), intent(inout) :: &
layerThicknessEdge !< Input: thickness at edge
!-----------------------------------------------------------------
!
! output variables
Expand Down Expand Up @@ -828,13 +814,8 @@ subroutine ocn_vel_vmix_tend_implicit_spatially_variable_mannings(forcingPool, b
N = maxLevelEdgeTop(iEdge)
if (N .gt. 0) then
! layerThicknessEdge is computed in compute_solve_diag, and is not available yet,
! so recompute layerThicknessEdge here.
cell1 = cellsOnEdge(1,iEdge)
cell2 = cellsOnEdge(2,iEdge)
do k = Nsurf, N
layerThicknessEdge(k,iEdge) = 0.5_RKIND * (layerThickness(k,cell1) + layerThickness(k,cell2))
end do
! average cell-based implicit bottom drag to edges and convert Mannings n to Cd
if (config_use_implicit_bottom_roughness) then
Expand Down

0 comments on commit d0389d9

Please sign in to comment.