-
Notifications
You must be signed in to change notification settings - Fork 386
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
Add tracers for freshwater sources to MPAS-Ocean #7087
base: master
Are you sure you want to change the base?
Changes from all commits
d872067
264a082
deb7ced
b9ded79
dd670fc
6d9357c
f938f02
2b8dee2
906380a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This testdef is used to test a stealth feature in mpaso introduced by | ||
PR #7087. It simplies changes one mpaso namelist variable, | ||
config_use_freshwaterTracers | ||
from its default value of .false. to .true.. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
config_use_freshwaterTracers = .true. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,9 @@ subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tr | |
if ( trim(groupName) == 'activeTracers' ) then | ||
call ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracerGroup, & | ||
tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err) | ||
elseif ( trim(groupName) == 'freshwaterTracers' ) then | ||
call ocn_surface_bulk_forcing_freshwater_tracers(meshPool, forcingPool, tracerGroup, & | ||
tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, err) | ||
end if | ||
call mpas_timer_stop("bulk_" // trim(groupName)) | ||
|
||
|
@@ -184,6 +187,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)) | ||
|
||
|
@@ -880,6 +886,215 @@ subroutine ocn_surface_bulk_forcing_active_tracers_subglacial_runoff(meshPool, f | |
|
||
end subroutine ocn_surface_bulk_forcing_active_tracers_subglacial_runoff!}}} | ||
|
||
!*********************************************************************** | ||
! | ||
! routine ocn_surface_bulk_forcing_freshwater_tracers | ||
! | ||
!> \brief computes a tracer tendency due to freshwater surface fluxes | ||
!> \author Carolyn Branecky Begeman | ||
!> \date June 2024 | ||
!> \details | ||
!> This routine computes a tracer tendency due to freshwater surface fluxes | ||
! | ||
!----------------------------------------------------------------------- | ||
|
||
subroutine ocn_surface_bulk_forcing_freshwater_tracers(meshPool, forcingPool, tracerGroup, & | ||
freshwaterSurfaceFlux, freshwaterSurfaceFluxRunoff, freshwaterSurfaceFluxRemoved, 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) :: & | ||
freshwaterSurfaceFlux, freshwaterSurfaceFluxRunoff, freshwaterSurfaceFluxRemoved | ||
real (kind=RKIND), dimension(:,:,:), intent(inout) :: tracerGroup | ||
|
||
!----------------------------------------------------------------- | ||
! | ||
! 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 :: indexRain, indexSnow, indexRiverRunoff, indexIceRunoff, indexSeaIceFreshWater, & | ||
indexIcebergFreshWater, indexLandIceFreshwater | ||
real (kind=RKIND), dimension(:), pointer :: & | ||
rainFlux, snowFlux, riverRunoffFlux, iceRunoffFlux, seaIceFreshWaterFlux, & | ||
icebergFreshWaterFlux, landIceFreshwaterFlux | ||
|
||
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_rainSurfaceFlux', indexRain) | ||
call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_snowSurfaceFlux', indexSnow) | ||
call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_riverRunoffFreshWaterSurfaceFlux', indexRiverRunoff) | ||
call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_iceRunoffFreshWaterSurfaceFlux', indexIceRunoff) | ||
call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_seaIceFreshWaterSurfaceFlux', indexSeaIceFreshWater) | ||
call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_icebergFreshWaterSurfaceFlux', indexIcebergFreshWater) | ||
call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_landIceFreshwaterSurfaceFlux', indexLandIceFreshwater) | ||
|
||
call mpas_pool_get_array(forcingPool, 'rainFlux', rainFlux) | ||
call mpas_pool_get_array(forcingPool, 'snowFlux', snowFlux) | ||
call mpas_pool_get_array(forcingPool, 'riverRunoffFlux', riverRunoffFlux) | ||
call mpas_pool_get_array(forcingPool, 'iceRunoffFlux', iceRunoffFlux) | ||
call mpas_pool_get_array(forcingPool, 'seaIceFreshWaterFlux', seaIceFreshWaterFlux) | ||
call mpas_pool_get_array(forcingPool, 'icebergFreshWaterFlux', icebergFreshWaterFlux) | ||
call mpas_pool_get_array(forcingPool, 'landIceFreshwaterFlux', landIceFreshwaterFlux) | ||
|
||
nCells = nCellsArray( 3 ) | ||
if (associated(indexRain) .and. associated(rainFlux)) then | ||
do iCell=1,nCells | ||
freshwaterSurfaceFlux(indexRain, iCell) = rainFlux(iCell) / rho_sw | ||
enddo ! iCell | ||
else | ||
call mpas_log_write('indexRain is not associated') | ||
endif | ||
if (associated(indexSnow) .and. associated(snowFlux)) then | ||
do iCell=1,nCells | ||
freshwaterSurfaceFlux(indexSnow, iCell) = snowFlux(iCell) / rho_sw | ||
enddo ! iCell | ||
else | ||
call mpas_log_write('indexSnow is not associated') | ||
Comment on lines
+981
to
+982
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this output (here and elsewhere in this file) would happen at every time step or at least every coupling time step and would be confusing to users. I think we probably want to remove it. |
||
endif | ||
if (associated(indexIceRunoff) .and. associated(iceRunoffFlux)) then | ||
do iCell=1,nCells | ||
freshwaterSurfaceFluxRunoff(indexIceRunoff, iCell) = iceRunoffFlux(iCell) / rho_sw | ||
enddo ! iCell | ||
else | ||
call mpas_log_write('indexIceRunoff is not associated') | ||
endif | ||
if (associated(indexRiverRunoff) .and. associated(riverRunoffFlux)) then | ||
do iCell=1,nCells | ||
freshwaterSurfaceFluxRunoff(indexRiverRunoff, iCell) = riverRunoffFlux(iCell) / rho_sw | ||
enddo ! iCell | ||
else | ||
if (.not. associated(indexRiverRunoff)) call mpas_log_write('indexRiverRunoff is not associated') | ||
if (.not. associated(riverRunoffFlux)) call mpas_log_write('riverRunoffFlux is not associated') | ||
endif | ||
if (associated(indexSeaIceFreshWater) .and. associated(seaIceFreshWaterFlux)) then | ||
do iCell=1,nCells | ||
freshwaterSurfaceFlux(indexSeaIceFreshWater, iCell) = seaIceFreshWaterFlux(iCell) / rho_sw | ||
enddo ! iCell | ||
else | ||
call mpas_log_write('indexSeaIceFreshWater is not associated') | ||
endif | ||
if (associated(indexIcebergFreshWater) .and. associated(icebergFreshWaterFlux)) then | ||
do iCell=1,nCells | ||
freshwaterSurfaceFlux(indexIcebergFreshWater, iCell) = icebergFreshWaterFlux(iCell) / rho_sw | ||
enddo ! iCell | ||
else | ||
call mpas_log_write('indexIcebergFreshWater is not associated') | ||
endif | ||
if (associated(indexLandIceFreshwater) .and. associated(landIceFreshwaterFlux)) then | ||
do iCell=1,nCells | ||
freshwaterSurfaceFlux(indexLandIceFreshwater, iCell) = landIceFreshwaterFlux(iCell) / rho_sw | ||
enddo ! iCell | ||
else | ||
call mpas_log_write('indexLandIceFreshwater or landIceFreshwaterFlux is not associated') | ||
endif | ||
call mpas_log_write('end fw assign sflux') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should probably also be removed. |
||
|
||
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 | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth considering:
to also test the ice-shelf-melt freshwater tracer. What do you think?