Skip to content

Commit

Permalink
Zero out normalVelocity in RK4
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-petersen committed Aug 29, 2022
1 parent 3c9f1c5 commit 3757046
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ subroutine ocn_time_integrator_rk4_diagnostic_update(block, dt, rkSubstepWeight,
logical, pointer :: config_prescribe_velocity, config_prescribe_thickness, config_use_GM
integer, pointer :: nCells, nEdges
integer, pointer :: nCells, nEdges, nVertLevels
integer :: iCell, iEdge, k
type (mpas_pool_type), pointer :: statePool, tendPool, meshPool, scratchPool
Expand Down Expand Up @@ -1173,6 +1173,7 @@ subroutine ocn_time_integrator_rk4_diagnostic_update(block, dt, rkSubstepWeight,
call mpas_pool_get_dimension(block % dimensions, 'nCells', nCells)
call mpas_pool_get_dimension(block % dimensions, 'nEdges', nEdges)
call mpas_pool_get_dimension(block % dimensions, 'nVertLevels', nVertLevels)
call mpas_pool_get_subpool(block % structs, 'state', statePool)
call mpas_pool_get_subpool(block % structs, 'tend', tendPool)
Expand Down Expand Up @@ -1213,6 +1214,9 @@ subroutine ocn_time_integrator_rk4_diagnostic_update(block, dt, rkSubstepWeight,
* normalVelocityTend(k, iEdge)
normalVelocityProvis(k, iEdge) = normalVelocityProvis(k, iEdge) * (1.0_RKIND - wettingVelocity(k, iEdge))
end do
do k = maxLevelEdgeTop(iEdge)+1, nVertLevels
normalVelocityProvis(k, iEdge) = 0.0_RKIND
end do
end do
!$omp end do
Expand Down Expand Up @@ -1384,7 +1388,7 @@ subroutine ocn_time_integrator_rk4_accumulate_update(block, rkWeight, err)!{{{
real (kind=RKIND), intent(in) :: rkWeight
integer, intent(out) :: err
integer, pointer :: nCells, nEdges
integer, pointer :: nCells, nEdges, nVertLevels
integer :: iCell, iEdge, k
type (mpas_pool_type), pointer :: statePool, tendPool, meshPool
Expand All @@ -1397,7 +1401,7 @@ subroutine ocn_time_integrator_rk4_accumulate_update(block, rkWeight, err)!{{{
real (kind=RKIND), dimension(:, :, :), pointer :: tracersGroupNew, tracersGroupTend
integer, dimension(:), pointer :: minLevelCell, maxLevelCell
integer, dimension(:), pointer :: minLevelCell, maxLevelCell, maxLevelEdgeTop
logical, pointer :: config_use_tracerGroup
type (mpas_pool_iterator_type) :: groupItr
Expand All @@ -1408,6 +1412,7 @@ subroutine ocn_time_integrator_rk4_accumulate_update(block, rkWeight, err)!{{{
call mpas_pool_get_dimension(block % dimensions, 'nCells', nCells)
call mpas_pool_get_dimension(block % dimensions, 'nEdges', nEdges)
call mpas_pool_get_dimension(block % dimensions, 'nVertLevels', nVertLevels)
call mpas_pool_get_subpool(block % structs, 'state', statePool)
call mpas_pool_get_subpool(block % structs, 'tend', tendPool)
Expand All @@ -1434,6 +1439,7 @@ subroutine ocn_time_integrator_rk4_accumulate_update(block, rkWeight, err)!{{{
call mpas_pool_get_array(meshPool, 'minLevelCell', minLevelCell)
call mpas_pool_get_array(meshPool, 'maxLevelCell', maxLevelCell)
call mpas_pool_get_array(meshPool, 'maxLevelEdgeTop', maxLevelEdgeTop)
!$omp parallel
!$omp do schedule(runtime) private(k)
Expand All @@ -1446,8 +1452,13 @@ subroutine ocn_time_integrator_rk4_accumulate_update(block, rkWeight, err)!{{{
!$omp do schedule(runtime)
do iEdge = 1, nEdges
normalVelocityNew(:, iEdge) = normalVelocityNew(:, iEdge) + rkWeight * normalVelocityTend(:, iEdge)
normalVelocityNew(:, iEdge) = normalVelocityNew(:, iEdge) * (1.0_RKIND - wettingVelocity(:, iEdge))
do k = 1, maxLevelEdgeTop(iEdge)
normalVelocityNew(k, iEdge) = normalVelocityNew(k, iEdge) + rkWeight * normalVelocityTend(k, iEdge)
normalVelocityNew(k, iEdge) = normalVelocityNew(k, iEdge) * (1.0_RKIND - wettingVelocity(k, iEdge))
end do
do k = maxLevelEdgeTop(iEdge)+1, nVertLevels
normalVelocityNew(k, iEdge) = 0.0_RKIND
end do
end do
!$omp end do
!$omp end parallel
Expand Down

0 comments on commit 3757046

Please sign in to comment.