Ignore:
Timestamp:
Feb 12, 2026, 9:09:12 AM (2 weeks ago)
Author:
jbclement
Message:

PEM:
Major refactor following the previous ones (r3989 and r3991) completing the large structural reorganization and cleanup of the PEM codebase. This revision introduces newly designed modules, standardizes interfaces with explicit ini/end APIs and adds native NetCDF I/O together with explicit PCM/PEM adapters. In detail:

  • Some PEM models were corrected or improved:
    • Frost/perennial ice semantics are clarified via renaming;
    • Soil temperature remapping clarified, notably by removing the rescaling of temperature deviation;
    • Geothermal flux for the PCM is computed based on the PEM state;
  • New explicit PEM/PCM adapters ("set_*"/"build4PCM_*") to decouple PEM internal representation from PCM file layouts and reconstruct consistent fields returned to the PCM;
  • New explicit build/teardown routines that centralize allocation and initialization ordering, reducing accidental use of uninitialized data and making the model lifecycle explicit;
  • Add native read/write helpers for NetCDF that centralize all low-level NetCDF interactions with major improvements (and more simplicity) compared to legacy PEM/PCM I/O (see the modules "io_netcdf" and "output"). They support reading, creation and writing of "diagevol.nc" (renamed from "diagpem.nc") and start/restart files;
  • Provide well-focused modules ("numerics"/"maths"/"utility"/"display") to host commonly-used primitives:
    • "numerics" defines numerical types and constants for reproducibility, portability across compilers and future transitions (e.g. quadruple precision experiments);
    • "display" provides a single controlled interface for runtime messages, status output and diagnostics, avoiding direct 'print'/'write' to enable silent mode, log redirection, and MPI-safe output in the future.
    • "utility" (new module) hosts generic helpers used throughout the code (e.g. "int2str" or "real2str");
  • Add modules "clim_state_init"/"clim_state_rec" which provide robust read/write logic for "start/startfi/startpem", including 1D fallbacks, mesh conversions and dimension checks. NetCDF file creation is centralized and explicit. Restart files are now self-consistent and future-proof, requiring changes only to affected variables;
  • Add module "atmosphere" which computes pressure fields, reconstructs potential temperature and air mass. It also holds the whole logic to define sigma or hybrid coordinates for altitudes;
  • Add module "geometry" to centrilize dimensions logic and grid conversions routines (including 2 new ones "dyngrd2vect"/"vect2dyngrd");
  • Add module "slopes" to isolate slopes handling;
  • Add module "surface" to isolate surface management. Notably, albedo and emissivity are now fully reconstructed following the PCM settings;
  • Add module "allocation" to check the dimension initialization and centrilize allocation/deallocation;
  • Finalize module decomposition and renaming to consolidate domain-based modules, purpose-based routines and physics/process-based variables;
  • The main program now drives a clearer sequence of conceptual steps (initialization / reading / evolution / update / build / writing) and fails explicitly instead of silently defaulting;
  • Ice table logic is made restart-safe;
  • 'Open'/'read' intrinsic logic is made safe and automatic;
  • Improve discoverability and standardize the data handling (private vs protected vs public);
  • Apply consistent documentation/header style already introduced;
  • Update deftank scripts to reflect new names and launch wrappers;

This revision is a structural milestone aiming to be behavior-preserving where possible. It has been tested via compilation and short integration runs. However, due to extensive renames, moves, and API changes, full validation is still ongoing.
Note: the revision includes one (possibly two) easter egg hidden in the code for future archaeologists of the PEM. No physics were harmed.
JBC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/deftank/run_PEM.def

    r3989 r4065  
    1515
    1616# If evol_orbit=.true., number of Earth years before present to start the PEM run. Default = 0
    17 # year_earth_bp_ini=0
     17# pem_ini_earth_date=0
    1818
    19 # Do you want to vary the obliquity when following "obl_ecc_lsp.asc"? Default = .true.
    20 # var_obl=.true.
     19# Do you want the obliquity to eveolve when following "obl_ecc_lsp.asc"? Default = .true.
     20# evol_obl=.true.
    2121
    22 # Do you want to vary the eccentricity when following "obl_ecc_lsp.asc"? Default = .true.
    23 # var_ecc=.true.
     22# Do you want the eccentricity to evolve when following "obl_ecc_lsp.asc"? Default = .true.
     23# evol_ecc=.true.
    2424
    25 # Do you want to vary the ls perihelie when following "obl_ecc_lsp.asc"? Default = .true.
    26 # var_lsp=.true.
     25# Do you want the ls perihelie to evolve when following "obl_ecc_lsp.asc"? Default = .true.
     26# evol_lsp=.true.
    2727
    2828# Time step length of the PEM in Martian years? Default = 1.
     
    3131#---------- Stopping criteria parameters ----------#
    3232# If evol_orbit=.false., maximal number of iterations if no stopping criterion is reached. Default=100000000.
    33 # nyears_max=100000000
     33# nmax_yr_run=100000000
    3434
    3535# Acceptance rate of sublimating H2O ice surface change. Default = 0.2
     
    6262
    6363# Value of the geothermal flux. Default = 0.
    64 # fluxgeo=0.
     64# flux_geo=0.
    6565
    6666# Depth at which the breccia layer begins. Default = 10 m
     
    8181
    8282# Threshold to consider the amount of H2O ice as an infinite reservoir. Default = 460. kg.m-2 (= 0.5 m)
    83 # h2oice_cap_threshold=460.
     83# threshold_h2oice_cap=460.
    8484
    8585# Do you want the H2O ice to flow along subslope inside a cell? Default = .true.
     
    9191#---------- Layering parameters ----------#
    9292# Do you want to run with the layering algorithm? Default = .false.
    93 # layering=.false.
     93# do_layering=.false.
    9494 
    9595# Value of the dust tendency. Default = 5.78e-2 kg.m-2.y-1
     
    103103
    104104# Some definitions for the physics, in file 'callphys.def'
    105 INCLUDEDEF=callphys.def
     105INCLUDEDEF=run_PCM.def
Note: See TracChangeset for help on using the changeset viewer.