Skip to content
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

Adding cryo fields to coupler budget accounting #6229

Merged
merged 15 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion components/mpas-ocean/driver/mpaso_cpl_indices.F
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ module mpaso_cpl_indices
integer :: index_o2x_So_dhdx
integer :: index_o2x_So_dhdy
integer :: index_o2x_Fioo_q
integer :: index_o2x_Foxo_q_li
integer :: index_o2x_Fioo_frazil
integer :: index_o2x_Foxo_frazil_li
integer :: index_o2x_Faoo_h2otemp
integer :: index_o2x_Faoo_fco2_ocn
integer :: index_o2x_Faoo_fdms_ocn
integer :: index_o2x_So_ssh

integer :: index_o2x_Foxo_ismw
integer :: index_o2x_Foxo_rrofl
integer :: index_o2x_Foxo_rrofi
integer :: index_o2x_Foxo_ismh
integer :: index_o2x_Foxo_rrofih

! ocn -> drv for calculation of ocean-ice sheet interactions

Expand Down Expand Up @@ -182,12 +188,21 @@ subroutine mpaso_cpl_indices_set( )
index_o2x_So_dhdx = mct_avect_indexra(o2x,'So_dhdx')
index_o2x_So_dhdy = mct_avect_indexra(o2x,'So_dhdy')
index_o2x_Fioo_q = mct_avect_indexra(o2x,'Fioo_q',perrWith='quiet')
index_o2x_Foxo_q_li = mct_avect_indexra(o2x,'Foxo_q_li',perrWith='quiet')
index_o2x_Fioo_frazil = mct_avect_indexra(o2x,'Fioo_frazil',perrWith='quiet')
index_o2x_Foxo_frazil_li= mct_avect_indexra(o2x,'Foxo_frazil_li',perrWith='quiet')
index_o2x_Faoo_h2otemp = mct_avect_indexra(o2x,'Faoo_h2otemp',perrWith='quiet')
index_o2x_Faoo_fco2_ocn = mct_avect_indexra(o2x,'Faoo_fco2_ocn',perrWith='quiet')
index_o2x_Faoo_fdms_ocn = mct_avect_indexra(o2x,'Faoo_fdms_ocn',perrWith='quiet')
index_o2x_So_ssh = mct_avect_indexra(o2x,'So_ssh')

index_o2x_Foxo_ismw = mct_avect_indexra(o2x,'Foxo_ismw',perrWith='quiet')
index_o2x_Foxo_rrofl = mct_avect_indexra(o2x,'Foxo_rrofl',perrWith='quiet')
index_o2x_Foxo_rrofi = mct_avect_indexra(o2x,'Foxo_rrofi',perrWith='quiet')

index_o2x_Foxo_ismh = mct_avect_indexra(o2x,'Foxo_ismh',perrWith='quiet')
index_o2x_Foxo_rrofih = mct_avect_indexra(o2x,'Foxo_rrofih',perrWith='quiet')

index_o2x_So_blt = mct_avect_indexra(o2x,'So_blt')
index_o2x_So_bls = mct_avect_indexra(o2x,'So_bls')
index_o2x_So_htv = mct_avect_indexra(o2x,'So_htv')
Expand Down
71 changes: 67 additions & 4 deletions components/mpas-ocean/driver/ocn_comp_mct.F
Original file line number Diff line number Diff line change
Expand Up @@ -2700,7 +2700,12 @@ subroutine ocn_export_mct(o2x_o, errorCode) !{{{
avgOceanSurfaceDOCSemiLabile, &
avgOceanSurfaceFeParticulate, &
avgOceanSurfaceFeDissolved, &
ssh
ssh, &
avgLandIceFreshwaterFlux, &
avgRemovedRiverRunoffFlux, &
avgRemovedIceRunoffFlux, &
avgLandIceHeatFlux, &
avgRemovedIceRunoffHeatFlux

real (kind=RKIND), dimension(:,:), pointer :: avgTracersSurfaceValue, avgSurfaceVelocity, &
avgSSHGradient, avgOceanSurfacePhytoC, &
Expand All @@ -2709,6 +2714,7 @@ subroutine ocn_export_mct(o2x_o, errorCode) !{{{
real (kind=RKIND) :: surfaceFreezingTemp

logical, pointer :: frazilIceActive, &
config_remove_AIS_coupler_runoff, &
config_use_ecosysTracers, &
config_use_DMSTracers, &
config_use_MacroMoleculesTracers, &
Expand All @@ -2725,6 +2731,7 @@ subroutine ocn_export_mct(o2x_o, errorCode) !{{{
call mpas_pool_get_package(domain % packages, 'frazilIceActive', frazilIceActive)
call mpas_pool_get_config(domain % configs, 'config_use_ecosysTracers', config_use_ecosysTracers)
call mpas_pool_get_config(domain % configs, 'config_land_ice_flux_mode', config_land_ice_flux_mode)
call mpas_pool_get_config(domain % configs, 'config_remove_AIS_coupler_runoff', config_remove_AIS_coupler_runoff)
call mpas_pool_get_config(domain % configs, 'config_use_DMSTracers', config_use_DMSTracers)
call mpas_pool_get_config(domain % configs, 'config_use_MacroMoleculesTracers', config_use_MacroMoleculesTracers)
call mpas_pool_get_config(domain % configs, 'config_use_ecosysTracers_sea_ice_coupling', &
Expand Down Expand Up @@ -2767,6 +2774,17 @@ subroutine ocn_export_mct(o2x_o, errorCode) !{{{
call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMass, 1)
end if

! Cryo fields
if (trim(config_land_ice_flux_mode) == 'standalone' .or. trim(config_land_ice_flux_mode) == 'data') then
call mpas_pool_get_array(forcingPool, 'avgLandIceFreshwaterFlux', avgLandIceFreshwaterFlux)
call mpas_pool_get_array(forcingPool, 'avgLandIceHeatFlux', avgLandIceHeatFlux)
endif
if (config_remove_AIS_coupler_runoff) then
call mpas_pool_get_array(forcingPool, 'avgRemovedRiverRunoffFlux', avgRemovedRiverRunoffFlux)
call mpas_pool_get_array(forcingPool, 'avgRemovedIceRunoffFlux', avgRemovedIceRunoffFlux)
call mpas_pool_get_array(forcingPool, 'avgRemovedIceRunoffHeatFlux', avgRemovedIceRunoffHeatFlux)
endif

! BGC fields
if (config_use_ecosysTracers) then

Expand Down Expand Up @@ -2818,6 +2836,17 @@ subroutine ocn_export_mct(o2x_o, errorCode) !{{{

o2x_o % rAttr(index_o2x_Faoo_h2otemp, n) = avgTotalFreshWaterTemperatureFlux(i) * rho_sw * cp_sw

! Cryo fields
if (trim(config_land_ice_flux_mode) == 'standalone' .or. trim(config_land_ice_flux_mode) == 'data') then
o2x_o % rAttr(index_o2x_Foxo_ismw, n) = avgLandIceFreshwaterFlux(i)
o2x_o % rAttr(index_o2x_Foxo_ismh, n) = avgLandIceHeatFlux(i)
endif
if (config_remove_AIS_coupler_runoff) then
o2x_o % rAttr(index_o2x_Foxo_rrofl, n) = avgRemovedRiverRunoffFlux(i)
o2x_o % rAttr(index_o2x_Foxo_rrofi, n) = avgRemovedIceRunoffFlux(i)
o2x_o % rAttr(index_o2x_Foxo_rrofih, n) = avgRemovedIceRunoffHeatFlux(i)
endif

if ( frazilIceActive ) then
! negative when frazil ice can be melted
keepFrazil = .true.
Expand Down Expand Up @@ -2853,6 +2882,10 @@ subroutine ocn_export_mct(o2x_o, errorCode) !{{{

o2x_o % rAttr(index_o2x_Fioo_q, n) = 0.0_RKIND
o2x_o % rAttr(index_o2x_Fioo_frazil, n) = 0.0_RKIND
if (trim(config_land_ice_flux_mode) == 'standalone' .or. trim(config_land_ice_flux_mode) == 'data') then
o2x_o % rAttr(index_o2x_Foxo_q_li, n) = accumulatedFrazilIceMass(i) * config_frazil_heat_of_fusion / ocn_cpl_dt
o2x_o % rAttr(index_o2x_Foxo_frazil_li, n) = accumulatedFrazilIceMass(i) / ocn_cpl_dt
endif

end if

Expand Down Expand Up @@ -3981,7 +4014,12 @@ subroutine ocn_export_moab(EClock) !{{{
avgOceanSurfaceDOCSemiLabile, &
avgOceanSurfaceFeParticulate, &
avgOceanSurfaceFeDissolved, &
ssh
ssh, &
avgLandIceFreshwaterFlux, &
avgRemovedRiverRunoffFlux, &
avgRemovedIceRunoffFlux, &
avgLandIceHeatFlux, &
avgRemovedIceRunoffHeatFlux

real (kind=RKIND), dimension(:,:), pointer :: avgTracersSurfaceValue, avgSurfaceVelocity, &
avgSSHGradient, avgOceanSurfacePhytoC, &
Expand All @@ -3990,6 +4028,7 @@ subroutine ocn_export_moab(EClock) !{{{
real (kind=RKIND) :: surfaceFreezingTemp

logical, pointer :: frazilIceActive, &
config_remove_AIS_coupler_runoff, &
config_use_ecosysTracers, &
config_use_DMSTracers, &
config_use_MacroMoleculesTracers, &
Expand All @@ -4006,6 +4045,7 @@ subroutine ocn_export_moab(EClock) !{{{
call mpas_pool_get_package(domain % packages, 'frazilIceActive', frazilIceActive)
call mpas_pool_get_config(domain % configs, 'config_use_ecosysTracers', config_use_ecosysTracers)
call mpas_pool_get_config(domain % configs, 'config_land_ice_flux_mode', config_land_ice_flux_mode)
call mpas_pool_get_config(domain % configs, 'config_remove_AIS_coupler_runoff', config_remove_AIS_coupler_runoff)
call mpas_pool_get_config(domain % configs, 'config_use_DMSTracers', config_use_DMSTracers)
call mpas_pool_get_config(domain % configs, 'config_use_MacroMoleculesTracers', config_use_MacroMoleculesTracers)
call mpas_pool_get_config(domain % configs, 'config_use_ecosysTracers_sea_ice_coupling', &
Expand Down Expand Up @@ -4047,6 +4087,16 @@ subroutine ocn_export_moab(EClock) !{{{
call mpas_pool_get_array(forcingPool, 'frazilSurfacePressure', frazilSurfacePressure)
call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMass, 1)
end if

if (trim(config_land_ice_flux_mode) == 'standalone' .or. trim(config_land_ice_flux_mode) == 'data') then
call mpas_pool_get_array(forcingPool, 'avgLandIceFreshwaterFlux', avgLandIceFreshwaterFlux)
call mpas_pool_get_array(forcingPool, 'avgLandIceHeatFlux', avgLandIceHeatFlux)
endif
if (config_remove_AIS_coupler_runoff) then
call mpas_pool_get_array(forcingPool, 'avgRemovedRiverRunoffFlux', avgRemovedRiverRunoffFlux)
call mpas_pool_get_array(forcingPool, 'avgRemovedIceRunoffFlux', avgRemovedIceRunoffFlux)
call mpas_pool_get_array(forcingPool, 'avgRemovedIceRunoffHeatFlux', avgRemovedIceRunoffHeatFlux)
endif

! BGC fields
if (config_use_ecosysTracers) then
Expand Down Expand Up @@ -4098,7 +4148,17 @@ subroutine ocn_export_moab(EClock) !{{{
o2x_om(n, index_o2x_So_dhdy) = avgSSHGradient(index_avgMeridionalSSHGradient, i)

o2x_om(n, index_o2x_Faoo_h2otemp) = avgTotalFreshWaterTemperatureFlux(i) * rho_sw * cp_sw


if (trim(config_land_ice_flux_mode) == 'standalone' .or. trim(config_land_ice_flux_mode) == 'data') then
o2x_om(n, index_o2x_Foxo_ismw) = avgLandIceFreshwaterFlux(i)
o2x_om(n, index_o2x_Foxo_ismh) = avgLandIceHeatFlux(i)
endif
if (config_remove_AIS_coupler_runoff) then
o2x_om(n, index_o2x_Foxo_rrofl) = avgRemovedRiverRunoffFlux(i)
o2x_om(n, index_o2x_Foxo_rrofi) = avgRemovedIceRunoffFlux(i)
o2x_om(n, index_o2x_Foxo_rrofih) = avgRemovedIceRunoffHeatFlux(i)
endif

if ( frazilIceActive ) then
! negative when frazil ice can be melted
keepFrazil = .true.
Expand Down Expand Up @@ -4134,7 +4194,10 @@ subroutine ocn_export_moab(EClock) !{{{

o2x_om(n, index_o2x_Fioo_q) = 0.0_RKIND
o2x_om(n, index_o2x_Fioo_frazil) = 0.0_RKIND

if (trim(config_land_ice_flux_mode) == 'standalone' .or. trim(config_land_ice_flux_mode) == 'data') then
o2x_om(n, index_o2x_Foxo_q_li) = accumulatedFrazilIceMass(i) * config_frazil_heat_of_fusion / ocn_cpl_dt
o2x_om(n, index_o2x_Foxo_frazil_li) = accumulatedFrazilIceMass(i) / ocn_cpl_dt
endif
end if

! Reset SeaIce Energy and Accumulated Frazil Ice
Expand Down
16 changes: 16 additions & 0 deletions components/mpas-ocean/src/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3608,6 +3608,7 @@
packages="activeTracersBulkRestoringPKG;thicknessBulkPKG"
/>


<!-- Misc. coupling fields -->
<var name="iceFraction" type="real" dimensions="nCells Time" units="fractional"
description="Fraction of sea ice coverage at cell centers from coupler. Positive into the ocean."
Expand Down Expand Up @@ -3689,6 +3690,21 @@
<var name="avgTotalFreshWaterTemperatureFlux" type="real" dimensions="nCells Time" units="C m s^-1"
description="Sum of heat fluxes associated with water fluxes cell centers sent to coupler. Positive into the ocean."
/>
<var name="avgLandIceFreshwaterFlux" type="real" dimensions="nCells Time" units="kg m^-2 s^-1"
description="Time-averaged sum of freshwater fluxes associated with ice shelf basal melt fluxes cell centers sent to coupler. Positive into the ocean."
/>
<var name="avgLandIceHeatFlux" type="real" dimensions="nCells Time" units="W m^-2"
description="Time-averaged sum of heat fluxes associated with ice shelf basal melt fluxes cell centers sent to coupler. Positive into the ocean."
/>
<var name="avgRemovedRiverRunoffFlux" type="real" dimensions="nCells Time" units="kg m^-2 s^-1"
description="Time-averaged sum of freshwater fluxes associated with removed liquid runoff fluxes cell centers sent to coupler. Positive into the ocean."
/>
<var name="avgRemovedIceRunoffFlux" type="real" dimensions="nCells Time" units="kg m^-2 s^-1"
description="Time-averaged sum of freshwater fluxes associated with removed ice runoff fluxes cell centers sent to coupler. Positive into the ocean."
/>
<var name="avgRemovedIceRunoffHeatFlux" type="real" dimensions="nCells Time" units="W m^-2"
description="Time-averaged sum of heat fluxes associated with removed ice runoff fluxes cell centers sent to coupler. Positive into the ocean."
/>

<!-- Input fields from coupler or initial condition for forcing under land ice -->
<var name="landIceFraction" type="real" dimensions="nCells Time" units="1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,7 @@
description="Sea ice salinity flux from coupler. Positive into the ocean."
/>
<var name="accumulatedFrazilSalinityFlux" type="real" dimensions="Time" units="kg m^-2 s^-1"
description="Salinity flux from frazil to sea ice, given to coupler. Positive into the ocean."
/>
<var name="accumulatedLandIceFrazilSalinityFlux" type="real" dimensions="Time" units="kg m^-2 s^-1"
description="Salinity flux from frazil to Land Ice, given to coupler. Positive into the ocean."
description="Salinity flux from frazil to sea ice, given to coupler. Land ice does not contribute because its frazil salinity is assumed 0. Positive into the ocean."
/>
</var_struct>
<var_struct name="conservationCheckCarbonAM" time_levs="1" packages="conservationCheckAMPKG">
Expand Down Expand Up @@ -305,7 +302,6 @@
<var name="accumulatedLandIceFrazilFlux"/>
<var name="accumulatedSeaIceSalinityFlux"/>
<var name="accumulatedFrazilSalinityFlux"/>
<var name="accumulatedLandIceFrazilSalinityFlux"/>
<var name="initialCarbon"/>
<var name="finalCarbon"/>
<var name="carbonChange"/>
Expand Down Expand Up @@ -362,7 +358,6 @@
<var name="accumulatedLandIceFrazilFlux"/>
<var name="accumulatedSeaIceSalinityFlux"/>
<var name="accumulatedFrazilSalinityFlux"/>
<var name="accumulatedLandIceFrazilSalinityFlux"/>
<var name="initialCarbon"/>
<var name="accumulatedAbsoluteCarbonError"/>
<var name="accumulatedRelativeCarbonError"/>
Expand Down
Loading