Skip to content
Draft
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
3 changes: 3 additions & 0 deletions cime_config/buildcpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def buildcpp(case):
ocn_grid = case.get_value("OCN_GRID")
turbclo = case.get_value("BLOM_TURBULENT_CLOSURE")
tracers = case.get_value("BLOM_TRACER_MODULES")
sed_spinoff = case.get_value("HAMOCC_OFFLINE_SEDIMENT_SPINUP")
blom_atrc = case.get_value("BLOM_ATRC")
pio_typename = case.get_value("PIO_TYPENAME", subgroup="OCN")

Expand Down Expand Up @@ -118,6 +119,8 @@ def buildcpp(case):
blom_cppdefs = blom_cppdefs + " -DHAMOCC"
else:
expect(False, "tracer module {} is not recognized".format(module))
if sed_spinoff:
blom_cppdefs = blom_cppdefs + " -DOFFLINE_SEDIMENT_SPINUP"

if blom_atrc:
blom_cppdefs = blom_cppdefs + " -DATRC"
Expand Down
12 changes: 12 additions & 0 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,18 @@
<desc>Set namelist option to activate the carbon isotope code. Requires module ecosys</desc>
</entry>

<entry id="HAMOCC_OFFLINE_SEDIMENT_SPINUP">
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
<default_value>FALSE</default_value>
<values>
<value compset="_BLOM.*%ECO">FALSE</value>
</values>
<group>build_component_blom</group>
<file>env_build.xml</file>
<desc>Offline sediment spinup. Requires module ecosys</desc>
</entry>

<entry id="HAMOCC_SEDBYPASS">
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
Expand Down
22 changes: 20 additions & 2 deletions cime_config/config_compsets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@


<!-- JRA repeat year forcing - no prognostic wave -->

<compset>
<alias>NOINYJRARYF1961OC</alias>
<lname>1850_DATM%JRARYF1961_SLND_CICE_BLOM%HYB%ECO_DROF%JRARYF1961_SGLC_SWAV</lname>
Expand All @@ -142,14 +142,32 @@
<lname>1850_DATM%JRA-RYF8485_SLND_CICE_BLOM%HYB%ECO_DROF%JRA-RYF8485_SGLC_SWAV</lname>
</compset>


<!-- CPLHIST forcing - no prognostic wave -->

<compset>
<alias>NOICPLHISTOC</alias>
<lname>1850_DATM%CPLHIST_SLND_CICE_BLOM%HYB%ECO_DROF%CPLHIST_SGLC_SWAV</lname>
</compset>

<!-- Offline sediment spinup -->

<!--<compset> EXAMPLE FROM CAM
<alias>FADIAB</alias>
<lname>2000_CAM%ADIAB_SLND_SICE_SOCN_SROF_SGLC_SWAV</lname>
</compset>-->

<compset>
<!-- offline sediment spinup for hybrid coordinates -->
<alias>OFFLSEDH</alias>
<lname>SCAM_SLND_SICE_BLOM%HYB%ECO_SROF_SGLC_SWAV</lname>
</compset>
<compset>
<!-- offline sediment spinup for hybrid coordinates -->
<alias>OFFLSED</alias>
<lname>SCAM_SLND_SICE_BLOM%ECO_SROF_SGLC_SWAV</lname>
</compset>

<entries>
<entry id="RUN_STARTDATE">
<values match="last">
Expand Down
38 changes: 38 additions & 0 deletions cime_config/config_pes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1019,5 +1019,43 @@
</mach>
</grid>

<!-- Offline sediment spinup - testwise - needs adjustment to reduce idling -->
<grid name="a%null.+oi%tnx2v1">
<mach name="any">
<pes pesize="M" compset="SCAM.*_BLOM.*%ECO">
<comment>Medium sized pe-layout with 384 pes in total</comment>
<ntasks>
<ntasks_atm>18</ntasks_atm>
<ntasks_rof>18</ntasks_rof>
<ntasks_ice>76</ntasks_ice>
<ntasks_ocn>272</ntasks_ocn>
<ntasks_cpl>76</ntasks_cpl>
<ntasks_lnd>1</ntasks_lnd>
<ntasks_glc>1</ntasks_glc>
<ntasks_wav>1</ntasks_wav>
</ntasks>
<nthrds>
<nthrds_atm>1</nthrds_atm>
<nthrds_lnd>1</nthrds_lnd>
<nthrds_rof>1</nthrds_rof>
<nthrds_ice>1</nthrds_ice>
<nthrds_ocn>1</nthrds_ocn>
<nthrds_glc>1</nthrds_glc>
<nthrds_wav>1</nthrds_wav>
<nthrds_cpl>1</nthrds_cpl>
</nthrds>
<rootpe>
<rootpe_atm>76</rootpe_atm>
<rootpe_lnd>0</rootpe_lnd>
<rootpe_rof>94</rootpe_rof>
<rootpe_ice>0</rootpe_ice>
<rootpe_ocn>112</rootpe_ocn>
<rootpe_glc>0</rootpe_glc>
<rootpe_wav>0</rootpe_wav>
<rootpe_cpl>0</rootpe_cpl>
</rootpe>
</pes>
</mach>
</grid>

</config_pes>
12 changes: 12 additions & 0 deletions cime_config/namelist_definition_blom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4603,6 +4603,18 @@
</desc>
</entry>

<entry id="sedspinoff_file" is_inputdata="yes">
<type>char</type>
<category>bgcnml</category>
<group>bgcnml</group>
<values>
<value>''</value>
</values>
<desc>
File name (incl. full path) for offline sediment spinup - holding climatological mean of carflx_bot,calflx_bot,dustflx_bot and bsiflx_bot
</desc>
</entry>

<entry id="shelfsea_maskfile" is_inputdata="yes">
<type>char</type>
<category>bgcnml</category>
Expand Down
36 changes: 36 additions & 0 deletions drivers/nuopc/ocn_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ module ocn_comp_nuopc

public :: SetServices, SetVM

logical :: mediator_present ! jm enabling to switch of mediator and data provision for sediment offline spinup
! see eg.: https://github.com/NorESMhub/CAM/blob/cda829d695a6cc8c14f56b89f4a86830c9b919a9/src/cpl/nuopc/atm_comp_nuopc.F90

!================================================================================
contains
!================================================================================
Expand Down Expand Up @@ -371,6 +374,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
! The NUOPC layer uses these to match fields between components in the
! coupled system.
! ---------------------------------------------------------------------------
!jm offline sediment spinup
use shr_sys_mod , only : shr_sys_abort
!jm end offline sediment spinup

! Input/output arguments.
type(ESMF_GridComp) :: gcomp
Expand Down Expand Up @@ -407,6 +413,22 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
use_BROMO = .false.
#endif

!jm offline sediment spinup
! Get info if mediator is present
call NUOPC_CompAttributeGet(gcomp, name="mediator_present", value=cvalue, &
isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
read (cvalue,*) mediator_present
! if (mediator_present) then
! call advertise_fields(gcomp, flds_scalar_name, rc)
! if (ChkErr(rc,__LINE__,u_FILE_u)) return
! end if
else
call shr_sys_abort(subname//'Need to set attribute mediator_present')
endif
!jm end offline sediment spinup

! Get debug flag.
call NUOPC_CompAttributeGet(gcomp, name='dbug_flag', value=cvalue, &
isPresent=isPresent, isSet=isSet, rc=rc)
Expand Down Expand Up @@ -612,6 +634,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)



if (mediator_present) then !jm offline-sediment-spinup
! ------------------------------------------------------------------------
! Advertise import fields.
! ------------------------------------------------------------------------
Expand All @@ -637,6 +660,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
TransferOfferGeomObject='will provide', rc=rc)
if (ChkErr(rc, __LINE__, u_FILE_u)) return
enddo
endif ! mediator_present jm offline-sediment-spinup

if (dbug > 5) call ESMF_LogWrite(subname//': done', ESMF_LOGMSG_INFO)

Expand Down Expand Up @@ -730,6 +754,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)

call blom_setareacor(areaMesh, maskMesh)

! jm offline sediment spinup
if (mediator_present) then
! ------------------------------------------------------------------------
! Realize the actively coupled fields.
! ------------------------------------------------------------------------
Expand Down Expand Up @@ -771,6 +797,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
call ocn_stream_sst_init(Emesh, clock, rc)
if (ChkErr(rc, __LINE__, u_FILE_u)) return
end if
! jm offline sediment spinup
endif

! Find if restart is needed at the end of the run
call NUOPC_CompAttributeGet(gcomp, name="write_restart_at_endofrun", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
Expand All @@ -780,11 +808,15 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
end if

#ifdef HAMOCC
! jm offline sediment spinup
if (mediator_present) then
! Initialize sdat for dust deposition climatology if appropriate
if (use_stream_dust) then
call ocn_stream_dust_init(Emesh, clock, rc)
if (ChkErr(rc, __LINE__, u_FILE_u)) return
end if
! jm offline sediment spinup
endif
#endif

if (dbug > 5) call ESMF_LogWrite(subname//': done', ESMF_LOGMSG_INFO)
Expand Down Expand Up @@ -838,6 +870,8 @@ subroutine DataInitialize(gcomp, rc)

call timer_stop('initialization', &
'between blom_init_phase1 and blom_init_phase2')
! jm offline sediment spinup
if (mediator_present) then
call blom_init_phase2
call timer_stop('initialization', 'blom_init_phase2')

Expand Down Expand Up @@ -871,6 +905,8 @@ subroutine DataInitialize(gcomp, rc)
call ESMF_LogWrite("BLOM - Initialize-Data-Dependency NOT SATISFIED!!!", &
ESMF_LOGMSG_INFO)
endif
! jm offline sediment spinup
endif

if (dbug > 5) call ESMF_LogWrite(subname//': done', ESMF_LOGMSG_INFO)

Expand Down
2 changes: 2 additions & 0 deletions hamocc/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ sources += files(
'mo_read_oafx.F90',
'mo_read_sedpor.F90',
'mo_read_sedqual.F90',
'mo_read_sedspinoff.F90',
'mo_sedmnt.F90',
'mo_sedmnt_spinoff.F90',
'mo_vgrid.F90',
'mo_ncout_hamocc.F90',
'mo_netcdf_bgcrw.F90',
Expand Down
2 changes: 1 addition & 1 deletion hamocc/mo_carchm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module mo_carchm
private

public :: carchm
public :: carchm_solve
public :: carchm_solve, carchm_kequi

! Maximum number of iterations for carbon chemistry solver
integer, parameter :: niter=20
Expand Down
6 changes: 6 additions & 0 deletions hamocc/mo_control_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ module mo_control_bgc
logical :: use_river2omip = .false. ! River2ocean MIP protocol
logical :: use_DOMclasses = .false. ! DOM classes (labile, semi-labile,semi-refractory and refractory)

#ifdef OFFLINE_SEDIMENT_SPINUP
logical :: offline_sediment_spinup = .true.
#else
logical :: offline_sediment_spinup = .false.
#endif

contains

subroutine get_bgc_namelist
Expand Down
15 changes: 13 additions & 2 deletions hamocc/mo_hamocc_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
lkwrbioz_off,do_n2o_coupled,do_nh3_coupled, &
ocn_co2_type, use_sedbypass, use_BOXATM, use_BROMO,use_extNcycle, &
use_coupler_ndep,lTO2depremin,use_sediment_quality,ldyn_sed_age, &
linit_DOMclasses_sim
linit_DOMclasses_sim,offline_sediment_spinup
use mo_param1_bgc, only: ks,init_por2octra_mapping
use mo_param_bgc, only: ini_parambgc,claydens,calcdens,calcwei,opaldens,opalwei,ropal, &
& ini_bgctimes,sec_per_day
Expand All @@ -65,6 +65,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
use mo_read_pi_ph, only: ini_pi_ph,pi_ph_file
use mo_read_sedpor, only: read_sedpor,sedporfile,sed_por
use mo_read_sedqual,only: read_sedqual,sedqualfile, sed_POCage_init,prorca_mavg_init
use mo_read_sedspinoff,only: read_sedspinoff,sedspinoff_file
use mo_clim_swa, only: ini_swa_clim,swaclimfile
use mo_Gdata_read, only: inidic,inialk,inipo4,inioxy,inino3,inisil,inid13c,inid14c,inidom
use mo_intfcblom, only: alloc_mem_intfcblom,nphys,bgc_dx,bgc_dy,bgc_dp,bgc_rho,omask, &
Expand All @@ -90,7 +91,7 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
& inidic,inialk,inipo4,inioxy,inino3,inisil,inid13c,inid14c,inidom,swaclimfile,&
& with_dmsph,pi_ph_file,l_3Dvarsedpor,sedporfile,ocn_co2_type, &
& do_n2o_coupled,do_nh3_coupled,lkwrbioz_off,lTO2depremin,shelfsea_maskfile, &
& sedqualfile,ldyn_sed_age,linit_DOMclasses_sim,dzs,sed_porosity
& sedqualfile,ldyn_sed_age,linit_DOMclasses_sim,dzs,sed_porosity,sedspinoff_file
!
! --- Set io units and some control parameters
!
Expand All @@ -113,6 +114,13 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
write(io_stdo_bgc,*) 'date',date
write(io_stdo_bgc,*) 'time step',dtbgc
write(io_stdo_bgc,*) 'nday_in_year ',nday_in_year
if (offline_sediment_spinup) then
write(io_stdo_bgc,*) '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
write(io_stdo_bgc,*) ' '
write(io_stdo_bgc,*) 'Performing offline sediment spinup - NO WATER COLUMN BGC!!!!'
write(io_stdo_bgc,*) ' '
write(io_stdo_bgc,*) '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
endif
endif

!
Expand Down Expand Up @@ -209,6 +217,9 @@ subroutine hamocc_init(read_rest,rstfnm_hamocc)
call read_sedpor(idm,jdm,ks,omask)
! Second, read the sediment POC age and climatological prorca and pot. apply it in ini_sedmnt
call read_sedqual(idm,jdm,ks,omask)
! Third, potentially read climatology for offline sediment spinup
call read_sedspinoff(idm,jdm,omask)
! Eventually, initialize the sediment
call ini_sedmnt(idm,jdm,omask,sed_por,sed_POCage_init,prorca_mavg_init)

!
Expand Down
Loading