Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix indexing of layers in high freq. output #6497

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ subroutine ocn_compute_high_frequency_output(domain, timeLevel, err)!{{{
type (mpas_pool_type), pointer :: highFrequencyOutputAMPool
type (mpas_pool_type), pointer :: tracersPool

integer :: iLevel, iLevelTarget, iCell, iEdge, i, cell1, cell2, k, eoe
integer :: iLevel, iCell, iEdge, i, cell1, cell2, k, eoe
integer :: iLevel0100, iLevel0250, iLevel0700, iLevel2000
real (kind=RKIND) :: sumLayerThickness
integer, pointer :: nVertLevels, nCells, nEdges
Expand Down Expand Up @@ -377,37 +377,41 @@ subroutine ocn_compute_high_frequency_output(domain, timeLevel, err)!{{{
call mpas_pool_get_array(highFrequencyOutputAMPool, 'columnIntegratedSpeed', columnIntegratedSpeed)

! find vertical level that is just above the 100 m reference level
iLevel0100 = 1
do iLevel=2,nVertLevels
! if even the bottom level isn't deep enough, we still default to the bottom level
iLevel0100 = nVertLevels
do iLevel=1,nVertLevels
if(refBottomDepth(iLevel) > 100.0_RKIND) then
iLevel0100 = iLevel-1
iLevel0100 = iLevel
exit
endif
enddo

! find vertical level that is just above the 250 m reference level
iLevel0250 = 1
! if even the bottom level isn't deep enough, we still default to the bottom level
iLevel0250 = nVertLevels
do iLevel=iLevel0100,nVertLevels
if(refBottomDepth(iLevel) > 250.0_RKIND) then
iLevel0250 = iLevel-1
iLevel0250 = iLevel
exit
endif
enddo

! find vertical level that is just above the 700 m reference level
iLevel0700 = 1
! if even the bottom level isn't deep enough, we still default to the bottom level
iLevel0700 = nVertLevels
do iLevel=iLevel0250,nVertLevels
if(refBottomDepth(iLevel) > 700.0_RKIND) then
iLevel0700 = iLevel-1
iLevel0700 = iLevel
exit
endif
enddo

! find vertical level that is just above the 2000 m reference level
iLevel2000 = 1
! if even the bottom level isn't deep enough, we still default to the bottom level
iLevel2000 = nVertLevels
do iLevel=iLevel0700,nVertLevels
if(refBottomDepth(iLevel) > 2000.0_RKIND) then
iLevel2000 = iLevel-1
iLevel2000 = iLevel
exit
endif
enddo
Expand Down