diff --git a/cime_config/buildnml b/cime_config/buildnml
index d70572dc..d6f7e6ba 100755
--- a/cime_config/buildnml
+++ b/cime_config/buildnml
@@ -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")
@@ -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
diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml
index 51544624..8e613dd2 100644
--- a/cime_config/config_component.xml
+++ b/cime_config/config_component.xml
@@ -198,6 +198,15 @@
Set namelist option to activate the preformed tracer code. Requires module ecosys
+
+ logical
+ TRUE,FALSE
+ FALSE
+ run_component_blom
+ env_run.xml
+ Set namelist option to activate the shelfsea water residence time code. Requires module ecosys
+
+
logical
TRUE,FALSE
diff --git a/cime_config/namelist_definition_blom.xml b/cime_config/namelist_definition_blom.xml
index 553f8792..cc0b63be 100644
--- a/cime_config/namelist_definition_blom.xml
+++ b/cime_config/namelist_definition_blom.xml
@@ -4057,6 +4057,18 @@
+
+ char
+ bgcnml
+ bgcnml
+
+ ''
+
+
+ File name (incl. full path) for shelfsea maskfile (1=shelf; 0=open ocean)
+
+
+
char
config_bgc
@@ -4211,6 +4223,17 @@
activate the HAMOCC preformed tracers code
+
+ logical
+ config_bgc
+ config_bgc
+
+ .false.
+ .true.
+
+ activate the HAMOCC shelfsea water residence time code
+
+
@@ -7001,6 +7024,19 @@
preformed DIC (p_dic) [mol C m-3]
+
+ integer(3)
+ diabgc
+ diabgc
+
+ 0,4,4
+ 4,2,2
+ 0,0,0
+
+ Shelfsea water residence time [d]
+
+
+
integer(3)
diabgc
@@ -7981,6 +8017,18 @@
preformed DIC (p_dic) [mol C m-3]
+
+ integer(3)
+ diabgc
+ diabgc
+
+ 0,4,4
+ 4,2,2
+ 0,0,0
+
+ Shelfsea water residence time [d]
+
+
integer(3)
diabgc
diff --git a/hamocc/meson.build b/hamocc/meson.build
index a9c240e5..80f79ec6 100644
--- a/hamocc/meson.build
+++ b/hamocc/meson.build
@@ -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',
diff --git a/hamocc/mo_accfields.F90 b/hamocc/mo_accfields.F90
index acac61ac..b16c8ca9 100644
--- a/hamocc/mo_accfields.F90
+++ b/hamocc/mo_accfields.F90
@@ -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, &
@@ -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
@@ -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)
@@ -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+ &
@@ -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)
diff --git a/hamocc/mo_aufr_bgc.F90 b/hamocc/mo_aufr_bgc.F90
index 112aab73..afe83b31 100644
--- a/hamocc/mo_aufr_bgc.F90
+++ b/hamocc/mo_aufr_bgc.F90
@@ -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, &
@@ -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
@@ -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
!
@@ -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)
diff --git a/hamocc/mo_aufw_bgc.F90 b/hamocc/mo_aufw_bgc.F90
index 86488187..07866fcc 100644
--- a/hamocc/mo_aufw_bgc.F90
+++ b/hamocc/mo_aufw_bgc.F90
@@ -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, &
@@ -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
@@ -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)
@@ -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
@@ -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)
diff --git a/hamocc/mo_bgcmean.F90 b/hamocc/mo_bgcmean.F90
index b768a95c..cdd025a4 100644
--- a/hamocc/mo_bgcmean.F90
+++ b/hamocc/mo_bgcmean.F90
@@ -49,7 +49,7 @@ module mo_bgcmean
use netcdf, only: nf90_fill_double
use mo_param1_bgc, only: ks
use mo_control_bgc, only: use_sedbypass,use_cisonew,use_CFC,use_natDIC,use_BROMO,use_BOXATM, &
- use_AGG,use_M4AGO,use_extNcycle
+ use_AGG,use_M4AGO,use_extNcycle,use_pref_tracers,use_shelfsea_res_time
implicit none
@@ -140,7 +140,7 @@ module mo_bgcmean
& LYR_EPS =0 ,LYR_ASIZE =0 ,LYR_N2O =0 , &
& LYR_PREFO2 =0 ,LYR_O2SAT =0 ,LYR_PREFPO4 =0 , &
& LYR_PREFALK =0 ,LYR_PREFDIC =0 ,LYR_DICSAT =0 , &
- & LYR_PREFSILICA=0 , &
+ & LYR_PREFSILICA=0 ,LYR_SHELFAGE =0 , &
& LYR_CFC11 =0 ,LYR_CFC12 =0 ,LYR_SF6 =0 , &
& LYR_NATDIC =0 ,LYR_NATALKALI =0 ,LYR_NATCALC =0 , &
& LYR_NATPH =0 ,LYR_NATOMEGAA =0 ,LYR_NATOMEGAC =0 , &
@@ -172,7 +172,7 @@ module mo_bgcmean
& LVL_ASIZE =0 ,LVL_N2O =0 ,LVL_PREFO2 =0 , &
& LVL_O2SAT =0 ,LVL_PREFPO4 =0 ,LVL_PREFALK =0 , &
& LVL_PREFDIC =0 ,LVL_DICSAT =0 , &
- & LVL_PREFSILICA=0 , &
+ & LVL_PREFSILICA=0 ,LVL_SHELFAGE =0 , &
& LVL_CFC11 =0 ,LVL_CFC12 =0 ,LVL_SF6 =0 , &
& LVL_NATDIC =0 ,LVL_NATALKALI =0 ,LVL_NATCALC =0 , &
& LVL_NATPH =0 ,LVL_NATOMEGAA =0 ,LVL_NATOMEGAC =0 , &
@@ -186,7 +186,7 @@ module mo_bgcmean
& LVL_nitr_NH4_OM =0 ,LVL_nitr_NO2_OM =0 ,LVL_denit_NO3 =0, &
& LVL_denit_NO2 = 0 ,LVL_denit_N2O = 0 ,LVL_DNRA_NO2 =0, &
& LVL_anmx_N2_prod=0 ,LVL_anmx_OM_prod=0 ,LVL_phosy_NH4 =0, &
- & LVL_phosy_NO3 = 0 ,LVL_remin_aerob =0 ,LVL_remin_sulf =0, &
+ & LVL_phosy_NO3 = 0 ,LVL_remin_aerob =0 ,LVL_remin_sulf =0, &
! M4AGO LVL
& LVL_agg_ws =0 ,LVL_dynvis =0 ,LVL_agg_stick =0 , &
& LVL_agg_stickf=0 ,LVL_agg_dmax =0 ,LVL_agg_avdp =0 , &
@@ -211,7 +211,7 @@ module mo_bgcmean
character(len=10), dimension(nbgcmax) :: glb_fnametag
namelist /diabgc/ &
& SRF_KWCO2 ,SRF_FCO2 ,SRF_PCO2 , &
- & SRF_XCO2 ,SRF_PCO2_GEX , &
+ & SRF_XCO2 ,SRF_PCO2_GEX , &
& SRF_DMSFLUX ,SRF_KWCO2SOL ,SRF_CO2SOL , &
& SRF_CO2FXD ,SRF_CO2FXU ,SRF_CO213FXD , &
& SRF_CO213FXU ,SRF_CO214FXD ,SRF_CO214FXU , &
@@ -257,7 +257,7 @@ module mo_bgcmean
& LYR_EPS ,LYR_ASIZE ,LYR_N2O , &
& LYR_PREFO2 ,LYR_O2SAT ,LYR_PREFPO4 , &
& LYR_PREFALK ,LYR_PREFDIC ,LYR_DICSAT , &
- & LYR_PREFSILICA , &
+ & LYR_PREFSILICA ,LYR_SHELFAGE , &
& LYR_CFC11 ,LYR_CFC12 ,LYR_SF6 , &
& LYR_NATDIC ,LYR_NATALKALI ,LYR_NATCALC , &
& LYR_NATPH ,LYR_NATOMEGAA ,LYR_NATOMEGAC , &
@@ -286,6 +286,7 @@ module mo_bgcmean
& LVL_ASIZE ,LVL_N2O ,LVL_PREFO2 , &
& LVL_O2SAT ,LVL_PREFPO4 ,LVL_PREFALK , &
& LVL_PREFDIC ,LVL_DICSAT ,LVL_PREFSILICA , &
+ & LVL_SHELFAGE , &
& LVL_CFC11 ,LVL_CFC12 ,LVL_SF6 , &
& LVL_NATDIC ,LVL_NATALKALI ,LVL_NATCALC , &
& LVL_NATPH ,LVL_NATOMEGAA ,LVL_NATOMEGAC , &
@@ -500,6 +501,7 @@ module mo_bgcmean
& jprefsilica= 0 , &
& jprefalk = 0 , &
& jprefdic = 0 , &
+ & jshelfage = 0 , &
& jdicsat = 0 , &
& jcfc11 = 0 , &
& jcfc12 = 0 , &
@@ -529,6 +531,7 @@ module mo_bgcmean
& jlvlprefsilica= 0 , &
& jlvlprefalk= 0 , &
& jlvlprefdic= 0 , &
+ & jlvlshelfage= 0 , &
& jlvldicsat = 0 , &
& jlvlcfc11 = 0 , &
& jlvlcfc12 = 0 , &
@@ -605,7 +608,7 @@ module mo_bgcmean
& jphosy_NH4 = 0 , &
& jphosy_NO3 = 0 , &
& jremin_aerob = 0 , &
- & jremin_sulf = 0 , &
+ & jremin_sulf = 0 , &
& jagg_ws = 0 , &
& jdynvis = 0 , &
& jagg_stick = 0 , &
@@ -617,9 +620,9 @@ module mo_bgcmean
& jagg_df = 0 , &
& jagg_b = 0 , &
& jagg_Vrhof = 0 , &
- & jagg_Vpor = 0 , &
+ & jagg_Vpor = 0 , &
& jlvlanh4 = 0 , &
- & jlvlano2 = 0 , &
+ & jlvlano2 = 0 , &
& jlvl_nitr_NH4 = 0 , &
& jlvl_nitr_NO2 = 0 , &
& jlvl_nitr_N2O_prod = 0 , &
@@ -1054,18 +1057,24 @@ subroutine alloc_mem_bgcmean(kpie,kpje,kpke)
jprefo2(n)=i_bsc_m3d*min(1,LYR_PREFO2(n))
if (LYR_O2SAT(n) > 0) i_bsc_m3d=i_bsc_m3d+1
jo2sat(n)=i_bsc_m3d*min(1,LYR_O2SAT(n))
- if (LYR_PREFPO4(n) > 0) i_bsc_m3d=i_bsc_m3d+1
- jprefpo4(n)=i_bsc_m3d*min(1,LYR_PREFPO4(n))
- if (LYR_PREFSILICA(n) > 0) i_bsc_m3d=i_bsc_m3d+1
- jprefsilica(n)=i_bsc_m3d*min(1,LYR_PREFSILICA(n))
- if (LYR_PREFALK(n) > 0) i_bsc_m3d=i_bsc_m3d+1
- jprefalk(n)=i_bsc_m3d*min(1,LYR_PREFALK(n))
- if (LYR_PREFDIC(n) > 0) i_bsc_m3d=i_bsc_m3d+1
- jprefdic(n)=i_bsc_m3d*min(1,LYR_PREFDIC(n))
if (LYR_DICSAT(n) > 0) i_bsc_m3d=i_bsc_m3d+1
jdicsat(n)=i_bsc_m3d*min(1,LYR_DICSAT(n))
if (LYR_DP(n) > 0) i_bsc_m3d=i_bsc_m3d+1
jdp(n)=i_bsc_m3d*min(1,LYR_DP(n))
+ if (use_pref_tracers) then
+ if (LYR_PREFPO4(n) > 0) i_bsc_m3d=i_bsc_m3d+1
+ jprefpo4(n)=i_bsc_m3d*min(1,LYR_PREFPO4(n))
+ if (LYR_PREFSILICA(n) > 0) i_bsc_m3d=i_bsc_m3d+1
+ jprefsilica(n)=i_bsc_m3d*min(1,LYR_PREFSILICA(n))
+ if (LYR_PREFALK(n) > 0) i_bsc_m3d=i_bsc_m3d+1
+ jprefalk(n)=i_bsc_m3d*min(1,LYR_PREFALK(n))
+ if (LYR_PREFDIC(n) > 0) i_bsc_m3d=i_bsc_m3d+1
+ jprefdic(n)=i_bsc_m3d*min(1,LYR_PREFDIC(n))
+ endif
+ if (use_shelfsea_res_time) then
+ if (LYR_SHELFAGE(n) > 0) i_bsc_m3d=i_bsc_m3d+1
+ jshelfage(n)=i_bsc_m3d*min(1,LYR_SHELFAGE(n))
+ endif
if (use_CFC) then
if (LYR_CFC11(n) > 0) i_bsc_m3d=i_bsc_m3d+1
jcfc11(n)=i_bsc_m3d*min(1,LYR_CFC11(n))
@@ -1233,16 +1242,22 @@ subroutine alloc_mem_bgcmean(kpie,kpje,kpke)
jlvlprefo2(n)=ilvl_bsc_m3d*min(1,LVL_PREFO2(n))
if (LVL_O2SAT(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
jlvlo2sat(n)=ilvl_bsc_m3d*min(1,LVL_O2SAT(n))
- if (LVL_PREFPO4(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
- jlvlprefpo4(n)=ilvl_bsc_m3d*min(1,LVL_PREFPO4(n))
- if (LVL_PREFSILICA(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
- jlvlprefsilica(n)=ilvl_bsc_m3d*min(1,LVL_PREFSILICA(n))
- if (LVL_PREFALK(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
- jlvlprefalk(n)=ilvl_bsc_m3d*min(1,LVL_PREFALK(n))
- if (LVL_PREFDIC(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
- jlvlprefdic(n)=ilvl_bsc_m3d*min(1,LVL_PREFDIC(n))
if (LVL_DICSAT(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
jlvldicsat(n)=ilvl_bsc_m3d*min(1,LVL_DICSAT(n))
+ if (use_pref_tracers) then
+ if (LVL_PREFPO4(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
+ jlvlprefpo4(n)=ilvl_bsc_m3d*min(1,LVL_PREFPO4(n))
+ if (LVL_PREFSILICA(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
+ jlvlprefsilica(n)=ilvl_bsc_m3d*min(1,LVL_PREFSILICA(n))
+ if (LVL_PREFALK(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
+ jlvlprefalk(n)=ilvl_bsc_m3d*min(1,LVL_PREFALK(n))
+ if (LVL_PREFDIC(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
+ jlvlprefdic(n)=ilvl_bsc_m3d*min(1,LVL_PREFDIC(n))
+ endif
+ if (use_shelfsea_res_time) then
+ if (LVL_SHELFAGE(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
+ jlvlshelfage(n)=ilvl_bsc_m3d*min(1,LVL_SHELFAGE(n))
+ endif
if (use_CFC) then
if (LVL_CFC11(n) > 0) ilvl_bsc_m3d=ilvl_bsc_m3d+1
jlvlcfc11(n)=ilvl_bsc_m3d*min(1,LVL_CFC11(n))
diff --git a/hamocc/mo_control_bgc.F90 b/hamocc/mo_control_bgc.F90
index 88dda4f8..26aff072 100644
--- a/hamocc/mo_control_bgc.F90
+++ b/hamocc/mo_control_bgc.F90
@@ -84,6 +84,7 @@ module mo_control_bgc
logical :: use_extNcycle = .false.
logical :: use_nuopc_ndep = .false.
logical :: use_pref_tracers = .true.
+ logical :: use_shelfsea_res_time = .false.
contains
diff --git a/hamocc/mo_hamocc4bcm.F90 b/hamocc/mo_hamocc4bcm.F90
index d194f18b..0bbb31a2 100644
--- a/hamocc/mo_hamocc4bcm.F90
+++ b/hamocc/mo_hamocc4bcm.F90
@@ -28,7 +28,7 @@ module mo_hamocc4bcm
subroutine hamocc4bcm(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,pdlxp,pdlyp,pddpo,prho, &
pglat,omask, dust,rivin,ndep,oafx,pi_ph,pfswr,psicomo,ppao,pfu10,ptho,psao,&
patmco2,pflxco2,pflxdms,patmbromo,pflxbromo, &
- patmn2o,pflxn2o,patmnh3,pflxnh3)
+ patmn2o,pflxn2o,patmnh3,pflxnh3,shelfmask)
!***********************************************************************************************
! Main routine of iHAMOCC.
@@ -55,7 +55,8 @@ subroutine hamocc4bcm(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,pdlxp,pd
do_sedspinup,sedspin_yr_s,sedspin_yr_e,sedspin_ncyc, &
use_BROMO, use_CFC, use_PBGC_CK_TIMESTEP, &
use_BOXATM, use_sedbypass,ocn_co2_type, &
- do_n2onh3_coupled,use_extNcycle,use_pref_tracers
+ do_n2onh3_coupled,use_extNcycle,use_pref_tracers, &
+ use_shelfsea_res_time
use mo_param1_bgc, only: iatmco2,iatmdms,nocetra,nriv,iatmbromo,nndep,iatmn2o,iatmnh3
use mo_vgrid, only: set_vgrid
use mo_apply_fedep, only: apply_fedep
@@ -72,6 +73,7 @@ subroutine hamocc4bcm(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,pdlxp,pd
use mo_ocprod, only: ocprod
use mo_carchm, only: carchm
use mo_chemcon, only: mw_nh3,mw_n2o
+ use mo_shelfsea_restime,only: shelfsea_residence_time
! Arguments
integer, intent(in) :: kpie ! 1st dimension of model grid.
@@ -108,6 +110,7 @@ subroutine hamocc4bcm(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,pdlxp,pd
real, intent(out) :: pflxn2o(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) ! Nitrous oxide flux [kg N2O m-2 s-1].
real, intent(in) :: patmnh3(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) ! atmospheric ammonia concentration [ppt] used in fully coupled mode
real, intent(out) :: pflxnh3(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) ! Ammonia flux [kg NH3 m-2 s-1].
+ logical, intent(in) :: shelfmask(kpie,kpje) ! mask for shelf sea regions (1=shelf, 0 elsewhere)
! Local variables
integer :: i,j,k,l
@@ -314,6 +317,11 @@ subroutine hamocc4bcm(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,pdlxp,pd
call preftrc(kpie,kpje,omask)
endif
+ if (use_shelfsea_res_time) then
+ ! Update shelf sea residence time tracer
+ call shelfsea_residence_time(kpie,kpje,kpke,pddpo,shelfmask,omask)
+ endif
+
!--------------------------------------------------------------------
! Sediment module
diff --git a/hamocc/mo_hamocc_init.F90 b/hamocc/mo_hamocc_init.F90
index de616649..e643e3d0 100644
--- a/hamocc/mo_hamocc_init.F90
+++ b/hamocc/mo_hamocc_init.F90
@@ -37,7 +37,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
use mod_time, only: date,baclin
use mod_xc, only: ii,jj,kk,idm,jdm,kdm,nbdy,isp,ifp,ilp,mnproc,lp,xchalt
- use mod_grid, only: plon,plat
+ use mod_grid, only: plon,plat,depths
use mod_tracers, only: ntrbgc,ntr,itrbgc,trc
use mo_control_bgc, only: bgc_namelist,get_bgc_namelist,do_ndep,do_rivinpt,do_oalk, &
do_sedspinup,sedspin_yr_s,sedspin_yr_e,sedspin_ncyc, &
@@ -67,6 +67,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
use mo_aufr_bgc, only: aufr_bgc
use mo_extNsediment,only: alloc_mem_extNsediment_diag
use mo_ihamocc4m4ago, only: alloc_mem_m4ago,init_m4ago_nml_params, init_m4ago_params
+ use mo_read_shelfmask,only: ini_read_shelfmask,shelfsea_maskfile
! Arguments
@@ -82,7 +83,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
& do_sedspinup,sedspin_yr_s,sedspin_yr_e,sedspin_ncyc, &
& inidic,inialk,inipo4,inioxy,inino3,inisil,inid13c,inid14c,swaclimfile, &
& with_dmsph,pi_ph_file,l_3Dvarsedpor,sedporfile,ocn_co2_type,use_M4AGO, &
- & do_n2onh3_coupled,lkwrbioz_off,lTO2depremin
+ & do_n2onh3_coupled,lkwrbioz_off,lTO2depremin,shelfsea_maskfile
!
! --- Set io units and some control parameters
!
@@ -203,6 +204,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
call ini_read_ndep(idm,jdm)
end if
call ini_read_rivin(idm,jdm,omask)
+ call ini_read_shelfmask(idm,jdm,nbdy,depths,omask)
call ini_read_oafx(idm,jdm,bgc_dx,bgc_dy,plat,omask)
if (use_BROMO) then
call ini_swa_clim(idm,jdm,omask)
diff --git a/hamocc/mo_hamocc_step.F90 b/hamocc/mo_hamocc_step.F90
index 39515374..9fa52abf 100644
--- a/hamocc/mo_hamocc_step.F90
+++ b/hamocc/mo_hamocc_step.F90
@@ -48,6 +48,7 @@ subroutine hamocc_step(m,n,mm,nn,k1m,k1n)
use mo_hamocc4bcm, only: hamocc4bcm
use mo_trc_limitc, only: trc_limitc
use mo_param1_bgc, only: nndep
+ use mo_read_shelfmask, only: shelfmask
! Arguments
integer, intent(in) :: m,n,mm,nn,k1m,k1n
@@ -83,7 +84,7 @@ subroutine hamocc_step(m,n,mm,nn,k1m,k1n)
& bgc_rho,plat,omask,dust,rivflx,ndep,oafx,pi_ph,swa,ficem,slp,abswnd, &
& temp(1-nbdy,1-nbdy,1+nn),saln(1-nbdy,1-nbdy,1+nn), &
& atmco2,flxco2,flxdms,atmbrf,flxbrf, &
- & atmn2o,flxn2o,atmnh3,flxnh3)
+ & atmn2o,flxn2o,atmnh3,flxnh3,shelfmask)
!
! --- accumulate fields and write output
diff --git a/hamocc/mo_ini_fields.F90 b/hamocc/mo_ini_fields.F90
index 5b8d0e10..3854a0b8 100644
--- a/hamocc/mo_ini_fields.F90
+++ b/hamocc/mo_ini_fields.F90
@@ -94,7 +94,8 @@ subroutine ini_fields_ocean(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask,pglon,pg
use mo_param_bgc, only: fesoly,cellmass,fractdim,bifr13_ini,bifr14_ini,c14fac,re1312,re14to
use mo_biomod, only: abs_oce
use mo_control_bgc, only: rmasks,use_FB_BGC_OCE,use_cisonew,use_AGG,use_CFC,use_natDIC, &
- use_BROMO, use_sedbypass,use_extNcycle,use_pref_tracers
+ use_BROMO, use_sedbypass,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, &
isco212,isilica,izoo,iadust,inos,ibromo,icfc11,icfc12,isf6, &
@@ -102,7 +103,7 @@ subroutine ini_fields_ocean(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask,pglon,pg
isco213,isco214,izoo13,izoo14,safediv,inatcalc, &
ipowaal,ipowaic,ipowaox,ipowaph,ipowasi,ipown2,ipowno3,isssc12, &
issso12,issssil,issster,ks,nsedtra,ipowc13,ipowc13,issso13,issso13, &
- isssc13,ipowc14,isssc14,issso14,iprefsilica,iano2,ianh4
+ isssc13,ipowc14,isssc14,issso14,iprefsilica,iano2,ianh4,ishelfage
use mo_vgrid, only: kmle,kbo
use mo_carbch, only: nathi,natco3
use mo_sedmnt, only: sedhpl,burial,powtra,sedlay
@@ -201,6 +202,9 @@ subroutine ini_fields_ocean(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask,pglon,pg
ocetra(i,j,k,iprefalk) = 0.
ocetra(i,j,k,iprefdic) = 0.
endif
+ if (use_shelfsea_res_time) then
+ ocetra(i,j,k,ishelfage) = 0.
+ endif
if (use_AGG) then
! calculate initial numbers from mass, to start with appropriate size distribution
snow = (ocetra(i,j,k,iphy)+ocetra(i,j,k,idet))*1.e+6
diff --git a/hamocc/mo_ncout_hamocc.F90 b/hamocc/mo_ncout_hamocc.F90
index 118eb36c..c3888275 100644
--- a/hamocc/mo_ncout_hamocc.F90
+++ b/hamocc/mo_ncout_hamocc.F90
@@ -35,7 +35,8 @@ subroutine ncwrt_bgc(iogrp)
use mod_grid, only: depths,plat,plon
use mod_dia, only: diafnm,sigmar1,iotype,ddm,depthslev,depthslev_bnds
use mo_control_bgc, only: dtbgc,use_cisonew,use_AGG,use_CFC,use_natDIC,use_BROMO, &
- use_sedbypass,use_BOXATM,use_M4AGO,use_extNcycle,use_pref_tracers
+ use_sedbypass,use_BOXATM,use_M4AGO,use_extNcycle,use_pref_tracers, &
+ use_shelfsea_res_time
use mo_vgrid, only: k0100,k0500,k1000,k2000,k4000
use mo_param1_bgc, only: ks
use mod_nctools, only: ncwrt1,ncdims,nctime,ncfcls,ncfopn,ncdimc,ncputr,ncputi,ncwrtr
@@ -88,6 +89,7 @@ subroutine ncwrt_bgc(iogrp)
jpco2,jxco2,jpco2_gex,jkwco2sol,jco2sol, &
jph,jphosph,jphosy,jphyto,jpoc,jprefalk, &
jprefdic,jprefo2,jprefpo4,jsilica,jprefsilica, &
+ jshelfage, &
jsrfalkali,jsrfano3,jsrfdic,jsrfiron, &
jsrfoxygen,jsrfphosph,jsrfphyto,jsrfsilica,jsrfph, &
jwnos,jwphy, &
@@ -97,14 +99,14 @@ subroutine ncwrt_bgc(iogrp)
lyr_opal,lyr_iron,lyr_phosy,lyr_co3,lyr_ph, &
lyr_omegaa,lyr_omegac,lyr_n2o,lyr_prefo2, &
lyr_o2sat,lyr_prefpo4,lyr_prefalk,lyr_prefsilica, &
- lyr_prefdic,lyr_dicsat, &
+ lyr_prefdic,lyr_dicsat,lyr_shelfage, &
lvl_dic,lvl_alkali, &
lvl_phosph,lvl_oxygen,lvl_ano3,lvl_silica, &
lvl_doc,lvl_phyto,lvl_grazer,lvl_poc, &
lvl_calc,lvl_opal,lvl_iron,lvl_phosy, &
lvl_co3,lvl_ph,lvl_omegaa,lvl_omegac, &
lvl_n2o,lvl_prefo2,lvl_o2sat,lvl_prefpo4,lvl_prefsilica, &
- lvl_prefalk,lvl_prefdic,lvl_dicsat, &
+ lvl_prefalk,lvl_prefdic,lvl_dicsat,lvl_shelfage, &
lvl_o2sat,srf_n2ofx,srf_pn2om,srf_atmco2,srf_kwco2, &
srf_kwco2sol,srf_co2sol,srf_fco2, &
srf_pco2,srf_xco2,srf_pco2_gex,srf_dmsflux,srf_co2fxd, &
@@ -141,7 +143,7 @@ subroutine ncwrt_bgc(iogrp)
lvl_d14c,lvl_bigd14c,lvl_poc13,lvl_doc13, &
lvl_calc13,lvl_phyto13,lvl_grazer13, &
jnatalkali,jnatdic,jnatcalc,jnatco3,jnatph, &
- jnatomegaa,jnatomegac,jlvlnatph,jlvlprefsilica, &
+ jnatomegaa,jnatomegac,jlvlnatph,jlvlprefsilica,jlvlshelfage, &
jsrfnatdic,jsrfnatalk,jsrfnatph, &
jnatpco2,jnatco2fx,lyr_natco3, &
lyr_natalkali,lyr_natdic,lyr_natph,lyr_natcalc, &
@@ -337,6 +339,9 @@ subroutine ncwrt_bgc(iogrp)
call finlyr(jprefalk(iogrp),jdp(iogrp))
call finlyr(jprefdic(iogrp),jdp(iogrp))
endif
+ if (use_shelfsea_res_time) then
+ call finlyr(jshelfage(iogrp),jdp(iogrp))
+ endif
if (use_cisonew) then
call finlyr(jdic13(iogrp),jdp(iogrp))
call finlyr(jdic14(iogrp),jdp(iogrp))
@@ -459,6 +464,9 @@ subroutine ncwrt_bgc(iogrp)
call msklvl(jlvlprefalk(iogrp),depths)
call msklvl(jlvlprefdic(iogrp),depths)
endif
+ if (use_shelfsea_res_time) then
+ call msklvl(jlvlshelfage(iogrp),depths)
+ endif
if (use_cisonew) then
call msklvl(jlvldic13(iogrp),depths)
call msklvl(jlvldic14(iogrp),depths)
@@ -692,6 +700,9 @@ subroutine ncwrt_bgc(iogrp)
call wrtlyr(jprefalk(iogrp), LYR_PREFALK(iogrp), 1e3, 0.,cmpflg,'p_talk')
call wrtlyr(jprefdic(iogrp), LYR_PREFDIC(iogrp), 1e3, 0.,cmpflg,'p_dic')
endif
+ if (use_shelfsea_res_time) then
+ call wrtlyr(jshelfage(iogrp), LYR_SHELFAGE(iogrp), rnacc, 0.,cmpflg,'shelfage')
+ endif
if (use_cisonew) then
call wrtlyr(jdic13(iogrp), LYR_DIC13(iogrp), 1.e3, 0.,cmpflg,'dissic13')
call wrtlyr(jdic14(iogrp), LYR_DIC14(iogrp), 1.e3*c14fac, 0.,cmpflg,'dissic14')
@@ -792,6 +803,9 @@ subroutine ncwrt_bgc(iogrp)
call wrtlvl(jlvlprefalk(iogrp), LVL_PREFALK(iogrp), rnacc*1e3, 0.,cmpflg,'p_talklvl')
call wrtlvl(jlvlprefdic(iogrp), LVL_PREFDIC(iogrp), rnacc*1e3, 0.,cmpflg,'p_diclvl')
endif
+ if (use_shelfsea_res_time) then
+ call wrtlvl(jlvlshelfage(iogrp), LVL_SHELFAGE(iogrp), rnacc, 0.,cmpflg,'shelfagelvl')
+ endif
if (use_cisonew) then
call wrtlvl(jlvldic13(iogrp), LVL_DIC13(iogrp), rnacc*1.e3, 0.,cmpflg,'dissic13lvl')
call wrtlvl(jlvldic14(iogrp), LVL_DIC14(iogrp), rnacc*1.e3*c14fac,0.,cmpflg,'dissic14lvl')
@@ -1057,6 +1071,9 @@ subroutine ncwrt_bgc(iogrp)
call inilyr(jprefalk(iogrp),0.)
call inilyr(jprefdic(iogrp),0.)
endif
+ if (use_shelfsea_res_time) then
+ call inilyr(jshelfage(iogrp),0.)
+ endif
if (use_cisonew) then
call inilyr(jdic13(iogrp),0.)
call inilyr(jdic14(iogrp),0.)
@@ -1155,6 +1172,9 @@ subroutine ncwrt_bgc(iogrp)
call inilvl(jlvlprefalk(iogrp),0.)
call inilvl(jlvlprefdic(iogrp),0.)
endif
+ if (use_shelfsea_res_time) then
+ call inilvl(jlvlshelfage(iogrp),0.)
+ endif
if (use_cisonew) then
call inilvl(jlvldic13(iogrp),0.)
call inilvl(jlvldic14(iogrp),0.)
@@ -1274,7 +1294,9 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg)
use mod_nctools, only: ncdefvar,ncattr,ncfopn,ncdimc,ncdims, &
nctime,ncfcls,ncedef,ncdefvar3d,ndouble
- use mo_control_bgc, only: use_M4AGO
+ use mo_control_bgc, only: use_cisonew,use_AGG,use_CFC,use_natDIC,use_BROMO, &
+ use_sedbypass,use_BOXATM,use_extNcycle,use_pref_tracers,use_M4AGO, &
+ use_shelfsea_res_time
use mo_bgcmean, only: srf_kwco2,srf_fco2,srf_pco2,srf_xco2,srf_pco2_gex,srf_dmsflux, &
srf_co2fxd,srf_co2fxu,srf_kwco2sol,srf_co2sol, &
srf_oxflux,srf_niflux,srf_pn2om,srf_dms,srf_dmsprod, &
@@ -1295,7 +1317,7 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg)
lyr_phyto,lyr_grazer,lyr_poc,lyr_calc,lyr_opal,lyr_iron, &
lyr_phosy,lyr_co3,lyr_ph,lyr_omegaa,lyr_omegac,lyr_n2o, &
lyr_prefo2,lyr_o2sat,lyr_prefpo4,lyr_prefalk,lyr_prefdic, &
- lyr_prefsilica, &
+ lyr_prefsilica,lyr_shelfage, &
lyr_dicsat,lvl_dic,lvl_alkali,lvl_phosph,lvl_oxygen,lvl_ano3, &
lvl_silica,lvl_doc,lvl_phyto,lvl_grazer,lvl_poc,lvl_calc, &
lvl_opal,lvl_iron,lvl_phosy,lvl_co3,lvl_ph,lvl_omegaa, &
@@ -1321,7 +1343,7 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg)
sdm_powaic,sdm_powaal,sdm_powaph,sdm_powaox, &
sdm_pown2,sdm_powno3,sdm_powasi,sdm_ssso12,sdm_ssssil, &
sdm_sssc12,sdm_ssster,bur_ssso12,bur_sssc12,bur_ssssil,bur_ssster, &
- lvl_prefsilica, &
+ lvl_prefsilica,lvl_shelfage, &
lyr_agg_ws,lyr_dynvis,lyr_agg_stick, &
lyr_agg_stickf,lyr_agg_dmax,lyr_agg_avdp, &
lyr_agg_avrhop,lyr_agg_avdC,lyr_agg_df, &
@@ -1370,8 +1392,6 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg)
SDM_anmx_N2_prod,SDM_anmx_OM_prod,SDM_remin_aerob, &
SDM_remin_sulf,jsediffnh4,jsediffn2o,jsediffno2, &
FLX_SEDIFFNH4,FLX_SEDIFFN2O,FLX_SEDIFFNO2
- use mo_control_bgc, only: use_cisonew,use_AGG,use_CFC,use_natDIC,use_BROMO, &
- use_sedbypass,use_BOXATM,use_extNcycle,use_pref_tracers
! Arguments
integer :: iogrp,cmpflg
@@ -1709,6 +1729,10 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg)
call ncdefvar3d(LYR_PREFDIC(iogrp),cmpflg,'p', &
& 'p_dic','Preformed DIC',' ','mol C m-3',1)
endif
+ if (use_shelfsea_res_time) then
+ call ncdefvar3d(LYR_SHELFAGE(iogrp),cmpflg,'p', &
+ & 'shelfage','Residence time of shelf water',' ','d',1)
+ endif
if (use_cisonew) then
call ncdefvar3d(LYR_DIC13(iogrp),cmpflg,'p', &
& 'dissic13','Dissolved C13',' ','mol 13C m-3',1)
@@ -1892,6 +1916,10 @@ subroutine hamoccvardef(iogrp,timeunits,calendar,cmpflg)
call ncdefvar3d(LVL_PREFDIC(iogrp),cmpflg,'p', &
& 'p_diclvl','Preformed DIC',' ','mol C m-3',2)
endif
+ if (use_shelfsea_res_time) then
+ call ncdefvar3d(LVL_SHELFAGE(iogrp),cmpflg,'p', &
+ & 'shelfagelvl','Residence time of shelf water',' ','d',2)
+ endif
if (use_cisonew) then
call ncdefvar3d(LVL_DIC13(iogrp),cmpflg,'p', &
& 'dissic13lvl','Dissolved C13',' ','mol 13C m-3',2)
diff --git a/hamocc/mo_param1_bgc.F90 b/hamocc/mo_param1_bgc.F90
index c319be9a..eb587c74 100644
--- a/hamocc/mo_param1_bgc.F90
+++ b/hamocc/mo_param1_bgc.F90
@@ -110,6 +110,10 @@ module mo_param1_bgc
integer, protected :: ianh4
integer, protected :: iano2
+ ! Indices for the age tracer for shelf water residence time
+ integer, protected :: i_shelfage
+ integer, protected :: ishelfage
+
! total number of advected tracers (set by allocate_tracers in mod_tracers.F90)
integer :: nocetra
@@ -243,12 +247,14 @@ subroutine init_indices()
use mo_control_bgc, only: use_BROMO,use_AGG,use_WLIN,use_natDIC,use_CFC,use_cisonew, &
use_sedbypass,use_PBGC_OCNP_TIMESTEP,use_PBGC_CK_TIMESTEP, &
use_FB_BGC_OCE, use_BOXATM,use_extNcycle,use_pref_tracers, &
- use_nuopc_ndep
+ use_nuopc_ndep,use_shelfsea_res_time
+
integer :: iounit
namelist / config_bgc / use_BROMO,use_AGG,use_WLIN,use_natDIC,use_CFC,use_cisonew, &
use_sedbypass,use_PBGC_OCNP_TIMESTEP,use_PBGC_CK_TIMESTEP, &
- use_FB_BGC_OCE,use_BOXATM,use_extNcycle,use_pref_tracers,use_nuopc_ndep
+ use_FB_BGC_OCE,use_BOXATM,use_extNcycle,use_pref_tracers, &
+ use_nuopc_ndep,use_shelfsea_res_time
io_stdo_bgc = lp ! standard out.
@@ -374,9 +380,16 @@ subroutine init_indices()
iprefdic = -1
iprefsilica = -1
endif
+ if (use_shelfsea_res_time) then
+ i_shelfage = 1
+ ishelfage = i_base+i_iso+i_cfc+i_agg+i_nat_dic+i_bromo+i_extn+i_pref+1
+ else
+ i_shelfage = 0
+ ishelfage = -1
+ endif
! total number of advected tracers
- nocetra=i_base+i_iso+i_cfc+i_agg+i_nat_dic +i_bromo+i_extn+i_pref
+ nocetra=i_base+i_iso+i_cfc+i_agg+i_nat_dic +i_bromo+i_extn+i_pref+i_shelfage
! ATMOSPHERE
i_base_atm=5
diff --git a/hamocc/mo_param_bgc.F90 b/hamocc/mo_param_bgc.F90
index 385a8037..b2147f08 100644
--- a/hamocc/mo_param_bgc.F90
+++ b/hamocc/mo_param_bgc.F90
@@ -38,7 +38,7 @@ module mo_param_bgc
use_BOXATM,use_CFC,use_PBGC_CK_TIMESTEP, &
use_sedbypass,with_dmsph,use_PBGC_OCNP_TIMESTEP,ocn_co2_type,use_M4AGO,&
do_n2onh3_coupled,use_extNcycle, &
- lkwrbioz_off,lTO2depremin
+ lkwrbioz_off,lTO2depremin,use_shelfsea_res_time
use mod_xc, only: mnproc
implicit none
@@ -99,6 +99,7 @@ module mo_param_bgc
public :: dmsp1,dmsp2,dmsp3,dmsp4,dmsp5,dmsp6,dms_gamma
public :: POM_remin_q10,opal_remin_q10,POM_remin_Tref,opal_remin_Tref
public :: O2thresh_aerob,O2thresh_hypoxic,NO3thresh_sulf
+ public :: shelfbreak_depth
! extended nitrogen cycle
public :: q10ano3denit,sc_ano3denit,Trefano3denit,rano3denit,bkano3denit, &
@@ -467,6 +468,10 @@ module mo_param_bgc
real, protected :: vsmall,safe,pupper,plower,zdis,nmldmin
real, protected :: cellsink = 9999.
+ !********************************************************************
+ ! Shelfsea water residence time
+ !********************************************************************
+ real, protected :: shelfbreak_depth = 200. ! [m] shelf-break depth fall-back value, if no shelfseaa mask file provided
!********************************************************************
! Sediment biogeochemistry
@@ -832,7 +837,7 @@ subroutine write_parambgc()
call cinfo_add_entry('use_extNcycle', use_extNcycle)
call cinfo_add_entry('use_PBGC_OCNP_TIMESTEP', use_PBGC_OCNP_TIMESTEP)
call cinfo_add_entry('use_PBGC_CK_TIMESTEP', use_PBGC_CK_TIMESTEP)
- call cinfo_add_entry('use_FB_BGC_OCE BROMO', use_FB_BGC_OCE)
+ call cinfo_add_entry('use_FB_BGC_OCE', use_FB_BGC_OCE)
call cinfo_add_entry('use_BOXATM', use_BOXATM)
call cinfo_add_entry('use_sedbypass', use_sedbypass)
write(io_stdo_bgc,*) '* ocn_co2_type = ',ocn_co2_type
@@ -844,6 +849,7 @@ subroutine write_parambgc()
call cinfo_add_entry('l_3Dvarsedpor', l_3Dvarsedpor)
call cinfo_add_entry('lkwrbioz_off', lkwrbioz_off)
call cinfo_add_entry('lTO2depremin', lTO2depremin)
+ call cinfo_add_entry('use_shelfsea_res_time', use_shelfsea_res_time)
call cinfo_add_entry('use_M4AGO', use_M4AGO)
if (use_extNcycle) then
call cinfo_add_entry('do_n2onh3_coupled', do_n2onh3_coupled)
diff --git a/hamocc/mo_preftrc.F90 b/hamocc/mo_preftrc.F90
index 9a80be36..dc252c4b 100644
--- a/hamocc/mo_preftrc.F90
+++ b/hamocc/mo_preftrc.F90
@@ -32,7 +32,7 @@ subroutine preftrc(kpie,kpje,omask)
! Preformed tracers are set to the value of their full counterparts in the mixed layer.
!
! J. Tjiputra, J.Schwinger, *BCCR, Bergen* 2015-01-23
- !
+ !
! Modified
! J.Tjiputra, *Uni Research, Bergen* 2018-04-12
! - added preformed DIC tracer
@@ -43,16 +43,16 @@ subroutine preftrc(kpie,kpje,omask)
use mo_vgrid, only: kmle
! Arguments
- integer :: kpie ! 1st dimension of model grid.
- integer :: kpje ! 2nd dimension of model grid.
- real :: omask(kpie,kpje)
+ integer, intent(in) :: kpie ! 1st dimension of model grid.
+ integer, intent(in) :: kpje ! 2nd dimension of model grid.
+ real, intent(in) :: omask(kpie,kpje) ! land-ocean mask
! Local variables
integer :: i,j
do j=1,kpje
do i=1,kpie
- if (omask(i,j) .gt. 0.5 ) then
+ if (omask(i,j) > 0.5 ) then
ocetra(i,j,1:kmle(i,j),iprefo2) = ocetra(i,j,1:kmle(i,j),ioxygen)
ocetra(i,j,1:kmle(i,j),iprefpo4) = ocetra(i,j,1:kmle(i,j),iphosph)
ocetra(i,j,1:kmle(i,j),iprefsilica)= ocetra(i,j,1:kmle(i,j),isilica)
diff --git a/hamocc/mo_read_shelfmask.F90 b/hamocc/mo_read_shelfmask.F90
new file mode 100644
index 00000000..0953172a
--- /dev/null
+++ b/hamocc/mo_read_shelfmask.F90
@@ -0,0 +1,134 @@
+! Copyright (C) 2021-2024 j. maerz
+!
+! This file is part of BLOM/iHAMOCC.
+!
+! BLOM is free software: you can redistribute it and/or modify it under the
+! terms of the GNU Lesser General Public License as published by the Free
+! Software Foundation, either version 3 of the License, or (at your option)
+! any later version.
+!
+! BLOM is distributed in the hope that it will be useful, but WITHOUT ANY
+! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+! more details.
+!
+! You should have received a copy of the GNU Lesser General Public License
+! along with BLOM. If not, see https://www.gnu.org/licenses/.
+
+
+module mo_read_shelfmask
+
+ !*************************************************************************************************
+ ! Routine to read and/or initialize an ocean shelf-sea mask either from netcdf file or from
+ ! internal bathymetry values, if use_shelfsea_res_time = .true.
+ !
+ ! If a file is read, it should hold real values with 1. for shelf-sea regions and 0 elsewhere
+ ! and the variable name is 'shelfmask'
+ !
+ ! The shelf-sea mask is currently used to calculate the shelf-sea water residence time
+ !
+ ! j.maerz *UiB, Bergen* 2024-10-31
+ !
+ !*************************************************************************************************
+
+ implicit none
+ private
+
+ public :: ini_read_shelfmask
+
+ character(len=512), public :: shelfsea_maskfile =''
+ logical, allocatable, protected, public :: shelfmask(:,:)
+
+contains
+
+ subroutine ini_read_shelfmask(kpie,kpje,kbnd,pbath,omask)
+
+ use mod_xc, only: mnproc,xchalt
+ use mod_dia, only: iotype
+ use mo_control_bgc, only: use_shelfsea_res_time,io_stdo_bgc
+ use mo_param_bgc, only: shelfbreak_depth
+ use netcdf, only: nf90_open,nf90_close,nf90_nowrite
+ use mo_netcdf_bgcrw,only: read_netcdf_var
+
+ ! Arguments
+ integer, intent(in) :: kpie ! 1st dimension of model grid
+ integer, intent(in) :: kpje ! 2nd dimension of model grid
+ integer, intent(in) :: kbnd ! number of halo grid points
+ real, intent(in) :: pbath(1-kbnd:kpie+kbnd,1-kbnd:kpje+kbnd) ! bathymetry fields - water depth [m]
+ real, intent(in) :: omask(kpie,kpje) ! land/ocean mask.
+
+ ! Local variables
+ logical :: file_exists=.false.
+ integer :: i,j,errstat,ncid,ncstat
+ real,allocatable :: mask(:,:)
+
+ ! Check, if we are going to run with shelf-sea water residence time tracers
+ if (.not.use_shelfsea_res_time) then
+ if (mnproc.eq.1) then
+ write(io_stdo_bgc,*) ''
+ write(io_stdo_bgc,*) '******************************************************'
+ write(io_stdo_bgc,*) 'read_shelfmask: shelf sea age tracer is not activated.'
+ endif
+ return
+ endif
+
+ ! Check if shelfsea mask file exists. If not, run in default mode.
+ inquire(file=shelfsea_maskfile,exist=file_exists)
+ if (.not. file_exists .and. mnproc.eq.1) then
+ write(io_stdo_bgc,*) ''
+ write(io_stdo_bgc,*) '************************************************************'
+ write(io_stdo_bgc,*) 'read_shelfmask: Cannot find (shelf sea) region mask file. '
+ write(io_stdo_bgc,*) 'Fallback to default ... '
+ write(io_stdo_bgc,*) '... using internal bathymetry data to reconstruct the mask '
+ endif
+
+ ! Allocate field to hold shelfsea mask
+ if(mnproc.eq.1) then
+ write(io_stdo_bgc,*)'Memory allocation for variable shelfmask ...'
+ write(io_stdo_bgc,*)'First dimension : ',kpie
+ write(io_stdo_bgc,*)'Second dimension : ',kpje
+ endif
+ allocate(shelfmask(kpie,kpje),stat=errstat)
+ allocate(mask(kpie,kpje),stat=errstat)
+ if(errstat.ne.0) stop 'not enough memory shelfmask'
+ shelfmask(:,:) = .false.
+ mask = 0.
+
+ if (file_exists) then
+ ! read shelf sea mask from file
+ if (mnproc.eq.1) then
+ write(io_stdo_bgc,*) ''
+ write(io_stdo_bgc,'(a)') 'read_shelfmask: read mask from ',trim(shelfsea_maskfile)
+ endif
+ ncstat=nf90_open(trim(shelfsea_maskfile),nf90_nowrite,ncid)
+ call read_netcdf_var(ncid,'shelfmask',mask,1,1,0)
+ ncstat=nf90_close(ncid)
+ else
+ ! reconstruct shelf sea mask from internal bathymetry
+ !$OMP DO PARALLEL PRIVATE (i,j)
+ do j=1,kpje
+ do i=1,kpie
+ if((omask(i,j) > 0.5) .and. (pbath(i,j) <= shelfbreak_depth)) then
+ mask(i,j) = 1.
+ endif
+ enddo
+ enddo
+ !$OMP END PARALLEL DO
+ endif
+
+ !$OMP DO PARALLEL PRIVATE (i,j)
+ ! Eventually fill the logical shelfsea mask field
+ do j = 1,kpje
+ do i = 1,kpie
+ if (1 == nint(mask(i,j))) then
+ shelfmask(i,j) = .true.
+ else
+ shelfmask(i,j) = .false.
+ endif
+ enddo
+ enddo
+ !$OMP END PARALLEL DO
+
+ end subroutine ini_read_shelfmask
+
+end module mo_read_shelfmask
diff --git a/hamocc/mo_shelfsea_restime.F90 b/hamocc/mo_shelfsea_restime.F90
new file mode 100644
index 00000000..8af725b1
--- /dev/null
+++ b/hamocc/mo_shelfsea_restime.F90
@@ -0,0 +1,73 @@
+! Copyright (C) 2021-2024 j. maerz
+!
+! This file is part of BLOM/iHAMOCC.
+!
+! BLOM is free software: you can redistribute it and/or modify it under the
+! terms of the GNU Lesser General Public License as published by the Free
+! Software Foundation, either version 3 of the License, or (at your option)
+! any later version.
+!
+! BLOM is distributed in the hope that it will be useful, but WITHOUT ANY
+! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+! FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+! more details.
+!
+! You should have received a copy of the GNU Lesser General Public License
+! along with BLOM. If not, see https://www.gnu.org/licenses/.
+
+
+module mo_shelfsea_restime
+
+ !*************************************************************************************************
+ ! Routine to calculate the residence time of shel-sea water according to:
+ !
+ ! Liu et al. 2019: Simulating Water Residence Time in the Coastal Ocean: A Global Perspective
+ !
+ ! j.maerz *UiB, Bergen* 2024-10-31
+ !
+ !*************************************************************************************************
+
+ implicit none
+ private
+
+ public :: shelfsea_residence_time
+
+contains
+
+ subroutine shelfsea_residence_time(kpie,kpje,kpke,pddpo,shelfmask,omask)
+
+ use mo_vgrid, only : dp_min
+ use mo_carbch, only : ocetra
+ use mo_param1_bgc, only : ishelfage
+ use mo_control_bgc, only : dtb,io_stdo_bgc
+
+ ! Arguments
+ integer, intent(in) :: kpie ! 1st dimension of model grid
+ integer, intent(in) :: kpje ! 2nd dimension of model grid
+ integer, intent(in) :: kpke ! 3rd dimension of model grid
+ real, intent(in) :: pddpo(kpie,kpje,kpke) ! size of grid cell (3rd dimension) [m].
+ logical, intent(in) :: shelfmask(kpie,kpje) ! shelf-sea mask True: shelf, False: else
+ real, intent(in) :: omask(kpie,kpje) ! land-ocean mask
+
+ ! Local variables
+ integer :: i,j,k
+
+ !$OMP PARALLEL DO PRIVATE (i,j,k)
+ do k=1,kpke
+ do j=1,kpje
+ do i=1,kpie
+ if (pddpo(i,j,k)>dp_min .and. omask(i,j)>0.5) then
+ ! Note that in Liu et al. 2019, min function is written,
+ ! but a gradual decrease in residence time off the shelf should require max function
+ ! to result in zero values in open ocean regions (and not negative values)
+ ocetra(i,j,k,ishelfage) = merge( ocetra(i,j,k,ishelfage) + dtb, &
+ max(0.,ocetra(i,j,k,ishelfage) - dtb), shelfmask(i,j) )
+ endif
+ enddo
+ enddo
+ enddo
+ !$OMP END PARALLEL DO
+
+ end subroutine shelfsea_residence_time
+
+end module mo_shelfsea_restime