Skip to content

Commit

Permalink
Introduce shelf-sea water residence time tracer acc. to Liu et al 2019 (
Browse files Browse the repository at this point in the history
#426)

* Introduce shelf-sea water residence time tracer according to Liu et al. 2019

* Introduce default fall-back shelf-sea mask reconstruction from internal bathymetry in case maskfile file is not provided
  • Loading branch information
jmaerz authored Nov 6, 2024
1 parent 4b9556a commit 79081d8
Show file tree
Hide file tree
Showing 19 changed files with 453 additions and 73 deletions.
2 changes: 2 additions & 0 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def buildnml(case, caseroot, compname):
hamocc_n2oc = case.get_value("HAMOCC_N2OC")
hamocc_atmndepc = case.get_value("HAMOCC_ATMNDEPC")
hamocc_sinking_scheme = case.get_value("HAMOCC_SINKING_SCHEME")
hamocc_shelf_res_time = case.get_value("HAMOCC_SHELFSEA_RES_TIME")
hamocc_sedbypass = case.get_value("HAMOCC_SEDBYPASS")
hamocc_sedspinup = case.get_value("HAMOCC_SEDSPINUP")
hamocc_sedspinup_yr_start = case.get_value("HAMOCC_SEDSPINUP_YR_START")
Expand Down Expand Up @@ -199,6 +200,7 @@ def buildnml(case, caseroot, compname):
config["hamocc_sedspinup_ncycle"] = hamocc_sedspinup_ncycle
config["is_test"] = "yes" if is_test else "no"
config["comp_interface"] = comp_interface
config["hamocc_shelf_res_time"] = "yes" if hamocc_shelf_res_time else "no"

# Set the sinking scheme in iHAMOCC
# Note: the following part requires to have set options for no/yes
Expand Down
9 changes: 9 additions & 0 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@
<desc>Set namelist option to activate the preformed tracer code. Requires module ecosys</desc>
</entry>

<entry id="HAMOCC_SHELFSEA_RES_TIME">
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
<default_value>FALSE</default_value>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Set namelist option to activate the shelfsea water residence time code. Requires module ecosys</desc>
</entry>

<entry id="HAMOCC_CISO">
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
Expand Down
48 changes: 48 additions & 0 deletions cime_config/namelist_definition_blom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4057,6 +4057,18 @@
</desc>
</entry>

<entry id="shelfsea_maskfile" is_inputdata="yes">
<type>char</type>
<category>bgcnml</category>
<group>bgcnml</group>
<values>
<value>''</value>
</values>
<desc>
File name (incl. full path) for shelfsea maskfile (1=shelf; 0=open ocean)
</desc>
</entry>

<entry id="ocn_co2_type" modify_via_xml="OCN_CO2_TYPE">
<type>char</type>
<category>config_bgc</category>
Expand Down Expand Up @@ -4211,6 +4223,17 @@
<desc>activate the HAMOCC preformed tracers code</desc>
</entry>

<entry id="use_shelfsea_res_time" modify_via_xml="HAMOCC_SHELFSEA_RES_TIME">
<type>logical</type>
<category>config_bgc</category>
<group>config_bgc</group>
<values>
<value>.false.</value>
<value hamocc_shelf_res_time="yes">.true.</value>
</values>
<desc>activate the HAMOCC shelfsea water residence time code</desc>
</entry>

<!-- ========================= -->
<!-- namelist group: bgcoafx -->
<!-- These options can be activated by expert users via user namelist. -->
Expand Down Expand Up @@ -7001,6 +7024,19 @@
<desc>preformed DIC (p_dic) [mol C m-3]</desc>
</entry>

<entry id="lyr_shelfage">
<type>integer(3)</type>
<category>diabgc</category>
<group>diabgc</group>
<values>
<value>0,4,4</value>
<value is_test="yes">4,2,2</value>
<value is_test="yes" empty_hist="yes">0,0,0</value>
</values>
<desc>Shelfsea water residence time [d]</desc>
</entry>


<entry id="lyr_dicsat">
<type>integer(3)</type>
<category>diabgc</category>
Expand Down Expand Up @@ -7981,6 +8017,18 @@
<desc>preformed DIC (p_dic) [mol C m-3]</desc>
</entry>

<entry id="lvl_shelfage">
<type>integer(3)</type>
<category>diabgc</category>
<group>diabgc</group>
<values>
<value>0,4,4</value>
<value is_test="yes">4,2,2</value>
<value is_test="yes" empty_hist="yes">0,0,0</value>
</values>
<desc>Shelfsea water residence time [d]</desc>
</entry>

<entry id="lvl_dicsat">
<type>integer(3)</type>
<category>diabgc</category>
Expand Down
2 changes: 2 additions & 0 deletions hamocc/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ sources += files(
'mo_read_ndep.F90',
'mo_read_pi_ph.F90',
'mo_read_rivin.F90',
'mo_read_shelfmask.F90',
'mo_shelfsea_restime.F90',
'mo_read_oafx.F90',
'mo_read_sedpor.F90',
'mo_sedmnt.F90',
Expand Down
14 changes: 10 additions & 4 deletions hamocc/mo_accfields.F90
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ subroutine accfields(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
jsdm_denit_NO3,jsdm_denit_NO2,jsdm_denit_N2O,jsdm_DNRA_NO2, &
jsdm_anmx_N2_prod,jsdm_anmx_OM_prod,jsdm_remin_aerob, &
jsdm_remin_sulf,jsediffnh4,jsediffn2o,jsediffno2,jatmn2o,jatmnh3, &
jndepnhxfx
jndepnhxfx,jshelfage,jlvlshelfage
use mo_control_bgc, only: io_stdo_bgc,dtb,use_BROMO,use_AGG,use_WLIN,use_natDIC, &
use_CFC,use_sedbypass,use_cisonew,use_BOXATM,use_M4AGO, &
use_extNcycle,use_pref_tracers
use_extNcycle,use_pref_tracers,use_shelfsea_res_time
use mo_param1_bgc, only: ialkali,ian2o,iano3,iatmco2,iatmdms,iatmn2,iatmn2o,iatmo2, &
icalc,idet,idms,idicsat,idoc,iiron,iopal, &
ioxygen,iphosph,iphy,iprefalk,iprefdic, &
Expand All @@ -146,7 +146,7 @@ subroutine accfields(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
ipowaal,ipowaic,ipowaox,ipowaph,ipowasi, &
ipown2,ipowno3,isssc12,issso12,issssil,issster, &
issso12,isssc12,issssil,issster,iprefsilica,iatmnh3,ianh4,iano2, &
ipownh4,ipown2o,ipowno2
ipownh4,ipown2o,ipowno2,ishelfage
use mo_sedmnt, only: powtra,sedlay,burial
use mo_vgrid, only: dp_min
use mo_inventory_bgc, only: inventory_bgc
Expand Down Expand Up @@ -413,6 +413,9 @@ subroutine accfields(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
call acclyr(jprefalk,ocetra(1,1,1,iprefalk),pddpo,1)
call acclyr(jprefdic,ocetra(1,1,1,iprefdic),pddpo,1)
endif
if (use_shelfsea_res_time) then
call acclyr(jshelfage,ocetra(1,1,1,ishelfage),pddpo,1)
endif
if (use_natDIC) then
call acclyr(jnatalkali,ocetra(1,1,1,inatalkali),pddpo,1)
call acclyr(jnatdic,ocetra(1,1,1,inatsco212),pddpo,1)
Expand Down Expand Up @@ -488,7 +491,7 @@ subroutine accfields(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
& jlvlano3+jlvlalkali+jlvlsilica+jlvldic+jlvldoc+jlvlpoc+jlvlcalc+ &
& jlvlopal+jlvln2o+jlvlco3+jlvlph+jlvlomegaa+jlvlomegac+jlvlphosy+ &
& jlvlo2sat+jlvlprefo2+jlvlprefpo4+jlvlprefalk+jlvlprefdic+ &
& jlvlprefsilica+ &
& jlvlprefsilica+jlvlshelfage+ &
& jlvldicsat+jlvlnatdic+jlvlnatalkali+jlvlnatcalc+jlvlnatco3+ &
& jlvlnatomegaa+jlvlnatomegac+jlvldic13+jlvldic14+jlvld13c+ &
& jlvld14c+jlvlbigd14c+jlvlpoc13+jlvldoc13+jlvlcalc13+jlvlphyto13+ &
Expand Down Expand Up @@ -532,6 +535,9 @@ subroutine accfields(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
call acclvl(jlvlprefalk,ocetra(1,1,1,iprefalk),k,ind1,ind2,wghts)
call acclvl(jlvlprefdic,ocetra(1,1,1,iprefdic),k,ind1,ind2,wghts)
endif
if (use_shelfsea_res_time) then
call acclvl(jlvlshelfage,ocetra(1,1,1,ishelfage),k,ind1,ind2,wghts)
endif
if (use_natDIC) then
call acclvl(jlvlnatdic,ocetra(1,1,1,inatsco212),k,ind1,ind2,wghts)
call acclvl(jlvlnatalkali,ocetra(1,1,1,inatalkali),k,ind1,ind2,wghts)
Expand Down
26 changes: 23 additions & 3 deletions hamocc/mo_aufr_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ subroutine aufr_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,kplyear,kplmon,kplday,o
use mo_carbch, only: co2star,co3,hi,satoxy,ocetra,atm,nathi
use mo_control_bgc, only: io_stdo_bgc,ldtbgc,use_cisonew,use_AGG, &
use_BOXATM,use_BROMO,use_CFC,use_natDIC,use_sedbypass, &
use_extNcycle,use_pref_tracers
use_extNcycle,use_pref_tracers,use_shelfsea_res_time
use mo_param1_bgc, only: ialkali,ian2o,iano3,icalc,idet,idicsat, &
idms,idoc,ifdust,igasnit,iiron,iopal,ioxygen,iphosph,iphy, &
iprefalk,iprefdic,iprefo2,iprefpo4,iprefsilica, &
iprefalk,iprefdic,iprefo2,iprefpo4,iprefsilica,ishelfage, &
isco212,isilica,izoo,nocetra, &
iadust,inos,iatmco2,iatmn2,iatmo2,ibromo,icfc11,icfc12,isf6, &
icalc13,icalc14,idet13,idet14,idoc13,idoc14,iphy13,iphy14, &
Expand Down Expand Up @@ -127,6 +127,7 @@ subroutine aufr_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,kplyear,kplmon,kplday,o
integer :: restdtoce ! time step number from bgc ocean file
integer :: idate(5),i,j,k
logical :: lread_cfc,lread_nat,lread_iso,lread_atm,lread_bro,lread_extn,lread_prefsi
logical :: lread_shelfage
real :: rco213,rco214,alpha14,beta13,beta14,d13C_atm,d14cat
integer :: ncid,ncstat,ncvarid

Expand Down Expand Up @@ -380,6 +381,23 @@ subroutine aufr_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,kplyear,kplmon,kplday,o
write(io_stdo_bgc,*) 'Initialising preformed tracer from scratch'
endif

lread_shelfage=.true.
if(IOTYPE==0) then
if(mnproc==1) ncstat=nf90_inq_varid(ncid,'shelfage',ncvarid)
call xcbcst(ncstat)
if(ncstat.ne.nf90_noerr) lread_shelfage=.false.
else if(IOTYPE==1) then
#ifdef PNETCDF
ncstat=nfmpi_inq_varid(ncid,'shelfage',ncvarid)
if(ncstat.ne.nf_noerr) lread_shelfage=.false.
#endif
endif
if(mnproc==1 .and. .not. lread_shelfage) then
write(io_stdo_bgc,*) ' '
write(io_stdo_bgc,*) 'AUFR_BGC info: shelfage not in restart file '
write(io_stdo_bgc,*) 'Initialising shelfage from scratch'
endif

!
! Read restart data : ocean aquateous tracer
!
Expand Down Expand Up @@ -410,7 +428,9 @@ subroutine aufr_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,kplyear,kplmon,kplday,o
call read_netcdf_var(ncid,'prefsilica',locetra(1,1,1,iprefsilica),2*kpke,0,iotype)
endif
endif

if (use_shelfsea_res_time .and. lread_shelfage) then
call read_netcdf_var(ncid,'shelfage',locetra(1,1,1,ishelfage),2*kpke,0,iotype)
endif
if (use_cisonew .and. lread_iso) then
call read_netcdf_var(ncid,'sco213',locetra(1,1,1,isco213),2*kpke,0,iotype)
call read_netcdf_var(ncid,'sco214',locetra(1,1,1,isco214),2*kpke,0,iotype)
Expand Down
38 changes: 23 additions & 15 deletions hamocc/mo_aufw_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ subroutine aufw_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,
use mo_carbch, only: co2star,co3,hi,satoxy,nathi
use mo_control_bgc, only: io_stdo_bgc,ldtbgc,rmasks,rmasko,use_cisonew,use_AGG,use_BOXATM, &
use_BROMO,use_CFC,use_natDIC,use_sedbypass,use_extNcycle, &
use_pref_tracers
use_pref_tracers,use_shelfsea_res_time
use mo_sedmnt, only: sedhpl
use mo_intfcblom, only: sedlay2,powtra2,burial2,atm2
use mo_param1_bgc, only: ialkali, ian2o,iano3,icalc,idet,idicsat,idms,idoc,ifdust,igasnit, &
Expand All @@ -87,7 +87,7 @@ subroutine aufw_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,
isssc13,isssc14,ipowc13,ipowc14,iatmnco2,iatmc13,iatmc14,inatalkali, &
inatcalc,inatsco212,ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2, &
ipowno3,isssc12,issso12,issssil,issster,iprefsilica,ianh4,iano2, &
ipownh4,ipown2o,ipowno2
ipownh4,ipown2o,ipowno2,ishelfage
use mo_netcdf_bgcrw,only: write_netcdf_var,netcdf_def_vardb
#ifdef PNETCDF
use mod_xc, only: mpicomm
Expand Down Expand Up @@ -432,24 +432,25 @@ subroutine aufw_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,
call NETCDF_DEF_VARDB(ncid,4,'iron',3,ncdimst,ncvarid, &
& 6,'mol/kg',14,'Dissolved iron',rmissing,26,io_stdo_bgc)

call NETCDF_DEF_VARDB(ncid,6,'prefo2',3,ncdimst,ncvarid, &
& 6,'mol/kg',16,'Preformed oxygen',rmissing,27,io_stdo_bgc)
call NETCDF_DEF_VARDB(ncid,6,'dicsat',3,ncdimst,ncvarid, &
& 6,'mol/kg',13,'Saturated dic',rmissing,31,io_stdo_bgc)

call NETCDF_DEF_VARDB(ncid,7,'prefpo4',3,ncdimst,ncvarid, &
& 6,'mol/kg',19,'Preformed phosphate',rmissing,28,io_stdo_bgc)
if (use_pref_tracers) then
call NETCDF_DEF_VARDB(ncid,6,'prefo2',3,ncdimst,ncvarid, &
& 6,'mol/kg',16,'Preformed oxygen',rmissing,27,io_stdo_bgc)

call NETCDF_DEF_VARDB(ncid,10,'prefsilica',3,ncdimst,ncvarid, &
& 6,'mol/kg',16,'Preformed silica',rmissing,28,io_stdo_bgc)
call NETCDF_DEF_VARDB(ncid,7,'prefpo4',3,ncdimst,ncvarid, &
& 6,'mol/kg',19,'Preformed phosphate',rmissing,28,io_stdo_bgc)

call NETCDF_DEF_VARDB(ncid,7,'prefalk',3,ncdimst,ncvarid, &
& 6,'mol/kg',20,'Preformed alkalinity',rmissing,29,io_stdo_bgc)
call NETCDF_DEF_VARDB(ncid,10,'prefsilica',3,ncdimst,ncvarid, &
& 6,'mol/kg',16,'Preformed silica',rmissing,28,io_stdo_bgc)

call NETCDF_DEF_VARDB(ncid,7,'prefdic',3,ncdimst,ncvarid, &
& 6,'mol/kg',13,'Preformed dic',rmissing,30,io_stdo_bgc)

call NETCDF_DEF_VARDB(ncid,6,'dicsat',3,ncdimst,ncvarid, &
& 6,'mol/kg',13,'Saturated dic',rmissing,31,io_stdo_bgc)
call NETCDF_DEF_VARDB(ncid,7,'prefalk',3,ncdimst,ncvarid, &
& 6,'mol/kg',20,'Preformed alkalinity',rmissing,29,io_stdo_bgc)

call NETCDF_DEF_VARDB(ncid,7,'prefdic',3,ncdimst,ncvarid, &
& 6,'mol/kg',13,'Preformed dic',rmissing,30,io_stdo_bgc)
endif
if (use_cisonew) then
call NETCDF_DEF_VARDB(ncid,6,'sco213',3,ncdimst,ncvarid, &
& 6,'mol/kg',15, 'Dissolved CO213',rmissing,32,io_stdo_bgc)
Expand Down Expand Up @@ -525,6 +526,10 @@ subroutine aufw_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,
call NETCDF_DEF_VARDB(ncid,4,'ano2',3,ncdimst,ncvarid, &
& 6,'mol/kg',17,'Dissolved nitrite',rmissing,55,io_stdo_bgc)
endif
if (use_shelfsea_res_time) then
call NETCDF_DEF_VARDB(ncid,8,'shelfage',3,ncdimst,ncvarid, &
& 1,'d',25,'Shelfwater residence time',rmissing,65,io_stdo_bgc)
endif

!
! Define variables : diagnostic ocean fields
Expand Down Expand Up @@ -771,6 +776,9 @@ subroutine aufw_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,
call write_netcdf_var(ncid,'prefalk',locetra(1,1,1,iprefalk),2*kpke,0)
call write_netcdf_var(ncid,'prefdic',locetra(1,1,1,iprefdic),2*kpke,0)
endif
if (use_shelfsea_res_time) then
call write_netcdf_var(ncid,'shelfage',locetra(1,1,1,ishelfage),2*kpke,0)
endif
if (use_cisonew) then
call write_netcdf_var(ncid,'sco213' ,locetra(1,1,1,isco213) ,2*kpke,0)
call write_netcdf_var(ncid,'sco214' ,locetra(1,1,1,isco214) ,2*kpke,0)
Expand Down
Loading

0 comments on commit 79081d8

Please sign in to comment.