Skip to content

iHAMOCC

Tomas Torsvik edited this page Sep 23, 2022 · 42 revisions

The origin of iHAMOCC is the Hamburg ocean carbon cycle model (HAMOCC), originally developed at MPI in Hamburg. This model has been adapted for an isopycnic ("constant density") vertical coordinate framework by researchers in Bergen, who have created the now independent iHAMOCC model. Although different versions of HAMOCC share the same origin (e.g. iHAMOCC used for NorESM2, HAMOCC6 used for MPI-ESM1.2), they are developed independently and are not interchangeable at current time (June 2021).

Although iHAMOCC is developed as a BGC component in the BLOM/iHAMOCC system, we still try to maintain a separation between BLOM and iHAMOCC source code, and a clean interface between the two. Hence, the core iHAMOCC code should not reference BLOM variables or parameters directly, but only those that have been defined for the BLOM/iHAMOCC interface. There are some exceptions to this general rule, mainly for the mod_xc module that defines parameters for the model dimensions.

BLOM/iHAMOCC interface

iHAMOCC extends the number of ocean tracers that is defined in BLOM, and use the BLOM routines for calculation of tracer advection and diffusion.

NOTE: Tracer fields in BLOM are defined with units [mol / kg] whereas tracer fields in iHAMOCC are defined with units [kmol / m^3]. It is therefore necessary to do a unit conversion when passing tracers between BLOM and iHAMOCC.

modules & subroutines

  • mo_intfcblom.F90 :: Declaration and memory allocation related to the BLOM-iHAMOCC interface. This includes 2-time-level copies of sediment and atmospheric fields.
    • mo_intfcblom (module)
    • alloc_mem_intfcblom (subroutine, public)
    • blom2hamocc (subroutine, public) :: unit conversion, pass sediment and atmospheric fields from BLOM to iHAMOCC
    • hamocc2blom (subroutine, public) :: unit conversion, pass sediment and atmospheric fields from iHAMOCC to BLOM
  • mo_vgrid.F90 :: Declaration, memory allocation, and routines related to the vertical grid structure. These have to be recalculated every time step when iHAMOCC is coupled to BLOM.
    • mo_vgrid (module)
    • set_vgrid (subroutine, public)
    • alloc_mem_vgrid (subroutine, public)
  • hamocc_init.F90 :: HAMOCC initialization when coupled to BLOM.
  • hamocc_step.F90 :: HAMOCC time step when coupled to BLOM.

Support for iHAMOCC restart files

The ability to write and read restart files also depend partly on the BLOM structure, hence the support for iHAMOCC restart files also reference some BLOM modules directly.

iHAMOCC main routine

The subroutine hamocc4bcm is called from hamocc_step, once per time step, and runs through the following steps:

  1. Increment BGC time step counter for run (ldtrunbgc) and for experiment (ldtbgc).
  2. call set_vgrid :: Calculate variables with respect to current vertical grid
  3. strahl :: Update net solar radiation
  4. atm :: Update atmospheric CO2 [optional: PROGCO2, DIAGCO2]
  5. call get_cfc :: Update atmospheric CFC [optional: CFC]
  6. call ocprod :: Update biological production, remineralisation and particle sinking.
  7. Set minimum ocetra values to zero.
  8. call cyano :: Nitrogen fixation by cyano bacteria, followed by remineralisation and nitrification.
  9. call carcham :: Inorganic carbon cycle.
  10. call n_deposition :: Apply nitrogen deposition to the top-most model layer
  11. call riverinpt :: Apply riverine input to oceanic tracer fields
  12. call update_boxatm :: Update atmospheric pCO2 [optional: BOXATM]
  13. call preftrc :: Update preformed tracers
  14. call powach :: Update sediment deposition [optional: SEDBYPASS]
  15. call sedshi :: Once per day, shift sediments [optional: SEDBYPASS]
  16. pflxco2 :: Pass CO2 flux, convert from [kmol / m^2] to [kg / m^2 / s].
  17. pflxdms :: Pass DMS flux, convert from [kmol / m^2] to [kg / m^2 / s].

NOTE: Steps marked by [optional: {LABEL}] are turned on/off depending on value of preprocessor flag {LABEL}.

General support routines

Tracer specific routines

Ocean biogeochemistry

  • mo_biomod.F90 :: Variables for marine biology.
    • mo_biomod (module)
    • alloc_mem_biomod (subroutine, public)
  • mo_carbch.F90 :: Variables for inorganic carbon cycle.
    • mo_carbch (module)
    • alloc_mem_carbch (subroutine, public)
  • mo_fedep.F90 :: Variables and routines for iron deposition
    • mo_fedep (module)
    • ini_fedep (subroutine, public)
    • get_fedep (subroutine, public)
  • mo_ndep.F90 :: Routines for reading and applying nitrogen deposition fluxes
    • mo_ndep (module)
    • ini_ndep (subroutine, public)
    • get_ndep (subroutine, public)
    • n_deposition (subroutine, public)
  • carchm.F90 :: Inorganic carbon cycle.
  • carchm_kequi.F90 :: Calculate equilibrium constant for the carbonate system
  • carchm_solve.F90 :: Solve carbon chemistry.
  • carchm_solve_DICsat.F90 :: Solve DICsat from TALK and pCO2.
  • cyano.F90 :: Nitrogen-fixation by cyano bacteria, followed by remineralisation and nitrification
  • ocprod.F90 :: Compute biological production, settling of debris, and related biogeochemistry

Ocean BGC - initial conditions

  • mo_Gdata_read.F90 :: Routines for reading initial condition files for OMIP-BGC
    • mo_Gdata_read (module)
    • set_Gdata (subroutine, public)
    • clean_Gdata (subroutine, public)
    • get_profile (subroutine, public)
    • get_region (function, public)
  • profile_gd.F90 :: Initialise HAMOCC fields with gridded (1x1 deg) WOA and GLODAP data using the module mo_Gdata_read.
  • get_pi_ph.F90 :: Read data for pi_ph variable (pre-industrial pH)

Sediments and pore water

  • mo_sedmnt.F90 :: Sediment declaration and memory allocation
    • mo_sedmnt (module)
    • alloc_mem_sedmnt (subroutine, public)
  • bodensed.F90 :: Set up of sediment layer
  • powach.F90 :: Main sediment routine - update sediment and pore water fluxes
  • powadi.F90 :: Sediment pore water vertical diffusion with simultaneous dissolution.
  • dipowa.F90 :: Calculate vertical diffusion of sediment pore water properties and diffusive flux through the ocean/sediment interface.
  • sedshi.F90 :: Shift solid sediment layer downwards, if layer is full.

Atmospheric boundary layer

River input

  • mo_riverinpt.F90 :: Routines for reading and applying riverine nutrient and carbon input data
    • mo_riverinpt (module)
    • ini_riverinput (subroutine, public)
    • riverinpt (subroutine, public)

I/O routines

  • mo_bgcmean.F90 :: Calculate mean values for BGC fields
    • mo_bgcmean (module)
    • alloc_mem_bgcmean (subroutine, public)
    • inisrf (subroutine, public)
    • inilyr (subroutine, public)
    • inilvl (subroutine, public)
    • inisdm (subroutine, public)
    • inibur (subroutine, public)
    • accsrf (subroutine, public)
    • acclyr (subroutine, public)
    • acclvl (subroutine, public)
    • accsdm (subroutine, public)
    • accbur (subroutine, public)
    • finsrf (subroutine, public)
    • finlyr (subroutine, public)
    • wrtsrf (subroutine, public)
    • wrtlyr (subroutine, public)
    • wrtlvl (subroutine, public)
    • wrtsdm (subroutine, public)
    • wrtbur (subroutine, public)
    • logsrf (subroutine, public)
    • loglyr (subroutine, public)
    • loglvl (subroutine, public)
    • logsdm (subroutine, public)
    • msksrf (subroutine, public)
    • msklvl (subroutine, public)
    • bgczlv (subroutine, public)
  • accfields.F90 :: Accumulate fields for time-averaged output and write output
  • inventory_bgc.F90 :: calculate the BGC inventory.
  • ncout_hamocc.F90 :: output routine for HAMOCC diagnostic fields
    • ncwrt_bgc (subroutine, public)
    • hamoccvardef (subroutine, public)
  • read_netcdf_var.F90 :: Reads a variable from a NETCDF file and distributes it to all PEs
  • write_netcdf_var.F90 :: Gathers a global variable from all PEs and writes it to a NETCDF file

List of preprocessor flags

  • AGG :: Sinking and aggregation of phosphorous mass, opal and calcium carbonate. Alternative to WLIN. DEFAULT IS WLIN
  • BOXATM :: (??)
  • BROMO :: Turn on/off bromoform tracer
  • cisonew :: Turn on/off carbon isotopes
  • CFC :: Turn on/off CFC tracer
  • DIAGCO2 :: Import diagnostic CO2 field from atmosphere. Alternative to PROGCO2.
  • DMSPH :: Turn on/off dms_ph calculation based on pi_ph. NOT ACTIVATED (calculation with pi_ph is commented out)
  • FB_BGC_OCE :: Feedback BGC-ocean, define variable abs_oce.
  • natDIC :: Turn on/off separate budget for natural (background) DIC(??)
  • PBGC_CK_TIMESTEP :: Debug hamocc4bmc, print fields with inventory_bgc.
  • PBGC_OCNP_TIMESTEP :: Debug ocprod, print fields with inventory_bgc.
  • PNETCDF :: Use PNETCDF library for reading/writing netCDF files.
  • PROGCO2 :: Import prognostic CO2 field from atmosphere. Alternative to DIAGCO2.
  • sedbypass :: Bypass sediment routines.
  • WLIN :: Linear model for sinking particulate matter(??). Alternative to AGG. DEFAULT IS WLIN

Some preprocessor flags can be changed in the NorESM build system (see BLOM/cime_config/buildlib):

  • Default flags :: HAMOCC, RESTART_BGC, WLIN
  • $HAMOCC_CFC == TRUE :: CFC
  • $HAMOCC_NATTRC == TRUE :: natDIC
  • $HAMOCC_SEDBYPASS == TRUE :: sedbypass
  • $HAMOCC_CISO == TRUE :: cisonew
    • Error if $HAMOCC_SEDPASS == FALSE
  • Select case based on $co2type:
    • $co2type == prognostic :: PROGCO2
    • $co2type == diagnostic :: DIAGCO2
    • Error if $co2type is not one of "constant", "prognostic" or "diagnostic".

Other preprocessor flags are not accessible by default. To use these, it is best to edit the buildlib file directly and add/edit flags in the default flag setting.