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

Making preformed tracers optional to enable HR runs without them #394

Merged
merged 2 commits into from
Sep 10, 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
35 changes: 22 additions & 13 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<default_value>FALSE</default_value>
<group>build_component_blom</group>
<file>env_build.xml</file>
<desc>Set preprocessor option to activate age tracer code. Requires module iage or ecosys</desc>
<desc>Set namelist option to activate age tracer code. Requires module iage or ecosys</desc>
</entry>

<entry id="BLOM_TURBULENT_CLOSURE">
Expand Down Expand Up @@ -148,12 +148,12 @@
<value compset="_BGC.*%N2OC">TRUE</value>
<value compset="_BGC.*%NH3C">TRUE</value>
<value compset="_BGC.*%ATMNDEPC">TRUE</value>
</values>
</values>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Set preprocessor option to activate the extended nitrogen cycle code. Requires module ecosys</desc>
<desc>Set namelist option to activate the extended nitrogen cycle code. Requires module ecosys</desc>
</entry>

<entry id="HAMOCC_ATMNDEPC">
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
Expand All @@ -165,7 +165,7 @@
<file>env_run.xml</file>
<desc>Nitrogen deposition coupled from atmosphere. Requires module ecosys and extncycle</desc>
</entry>

<entry id="HAMOCC_N2OC">
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
Expand All @@ -184,7 +184,16 @@
<default_value>FALSE</default_value>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Set preprocessor option to activate the M4AGO sinking scheme. Requires module ecosys</desc>
<desc>Set namelist option to activate the M4AGO sinking scheme. Requires module ecosys</desc>
</entry>

<entry id="HAMOCC_PREF_TRACERS">
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
<default_value>TRUE</default_value>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Set namelist option to activate the preformed tracer code. Requires module ecosys</desc>
</entry>

<entry id="HAMOCC_CISO">
Expand All @@ -193,7 +202,7 @@
<default_value>FALSE</default_value>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Set preprocessor option to activate the carbon isotope code. Requires module ecosys</desc>
<desc>Set namelist option to activate the carbon isotope code. Requires module ecosys</desc>
</entry>

<entry id="HAMOCC_SEDBYPASS">
Expand All @@ -202,7 +211,7 @@
<default_value>FALSE</default_value>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Set preprocessor option to bypass the sediment code. Requires module ecosys</desc>
<desc>Set namelist option to bypass the sediment code. Requires module ecosys</desc>
</entry>

<entry id="HAMOCC_SEDSPINUP">
Expand All @@ -211,7 +220,7 @@
<default_value>TRUE</default_value>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Activate sediment spinup. HAMOCC_SEDSPINUP_YR_START and HAMOCC_SEDSPINUP_YR_END
<desc>Activate sediment spinup. HAMOCC_SEDSPINUP_YR_START and HAMOCC_SEDSPINUP_YR_END
need to be set to valid values for this option to take effect. Requires module ecosys</desc>
</entry>

Expand All @@ -221,7 +230,7 @@
<default_value>1</default_value>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Set start year for HAMOCC sediment spin-up if HAMOCC_SEDSPINUP == TRUE.
<desc>Set start year for HAMOCC sediment spin-up if HAMOCC_SEDSPINUP == TRUE.
Requires module ecosys</desc>
</entry>

Expand All @@ -231,17 +240,17 @@
<default_value>800</default_value>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Set end year for HAMOCC sediment spin-up if HAMOCC_SEDSPINUP == TRUE.
<desc>Set end year for HAMOCC sediment spin-up if HAMOCC_SEDSPINUP == TRUE.
Requires module ecosys</desc>
</entry>

<entry id="HAMOCC_SEDSPINUP_NCYCLE">
<type>integer</type>
<valid_values/>
<default_value>20</default_value>
<group>run_component_blom</group>
<file>env_run.xml</file>
<desc>Set the number of sub-cycles for HAMOCC sediment spin-up if HAMOCC_SEDSPINUP == TRUE.
<desc>Set the number of sub-cycles for HAMOCC sediment spin-up if HAMOCC_SEDSPINUP == TRUE.
Requires module ecosys</desc>
</entry>

Expand Down
11 changes: 11 additions & 0 deletions cime_config/namelist_definition_blom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4145,6 +4145,17 @@
<desc>add desc</desc>
</entry>

<entry id="use_pref_tracers" modify_via_xml="HAMOCC_PREF_TRACERS">
<type>logical</type>
<category>config_bgc</category>
<group>config_bgc</group>
<values>
<value>.true.</value>
<value hamocc_pref_tracers="false">.false.</value>
</values>
<desc>activate the HAMOCC preformed tracers code</desc>
</entry>

<!-- ========================= -->
<!-- namelist group: bgcoafx -->
<!-- These options can be activated by expert users via user namelist. -->
Expand Down
27 changes: 16 additions & 11 deletions hamocc/mo_accfields.F90
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ subroutine accfields(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
jsdm_remin_sulf,jsediffnh4,jsediffn2o,jsediffno2,jatmn2o,jatmnh3, &
jndepnhxfx
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_CFC,use_sedbypass,use_cisonew,use_BOXATM,use_M4AGO, &
use_extNcycle,use_pref_tracers
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 Down Expand Up @@ -394,12 +395,14 @@ subroutine accfields(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
call acclyr(jomegac,OmegaC,pddpo,1)
call acclyr(jphosy,phosy3d,pddpo,1)
call acclyr(jo2sat,satoxy,pddpo,1)
call acclyr(jprefo2,ocetra(1,1,1,iprefo2),pddpo,1)
call acclyr(jprefpo4,ocetra(1,1,1,iprefpo4),pddpo,1)
call acclyr(jprefsilica,ocetra(1,1,1,iprefsilica),pddpo,1)
call acclyr(jprefalk,ocetra(1,1,1,iprefalk),pddpo,1)
call acclyr(jprefdic,ocetra(1,1,1,iprefdic),pddpo,1)
call acclyr(jdicsat,ocetra(1,1,1,idicsat),pddpo,1)
if (use_pref_tracers) then
call acclyr(jprefo2,ocetra(1,1,1,iprefo2),pddpo,1)
call acclyr(jprefpo4,ocetra(1,1,1,iprefpo4),pddpo,1)
call acclyr(jprefsilica,ocetra(1,1,1,iprefsilica),pddpo,1)
call acclyr(jprefalk,ocetra(1,1,1,iprefalk),pddpo,1)
call acclyr(jprefdic,ocetra(1,1,1,iprefdic),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 @@ -511,12 +514,14 @@ subroutine accfields(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask)
call acclvl(jlvlomegac,OmegaC,k,ind1,ind2,wghts)
call acclvl(jlvlphosy,phosy3d,k,ind1,ind2,wghts)
call acclvl(jlvlo2sat,satoxy,k,ind1,ind2,wghts)
call acclvl(jlvlprefo2,ocetra(1,1,1,iprefo2),k,ind1,ind2,wghts)
call acclvl(jlvlprefpo4,ocetra(1,1,1,iprefpo4),k,ind1,ind2,wghts)
call acclvl(jlvlprefsilica,ocetra(1,1,1,iprefsilica),k,ind1,ind2,wghts)
call acclvl(jlvlprefalk,ocetra(1,1,1,iprefalk),k,ind1,ind2,wghts)
call acclvl(jlvlprefdic,ocetra(1,1,1,iprefdic),k,ind1,ind2,wghts)
call acclvl(jlvldicsat,ocetra(1,1,1,idicsat),k,ind1,ind2,wghts)
if (use_pref_tracers) then
call acclvl(jlvlprefo2,ocetra(1,1,1,iprefo2),k,ind1,ind2,wghts)
call acclvl(jlvlprefpo4,ocetra(1,1,1,iprefpo4),k,ind1,ind2,wghts)
call acclvl(jlvlprefsilica,ocetra(1,1,1,iprefsilica),k,ind1,ind2,wghts)
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_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
16 changes: 9 additions & 7 deletions hamocc/mo_aufr_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ 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_extNcycle,use_pref_tracers
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, &
Expand Down Expand Up @@ -400,13 +400,15 @@ subroutine aufr_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,kplyear,kplmon,kplday,o
call read_netcdf_var(ncid,'dms',locetra(1,1,1,idms),2*kpke,0,iotype)
call read_netcdf_var(ncid,'fdust',locetra(1,1,1,ifdust),2*kpke,0,iotype)
call read_netcdf_var(ncid,'iron',locetra(1,1,1,iiron),2*kpke,0,iotype)
call read_netcdf_var(ncid,'prefo2',locetra(1,1,1,iprefo2),2*kpke,0,iotype)
call read_netcdf_var(ncid,'prefpo4',locetra(1,1,1,iprefpo4),2*kpke,0,iotype)
call read_netcdf_var(ncid,'prefalk',locetra(1,1,1,iprefalk),2*kpke,0,iotype)
call read_netcdf_var(ncid,'prefdic',locetra(1,1,1,iprefdic),2*kpke,0,iotype)
call read_netcdf_var(ncid,'dicsat',locetra(1,1,1,idicsat),2*kpke,0,iotype)
if(lread_prefsi) then
call read_netcdf_var(ncid,'prefsilica',locetra(1,1,1,iprefsilica),2*kpke,0,iotype)
if (use_pref_tracers) then
call read_netcdf_var(ncid,'prefo2',locetra(1,1,1,iprefo2),2*kpke,0,iotype)
call read_netcdf_var(ncid,'prefpo4',locetra(1,1,1,iprefpo4),2*kpke,0,iotype)
call read_netcdf_var(ncid,'prefalk',locetra(1,1,1,iprefalk),2*kpke,0,iotype)
call read_netcdf_var(ncid,'prefdic',locetra(1,1,1,iprefdic),2*kpke,0,iotype)
if(lread_prefsi) then
call read_netcdf_var(ncid,'prefsilica',locetra(1,1,1,iprefsilica),2*kpke,0,iotype)
endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why the preformed silicate is treated differently from the other preformed tracers? Does it make sense to have the capability to restart with a preformed tracer when it is not in the restart file only for silicate but not for the others? I do not see so many use cases for this so maybe we can just omit the lread_prefsi related code?

Copy link
Collaborator Author

@jmaerz jmaerz Sep 10, 2024

Choose a reason for hiding this comment

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

Hi Jörg, since preformed silicate wasn't in the restart files before, start-up from restart files was an issue, hence this little quirky treatment that was put in to enable running the model from a restart file without it. Once we settle with #356 or have enough spun-up restart files with preformed silicate, this won't be an issue any longer and it can be removed. Hence, I would keep this treatment for now. We can put this clean-up task into #340 (and #356).

endif

if (use_cisonew .and. lread_iso) then
Expand Down
15 changes: 9 additions & 6 deletions hamocc/mo_aufw_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ subroutine aufw_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,
use mod_dia, only: iotype
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_BROMO,use_CFC,use_natDIC,use_sedbypass,use_extNcycle, &
use_pref_tracers
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 Down Expand Up @@ -762,12 +763,14 @@ subroutine aufw_bgc(kpie,kpje,kpke,ntr,ntrbgc,itrbgc,trc,
call write_netcdf_var(ncid,'dms',locetra(1,1,1,idms),2*kpke,0)
call write_netcdf_var(ncid,'fdust',locetra(1,1,1,ifdust),2*kpke,0)
call write_netcdf_var(ncid,'iron',locetra(1,1,1,iiron),2*kpke,0)
call write_netcdf_var(ncid,'prefo2',locetra(1,1,1,iprefo2),2*kpke,0)
call write_netcdf_var(ncid,'prefpo4',locetra(1,1,1,iprefpo4),2*kpke,0)
call write_netcdf_var(ncid,'prefsilica',locetra(1,1,1,iprefsilica),2*kpke,0)
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)
call write_netcdf_var(ncid,'dicsat',locetra(1,1,1,idicsat),2*kpke,0)
if (use_pref_tracers) then
call write_netcdf_var(ncid,'prefo2',locetra(1,1,1,iprefo2),2*kpke,0)
call write_netcdf_var(ncid,'prefpo4',locetra(1,1,1,iprefpo4),2*kpke,0)
call write_netcdf_var(ncid,'prefsilica',locetra(1,1,1,iprefsilica),2*kpke,0)
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_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
1 change: 1 addition & 0 deletions hamocc/mo_control_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ module mo_control_bgc
logical :: use_BOXATM = .false.
logical :: use_sedbypass = .false.
logical :: use_extNcycle = .false.
logical :: use_pref_tracers = .true.

contains

Expand Down
8 changes: 5 additions & 3 deletions hamocc/mo_hamocc4bcm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ 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
do_n2onh3_coupled,use_extNcycle,use_pref_tracers
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
Expand Down Expand Up @@ -309,8 +309,10 @@ subroutine hamocc4bcm(kpie,kpje,kpke,kbnd,kplyear,kplmon,kplday,kldtday,pdlxp,pd
call inventory_bgc(kpie,kpje,kpke,pdlxp,pdlyp,pddpo,omask,0)
endif

! update preformed tracers
call preftrc(kpie,kpje,omask)
if (use_pref_tracers) then
! update preformed tracers
call preftrc(kpie,kpje,omask)
endif

!--------------------------------------------------------------------
! Sediment module
Expand Down
40 changes: 22 additions & 18 deletions hamocc/mo_ini_fields.F90
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ 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_BROMO, use_sedbypass,use_extNcycle,use_pref_tracers
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, &
Expand Down Expand Up @@ -190,15 +190,17 @@ subroutine ini_fields_ocean(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask,pglon,pg
ocetra(i,j,k,idms) =0.
ocetra(i,j,k,ifdust) =0.
ocetra(i,j,k,iiron) =fesoly
ocetra(i,j,k,iprefo2)=0.
ocetra(i,j,k,iprefpo4)=0.
ocetra(i,j,k,iprefsilica)=0.
ocetra(i,j,k,iprefalk)=0.
ocetra(i,j,k,iprefdic)=0.
ocetra(i,j,k,idicsat)=1.e-8
hi(i,j,k) =1.e-8
co3(i,j,k) =0.
co2star(i,j,k) =20.e-6
if (use_pref_tracers) then
ocetra(i,j,k,iprefo2) = 0.
ocetra(i,j,k,iprefpo4) = 0.
ocetra(i,j,k,iprefsilica) = 0.
ocetra(i,j,k,iprefalk) = 0.
ocetra(i,j,k,iprefdic) = 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
Expand Down Expand Up @@ -243,19 +245,21 @@ subroutine ini_fields_ocean(kpaufr,kpie,kpje,kpke,kbnd,pddpo,prho,omask,pglon,pg
enddo
enddo

! Initialise preformed tracers in the mixed layer; note that the
! whole field has been initialised to zero above
do j=1,kpje
do i=1,kpie
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)
ocetra(i,j,1:kmle(i,j),iprefalk) = ocetra(i,j,1:kmle(i,j),ialkali)
ocetra(i,j,1:kmle(i,j),iprefdic) = ocetra(i,j,1:kmle(i,j),isco212)
endif
if (use_pref_tracers) then
! Initialise preformed tracers in the mixed layer; note that the
! whole field has been initialised to zero above
do j=1,kpje
do i=1,kpie
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)
ocetra(i,j,1:kmle(i,j),iprefalk) = ocetra(i,j,1:kmle(i,j),ialkali)
ocetra(i,j,1:kmle(i,j),iprefdic) = ocetra(i,j,1:kmle(i,j),isco212)
endif
enddo
enddo
enddo
endif


! Initial values for sediment
Expand Down
Loading