Skip to content

Fesom2.7 recom3.1#864

Draft
ogurses wants to merge 17 commits intomainfrom
fesom2.7-recom3.1
Draft

Fesom2.7 recom3.1#864
ogurses wants to merge 17 commits intomainfrom
fesom2.7-recom3.1

Conversation

@ogurses
Copy link
Collaborator

@ogurses ogurses commented Feb 27, 2026

Update REcoM in FESOM2.7

ogurses and others added 17 commits December 9, 2025 11:42
This commit includes bugfixes, new diagnostics variables for grazing
and code pieces to track BGC tracer budget.
Add recom initialzation and sbc files for recom. Standard setup for recom is

enable_3zoo2det = .true.  and enable_coccos = .false. (namelist.recom)
Build REcoM CI test. Add push trigger and improve debugging.
- namelist.recom and namelist.tra required by REcoM (not auto-generated)
- Updated file paths to use local copies in work directory
- Set REcoM_restart=false for initialization from climatology
- Workflow copies these template files to work_recom/
Added mslp (mean sea level pressure) forcing configuration to enable
CO2 flux calculations in REcoM. Without atmospheric pressure, the CO2
flux calculation fails with NaN values.

Changes:
- Added namelist.forcing section with l_mslp=True
- Configured to read from 'slp.' files with 'slp' variable
- Copy PHC2_salx.nc and runoff.nc to work directory in CI
…orcing

The default namelist.forcing.CORE2 already has mslp (atmospheric
pressure) configured but disabled (l_mslp=.false.). Patch it to
l_mslp=.true. in the workflow to enable reading of slp.*.nc files.

This is needed for REcoM CO2 flux calculations which require
atmospheric pressure (Patm).

Removed unnecessary namelist.forcing section from setup.yml since
we just patch the default config file directly.
Namelist for REcoM3.1 are updated (for albedo)
Grazing diagnostics results in segmentation faulf in 2p1z1d setup.
Macrozooplankton allocation and initialization is revisited. Deallocation
was not an issue.
ESM tools cause problems in coupled model run
If double precision sign is in the namelist.recom.
d0 is removed.
Tracer fields have different numbers depending on configuration. Output routine
is now aware of which configuration we use.

1. **Tracer ID 1001-1022 Base tracers** always present in all configuration:

1. **Tracer ID 1023-1028 have different meanings** depending on configuration:
- In **COCCOS-ONLY**: 1023-1025 are Coccos (N,C,Chl), 1026-1028 are Phaeo (N,C,Chl)
- In **3ZOO2DET configs**: 1023-1024 are Zoo2 (N,C), 1025-1028 are Det2 pool
- In **BASE with rivers**: 1023 is DOCt

2. **Tracer ID 1029-1031** vary by configuration:
- In **FULL model**: Coccos (N,C,Chl)
- In **3ZOO2DET-ONLY**: 1029-1030 are Microzoo (N,C)
- In **COCCOS-ONLY with rivers**: 1029 is DOCt

3. **Tracer ID 1032-1036** only exist in **FULL model**:
- 1032-1034: Phaeocystis (N,C,Chl)
- 1035-1036: Microzooplankton (N,C)

4. **Tracer ID 1037** only in **FULL model with rivers**: DOCt

5. **Added comprehensive comments** explaining which configuration uses which tracer IDs to prevent confusion.
Terrestrial DOC input is added as a new tracer. Input variables are read from a Netcdf file
using a new subroutine as standard FESOM routines do not help in this case. 

Update namelist.config file for various recom setups.
REcoM runs with more than 35 tracer fields. Therefore, we increase maximum number of
allowed restart files.
DIC budget calculations are updated. We have now the correct split.
Budget closes. It is extended to the variables of DIN, All and DSi.
Photosynthesis, respiration, N assimilation and remineralization
diagnostics are added.
…ication and permanent burial of organic matter in marine sediments. Update recom output variables.

- Denitrification: Uses Middelburg et al. (1996) parameterization to calculate nitrogen removal as a function of organic carbon flux
- Permanent Burial: Uses Dunne et al. (2007) formulation to calculate burial efficiency and permanent removal of C, N, Si, and CaCO3
- Calcite Dissolution: Accounts for calcite preservation based on carbonate saturation state (Omega_calcite)
- Update output streams for the REcoM tracer variables (mocsy 3D outputs, missing ballasting outputs and burial)
We hhave either 2p or 4p cases. 3p setup is not needed anymore.
@ogurses
Copy link
Collaborator Author

ogurses commented Feb 27, 2026

I am not allowed to add the following yml file.

.github/workflows/fesom2_recom.yml

name: "FESOM2: REcoM Biogeochemistry"

Controls when the action will run. Triggers the workflow on pull request only.

on:
workflow_dispatch: {}
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main

A workflow run is made up of one or more jobs that can run sequentially or in parallel

jobs:
general_test:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
# Docker Hub image that container-job executes in
container: ghcr.io/fesom/fesom2_docker:fesom2_test_refactoring-master

# Service containers to run with `gfortran_ubuntu`
steps:
  # NK: this changes working directory to fesom2
  - uses: actions/checkout@v2

  - name: Git safe directory
    run: |
      git config --global --add safe.directory ${PWD}
  - name: Compile model with REcoM
    run: |
      ./configure.sh ubuntu -DRECOM_COUPLED=ON
  - name: Create REcoM test run
    run: |
      mkrun recom test_pi_recom -m docker

  - name: Add REcoM namelists
    run: |
      # mkrun doesn't create namelist.recom, so copy from config and patch
      # Using 2p3z2d (30 tracers) - more complete/tested than 2p1z1d
      cp config/bin_2p3z2d/namelist.recom work_recom/
      cp config/bin_2p3z2d/namelist.tra work_recom/

      # Patch file paths in namelists to use local files
      cd work_recom

      # Remove nam_rsbc section (not used by code, causes parsing errors)
      sed -i '/^&nam_rsbc/,/^\//d' namelist.recom

      # Set REcoM_restart to false for initialization from climatology
      sed -i "s|REcoM_restart.*=.*\.true\.|REcoM_restart         =.false.|" namelist.recom

      # Patch tracer file list in namelist.tra  
      sed -i "s|fe_pisces_opa_eq_init_3D_changed_name\.nc|fe5deg.nc|" namelist.tra
      sed -i "s|woa18_all_o00_01_mmol_fesom2\.nc|oxy5deg.nc|" namelist.tra
      sed -i "s|woa13_all_i00_01_fesom2\.nc|si5deg.nc|" namelist.tra
      sed -i "s|GLODAPv2\.2016b\.TAlk_fesom2_mmol_fix_z_Fillvalue\.nc|talk5deg.nc|" namelist.tra
      sed -i "s|GLODAPv2\.2016b\.TCO2_fesom2_mmol_fix_z_Fillvalue\.nc|tco2_5deg.nc|" namelist.tra
      sed -i "s|woa13_all_n00_01_fesom2\.nc|din5deg.nc|" namelist.tra
      sed -i "s|phc3\.0_winter\.nc|woa18_netcdf_5deg.nc|g" namelist.tra

      # Enable atmospheric pressure forcing for REcoM CO2 flux calculation
      sed -i "s|l_mslp *= *\.false\.|l_mslp=.true.|" namelist.forcing
     
      echo "--- Verifying patches ---"
      echo "REcoM restart: $(grep 'REcoM_restart' namelist.recom)"
      echo "Atmospheric pressure: $(grep 'l_mslp' namelist.forcing)"
     cd ..

      # Copy REcoM input data files
      cp test/input/recom/*.nc work_recom/

      # Create dust file with expected name in the source directory
      # (code reads from ClimateDataPath, not work directory)
      cd test/input/recom
      ln -s DustClimMonthlyAlbani_pimesh.nc DustClimMonthlyAlbani.nc
      cd ../../..
      
      # Copy forcing data files (from 1948)
      cp test/input/global/*.1948.nc work_recom/
      cp test/input/global/runoff.nc work_recom/
      cp test/input/global/PHC2_salx.nc work_recom/
        
  - name: FESOM2 REcoM test run
    run: |
      cd work_recom
      echo "--- Running REcoM test (32 timesteps, 1 day) ---"
      chmod +x job_docker_new
      ./job_docker_new

  - name: Check REcoM results
    run: |-
      cd work_recom
      fcheck .

@JanStreffing
Copy link
Collaborator

Hey @ogurses, & @patrickscholz. I suggest we first merge #863, then #802. Then we update this branch and merge here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants