Skip to content

Commit

Permalink
Merge branch 'njeffery/seaice/updated-icepack-bgc' into master
Browse files Browse the repository at this point in the history
This version uses a branch of Icepack with BGC enabled
E3SM-Project/Icepack.git branch njeffery/merge-fixes-to-bgc
  • Loading branch information
njeffery committed Apr 4, 2024
2 parents bc20da7 + 6357063 commit b915d16
Show file tree
Hide file tree
Showing 22 changed files with 2,553 additions and 2,959 deletions.
9 changes: 3 additions & 6 deletions components/mpas-seaice/bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -628,12 +628,7 @@ add_default($nl, 'config_recover_tracer_means_check');
##################################
# Namelist group: column_package #
##################################

if ($ice_bgc eq 'ice_bgc') {
add_default($nl, 'config_column_physics_type', 'val'=>"column_package");
} else {
add_default($nl, 'config_column_physics_type');
}
add_default($nl, 'config_column_physics_type');
add_default($nl, 'config_use_column_shortwave');
add_default($nl, 'config_use_column_vertical_thermodynamics');
if ($ice_bgc eq 'ice_bgc') {
Expand Down Expand Up @@ -681,6 +676,7 @@ if ($ice_bgc eq 'ice_bgc') {
add_default($nl, 'config_use_humics', 'val'=>".true.");
add_default($nl, 'config_use_DON', 'val'=>".true.");
add_default($nl, 'config_use_iron', 'val'=>".true.");
add_default($nl, 'config_couple_biogeochemistry_fields');
} else {
add_default($nl, 'config_use_vertical_biochemistry', 'val'=>".false.");
add_default($nl, 'config_use_vertical_tracers', 'val'=>".false.");
Expand All @@ -694,6 +690,7 @@ if ($ice_bgc eq 'ice_bgc') {
add_default($nl, 'config_use_humics', 'val'=>".false.");
add_default($nl, 'config_use_DON', 'val'=>".false.");
add_default($nl, 'config_use_iron', 'val'=>".false.");
add_default($nl, 'config_couple_biogeochemistry_fields', 'val'=>".false.");
}
add_default($nl, 'config_use_chlorophyll');
add_default($nl, 'config_use_macromolecules');
Expand Down
1 change: 1 addition & 0 deletions components/mpas-seaice/bld/build-namelist-section
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ add_default($nl, 'config_use_floe_size_distribution');
# Namelist group: biogeochemistry #
###################################

add_default($nl, 'config_couple_biogeochemistry_fields');
add_default($nl, 'config_use_brine');
add_default($nl, 'config_use_vertical_zsalinity');
add_default($nl, 'config_use_vertical_biochemistry');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
<config_use_floe_size_distribution>false</config_use_floe_size_distribution>

<!-- biogeochemistry -->
<config_couple_biogeochemistry_fields>false</config_couple_biogeochemistry_fields>
<config_use_brine>false</config_use_brine>
<config_use_vertical_zsalinity>false</config_use_vertical_zsalinity>
<config_use_vertical_biochemistry>false</config_use_vertical_biochemistry>
Expand Down Expand Up @@ -343,12 +344,12 @@
<config_mobility_type_proteins>0.0</config_mobility_type_proteins>
<config_mobility_type_dissolved_iron>0.0</config_mobility_type_dissolved_iron>
<config_mobility_type_particulate_iron>0.5</config_mobility_type_particulate_iron>
<config_mobility_type_black_carbon1>0.0</config_mobility_type_black_carbon1>
<config_mobility_type_black_carbon2>0.0</config_mobility_type_black_carbon2>
<config_mobility_type_dust1>0.0</config_mobility_type_dust1>
<config_mobility_type_dust2>0.0</config_mobility_type_dust2>
<config_mobility_type_dust3>0.0</config_mobility_type_dust3>
<config_mobility_type_dust4>0.0</config_mobility_type_dust4>
<config_mobility_type_black_carbon1>-1.0</config_mobility_type_black_carbon1>
<config_mobility_type_black_carbon2>-1.0</config_mobility_type_black_carbon2>
<config_mobility_type_dust1>-1.0</config_mobility_type_dust1>
<config_mobility_type_dust2>-1.0</config_mobility_type_dust2>
<config_mobility_type_dust3>-1.0</config_mobility_type_dust3>
<config_mobility_type_dust4>-1.0</config_mobility_type_dust4>
<config_ratio_C_to_N_diatoms>7.0</config_ratio_C_to_N_diatoms>
<config_ratio_C_to_N_small_plankton>7.0</config_ratio_C_to_N_small_plankton>
<config_ratio_C_to_N_phaeocystis>7.0</config_ratio_C_to_N_phaeocystis>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,14 @@ Default: Defined in namelist_defaults.xml

<!-- biogeochemistry -->

<entry id="config_couple_biogeochemistry_fields" type="logical"
category="biogeochemistry" group="biogeochemistry">
Couple ocean and seaice biogeochemical fields

Valid values: true or false
Default: Defined in namelist_defaults.xml
</entry>

<entry id="config_use_brine" type="logical"
category="biogeochemistry" group="biogeochemistry">
Use the brine height tracer
Expand Down
9 changes: 9 additions & 0 deletions components/mpas-seaice/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,15 @@ def buildnml(case, caseroot, compname):
lines.append(' <var name="netCarbonFlux"/>')
lines.append(' <var name="absoluteCarbonError"/>')
lines.append(' <var name="relativeCarbonError"/>')
lines.append(' <var name="initialBlackCarbon"/>')
lines.append(' <var name="finalBlackCarbon"/>')
lines.append(' <var name="blackCarbonChange"/>')
lines.append(' <var name="blackCarbonChangeFlux"/>')
lines.append(' <var name="blackCarbonConsAtmBlackCarbonFlux"/>')
lines.append(' <var name="blackCarbonConsOceanBlackCarbonFlux"/>')
lines.append(' <var name="netBlackCarbonFlux"/>')
lines.append(' <var name="absoluteBlackCarbonError"/>')
lines.append(' <var name="relativeBlackCarbonError"/>')
lines.append('</stream>')
lines.append('')
lines.append('<immutable_stream name="conservationCheckRestart"')
Expand Down
127 changes: 65 additions & 62 deletions components/mpas-seaice/driver/ice_comp_mct.F
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,8 @@ subroutine ice_import_mct(x2i_i, errorCode)!{{{
config_use_aerosols, &
config_use_modal_aerosols, &
config_use_zaerosols, &
config_use_column_biogeochemistry
config_use_column_biogeochemistry, &
config_couple_biogeochemistry_fields
character(len=strKIND), pointer :: &
config_column_physics_type, &
Expand Down Expand Up @@ -2070,6 +2071,8 @@ subroutine ice_import_mct(x2i_i, errorCode)!{{{
call mpas_pool_get_config(configs, "config_use_aerosols", config_use_aerosols)
call mpas_pool_get_config(configs, "config_use_modal_aerosols", config_use_modal_aerosols)
call mpas_pool_get_config(configs, "config_use_column_biogeochemistry", config_use_column_biogeochemistry)
call mpas_pool_get_config(configs, "config_couple_biogeochemistry_fields", config_couple_biogeochemistry_fields)
call mpas_pool_get_config(configs, "config_use_zaerosols", config_use_zaerosols)
call mpas_pool_get_subpool(block_ptr % structs, 'mesh', meshPool)
call mpas_pool_get_subpool(block_ptr % structs, 'ocean_coupling', oceanCoupling)
Expand Down Expand Up @@ -2108,9 +2111,13 @@ subroutine ice_import_mct(x2i_i, errorCode)!{{{
call mpas_pool_get_array(aerosols, "atmosAerosolFlux", atmosAerosolFlux)
endif
if (config_use_column_biogeochemistry) then
call mpas_pool_get_config(configs, "config_use_zaerosols", config_use_zaerosols)
call mpas_pool_get_subpool(block_ptr % structs, 'biogeochemistry', biogeochemistry)
call mpas_pool_get_subpool(block_ptr % structs, 'biogeochemistry', biogeochemistry)
if (config_use_zaerosols) then
call mpas_pool_get_array(biogeochemistry, 'oceanZAerosolConc', oceanZAerosolConc)
call mpas_pool_get_array(biogeochemistry, 'atmosBlackCarbonFlux', atmosBlackCarbonFlux)
call mpas_pool_get_array(biogeochemistry, 'atmosDustFlux', atmosDustFlux)
endif
if (config_use_column_biogeochemistry .and. config_couple_biogeochemistry_fields) then
call mpas_pool_get_array(biogeochemistry, 'oceanAlgaeConc', oceanAlgaeConc)
call mpas_pool_get_array(biogeochemistry, 'oceanDOCConc', oceanDOCConc)
Expand All @@ -2124,15 +2131,10 @@ subroutine ice_import_mct(x2i_i, errorCode)!{{{
call mpas_pool_get_array(biogeochemistry, 'oceanHumicsConc', oceanHumicsConc)
call mpas_pool_get_array(biogeochemistry, 'oceanParticulateIronConc', oceanParticulateIronConc)
call mpas_pool_get_array(biogeochemistry, 'oceanDissolvedIronConc', oceanDissolvedIronConc)
call mpas_pool_get_array(biogeochemistry, 'oceanZAerosolConc', oceanZAerosolConc)
call mpas_pool_get_array(biogeochemistry, 'carbonToNitrogenRatioAlgae', carbonToNitrogenRatioAlgae)
call mpas_pool_get_array(biogeochemistry, 'carbonToNitrogenRatioDON', carbonToNitrogenRatioDON)
call mpas_pool_get_array(biogeochemistry, 'DOCPoolFractions', DOCPoolFractions)
if (config_use_zaerosols) then
call mpas_pool_get_array(biogeochemistry, "atmosBlackCarbonFlux", atmosBlackCarbonFlux)
call mpas_pool_get_array(biogeochemistry, "atmosDustFlux", atmosDustFlux)
endif
endif
do i = 1, nCellsSolve
Expand Down Expand Up @@ -2224,8 +2226,44 @@ subroutine ice_import_mct(x2i_i, errorCode)!{{{
endif
endif
! set aerosols, if configured
if (config_use_zaerosols) then
oceanZAerosolConc(1,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer1, n)
oceanZAerosolConc(2,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer2, n)
oceanZAerosolConc(3,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer3, n)
oceanZAerosolConc(4,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer4, n)
oceanZAerosolConc(5,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer5, n)
oceanZAerosolConc(6,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer6, n)
if (config_use_modal_aerosols) then
atmosBlackCarbonFlux(1,i) = x2i_i % rAttr(index_x2i_Faxa_bcphodry, n) &
+ x2i_i % rAttr(index_x2i_Faxa_bcphidry, n)
atmosBlackCarbonFlux(2,i) = x2i_i % rAttr(index_x2i_Faxa_bcphiwet, n)
!combine wet and dry dust
atmosDustFlux(1,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet1, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry1, n)
atmosDustFlux(2,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet2, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry2, n)
atmosDustFlux(3,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet3, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry3, n)
atmosDustFlux(4,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet4, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry4, n)
else
atmosBlackCarbonFlux(1,i) = x2i_i % rAttr(index_x2i_Faxa_bcphodry, n)
atmosBlackCarbonFlux(2,i) = x2i_i % rAttr(index_x2i_Faxa_bcphidry, n) &
+ x2i_i % rAttr(index_x2i_Faxa_bcphiwet, n)
! combine wet and dry dust
atmosDustFlux(1,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet1, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry1, n)
atmosDustFlux(2,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet2, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry2, n)
atmosDustFlux(3,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet3, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry3, n)
atmosDustFlux(4,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet4, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry4, n)
endif
endif
! import biogeochemistry fields, if configured
if (config_use_column_biogeochemistry) then
if (config_use_column_biogeochemistry .and. config_couple_biogeochemistry_fields) then
oceanAlgaeConc(1,i) = x2i_i % rAttr(index_x2i_So_algae1, n)
oceanAlgaeConc(2,i) = x2i_i % rAttr(index_x2i_So_algae2, n)
oceanAlgaeConc(3,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_algae3, n)
Expand All @@ -2245,42 +2283,6 @@ subroutine ice_import_mct(x2i_i, errorCode)!{{{
oceanParticulateIronConc(2,i) = x2i_i % rAttr(index_x2i_So_fep2, n)
oceanDissolvedIronConc(1,i) = x2i_i % rAttr(index_x2i_So_fed1, n)
oceanDissolvedIronConc(2,i) = x2i_i % rAttr(index_x2i_So_fed2, n)
oceanZAerosolConc(1,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer1, n)
oceanZAerosolConc(2,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer2, n)
oceanZAerosolConc(3,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer3, n)
oceanZAerosolConc(4,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer4, n)
oceanZAerosolConc(5,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer5, n)
oceanZAerosolConc(6,i) = 0.0_RKIND !x2i_i % rAttr(index_x2i_So_zaer6, n)
! set aerosols, if configured
if (config_use_zaerosols) then
if (config_use_modal_aerosols) then
atmosBlackCarbonFlux(1,i) = x2i_i % rAttr(index_x2i_Faxa_bcphodry, n) &
+ x2i_i % rAttr(index_x2i_Faxa_bcphidry, n)
atmosBlackCarbonFlux(2,i) = x2i_i % rAttr(index_x2i_Faxa_bcphiwet, n)
! combine wet and dry dust
atmosDustFlux(1,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet1, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry1, n)
atmosDustFlux(2,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet2, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry2, n)
atmosDustFlux(3,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet3, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry3, n)
atmosDustFlux(4,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet4, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry4, n)
else
atmosBlackCarbonFlux(1,i) = x2i_i % rAttr(index_x2i_Faxa_bcphodry, n)
atmosBlackCarbonFlux(2,i) = x2i_i % rAttr(index_x2i_Faxa_bcphidry, n) &
+ x2i_i % rAttr(index_x2i_Faxa_bcphiwet, n)
! combine wet and dry dust
atmosDustFlux(1,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet1, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry1, n)
atmosDustFlux(2,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet2, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry2, n)
atmosDustFlux(3,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet3, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry3, n)
atmosDustFlux(4,i) = x2i_i % rAttr(index_x2i_Faxa_dstwet4, n) &
+ x2i_i % rAttr(index_x2i_Faxa_dstdry4, n)
endif
endif
endif
end do
Expand All @@ -2293,7 +2295,7 @@ subroutine ice_import_mct(x2i_i, errorCode)!{{{
seaSurfaceTemperature(i) = seaSurfaceTemperature(i) - seaiceFreshWaterFreezingPoint
if (config_use_column_biogeochemistry) then
if (config_use_column_biogeochemistry .and. config_couple_biogeochemistry_fields) then
! convert from mmol C/m^3 to mmol N/m^3
oceanAlgaeConc(1,i) = oceanAlgaeConc(1,i) / carbonToNitrogenRatioAlgae(1)
oceanAlgaeConc(2,i) = oceanAlgaeConc(2,i) / carbonToNitrogenRatioAlgae(2)
Expand Down Expand Up @@ -2343,7 +2345,12 @@ subroutine ice_import_mct(x2i_i, errorCode)!{{{
call mpas_pool_get_field(aerosols, "atmosAerosolFlux", atmosAerosolFluxField)
endif
if (config_use_column_biogeochemistry) then
if (config_use_zaerosols) then
call mpas_pool_get_field(biogeochemistry, "atmosBlackCarbonFlux", atmosBlackCarbonFluxField)
call mpas_pool_get_field(biogeochemistry, "atmosDustFlux", atmosDustFluxField)
call mpas_pool_get_field(biogeochemistry, 'oceanZAerosolConc', oceanZAerosolConcField)
endif
if (config_use_column_biogeochemistry .and. config_couple_biogeochemistry_fields) then
call mpas_pool_get_subpool(domain % blocklist % structs, 'biogeochemistry', biogeochemistry)
call mpas_pool_get_field(biogeochemistry, 'oceanAlgaeConc', oceanAlgaeConcField)
Expand All @@ -2358,11 +2365,6 @@ subroutine ice_import_mct(x2i_i, errorCode)!{{{
call mpas_pool_get_field(biogeochemistry, 'oceanHumicsConc', oceanHumicsConcField)
call mpas_pool_get_field(biogeochemistry, 'oceanParticulateIronConc', oceanParticulateIronConcField)
call mpas_pool_get_field(biogeochemistry, 'oceanDissolvedIronConc', oceanDissolvedIronConcField)
call mpas_pool_get_field(biogeochemistry, 'oceanZAerosolConc', oceanZAerosolConcField)
if (config_use_zaerosols) then
call mpas_pool_get_field(biogeochemistry, "atmosBlackCarbonFlux", atmosBlackCarbonFluxField)
call mpas_pool_get_field(biogeochemistry, "atmosDustFlux", atmosDustFluxField)
endif
endif
call mpas_dmpar_exch_halo_field(seaSurfaceTemperatureField)
Expand Down Expand Up @@ -2393,8 +2395,12 @@ subroutine ice_import_mct(x2i_i, errorCode)!{{{
if (config_use_aerosols) then
call mpas_dmpar_exch_halo_field(atmosAerosolFluxField)
endif
if (config_use_column_biogeochemistry) then
if (config_use_zaerosols) then
call mpas_dmpar_exch_halo_field(atmosBlackCarbonFluxField)
call mpas_dmpar_exch_halo_field(atmosDustFluxField)
call mpas_dmpar_exch_halo_field(oceanZAerosolConcField)
endif
if (config_use_column_biogeochemistry .and. config_couple_biogeochemistry_fields) then
call mpas_dmpar_exch_halo_field(oceanAlgaeConcField)
call mpas_dmpar_exch_halo_field(oceanDOCConcField)
call mpas_dmpar_exch_halo_field(oceanDICConcField)
Expand All @@ -2407,11 +2413,6 @@ subroutine ice_import_mct(x2i_i, errorCode)!{{{
call mpas_dmpar_exch_halo_field(oceanHumicsConcField)
call mpas_dmpar_exch_halo_field(oceanParticulateIronConcField)
call mpas_dmpar_exch_halo_field(oceanDissolvedIronConcField)
call mpas_dmpar_exch_halo_field(oceanZAerosolConcField)
if (config_use_zaerosols) then
call mpas_dmpar_exch_halo_field(atmosBlackCarbonFluxField)
call mpas_dmpar_exch_halo_field(atmosDustFluxField)
endif
endif
! REVISION HISTORY:
Expand Down Expand Up @@ -2486,6 +2487,7 @@ subroutine ice_export_mct(i2x_i, errorCode) !{{{
config_rotate_cartesian_grid, &
config_use_topo_meltponds, &
config_use_column_biogeochemistry, &
config_couple_biogeochemistry_fields, &
config_use_column_shortwave, &
config_use_data_icebergs
Expand Down Expand Up @@ -2558,6 +2560,7 @@ subroutine ice_export_mct(i2x_i, errorCode) !{{{
call MPAS_pool_get_config(configs, "config_rotate_cartesian_grid", config_rotate_cartesian_grid)
call MPAS_pool_get_config(configs, "config_use_topo_meltponds", config_use_topo_meltponds)
call MPAS_pool_get_config(configs, "config_use_column_biogeochemistry", config_use_column_biogeochemistry)
call mpas_pool_get_config(configs, "config_couple_biogeochemistry_fields", config_couple_biogeochemistry_fields)
call MPAS_pool_get_config(configs, "config_use_column_shortwave", config_use_column_shortwave)
call MPAS_pool_get_config(configs, "config_use_data_icebergs", config_use_data_icebergs)
Expand Down Expand Up @@ -2620,7 +2623,7 @@ subroutine ice_export_mct(i2x_i, errorCode) !{{{
call MPAS_pool_get_array(icebergFluxes, "bergLatentHeatFlux", bergLatentHeatFlux)
endif
if (config_use_column_biogeochemistry) then
if (config_use_column_biogeochemistry .and. config_couple_biogeochemistry_fields) then
call mpas_pool_get_subpool(block_ptr % structs, 'biogeochemistry', biogeochemistry)
call mpas_pool_get_array(biogeochemistry, 'oceanAlgaeFlux', oceanAlgaeFlux)
Expand Down Expand Up @@ -2741,7 +2744,7 @@ subroutine ice_export_mct(i2x_i, errorCode) !{{{
i2x_i % rAttr(index_i2x_Fioi_tauy ,n) = tauyo
! export biogeochemistry fields, if configured
if (config_use_column_biogeochemistry) then
if (config_use_column_biogeochemistry .and. config_couple_biogeochemistry_fields) then
! convert from mmol N/m^3 to mmol C/m^3
i2x_i % rAttr(index_i2x_Fioi_algae1,n) = oceanAlgaeFlux(1,i) * carbonToNitrogenRatioAlgae(1)
i2x_i % rAttr(index_i2x_Fioi_algae2,n) = oceanAlgaeFlux(2,i) * carbonToNitrogenRatioAlgae(2)
Expand Down
Loading

0 comments on commit b915d16

Please sign in to comment.