Changeset 4110 for trunk/LMDZ.COMMON/libf/evolution/deftank
- Timestamp:
- Mar 9, 2026, 10:29:53 AM (5 days ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution/deftank
- Files:
-
- 9 edited
- 1 moved
-
README (modified) (5 diffs)
-
clean.sh (modified) (1 diff)
-
concat_pem.py (modified) (2 diffs)
-
pcm_run.job (modified) (1 diff)
-
pem_run.job (modified) (2 diffs)
-
pem_workflow.sh (modified) (1 diff)
-
pem_workflow_lib.sh (modified) (10 diffs, 1 prop)
-
run_pem.def (modified) (4 diffs)
-
visu_layering.py (modified) (1 diff)
-
visu_layering_evo.py (moved) (moved from trunk/LMDZ.COMMON/libf/evolution/deftank/visu_layering_evol.py) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/deftank/README
r4090 r4110 47 47 > the starting files you want to run the PCM: "startfi.nc" and "start.nc"/"start1D.txt"; 48 48 > the necessary PEM files: "pem_workflow.sh", "pem_workflow_lib.sh", "pcm_run.job", "pem_run.job", "run_pem.def" and "obl_ecc_lsp.asc"; 49 > the optional PEM files: "diagevo l.def" to define the PEM variables to be ouputted and "startevol.nc" to set the initial state of the PEM.49 > the optional PEM files: "diagevo.def" to define the PEM variables to be ouputted and "startevo.nc" to set the initial state of the PEM. 50 50 51 51 The PEM files can be found in the deftank folder. … … 55 55 > "pcm_run.job" (see below for details); 56 56 > "pem_run.job" (see below for details); 57 > def files, especially for "run_pem.def", "run_pcm.def" and "callphys.def" which must be consistent. In particular, "run_pem.def" needs to include some definitions for the physics in file "run_pcm.def" with "INCLUDEDEF=run_pcm.def".57 > def files, especially for "run_pem.def", "run_pcm.def" and "callphys.def" which must be consistent. In particular, "run_pem.def" needs to include some definitions in file "run_pcm.def" and "callphys.def" with "INCLUDEDEF=run_pcm.def". 58 58 In addition, the user has to provide a "startfi.nc" whose orbital parameters are consistent with the initial date set in "run_pem.def". The script "ini_pem_orbit.sh" can do it automatically reading "obl_ecc_lsp.asc". 59 59 … … 64 64 > the XIOS outputs of the PCM: "Xoutdaily4pem*.nc"/"Xoutyearly4pem*.nc"; 65 65 > the outputs of the chained simulation: "pem_workflow.log", "pem_workflow.sts" and possibly "kill_pem_workflow.sh"; 66 > the usual outputs of the PEM: "restartevo l.nc", "restartfi.nc", "restart.nc"/"restart1D.txt" and "diagevol.nc".66 > the usual outputs of the PEM: "restartevo.nc", "restartfi.nc", "restart.nc"/"restart1D.txt" and "diagevo.nc". 67 67 During the simulation, the PCM/PEM run files are renamed conveniently and stored in the sub-directories "logs" (log files), "starts" (starting files) and "diags" (diagnostic files). 68 68 If you run a simulation by submitting jobs, the script "kill_pem_workflow.sh" is automatically generated. It can be used to kill the jobs related to your chained simulation in the queue of the job scheduler. … … 102 102 # run_pem.def 103 103 All the possible parameters to define a PEM run (read in "config.F90"). 104 It needs to include some definitions for the physics in file "run_pcm.def" with "INCLUDEDEF=run_pcm.def".104 It needs to include some definitions in file "run_pcm.def" and "callphys.def" with "INCLUDEDEF=run_pcm.def". 105 105 106 106 # obl_ecc_lsp.asc [default], obl_ecc_lsp_pos.asc [future years] … … 126 126 127 127 # visu_layering.py: 128 Python script file to output the stratification data from the "startevo l.nc" files.128 Python script file to output the stratification data from the "startevo.nc" files. 129 129 130 # visu_layering_evo l.py:131 Python script file to output the stratification data over time from the "startevo l.nc" files.130 # visu_layering_evo.py: 131 Python script file to output the stratification data over time from the "startevo.nc" files. -
trunk/LMDZ.COMMON/libf/evolution/deftank/clean.sh
r4091 r4110 35 35 cp starts/start1D.txt . 36 36 fi 37 if [ -f "starts/startevo l.nc" ]; then38 cp starts/startevo l.nc .37 if [ -f "starts/startevo.nc" ]; then 38 cp starts/startevo.nc . 39 39 fi 40 40 # Cleaning of files in the sub-folders -
trunk/LMDZ.COMMON/libf/evolution/deftank/concat_pem.py
r4065 r4110 35 35 parser.add_argument( 36 36 "--basename", type=str, 37 help="Base name of the files, e.g., 'diagevo l' for files like diagevol1.nc"37 help="Base name of the files, e.g., 'diagevo' for files like diagevo1.nc" 38 38 ) 39 39 parser.add_argument( … … 88 88 # Defaults 89 89 default_folder = args.folder or "diags" 90 default_basename = args.basename or "diagevo l"90 default_basename = args.basename or "diagevo" 91 91 92 92 # Prompt for folder and basename with defaults -
trunk/LMDZ.COMMON/libf/evolution/deftank/pcm_run.job
r4091 r4110 32 32 33 33 ulimit -s unlimited 34 35 # Checking the executable 36 if [ ! -f $pcm_exe ]; then 37 echo "Error: required file \"$pcm_exe\" not found!" 38 exit 1 39 fi 34 40 35 41 # Running the PCM -
trunk/LMDZ.COMMON/libf/evolution/deftank/pem_run.job
r4091 r4110 30 30 ulimit -s unlimited 31 31 32 # Checking the executable 33 if [ ! -f $pem_exe ]; then 34 echo "Error: required file \"$pem_exe\" not found!" 35 exit 1 36 fi 37 32 38 # Running the PEM 33 39 read n_yr_sim ntot_yr_sim r_plnt2earth_yr i_pcm_run i_pem_run n_pcm_runs n_pcm_runs_ini < pem_workflow.sts … … 42 48 # Copy data files and prepare the next run 43 49 mv run.log logs/run_pem${i_pem_run}.log 44 if [ -f "diagevo l.nc" ]; then45 mv diagevo l.nc diags/diagevol${i_pem_run}.nc50 if [ -f "diagevo.nc" ]; then 51 mv diagevo.nc diags/diagevo${i_pem_run}.nc 46 52 fi 47 if [ -f "diagevo l_soil.nc" ]; then48 mv diagevo l_soil.nc diags/diagevol_soil${i_pem_run}.nc53 if [ -f "diagevo_soil.nc" ]; then 54 mv diagevo_soil.nc diags/diagevo_soil${i_pem_run}.nc 49 55 fi 50 cp restartevo l.nc starts/restartevol${i_pem_run}.nc51 mv restartevo l.nc startevol.nc56 cp restartevo.nc starts/restartevo${i_pem_run}.nc 57 mv restartevo.nc startevo.nc 52 58 cp restartfi.nc starts/restartfi_postpem${i_pem_run}.nc 53 59 mv restartfi.nc startfi.nc -
trunk/LMDZ.COMMON/libf/evolution/deftank/pem_workflow.sh
r4074 r4110 33 33 user=`whoami` 34 34 if [ ! -f "pem_workflow_lib.sh" ]; then 35 echo "Error: file \"pem_workflow_lib.sh\" does not exist in $dir!"35 echo "Error: required file \"pem_workflow_lib.sh\" does not exist in $dir!" 36 36 echo "It can be found in the PEM deftank." 37 37 exit 1 -
trunk/LMDZ.COMMON/libf/evolution/deftank/pem_workflow_lib.sh
- Property svn:executable deleted
r4091 r4110 21 21 echo "Error: an issue occured in the PEM workflow script!" 22 22 exit 1 23 } 24 25 # To check if the command exists 26 # arg1: required command 27 require_cmd() { 28 if ! command -v "$1" >/dev/null 2>&1; then 29 echo "Error: required command '$1' not found." 30 echo "Please install or load the corresonding library." 31 abort_workflow 32 fi 23 33 } 24 34 … … 37 47 else 38 48 echo "Error: neither SLURM nor TORQUE/PBS is installed on $machine!" 39 echo " You need to adapt the script to your job job_scheduler or set 'mode' to 0."49 echo "Please adapt the script to your job scheduler or set 'mode' to 0." 40 50 abort_workflow 41 51 fi … … 176 186 } 177 187 188 # To check the "callphys.def" compatibility to run with the PEM 189 # arg1: callphys key 190 check_callphys_key() { 191 key="$1" 192 line=$(grep -E "^[[:space:]]*${key}[[:space:]]*=" callphys.def \ 193 | grep -v '^[[:space:]]*#' \ 194 | tail -n 1) 195 if [[ -z "$line" ]]; then 196 echo "Error: the key '$key' is missing in \"callphys.def\"!" 197 abort_workflow 198 fi 199 # Remove inline comments, extract value, normalize 200 value=$(echo "$line" \ 201 | cut -d'#' -f1 \ 202 | cut -d'=' -f2 \ 203 | tr -d '[:space:]' \ 204 | tr '[:upper:]' '[:lower:]') 205 if [[ "$value" == "true" || "$value" == ".true." ]]; then 206 return 0 207 else 208 echo "Error: the key '$key' must be true in \"callphys.def\"!" 209 abort_workflow 210 fi 211 } 212 178 213 # To check if everything necessary for the workflow script is ok 179 214 check_workflow() { … … 220 255 abort_workflow 221 256 fi 257 if [ ! -f "callphys.def" ]; then 258 echo "Error: file \"callphys.def\" does not exist in $dir!" 259 abort_workflow 260 fi 261 if [ ! -f "z2sig.def" ]; then 262 echo "Error: file \"z2sig.def\" does not exist in $dir!" 263 abort_workflow 264 fi 265 if [ ! -f "traceur.def" ]; then 266 echo "Error: file \"traceur.def\" does not exist in $dir!" 267 abort_workflow 268 fi 222 269 if [ ! -f "context_lmdz_physics.xml" ]; then 223 270 echo "Error: file \"context_lmdz_physics.xml\" does not exist in $dir!" … … 236 283 abort_workflow 237 284 fi 285 if [ ! -f "obl_ecc_lsp.asc" ]; then 286 echo "Warning: file \"obl_ecc_lsp.asc\" has not been found in $dir!" 287 fi 238 288 if [ ! -d "logs" ]; then 239 289 mkdir logs … … 248 298 detect_scheduler 249 299 fi 300 require_cmd ncdump 301 # Check if the "callphys.def" is compatible with the PEM 302 check_callphys_key paleoclimate 250 303 # Set automatically the XIOS output file for the PEM according to the number of slopes 251 304 get_nslope … … 285 338 cp start1D.txt starts/ 286 339 fi 287 if [ -f "startevo l.nc" ]; then288 cp startevo l.nc starts/340 if [ -f "startevo.nc" ]; then 341 cp startevo.nc starts/ 289 342 fi 290 343 … … 462 515 n_yr_sim=0 463 516 sed -i "1s/.*/$n_yr_sim $ntot_yr_sim $r_plnt2earth_yr $i_pcm_run $i_pem_run $n_pcm_runs $n_pcm_runs_ini/" pem_workflow.sts 464 cleanup diags/diagevo l.nc $(($i_pem_run - 1))465 cleanup diags/diagevo l_soil .nc $(($i_pem_run - 1))517 cleanup diags/diagevo .nc $(($i_pem_run - 1)) 518 cleanup diags/diagevo_soil .nc $(($i_pem_run - 1)) 466 519 cleanup logs/run_pem .log $(($i_pem_run - 1)) 467 520 cleanup starts/restart1D_postpem .txt $(($i_pem_run - 1)) 468 521 cleanup starts/restart_postpem .nc $(($i_pem_run - 1)) 469 522 cleanup starts/restartfi_postpem .nc $(($i_pem_run - 1)) 470 cleanup starts/restartevo l.nc $(($i_pem_run - 1))471 rm -f startevo l.nc472 if [ -f "starts/startevo l.nc" ]; then473 cp starts/startevo l.nc .523 cleanup starts/restartevo .nc $(($i_pem_run - 1)) 524 rm -f startevo.nc 525 if [ -f "starts/startevo.nc" ]; then 526 cp starts/startevo.nc . 474 527 fi 475 528 if [ $i_resume -eq $(($n_pcm_runs_ini - 1)) ]; then … … 492 545 n_yr_sim=$(awk "NR==$i_pem_run {printf \"%s\n\", \$3}" "pem_workflow.sts") 493 546 sed -i "1s/.*/$n_yr_sim $ntot_yr_sim $r_plnt2earth_yr $i_pcm_run $i_pem_run $n_pcm_runs $n_pcm_runs_ini/" pem_workflow.sts 494 cleanup diags/diagevo l.nc $(($i_pem_run - 1))495 cleanup diags/diagevo l_soil .nc $(($i_pem_run - 1))547 cleanup diags/diagevo .nc $(($i_pem_run - 1)) 548 cleanup diags/diagevo_soil .nc $(($i_pem_run - 1)) 496 549 cleanup logs/run_pem .log $(($i_pem_run - 1)) 497 550 cleanup starts/restart1D_postpem .txt $(($i_pem_run - 1)) 498 551 cleanup starts/restart_postpem .nc $(($i_pem_run - 1)) 499 552 cleanup starts/restartfi_postpem .nc $(($i_pem_run - 1)) 500 cleanup starts/restartevo l.nc $(($i_pem_run - 1))501 cp starts/restartevo l$(($i_pem_run - 1)).nc startevol.nc553 cleanup starts/restartevo .nc $(($i_pem_run - 1)) 554 cp starts/restartevo$(($i_pem_run - 1)).nc startevo.nc 502 555 if [ $il -eq $(($n_pcm_runs - 1)) ]; then # Second to last PCM run 503 556 cp diags/Xoutdaily4pem${i_resume}.nc Xoutdaily4pem_Y1.nc … … 531 584 cleanup diags/Xoutdaily4pem .nc $(($i_pcm_run - 1)) 532 585 cleanup diags/Xoutyearly4pem .nc $(($i_pcm_run - 1)) 533 cleanup diags/diagevo l.nc $i_resume534 cleanup diags/diagevo l_soil .nc $i_resume586 cleanup diags/diagevo .nc $i_resume 587 cleanup diags/diagevo_soil .nc $i_resume 535 588 cleanup logs/run_pem .log $i_resume 536 589 cleanup starts/restart1D_postpem .txt $i_resume 537 590 cleanup starts/restart_postpem .nc $i_resume 538 591 cleanup starts/restartfi_postpem .nc $i_resume 539 cleanup starts/restartevo l.nc $i_resume540 cp starts/restartevo l${i_resume}.nc startevol.nc592 cleanup starts/restartevo .nc $i_resume 593 cp starts/restartevo${i_resume}.nc startevo.nc 541 594 cp starts/restartfi_postpem${i_resume}.nc startfi.nc 542 595 if [ -f "starts/restart_postpem${i_resume}.nc" ]; then -
trunk/LMDZ.COMMON/libf/evolution/deftank/run_pem.def
r4090 r4110 4 4 5 5 #---------- Output parameters ----------# 6 # Output rate? Default = 1 7 output_rate=1 6 # Do you want to output onto the terminal? Default = .true. 7 # out2term=.true. 8 9 # Do you want to output into a log file? Default = .false. 10 # out2log=.false. 11 12 # Which level of verbosity do you want to? Default = 2 13 # verbosity_lvl=2 14 15 # Value of output rate for diagnostic files? Default = 1 16 # output_rate=1 8 17 9 18 #---------- Orbital parameters ----------# 10 19 # Do you want to follow an orbital forcing read in "obl_ecc_lsp.asc"? Default = .false. 11 # evo l_orbit=.false.20 # evo_orbit=.false. 12 21 13 # If evo l_orbit=.true., number of Earth years before present to start the PEM run. Default = 022 # If evo_orbit=.true., number of Earth years before present to start the PEM run. Default = 0 14 23 # pem_ini_earth_date=0 15 24 16 25 # Do you want the obliquity to evolve when following "obl_ecc_lsp.asc"? Default = .true. 17 # evo l_obl=.true.26 # evo_obl=.true. 18 27 19 28 # Do you want the eccentricity to evolve when following "obl_ecc_lsp.asc"? Default = .true. 20 # evo l_ecc=.true.29 # evo_ecc=.true. 21 30 22 31 # Do you want the ls perihelie to evolve when following "obl_ecc_lsp.asc"? Default = .true. 23 # evo l_lsp=.true.32 # evo_lsp=.true. 24 33 25 34 # Time step length of the PEM in Martian years? Default = 1. … … 27 36 28 37 #---------- Stopping criteria parameters ----------# 29 # If evo l_orbit=.false., maximal number of iterations if no stopping criterion is reached. Default=100000000.38 # If evo_orbit=.false., maximal number of iterations if no stopping criterion is reached. Default=100000000. 30 39 # nmax_yr_run=100000000 31 40 … … 74 83 75 84 #---------- Ice management parameters ----------# 76 # Amount of H2O ice to initialize the huge reservoir if the variable is not present in "startevo l.nc". Default = 9200. kg.m-2 (= 10 m)85 # Amount of H2O ice to initialize the huge reservoir if the variable is not present in "startevo.nc". Default = 9200. kg.m-2 (= 10 m) 77 86 # h2oice_huge_ini=9200. 78 87 … … 99 108 # dust2ice_ratio=0.1 100 109 101 # Some definitions for the physics in file "run_pcm.def"110 # Some definitions in file "run_pcm.def" and "callphys.def" 102 111 INCLUDEDEF=run_pcm.def -
trunk/LMDZ.COMMON/libf/evolution/deftank/visu_layering.py
r4090 r4110 1 1 #!/usr/bin/env python3 2 2 ####################################################################################### 3 ### Python script to output the stratification data from the "restartevo l#.nc" files ###3 ### Python script to output the stratification data from the "restartevo#.nc" files ### 4 4 ####################################################################################### 5 5 -
trunk/LMDZ.COMMON/libf/evolution/deftank/visu_layering_evo.py
r4109 r4110 1 1 #!/usr/bin/env python3 2 2 ####################################################################################################### 3 ### Python script to output stratification data over time from "restartevo l#.nc" files ###3 ### Python script to output stratification data over time from "restartevo#.nc" files ### 4 4 ### and to plot orbital parameters from "obl_ecc_lsp.asc" ### 5 5 ####################################################################################################### … … 21 21 Prompt the user for: 22 22 - folder_path: directory containing NetCDF files (default: "starts") 23 - base_name: base filename (default: "restartevo l")23 - base_name: base filename (default: "restartevo") 24 24 - infofile: name of the PEM info file (default: "pem_workflow.sts") 25 25 Validates existence of folder and infofile before returning. … … 37 37 base_name = input( 38 38 "Enter the base name of the NetCDF files " 39 "(press Enter for default [restartevo l]): "40 ).strip() or "restartevo l"39 "(press Enter for default [restartevo]): " 40 ).strip() or "restartevo" 41 41 42 42 infofile = input(
Note: See TracChangeset
for help on using the changeset viewer.
