Skip to content

Commit

Permalink
add bottomDepthEdge calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-petersen committed Sep 21, 2022
1 parent 81a0366 commit cf46d28
Showing 1 changed file with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{
edgeHaloComputeCounter, &! halo counters to reduce
cellHaloComputeCounter ! halo updates during cycling

integer, dimension(:), pointer :: nEdgesArray

real (kind=RKIND) :: &
normalThicknessFluxSum, &! sum of thickness flux in column
thicknessSum, &! sum of thicknesses in column
Expand All @@ -191,7 +193,8 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{
uTemp

real (kind=RKIND), dimension(:), allocatable :: &
btrvel_temp
btrvel_temp, &
bottomDepthEdge

! State Array Pointers
real (kind=RKIND), dimension(:), pointer :: &
Expand Down Expand Up @@ -382,6 +385,10 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{

call mpas_pool_get_array(tracersPool, 'activeTracers', activeTracersNew, 2)

call mpas_pool_get_dimension(meshPool,'nEdgesArray', nEdgesArray)

allocate(bottomDepthEdge(nEdgesAll+1))

if (config_transport_tests_flow_id > 0) then
! This is a transport test. Write advection velocity from prescribed
! flow field.
Expand Down Expand Up @@ -768,6 +775,8 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{
enddo
barotropicForcing(iEdge) = splitFact* &
normalThicknessFluxSum/thicknessSum/dt
bottomDepthEdge(iEdge) = thicknessSum &
- 0.5_RKIND*(sshNew(cell1) + sshNew(cell2))
do k = minLevelEdgeBot(iEdge), maxLevelEdgeTop(iEdge)
! These two steps are together here:
Expand All @@ -786,6 +795,25 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{
!$omp end do
!$omp end parallel

!mrp note, not sure if I need nEdgesAll here, or nEdgesArray(3)?
!mrp note, if I have bfb partition problems, it could be this section.
!$omp parallel
!$omp do schedule(runtime) &
!$omp private(k)
do iEdge = nEdgesOwned+1, nEdgesArray(3)
cell1 = cellsOnEdge(1,iEdge)
cell2 = cellsOnEdge(2,iEdge)
thicknessSum = layerThickEdgeFlux(minLevelEdgeBot(iEdge),iEdge)
do k = minLevelEdgeBot(iEdge)+1, maxLevelEdgeTop(iEdge)
thicknessSum = thicknessSum + &
layerThickEdgeFlux(k,iEdge)
enddo
bottomDepthEdge(iEdge) = thicknessSum &
- 0.5_RKIND*(sshNew(cell1) + sshNew(cell2))
enddo ! iEdge
!$omp end do
!$omp end parallel

deallocate(uTemp)

call mpas_timer_start("se halo normalBaroclinicVelocity")
Expand Down Expand Up @@ -2682,6 +2710,7 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{
call mpas_dmpar_exch_halo_field(effectiveDensityField)
call mpas_timer_stop("se effective density halo")
end if
deallocate(bottomDepthEdge)
call mpas_timer_stop('se fini')
call mpas_timer_stop("se timestep")
Expand Down

0 comments on commit cf46d28

Please sign in to comment.