Skip to content

Commit

Permalink
move landIcePressureApplied to diagnostics pool
Browse files Browse the repository at this point in the history
  • Loading branch information
cbegeman committed Nov 11, 2024
1 parent 3bfa57e commit cd8cb8f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 34 deletions.
7 changes: 3 additions & 4 deletions components/mpas-ocean/src/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2435,10 +2435,6 @@
description="Mass per unit area of frazil ice produced under land ice. Only computed when not coupled to a dynamic land-ice model."
packages="frazilIce"
/>
<var name="landIcePressureApplied" type="real" dimensions="nCells Time" units="Pa"
description="landIcePressure as used in state"
packages="landIcePressurePKG"
/>

<!-- FIELDS FOR SPLIT EXPLICIT TIME INTEGRATOR -->
<var name="normalBarotropicVelocity" type="real" dimensions="nEdges Time" units="m s^-1"
Expand Down Expand Up @@ -2951,6 +2947,9 @@
<var name="surfacePressure" type="real" dimensions="nCells Time" units="Pa"
description="Pressure at the sea surface due to atmosphere, sea ice, frazil and land ice"
/>
<var name="landIcePressureApplied" type="real" dimensions="nCells Time" units="Pa"
description="landIcePressure as used in state"
/>
<var_array name="SSHGradient" type="real" dimensions="nCells Time" packages="forwardMode;analysisMode">
<var name="SSHGradientZonal" array_group="ssh_zonal" units="1"
description="Zonal gradient of SSH reconstructed at cell centers"
Expand Down
62 changes: 32 additions & 30 deletions components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe
logical :: full_compute = .true.

real (kind=RKIND), dimension(:), pointer :: &
frazilSurfacePressure, landIcePressureApplied, landIcePressure, landIceDraft, landIceFraction
frazilSurfacePressure, landIcePressure, landIceDraft, landIceFraction

integer, dimension(:), pointer :: &
landIceFloatingMask
Expand Down Expand Up @@ -171,7 +171,6 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe
call mpas_pool_get_array(statePool, 'layerThickness', layerThickness, timeLevel)
call mpas_pool_get_array(statePool, 'normalVelocity', normalVelocity, timeLevel)
call mpas_pool_get_array(statePool, 'ssh', ssh, timeLevel)
call mpas_pool_get_array(statePool, 'landIcePressureApplied', landIcePressureApplied, timeLevel)

call mpas_pool_get_array(forcingPool, 'seaIcePressure', seaIcePressure)
call mpas_pool_get_array(forcingPool, 'atmosphericPressure', atmosphericPressure)
Expand Down Expand Up @@ -347,7 +346,7 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe
! inputs: atmosphericPressure, seaIcePressure, frazilSurfacePressure, landIcePressure
! outputs: surfacePressure
call ocn_diagnostic_solve_surface_pressure(forcingPool, atmosphericPressure, &
ssh, seaIcePressure, landIcePressureApplied, surfacePressure)
ssh, seaIcePressure, surfacePressure)


!
Expand Down Expand Up @@ -2540,15 +2539,17 @@ subroutine ocn_diagnostic_solve_surface_pressure(forcingPool, &
real (kind=RKIND), dimension(:), intent(in) :: &
ssh, &
atmosphericPressure, &!< [in] atmospheric pressure on surface
seaIcePressure, & !< [in] sea-ice pressure on surface
landIcePressureApplied!< [in] land-ice pressure on surface
seaIcePressure !< [in] sea-ice pressure on surface
!-----------------------------------------------------------------
! output variables
!-----------------------------------------------------------------
real (kind=RKIND), dimension(:), intent(inout) :: &
landIcePressureApplied !< [out] land ice pressure applied
real (kind=RKIND), dimension(:), intent(out) :: &
surfacePressure !< [out] total surface pressure
surfacePressure !< [out] total surface pressure
!-----------------------------------------------------------------
! local variables
Expand Down Expand Up @@ -2648,33 +2649,12 @@ subroutine ocn_diagnostic_solve_surface_pressure(forcingPool, &
h_crit = config_drying_min_cell_height * (maxLevelCell(iCell) - minLevelCell(iCell) + 1)
ssh_crit = bottomDepth(iCell) - h_crit + config_land_ice_overburden_height
landIcePressureMax(iCell) = gravity * rho_sw * ssh_crit
surfacePressure(iCell) = surfacePressure(iCell) + &
min(landIcePressureMax(iCell), landIcePressure(iCell))
end do
#ifndef MPAS_OPENACC
!$omp end do
!$omp end parallel
#endif
else
#ifdef MPAS_OPENACC
!$acc parallel loop &
!$acc present(surfacePressure)
!! need this eventually, but there is currently
!! an issue, probably with the re-retrieval of pointer
!!acc present(surfacePressure, landIcePressure)
#else
!$omp parallel
!$omp do schedule(runtime) &
!$omp private(floatation_pressure, h_crit, ssh_crit)
#endif
do iCell = 1, nCellsAll
surfacePressure(iCell) = surfacePressure(iCell) + &
landIcePressure(iCell)
end do
#ifndef MPAS_OPENACC
!$omp end do
!$omp end parallel
#endif
endif
if (config_use_land_ice_pressure_relaxation) then
#ifdef MPAS_OPENACC
Expand All @@ -2694,17 +2674,39 @@ subroutine ocn_diagnostic_solve_surface_pressure(forcingPool, &
ssh_crit = h_crit - bottomDepth(iCell)
if (ssh(iCell) > ssh_crit .and. &
landIcePressureMax(iCell) > surfacePressure(iCell)) then
surfacePressure(iCell) = surfacePressure(iCell) + &
config_land_ice_pressure_increment
landIcePressureMax(iCell) = landIcePressureApplied(iCell) + config_land_ice_pressure_increment
adjust_count = adjust_count + 1
endif
end do
#ifndef MPAS_OPENACC
!!$omp end do
!!$omp end parallel
#endif
if (adjust_count > 0) call mpas_log_write('Increment pressure for $i cells', intArgs=(/adjust_count/))
if (adjust_count > 0) &
call mpas_log_write('Increment pressure for $i cells', intArgs=(/adjust_count/))
endif
#ifdef MPAS_OPENACC
!$acc parallel loop &
!$acc present(surfacePressure)
!! need this eventually, but there is currently
!! an issue, probably with the re-retrieval of pointer
!!acc present(surfacePressure, landIcePressure)
#else
!$omp parallel
!$omp do schedule(runtime) &
!$omp private(floatation_pressure, h_crit, ssh_crit)
#endif
! Update landIcePressureApplied and surfacePressure
do iCell = 1, nCellsAll
landIcePressureApplied(iCell) = min(landIcePressureMax(iCell), &
landIcePressure(iCell))
surfacePressure(iCell) = surfacePressure(iCell) + &
landIcePressureApplied(iCell)
end do
#ifndef M_OPENACC
!$omp end do
!$omp end parallel
#endif
endif ! land ice pressure

!--------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ module ocn_diagnostics_variables
real (kind=RKIND), dimension(:), pointer :: surfaceBuoyancyForcing
real (kind=RKIND), dimension(:), pointer :: surfaceFrictionVelocity
real (kind=RKIND), dimension(:), pointer :: surfacePressure
real (kind=RKIND), dimension(:), pointer :: landIcePressureApplied

real (kind=RKIND), dimension(:,:), pointer :: &
transportVelocityX, transportVelocityY, transportVelocityZ, transportVelocityZonal, &
Expand Down Expand Up @@ -707,6 +708,8 @@ subroutine ocn_diagnostics_variables_init(domain, jenkinsOn, hollandJenkinsOn, e
call mpas_pool_get_array(diagnosticsPool, 'dThreshMLD', dThreshMLD)
call mpas_pool_get_array(diagnosticsPool, 'surfacePressure', &
surfacePressure)
call mpas_pool_get_array(diagnosticsPool, 'landIcePressureApplied', &
landIcePressureApplied)

! Semi-implicit Array Pointer retrievals
if (trim(config_time_integrator) == 'split_implicit') then
Expand Down Expand Up @@ -957,6 +960,7 @@ subroutine ocn_diagnostics_variables_init(domain, jenkinsOn, hollandJenkinsOn, e
!$acc thermExpCoeff, &
!$acc sfcFlxAttCoeff, &
!$acc surfacePressure, &
!$acc landIcePressureApplied, &
!$acc potentialDensity, &
!$acc displacedDensity, &
!$acc boundaryLayerDepth, &
Expand Down Expand Up @@ -1217,6 +1221,7 @@ subroutine ocn_diagnostics_variables_destroy(err) !{{{
!$acc thermExpCoeff, &
!$acc sfcFlxAttCoeff, &
!$acc surfacePressure, &
!$acc landIcePressureApplied, &
!$acc potentialDensity, &
!$acc displacedDensity, &
!$acc boundaryLayerDepth, &
Expand Down Expand Up @@ -1420,6 +1425,7 @@ subroutine ocn_diagnostics_variables_destroy(err) !{{{
thermExpCoeff, &
sfcFlxAttCoeff, &
surfacePressure, &
landIcePressureApplied, &
potentialDensity, &
displacedDensity, &
boundaryLayerDepth, &
Expand Down

0 comments on commit cd8cb8f

Please sign in to comment.