source: trunk/LMDZ.COMMON/libf/evolution/deftank/PEMrun.job @ 4068

Last change on this file since 4068 was 4065, checked in by jbclement, 3 weeks ago

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

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2### Partition to use
3#SBATCH --account=cin0391
4#SBATCH --constraint=GENOA
5### Number of nodes/cores to use
6#SBATCH --nodes=1
7#SBATCH --ntasks-per-node=1
8#SBATCH --cpus-per-task=1
9#SBATCH --threads-per-core=1 # --hint=nomultithread
10### Job information
11#SBATCH --job-name=jobPEM1
12#SBATCH --output=jobPEM_%j.out
13#SBATCH --time=24:00:00
14#SBATCH --mem=64G
15
16########################################################################
17# Modify here the parameters depending on your setup
18####################################################
19# Path to the arch.env to source:
20source ../trunk/LMDZ.COMMON/arch.env
21
22# Name of executable for the PEM:
23exePEM="pem_64x48x32_phymars_seq.e"
24
25# Argument for the PEM execution ("--auto-exit" for SLURM and PBS/TORQUE | "" when the script is not run as a job):
26arg_pem="--auto-exit"
27########################################################################
28
29
30ulimit -s unlimited
31
32# Running the PEM
33read i_year n_year r_plnt2earth_yr iPCM iPEM nPCM nPCM_ini < launchPEM.info
34echo "Run \"PEM $iPEM\" is starting."
35cp run_PEM.def run.def
36eval "./$exePEM $arg_pem > run.log 2>&1"
37if [ ! -f "restartfi.nc" ] || ! (tail -n 100 run.log | grep -iq "so far, so good!"); then # Check if it ended abnormally
38    echo "Error: the run \"PEM $iPEM\" crashed!"
39    exit 1
40fi
41
42# Copy data files and prepare the next run
43mv run.log logs/runPEM${iPEM}.log
44if [ -f "diagevol.nc" ]; then
45    mv diagevol.nc diags/diagevol${iPEM}.nc
46fi
47if [ -f "diagevol_soil.nc" ]; then
48    mv diagevol_soil.nc diags/diagevol_soil${iPEM}.nc
49fi
50cp restartpem.nc starts/restartpem${iPEM}.nc
51mv restartpem.nc startpem.nc
52cp restartfi.nc starts/restartfi_postPEM${iPEM}.nc
53mv restartfi.nc startfi.nc
54if [ -f "restart.nc" ]; then
55    cp restart.nc starts/restart_postPEM${iPEM}.nc
56    mv restart.nc start.nc
57elif [ -f "restart1D.txt" ]; then
58    cp restart1D.txt starts/restart1D_postPEM${iPEM}.txt
59    mv restart1D.txt start1D.txt
60fi
61
62# Launch the next cycle
63#if [ "$(awk 'END{print $NF}' launchPEM.info)" -eq 7 ]; then
64#    read i_year n_year r_plnt2earth_yr iPCM iPEM nPCM nPCM_ini < launchPEM.info
65#    ./launchPEM.sh cont # Continue the PEM run if it stopped because of job time limit
66#else
67    ./launchPEM.sh new
68#fi
Note: See TracBrowser for help on using the repository browser.