Skip to content

Commit

Permalink
Merge branch 'mark-petersen/ocn/remove-unused-variables' (PR #5610)
Browse files Browse the repository at this point in the history
Remove unused variables in ocean

The variables tidalPotentialZMid and nTidalPotentialConstituents are
defined in the Registry but not used for any computations. This tricks
the gnu compiler in optimized mode, which removes them internally. The
simulation then dies when the i/o references these variables on
initialization.

Fixes #5609
[BFB]
  • Loading branch information
jonbob committed Apr 28, 2023
2 parents 7ab58cf + fc282e7 commit de075c7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
8 changes: 0 additions & 8 deletions components/mpas-ocean/src/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3736,10 +3736,6 @@
description="Equilibrium tidal potential"
packages="forwardMode"
/>
<var name="nTidalPotentialConstituents" type="integer" dimensions="Time"
description="Number of tidal constituents"
packages="tidalPotentialForcingPKG"
/>
<var name="tidalPotentialConstituentFrequency" type="real" dimensions="maxTidalConstituents Time" units="s^-1"
description="Frequency of tidal constituents"
packages="tidalPotentialForcingPKG"
Expand Down Expand Up @@ -3772,10 +3768,6 @@
description="Latitude function for tidal constituents: long-period = 3\sin^2(\phi)-1, diurnal = \sin(2\phi), semi-diurnal = \cos^2(\phi)"
packages="tidalPotentialForcingPKG"
/>
<var name="tidalPotentialZMid" type="real" dimensions="nVertLevels nCells Time" units="m"
description="zMid - Equilibrium tidal potential in RK4"
packages="tidalPotentialForcingPKG"
/>
<var name="sshSubcycleCurWithTides" type="real" dimensions="nCells Time" units="m"
description="SSH - tidal potential in split explicit "
packages="tidalPotentialForcingPKG"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ subroutine ocn_vel_tidal_potential_init(domain,err)!{{{
type (mpas_pool_type), pointer :: forcingPool
type (mpas_pool_type), pointer :: meshPool
integer, pointer :: nCells
integer, pointer :: nTidalPotentialConstituents
real (kind=RKIND), dimension(:), pointer :: latCell

! End preamble
Expand Down Expand Up @@ -358,9 +357,6 @@ subroutine ocn_vel_tidal_potential_init(domain,err)!{{{
call mpas_pool_get_array(forcingPool, 'tidalPotentialEta', &
tidalPotEta)

call mpas_pool_get_array(forcingPool, &
'nTidalPotentialConstituents', &
nTidalPotentialConstituents)
call mpas_pool_get_array(forcingPool, &
'tidalPotentialConstituentAmplitude', &
tidalConstituentAmplitude)
Expand Down Expand Up @@ -434,9 +430,6 @@ subroutine ocn_vel_tidal_potential_init(domain,err)!{{{
constituentList(nTidalConstituents)%constituent = 'P1'
end if

! set point value in forcing pool just in case
nTidalPotentialConstituents = nTidalConstituents

call tidal_constituent_factors(constituentList, &
nTidalConstituents, refTime, &
tidalConstituentFrequency, &
Expand Down

0 comments on commit de075c7

Please sign in to comment.