Skip to content

Commit

Permalink
Merge branch 'cbegeman/ocn-enhance-tidal-boundary' (PR E3SM-Project#6049
Browse files Browse the repository at this point in the history
)

Add tidal boundary conditions to split-explicit time integrator

This PR adds the option to have a tidal boundary condition with the
split-explicit time integrator. Formerly, only tidal boundary conditions
were supported with RK4.

This PR also includes options for a linearly-varying tidal boundary
condition to match a test case from O'Dea et al. 2021 used for
validation.

[BFB] used by standalone mpaso only
  • Loading branch information
jonbob committed Jan 3, 2024
2 parents f427d86 + c773b78 commit a733924
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 3 deletions.
18 changes: 15 additions & 3 deletions components/mpas-ocean/src/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@
/>
<nml_option name="config_tidal_forcing_model" type="character" default_value="off"
description="Selects the mode in which tidal forcing is computed."
possible_values="'off','monochromatic'"
possible_values="'off','monochromatic','linear'"
/>
<nml_option name="config_tidal_forcing_monochromatic_amp" type="real" default_value="2.0" units="m"
description="Value of amplitude of monochromatic tide."
Expand All @@ -811,6 +811,18 @@
description="Value of baseline monochromatic tide, e.g., sea level rise."
possible_values="Any positive real number."
/>
<nml_option name="config_tidal_forcing_linear_baseline" type="real" default_value="0.0" units="days"
description="Value of baseline linear tide, e.g., sea level rise."
possible_values="Any positive real number."
/>
<nml_option name="config_tidal_forcing_linear_min" type="real" default_value="-1.0" units="days"
description="Value of minimum tide."
possible_values="Any real number."
/>
<nml_option name="config_tidal_forcing_linear_rate" type="real" default_value="-8.0" units="days"
description="Value of tide rate of change in m per day."
possible_values="Any real number."
/>
</nml_record>
<nml_record name="self_attraction_loading" mode="init;forward">
<nml_option name="config_use_self_attraction_loading" type="logical" default_value=".false."
Expand Down Expand Up @@ -3857,11 +3869,11 @@
/>
<var name="sshSubcycleCurWithTides" type="real" dimensions="nCells Time" units="m"
description="SSH - tidal potential in split explicit "
packages="tidalPotentialForcingPKG"
packages="tidalPotentialForcingPKG;tidalForcing"
/>
<var name="sshSubcycleNewWithTides" type="real" dimensions="nCells Time" units="m"
description="SSH - tidal potential in split explicit "
packages="tidalPotentialForcingPKG"
packages="tidalPotentialForcingPKG;tidalForcing"
/>
<var name="coastalSmoothingFactor" type="real" dimensions="nCells" units="1"
description="Multiplication factors to smooth ssh at coastlines for SAL caculation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{
! Forcing pool
real (kind=RKIND), dimension(:), pointer :: tidalPotentialEta

real (kind=RKIND) :: totalDepth
real (kind=RKIND), dimension(:), pointer :: tidalInputMask, tidalBCValue
real (kind=RKIND), dimension(:,:), pointer :: restingThickness

real (kind=RKIND), dimension(:), pointer :: &
seaIcePressure, atmosphericPressure

Expand Down Expand Up @@ -1029,6 +1033,29 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{

end if ! tidal potential forcing

! direct application of tidal boundary condition
if (config_use_tidal_forcing .and. trim(config_tidal_forcing_type) == 'direct') then
call mpas_pool_get_array(forcingPool, &
'sshSubcycleCurWithTides', &
sshSubcycleCurWithTides)
call mpas_pool_get_array(forcingPool, 'tidalInputMask', tidalInputMask)
call mpas_pool_get_array(forcingPool, 'tidalBCValue', tidalBCValue)
!$omp parallel
!$omp do schedule(runtime)
do iCell=1, nCellsAll
! boolean mask for now, could generalize to tappered sponge layer
! only modify layer thicknesses on tidal boundary
do k = minLevelCell(iCell), maxLevelCell(iCell)
sshSubcycleCurWithTides(iCell) = sshSubcycleCur(iCell) + &
(tidalInputMask(iCell)*(tidalBCValue(iCell) - sshSubcycleCur(iCell)))
end do
end do
!$omp end do
!$omp end parallel
call mpas_pool_get_array(forcingPool, &
'sshSubcycleCurWithTides', &
sshSubcycleCur)
end if
if (edgeHaloComputeCounter <= 1) then
nEdges = nEdgesOwned
else
Expand Down Expand Up @@ -1262,6 +1289,37 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{
'sshSubcycleNewWithTides', &
sshSubcycleNew)
end if ! tidal potential forcing
! direct application of tidal boundary condition
if (config_use_tidal_forcing .and. trim(config_tidal_forcing_type) == 'direct') then
call mpas_pool_get_array(forcingPool, &
'sshSubcycleCurWithTides', &
sshSubcycleCurWithTides)
call mpas_pool_get_array(forcingPool, &
'sshSubcycleNewWithTides', &
sshSubcycleNewWithTides)
call mpas_pool_get_array(forcingPool, 'tidalInputMask', tidalInputMask)
call mpas_pool_get_array(forcingPool, 'tidalBCValue', tidalBCValue)
!$omp parallel
!$omp do schedule(runtime)
do iCell=1, nCellsAll
! boolean mask for now, could generalize to tappered sponge layer
! only modify layer thicknesses on tidal boundary
do k = minLevelCell(iCell), maxLevelCell(iCell)
sshSubcycleCurWithTides(iCell) = sshSubcycleCur(iCell) + &
(tidalInputMask(iCell)*(tidalBCValue(iCell) - sshSubcycleCur(iCell)))
sshSubcycleNewWithTides(iCell) = sshSubcycleNew(iCell) + &
(tidalInputMask(iCell)*(tidalBCValue(iCell) - sshSubcycleNew(iCell)))
end do
end do
!$omp end do
!$omp end parallel
call mpas_pool_get_array(forcingPool, &
'sshSubcycleCurWithTides', &
sshSubcycleCur)
call mpas_pool_get_array(forcingPool, &
'sshSubcycleNewWithTides', &
sshSubcycleNew)
end if

! Need to initialize btr_vel_temp over one more halo
! than we are computing over
Expand Down Expand Up @@ -2593,6 +2651,31 @@ subroutine ocn_time_integrator_split(domain, dt)!{{{
#endif
end if

! direct application of tidal boundary condition
if (config_use_tidal_forcing .and. trim(config_tidal_forcing_type) == 'direct') then
call mpas_pool_get_array(verticalMeshPool, 'restingThickness', restingThickness)
call mpas_pool_get_array(forcingPool, 'tidalInputMask', tidalInputMask)
call mpas_pool_get_array(forcingPool, 'tidalBCValue', tidalBCValue)
do iCell=1, nCells
! artificially assumes boolean mask for now, could generalize to tappered sponge layer
if (tidalInputMask(iCell) == 1.0_RKIND) then
! compute total depth for relative thickness contribution
totalDepth = 0.0_RKIND
do k = minLevelCell(iCell), maxLevelCell(iCell)
totalDepth = totalDepth + restingThickness(k,iCell)
end do

! only modify layer thicknesses on tidal boundary
do k = minLevelCell(iCell), maxLevelCell(iCell)
layerThicknessNew(k, iCell) = tidalInputMask(iCell)* &
(tidalBCValue(iCell) + bottomDepth(iCell))* &
(restingThickness(k,iCell)/totalDepth)
!(1.0_RKIND - tidalInputMask(iCell))*layerThicknessNew(k, iCell) ! generalized tappered assumption code
end do
end if
end do
end if

call ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMeshPool, &
scratchPool, tracersPool, 2)

Expand Down
4 changes: 4 additions & 0 deletions components/mpas-ocean/src/shared/mpas_ocn_tidal_forcing.F
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ subroutine ocn_tidal_forcing_build_array(domain, meshPool, forcingPool, statePoo
SIN(2.0_RKIND*pii/config_tidal_forcing_monochromatic_period * daysSinceStartOfSim - &
pii*config_tidal_forcing_monochromatic_phaseLag/180.0_RKIND) - &
config_tidal_forcing_monochromatic_baseline
elseif (trim(config_tidal_forcing_model) == 'linear') then
tidalHeight = max(config_tidal_forcing_linear_min, &
config_tidal_forcing_linear_baseline + &
config_tidal_forcing_linear_rate * daysSinceStartOfSim)
!else if (trim(config_tidal_forcing_type) == 'data') then
! ! data option
! ! pass
Expand Down

0 comments on commit a733924

Please sign in to comment.