Skip to content

Commit

Permalink
Add subglacial runoff as a freshwater tracer
Browse files Browse the repository at this point in the history
  • Loading branch information
cbegeman committed Sep 25, 2024
1 parent bc95733 commit d1febf3
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 13 deletions.
77 changes: 77 additions & 0 deletions components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ subroutine ocn_surface_bulk_forcing_tracers_subglacial_runoff(meshPool, groupNam
if ( trim(groupName) == 'activeTracers' ) then
call ocn_surface_bulk_forcing_active_tracers_subglacial_runoff(meshPool, forcingPool, &
tracersSurfaceFluxSubglacialRunoff, err)
elseif ( trim(groupName) == 'freshwaterTracers' ) then
call ocn_surface_bulk_forcing_freshwater_tracers_subglacial_runoff(meshPool, forcingPool, &
tracersSurfaceFluxSubglacialRunoff, err)!{{{
end if
call mpas_timer_stop("bulk_" // trim(groupName))

Expand Down Expand Up @@ -983,6 +986,80 @@ subroutine ocn_surface_bulk_forcing_freshwater_tracers(meshPool, forcingPool, tr

end subroutine ocn_surface_bulk_forcing_freshwater_tracers!}}}

!***********************************************************************
!
! routine ocn_surface_bulk_forcing_freshwater_tracers_subglacial_runoff
!
!> \brief computes a tracer tendency due to CFC surface fluxes
!> \author Irena Vankova
!> \date July 2024
!> \details
!> This routine computes a tracer tendency due to CFC surface fluxes
!
!-----------------------------------------------------------------------

subroutine ocn_surface_bulk_forcing_freshwater_tracers_subglacial_runoff(meshPool, forcingPool, &
tracersSurfaceFluxSubglacialRunoff, err)!{{{

!-----------------------------------------------------------------
!
! input variables
!
!-----------------------------------------------------------------
type (mpas_pool_type), intent(in) :: meshPool !< Input: mesh information

!-----------------------------------------------------------------
!
! input/output variables
!
!-----------------------------------------------------------------

type (mpas_pool_type), intent(inout) :: forcingPool

! two dimensional arrays
real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxSubglacialRunoff

!-----------------------------------------------------------------
!
! output variables
!
!-----------------------------------------------------------------

integer, intent(out) :: err !< Output: Error flag

!-----------------------------------------------------------------
!
! local variables
!
!-----------------------------------------------------------------
integer :: iCell, nCells
integer, dimension(:), pointer :: nCellsArray

type(mpas_pool_type),pointer :: tracersSurfaceFluxPool
integer, pointer :: indexSubglacialRunoff
real (kind=RKIND), dimension(:), pointer :: subglacialRunoffFlux

err = 0

call mpas_pool_get_dimension(meshPool, 'nCellsArray', nCellsArray)

call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool)
call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_subglacialRunoffFreshWaterSurfaceFlux', indexSubglacialRunoff)

call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux)

nCells = nCellsArray( 3 )
if (associated(indexSubglacialRunoff) .and. associated(subglacialRunoffFlux)) then
do iCell=1,nCells
tracersSurfaceFluxSubglacialRunoff(indexSubglacialRunoff, iCell) = subglacialRunoffFlux(iCell) / rho_sw
enddo ! iCell
else
call mpas_log_write('indexSubglacialRunoff or subglacialRunoffFlux is not associated')
tracersSurfaceFluxSubglacialRunoff(indexSubglacialRunoff, :) = 0.0_RKIND
endif

end subroutine ocn_surface_bulk_forcing_freshwater_tracers_subglacial_runoff!}}}

end module ocn_surface_bulk_forcing


Expand Down
19 changes: 6 additions & 13 deletions components/mpas-ocean/src/shared/mpas_ocn_tendency.F
Original file line number Diff line number Diff line change
Expand Up @@ -844,21 +844,14 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, &

if (trim(config_subglacial_runoff_mode) == 'data') then
! Get surface flux due to subglacial runoff array
! only active tracers have subglacial runoff flux for now,
! but we still need to associate for ALL tracers
modifiedGroupName = groupName // "SurfaceFluxSubglacialRunoff"
call mpas_pool_get_array(tracersSurfaceFluxPool, &
modifiedGroupName, &
tracerGroupSurfaceFluxSubglacialRunoff)
end if

if (associated(tracerGroupSurfaceFluxRunoff)) then
call mpas_log_write(modifiedGroupName // " is associated")
else
call mpas_log_write(modifiedGroupName // " is not associated")
endif
!call mpas_pool_print_summary(tracersSurfaceFluxPool, MPAS_POOL_FIELD, .true.)

call mpas_pool_print_summary(tracersSurfaceFluxPool, MPAS_POOL_FIELD, .true.)
! Get surface flux removed array to keep track of how much
! flux is ignored
modifiedGroupName = groupName // "SurfaceFluxRemoved"
Expand Down Expand Up @@ -1336,12 +1329,12 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, &
!
! Compute tracer tendency due to non-local flux computed in KPP
!
if (config_use_cvmix_kpp .or. config_use_gotm) then
call ocn_compute_KPP_input_fields(statePool, forcingPool,&
if (config_use_cvmix_kpp) then
call mpas_timer_start("non-local flux from KPP")
if (.not. config_cvmix_kpp_nonlocal_with_implicit_mix) then
call ocn_compute_KPP_input_fields(statePool, forcingPool,&
meshPool, timeLevel)

if (.not. config_cvmix_kpp_nonlocal_with_implicit_mix) then
call mpas_timer_start("non-local flux from KPP")
if (computeBudgets) then
!$omp parallel
!$omp do schedule(runtime) private(k,n)
Expand Down Expand Up @@ -1384,8 +1377,8 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, &
!$omp end do
!$omp end parallel
endif ! compute budgets
call mpas_timer_stop("non-local flux from KPP")
end if ! not non-local with implicit mix
call mpas_timer_stop("non-local flux from KPP")
end if ! KPP

! Compute tracer tendency due to production/destruction of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
<var name="riverRunoffFreshWaterConcentration" array_group="freshwaterGRP" units="fractional"
description="Concentration of river runoff-derived freshwater by volume."
/>
<var name="subglacialRunoffFreshWaterConcentration" array_group="freshwaterGRP" units="fractional"
description="Concentration of subglacial runoff-derived freshwater by volume."
/>
</var_array>
</var_struct>
</var_struct>
Expand Down Expand Up @@ -95,6 +98,9 @@
<var name="riverRunoffFreshWaterTend" array_group="freshwaterGRP" units="fractional"
description="Concentration of river runoff-derived freshwater by volume."
/>
<var name="subglacialRunoffFreshWaterTend" array_group="freshwaterGRP" units="fractional"
description="Concentration of subglacial runoff-derived freshwater by volume."
/>
</var_array>
</var_struct>
</var_struct>
Expand Down Expand Up @@ -123,6 +129,9 @@
<var name="riverRunoffFreshWaterSurfaceFlux" array_group="freshwaterTracerFluxGRP" units="fractional"
description="Concentration of river runoff-derived freshwater by volume."
/>
<var name="subglacialRunoffFreshWaterSurfaceFlux" array_group="freshwaterTracerFluxGRP" units="fractional"
description="Concentration of subglacial runoff-derived freshwater by volume."
/>
</var_array>
<var_array name="freshwaterTracersSurfaceFluxRunoff" type="real" dimensions="nCells Time" packages="freshwaterTracersPKG">
<var name="snowSurfaceFluxRunoff" array_group="freshwaterTracersSurfaceFluxRunoffGRP" units="fractional"
Expand All @@ -146,6 +155,35 @@
<var name="riverRunoffFreshWaterSurfaceFluxRunoff" array_group="freshwaterTracersSurfaceFluxRunoffGRP" units="fractional"
description="Concentration of river runoff-derived freshwater by volume."
/>
<var name="subglacialRunoffFreshWaterSurfaceFluxRunoff" array_group="freshwaterTracersSurfaceFluxRunoffGRP" units="fractional"
description="Concentration of subglacial runoff-derived freshwater by volume."
/>
</var_array>
<var_array name="freshwaterTracersSurfaceFluxSubglacialRunoff" type="real" dimensions="nCells Time" packages="freshwaterTracersPKG">
<var name="snowSurfaceFluxSubglacialRunoff" array_group="freshwaterTracersSurfaceFluxSubglacialRunoffGRP" units="fractional"
description="Concentration of snow by volume."
/>
<var name="rainSurfaceFluxSubglacialRunoff" array_group="freshwaterTracersSurfaceFluxSubglacialRunoffGRP" units="fractional"
description="Concentration of rain by volume."
/>
<var name="seaIceFreshWaterSurfaceFluxSubglacialRunoff" array_group="freshwaterTracersSurfaceFluxSubglacialRunoffGRP" units="fractional"
description="Concentration of sea ice-derived freshwater by volume."
/>
<var name="icebergFreshWaterSurfaceFluxSubglacialRunoff" array_group="freshwaterTracersSurfaceFluxSubglacialRunoffGRP" units="fractional"
description="Concentration of iceberg-derived freshwater by volume."
/>
<var name="iceRunoffFreshWaterSurfaceFluxSubglacialRunoff" array_group="freshwaterTracersSurfaceFluxSubglacialRunoffGRP" units="fractional"
description="Concentration of ice runoff-derived freshwater by volume."
/>
<var name="landIceFreshwaterSurfaceFluxSubglacialRunoff" array_group="freshwaterTracersSurfaceFluxSubglacialRunoffGRP" units="fractional"
description="Concentration of land ice-derived freshwater by volume."
/>
<var name="riverRunoffFreshWaterSurfaceFluxSubglacialRunoff" array_group="freshwaterTracersSurfaceFluxSubglacialRunoffGRP" units="fractional"
description="Concentration of river runoff-derived freshwater by volume."
/>
<var name="subglacialRunoffFreshWaterSurfaceFluxSubglacialRunoff" array_group="freshwaterTracersSurfaceFluxSubglacialRunoffGRP" units="fractional"
description="Concentration of subglacial runoff-derived freshwater by volume."
/>
</var_array>
<var_array name="freshwaterTracersSurfaceFluxRemoved" type="real" dimensions="nCells Time" packages="freshwaterTracersPKG">
<var name="snowSurfaceFluxRemoved" array_group="freshwaterTracersSurfaceFluxRemovedGRP" units="fractional"
Expand All @@ -169,6 +207,9 @@
<var name="riverRunoffFreshWaterSurfaceFluxRemoved" array_group="freshwaterTracersSurfaceFluxRemovedGRP" units="fractional"
description="Concentration of river runoff-derived freshwater by volume."
/>
<var name="subglacialRunoffFreshWaterSurfaceFluxRemoved" array_group="freshwaterTracersSurfaceFluxRemovedGRP" units="fractional"
description="Concentration of subglacial runoff-derived freshwater by volume."
/>
</var_array>
</var_struct>
</var_struct>

0 comments on commit d1febf3

Please sign in to comment.