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

always obtain ndep from datm or cam using cmeps/cdeps #410

Merged
merged 8 commits into from
Oct 23, 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
4 changes: 1 addition & 3 deletions cesm/mod_cesm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ subroutine getfrc_cesm
call ncdefvar('atmbrf_da', 'x y', ndouble, 8)
call ncdefvar('atmn2o_da', 'x y', ndouble, 8)
call ncdefvar('atmnh3_da', 'x y', ndouble, 8)
call ncdefvar('atmnoydep_da', 'x y', ndouble, 8)
call ncdefvar('atmnhxdep_da', 'x y', ndouble, 8)
call ncdefvar('atmnoydep_da', 'x y', ndouble, 8)
call ncdefvar('ztx_da', 'x y', ndouble, 8)
call ncdefvar('mty_da', 'x y', ndouble, 8)
Expand Down Expand Up @@ -301,8 +301,6 @@ subroutine getfrc_cesm
call ncwrtr('mty_da', 'x y', mty_da(1 - nbdy, 1 - nbdy, l2ci), &
iv, 1, 1._r8, 0._r8, 8)
call ncfcls
call xcstop('(getfrc_cesm)')
stop '(getfrc_cesm)'
end if

if (csdiag) then
Expand Down
3 changes: 0 additions & 3 deletions cime_config/buildcpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ def buildcpp(case):
if pio_typename == "pnetcdf":
blom_cppdefs = blom_cppdefs + " -DPNETCDF"

if ocn_grid in ["tnx2v1", "tnx1.5v1", "tnx1v1", "tnx1v3", "tnx1v4", "tnx0.5v1", "tnx0.25v1", "tnx0.25v3", "tnx0.25v4", "tnx0.125v4"]:
blom_cppdefs = blom_cppdefs + " -DARCTIC"

if ocn_grid in ["gx1v5", "gx1v6", "tnx1v1", "tnx1v3", "tnx1v4", "tnx0.5v1", "tnx0.25v1", "tnx0.25v3", "tnx0.25v4", "tnx0.125v4"]:
blom_cppdefs = blom_cppdefs + " -DLEVITUS2X"

Expand Down
32 changes: 17 additions & 15 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,24 @@
<valid_values>UNSET,1850,2000,hist,ssp119,ssp126,ssp245,ssp370,ssp434,ssp460,ssp534os,ssp585</valid_values>
<default_value>1850</default_value>
<values>
<value compset="HIST_CAM60%NORESM.*_BLOM%ECO" >hist</value>
<value compset="20TR_DATM.*_BLOM%ECO" >hist</value>
<value compset="2000_CAM60%NORESM.*_BLOM%ECO" >2000</value>
<value compset="SSP119_CAM60%NORESM.*_BLOM%ECO" >ssp119</value>
<value compset="SSP126_CAM60%NORESM.*_BLOM%ECO" >ssp126</value>
<value compset="SSP245_CAM60%NORESM.*_BLOM%ECO" >ssp245</value>
<value compset="SSP370_CAM60%NORESM.*_BLOM%ECO" >ssp370</value>
<value compset="SSP370LOWNTCF_CAM60%NORESM.*_BLOM%ECO" >ssp370</value>
<value compset="SSP370REFGHGLOWNTCF_CAM60%NORESM.*_BLOM%ECO">ssp370</value>
<value compset="SSP434_CAM60%NORESM.*_BLOM%ECO" >ssp434</value>
<value compset="SSP460_CAM60%NORESM.*_BLOM%ECO" >ssp460</value>
<value compset="SSP534_CAM60%NORESM.*_BLOM%ECO" >ssp534os</value>
<value compset="SSP585_CAM60%NORESM.*_BLOM%ECO" >ssp585</value>
<value compset="1850_.*_BLOM%ECO" >1850</value>
<value compset="2000_.*_BLOM%ECO" >2000</value>
<value compset="HIST_.*_BLOM%ECO" >hist</value>
<value compset="20TR_.*_BLOM%ECO" >hist</value>
<value compset="SSP119_.*_BLOM%ECO" >ssp119</value>
<value compset="SSP126_.*_BLOM%ECO" >ssp126</value>
<value compset="SSP245_.*_BLOM%ECO" >ssp245</value>
<value compset="SSP370_.*_BLOM%ECO" >ssp370</value>
<value compset="SSP434_.*_BLOM%ECO" >ssp434</value>
<value compset="SSP460_.*_BLOM%ECO" >ssp460</value>
<value compset="SSP534_.*_BLOM%ECO" >ssp534os</value>
<value compset="SSP585_.*_BLOM%ECO" >ssp585</value>
<value compset="SSP370.*_BLOM%ECO" >ssp370</value>
</values>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Scenario for nitrogen deposition data. Requires module ecosys</desc>
<desc>Scenario for nitrogen deposition data. Requires module ecosys.
Not used when coupling with nuopc-cmeps</desc>
</entry>

<entry id="HAMOCC_EXTNCYCLE">
Expand All @@ -163,7 +164,8 @@
</values>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Nitrogen deposition coupled from atmosphere. Requires module ecosys and extncycle</desc>
<desc>Nitrogen deposition coupled from atmosphere. Requires module ecosys and extncycle.
Not used when coupling with nuopc-cmeps</desc>
</entry>

<entry id="HAMOCC_N2OC">
Expand Down
58 changes: 41 additions & 17 deletions cime_config/namelist_definition_blom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -636,17 +636,6 @@
</desc>
</entry>

<entry id="use_stream_relaxation">
<type>logical</type>
<category>limits</category>
<group>limits</group>
<values>
<value>.false.</value>
<value comp_interface="nuopc">.true.</value>
</values>
<desc>if .true., use NUOPC stream relaxation capability</desc>
</entry>

<entry id="trxday">
<type>real</type>
<category>limits</category>
Expand Down Expand Up @@ -903,6 +892,26 @@
<desc>0 = netcdf, 1 = pnetcdf</desc>
</entry>

<entry id="use_diag">
<type>logical</type>
<category>limits</category>
<group>limits</group>
<values>
<value>.false.</value>
</values>
<desc>optionally turn on additional diagnostics</desc>
</entry>

<entry id="use_arctic">
<type>logical</type>
<category>limits</category>
<group>limits</group>
<values>
<value>.true.</value>
</values>
<desc>if region includes arctic ocean</desc>
</entry>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question out of curiosity: what is the use_arctic switch for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use_arctic has a different communication pattern in mod_xc.F90.
In particular - it checks that all arctic patch tiles must be the same size or empty,
and empty tiles must be "twinned" across the top boundary. It ensures that the latitudinal tile dimension is closed/arctic and handles the halo in the arctic differently. @matsbn - do you want to add more?

<!-- ========================= -->
<!-- namelist group: vcoord -->
<!-- ========================= -->
Expand Down Expand Up @@ -3830,15 +3839,15 @@
<desc>File name (incl. full path) for atmopheric N-deposition data</desc>
</entry>

<entry id="do_ndep_coupled" modify_via_xml="HAMOCC_ATMNDEPC">
<entry id="use_nuopc_ndep">
<type>logical</type>
<category>bgcnml</category>
<group>bgcnml</group>
<category>config_bgc</category>
<group>config_bgc</group>
<values>
<value>.false.</value>
<value blom_n_deposition="yes" hamocc_atmndepc="yes" hamocc_extncycle="yes">.true.</value>
<value comp_interface="nuopc">.true.</value>
</values>
<desc>Switch to couple nitrogen deposition. Requires do_ndep.</desc>
<desc>if .true., use NUOPC to obtain NDEP (always imported to model).</desc>
</entry>

<entry id="do_n2onh3_coupled" modify_via_xml="HAMOCC_N2OC">
Expand Down Expand Up @@ -6051,7 +6060,7 @@
<value is_test="yes">0,0,0</value>
<value is_test="yes" empty_hist="yes">0,0,0</value>
</values>
<desc>AMELIST FOR DIAGNOSTIC iHAMOCC OUTPUT</desc>
<desc>namelist for diagnostic iHAMOCC output</desc>
</entry>

<entry id="flx_car0100">
Expand Down Expand Up @@ -8738,6 +8747,21 @@
<desc>(ssster) [mol m-3]</desc>
</entry>

<!-- ========================= -->
<!-- namelist group: forcing fields using nuopc -->
<!-- ========================= -->

<entry id="use_stream_relaxation">
<type>logical</type>
<category>limits</category>
<group>limits</group>
<values>
<value>.false.</value>
<value comp_interface="nuopc">.true.</value>
</values>
<desc>if .true., use NUOPC stream relaxation capability</desc>
</entry>

<!-- ========================= -->
<!-- namelist group: stream_sss -->
<!-- ========================= -->
Expand Down
57 changes: 28 additions & 29 deletions cime_config/ocn_in.readme
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
! CWMI : Array of grid cell i-indices (i)
! CWMJ : Array of grid cell j-indices (i)
! CWMWTH : Array of modified grid cell widths (m) (f)
!
!
!===========================================================================
! NAMELIST FOR MERIDIONAL OVERTURNING AND FLUX DIAGNOSTICS
!
Expand All @@ -188,15 +188,15 @@
! for each region (i)
! MER_MINLAT : Minimum latitude to be considered for each region (f)
! MER_MAXLAT : Maximum latitude to be considered for each region (f)
!
!
!===========================================================================
! NAMELIST FOR SECTION TRANSPORT DIAGNOSTICS
!
! CONTENTS:
!
! SEC_SIFILE : Name of file containing section specification for section
! transport computation (a)
!
!
!===========================================================================
! IO-NAMELIST FOR DIAGNOSTIC OUTPUT
!
Expand Down Expand Up @@ -230,10 +230,10 @@
! MSC_ - miscellanous, non-gridded fields
!
! Global parameters:
! FNAMETAG - tag used in file name (c10)
! AVEPERIO - average period in days (i)
! FILEFREQ - how often to start a new file in days (i)
! COMPFLAG - switch for compressed/uncompressed output (i)
! FNAMETAG - tag used in file name (c10)
! AVEPERIO - average period in days (i)
! FILEFREQ - how often to start a new file in days (i)
! COMPFLAG - switch for compressed/uncompressed output (i)
! NCFORMAT - netcdf format (valid arguments are 0 for classic,
! 1 for 64-bit offset and 2 for netcdf4/hdf5 format)
!
Expand Down Expand Up @@ -380,13 +380,12 @@
!
! ATM_CO2 : Atmospheric CO2 concentration [ppmv]
! FEDEPFILE : File name (incl. full path) for iron (dust) deposition data
! SWACLIMFILE : File name (incl. full path) for swa climatology field (needed
! SWACLIMFILE : File name (incl. full path) for swa climatology field (needed
! if bromoform scheme is activated)
! DO_RIVINPT : Logical switch to activate riverine input
! RIVINFILE : File name (incl. full path) for riverine input data
! DO_NDEP : Logical switch to activate N-deposition
! DO_NDEP_COUPLED: Logical to apply N-deposition fluxes received from the atmosphere (true=atm, false=clim), requires DO_NDEP=TRUE
! NDEPFILE : File name (incl. full path) for atmopheric N-deposition data
! NDEPFILE : File name (incl. full path) for atmopheric N-deposition data (not used for coupling to cmeps)
! DO_N2ONH3_COUPLED: Logical switch for interactive coupling of N2O and NH3 fluxes (true=atm, false=fix atmospheric value)
! DO_SEDSPINUP: Logical switch to activate sediment spin-up
! SEDSPIN_YR_S: Start year for sediment spinup
Expand All @@ -398,21 +397,21 @@
! PI_PH_FILE : File name (incl. full path) for surface PI pH input data.
! use_M4AGO : Switch for M4AGO settling scheme
! LEUPHOTIC_CYA : Switch to perform bluefix (cyanobacteria) only in the euphotic zone
! L_3DVARSEDPOR : Logical switch to enable lon-lat-depth variable sediment porosity (as opposed to default: only depth)
! L_3DVARSEDPOR : Logical switch to enable lon-lat-depth variable sediment porosity (as opposed to default: only depth)
! SEDPORFILE : File name (incl. full path) for sediment porosity
!
!===========================================================================
! NAMELIST BGCPARAMS FOR iHAMOCC-BGC PARAMETERS (DEVELOPERS ONLY)
!
!
! CONTENTS: EMPTY BY DEFAULT
! FOR ADJUSTABLE PARAMETERS, SEE CODE
!
!
!===========================================================================
! NAMELIST BGCOAFX FOR ALKALINIZATION SCENARIO
!
! CONTENTS:
!
! OALKSCEN : Name of alkalinization scenario ('const', 'ramp', or 'file')
! OALKSCEN : Name of alkalinization scenario ('const', 'ramp', or 'file')
! OALKFILE : Full path of the input file for the alkalinization scenario 'file'
! ADDALK : Pmol alkalinity/yr added in 'const' or 'ramp' scenarios
! CDRMIP_LATMAX : Max latitude where alkalinity is added in 'const' or 'ramp' scenarios
Expand All @@ -434,10 +433,10 @@
! BUR_ - 2d fields of sediment burial
!
! Global parameters:
! FNAMETAG - tag used in file name (c10)
! AVEPERIO - average period in days (i)
! FILEFREQ - how often to start a new file in days (i)
! COMPFLAG - switch for compressed/uncompressed output (i)
! FNAMETAG - tag used in file name (c10)
! AVEPERIO - average period in days (i)
! FILEFREQ - how often to start a new file in days (i)
! COMPFLAG - switch for compressed/uncompressed output (i)
! NCFORMAT - netcdf format (valid arguments are 0 for classic,
! 1 for 64-bit offset and 2 for netcdf4/hdf5 format)
! INVENTORY- how often to write an inventory of tracers to ocean
Expand Down Expand Up @@ -487,7 +486,7 @@
! PHOSY - Primary production (pp) [mol C m-3 s-1]
! CO3 - Carbonate ions (co3) [mol C m-3]
! N2O - Nitrous oxide concentration [mol N2O m-3]
! NITR_NH4 - nitrification rate on NH4 [mol NH4 m-3 s-1] - extended N cycle only
! NITR_NH4 - nitrification rate on NH4 [mol NH4 m-3 s-1] - extended N cycle only
! NITR_NO2 - nitrification rate on NO2 [mol NO2 m-3 s-1] - extended N cycle only
! NITR_N2O_PROD - N2O production rate during nitrification on NH4 [mol N2O m-3 s-1] - ext. N cycle only
! NITR_NH4_OM - detritus production during nitrification on NH4 [mol P m-3 s-1] - ext. N cycle only
Expand All @@ -498,9 +497,9 @@
! DNRA_NO2 - DNRA on NO2 [mol NO2 m-3 s-1] - ext. N cycle only
! ANMX_N2_PROD - anammox N2 production [mol N2 m-3 s-1] - ext. N cycle only
! ANMX_OM_PROD - anammox detritus production [mol P m-3 s-1] - ext. N cycle only
! PHOSY_NH4 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only
! PHOSY_NO3 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only
! REMIN_AEROB - aerob remineralization rate (sev. sources) [mol NH4 m-3 s-1] - ext. N cycle only
! PHOSY_NH4 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only
! PHOSY_NO3 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only
! REMIN_AEROB - aerob remineralization rate (sev. sources) [mol NH4 m-3 s-1] - ext. N cycle only
! REMIN_SULF - sulfate-based remin rate on det [mol P m-3 s-1] - ext. N cycle only
! AGG_WS - M4AGO aggregate mean settling velocity [m/d]
! DYNVIS - molecular dynamic viscosity of sea water [kg m-1 s-1]
Expand Down Expand Up @@ -549,8 +548,8 @@
! PCO2M - Surface PCO2 under moist air assumption [uatm]
! KWCO2 - Piston velocity (kwco2) [m s-1]
! KWCO2KHM - Piston velocity times solubility (kwco2*kh; moist air) [m s-1 mol kg-1 uatm-1]
! CO2KH - CO2 solubility under dry air assumption (khd) [mol kg-1 atm-1]
! CO2KHM - CO2 solubility under moist air assumption (kh) [mol kg-1 atm-1]
! CO2KH - CO2 solubility under dry air assumption (khd) [mol kg-1 atm-1]
! CO2KHM - CO2 solubility under moist air assumption (kh) [mol kg-1 atm-1]
! CO2FXD - Downward CO2 flux (co2fxd) [kg C m-2 s-1]
! CO2FXU - Upward CO2 flux (co2fxu) [kg C m-2 s-1]
! NIFLUX - Nitrogen flux (fgn2) [mol N2 m-2 s-1]
Expand Down Expand Up @@ -608,7 +607,7 @@
! BURSSSC12 - burial fluxes of calcium carbonate [mol Ca m-2 s-1]
! BURSSSSIL - burial fluxes of silicate [mol Si m-2 s-1]
! BURSSSTER - burial fluxes of clay [g m-2 s-1]
!
!
! Sediment fields (SDM)
! POWAIC - (powdic) [mol C m-3]
! POWAAL - (powalk) [eq m-3]
Expand All @@ -620,7 +619,7 @@
! POWNH4 - (pownh4) [mol NH4 m-3] - extended N cycle only
! POWN2O - (pown2o) [mol N2O m-3] - extended N cycle only
! POWNO2 - (powno2) [mol NO2 m-3] - extended N cycle only
! NITR_NH4 - nitrification rate on NH4 [mol NH4 m-3 s-1] - extended N cycle only
! NITR_NH4 - nitrification rate on NH4 [mol NH4 m-3 s-1] - extended N cycle only
! NITR_NO2 - nitrification rate on NO2 [mol NO2 m-3 s-1] - extended N cycle only
! NITR_N2O_PROD - N2O production rate during nitrification on NH4 [mol N2O m-3 s-1] - ext. N cycle only
! NITR_NH4_OM - detritus production during nitrification on NH4 [mol P m-3 s-1] - ext. N cycle only
Expand All @@ -631,9 +630,9 @@
! DNRA_NO2 - DNRA on NO2 [mol NO2 m-3 s-1] - ext. N cycle only
! ANMX_N2_PROD - anammox N2 production [mol N2 m-3 s-1] - ext. N cycle only
! ANMX_OM_PROD - anammox detritus production [mol P m-3 s-1] - ext. N cycle only
! PHOSY_NH4 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only
! PHOSY_NO3 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only
! REMIN_AEROB - aerob remineralization rate (sev. sources) [mol NH4 m-3 s-1] - ext. N cycle only
! PHOSY_NH4 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only
! PHOSY_NO3 - PP consumption of NH4 [mol NH4 m-3 s-1] - ext. N cycle only
! REMIN_AEROB - aerob remineralization rate (sev. sources) [mol NH4 m-3 s-1] - ext. N cycle only
! REMIN_SULF - sulfate-based remin rate on det [mol P m-3 s-1] - ext. N cycle only
! SSSO12 - (ssso12) [mol m-3]
! SSSSIL - (ssssil) [mol Si m-3]
Expand Down
11 changes: 11 additions & 0 deletions drivers/nuopc/ocn_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module ocn_import_export
rnf_da, rfi_da, fmltfz_da, sfl_da, ztx_da, mty_da, &
ustarw_da, slp_da, abswnd_da, ficem_da, lamult_da, &
lasl_da, ustokes_da, vstokes_da, atmco2_da, &
atmnhxdep_da, atmnoydep_da, &
l1ci, l2ci
use mod_utility, only: util1, util2
use mod_checksum, only: csdiag, chksummsk
Expand Down Expand Up @@ -142,6 +143,7 @@ module ocn_import_export
index_Faxa_lwdn = -1, &
index_Faxa_snow = -1, &
index_Faxa_rain = -1, &
index_Faxa_ndep = -1, &
index_Sa_pslv = -1, &
index_Sa_co2diag = -1, &
index_Sa_co2prog = -1, &
Expand Down Expand Up @@ -269,6 +271,8 @@ subroutine blom_advertise_imports(flds_scalar_name, fldsToOcn_num, fldsToOcn, &
call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faxa_lwdn' , index_Faxa_lwdn)
call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faxa_snow' , index_Faxa_snow)
call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faxa_rain' , index_Faxa_rain)
call fldlist_add(fldsToOcn_num, fldsToOcn, 'Faxa_ndep' , index_Faxa_ndep, &
ungridded_lbound=1, ungridded_ubound=2)
if (flds_co2a .or. flds_co2c) then
call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sa_co2diag' ,index_Sa_co2diag)
call fldlist_add(fldsToOcn_num, fldsToOcn, 'Sa_co2prog', index_Sa_co2prog)
Expand Down Expand Up @@ -884,6 +888,9 @@ subroutine blom_importflds(fldlist_num, fldlist)
! Ice fraction [].
ficem_da(i,j,l2ci) = fldlist(index_Si_ifrac)%dataptr(n)

! Nitrogen deposition [kg m-2 s-1].
atmnhxdep_da(i,j,l2ci) = fldlist(index_Faxa_ndep)%dataptr2d(1,n)*afac
atmnoydep_da(i,j,l2ci) = fldlist(index_Faxa_ndep)%dataptr2d(2,n)*afac
endif

enddo
Expand All @@ -901,6 +908,8 @@ subroutine blom_importflds(fldlist_num, fldlist)
call xctilr(swa_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps)
call xctilr(nsf_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps)
call xctilr(hmlt_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps)
call xctilr(atmnhxdep_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps)
call xctilr(atmnoydep_da(1-nbdy,1-nbdy,l2ci), 1,1, 0,0, halo_ps)
endif

call fill_global(mval, fval, halo_ps, slp_da(1-nbdy,1-nbdy,l2ci))
Expand Down Expand Up @@ -1034,6 +1043,8 @@ subroutine blom_importflds(fldlist_num, fldlist)
call chksummsk(abswnd_da(1-nbdy,1-nbdy,l2ci),ip,1,'abswnd')
call chksummsk( ficem_da(1-nbdy,1-nbdy,l2ci),ip,1,'ficem')
call chksummsk(atmco2_da(1-nbdy,1-nbdy,l2ci),ip,1,'atmco2')
call chksummsk(atmnhxdep_da(1-nbdy,1-nbdy,l2ci),ip,1,'atmnhxdep')
call chksummsk(atmnoydep_da(1-nbdy,1-nbdy,l2ci),ip,1,'atmnoydep')
endif

if (first_call) then
Expand Down
Loading