Ignore:
Timestamp:
Feb 28, 2025, 5:51:32 PM (5 months ago)
Author:
jbclement
Message:

PEM:

  • Adjusments of few scripts to handle more situations.
  • Bug correction related to deallocation in case of "soil_pem = .false." or "layering_algo = .true.".

JBC

Location:
trunk/LMDZ.COMMON/libf/evolution/deftank
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/deftank/inipem_orbit.sh

    r3579 r3666  
    1515# Name of the file containing the orbital data
    1616orb_data="obl_ecc_lsp.asc"
     17
     18# Name of the file containing the starting date (Earth years)
     19date_file="run_PEM.def"
    1720######################################################################
    1821
     
    2326    exit 1
    2427fi
    25 if [ ! -f "startfi.nc" ]; then
     28if [ ! -f "$name_file" ]; then
    2629    echo "Error: file \"$name_file\" not found!"
    2730    exit 1
    2831fi
    29 if [ ! -f "run_PEM.def" ]; then
    30     echo "Error: file \"run_PEM.def\" not found!"
     32if [ ! -f "$date_file" ]; then
     33    echo "Error: file \"$date_file\" not found!"
    3134    exit 1
    3235fi
    3336
    34 # Get the number of Earth years before present to start the PEM run from "run_PEM.def"
    35 eyears_bp_ini=$(grep 'year_earth_bp_ini=' run_PEM.def | cut -d '=' -f 2 | tr -d '[:space:]')
    36 echo "The starting date is $eyears_bp_ini Earth years according to \"run_PEM.def\"."
     37# Get the number of Earth years before present to start the PEM run
     38eyears_bp_ini=$(grep 'year_earth_bp_ini=' $date_file | cut -d '=' -f 2 | tr -d '[:space:]')
     39echo "In \"$date_file\":"
     40echo "The starting date is $eyears_bp_ini Earth years."
    3741
    3842# Get the new values for the orbital parameters
     
    5862        fi
    5963        new_Lsp=$(echo "($lsp2 - $lsp1)/($y2 - $y1)*($yearlask - $y1) + $lsp1" | bc -l)
    60         echo "New obliquity    = $new_obl"
    61         echo "New eccentricity = $new_ecc"
    62         echo "New Lsp          = $new_Lsp"
    63         echo "Done!"
     64        echo "In \"$orb_data\":"
     65        echo "Found obliquity    = $new_obl"
     66        echo "Found eccentricity = $new_ecc"
     67        echo "Found Lsp          = $new_Lsp"
    6468        break
    6569    fi
     
    9599peri_day=$(echo "$year_day*(1. - ($zx0 - $new_ecc*s($zx0))/(2.*$pi))" | bc -l)
    96100
    97 ztheta=$(echo "($new_iniLs - $new_Lsp)/$degrad" | bc -l)
    98 tan=$(echo "s(0.5*$ztheta)/c(0.5*$ztheta)" | bc -l)
    99 zx0=$(echo "2.*a($tan*sqrt((1. - $new_ecc)/(1. + $new_ecc)))" | bc -l)
    100 xref=$(echo "$zx0 - $new_ecc*s($zx0)" | bc -l)
    101 new_inisol=$(echo "$peri_day + $xref*$year_day/(2.*$pi)" | bc -l)
    102 if [ $(echo "$new_inisol < 0." | bc -l) -eq 1 ]; then
    103     new_inisol=$(echo "$new_inisol + $year_day" | bc -l)
    104 fi
    105 if [ $(echo "$new_inisol >= $year_day" | bc -l) -eq 1 ]; then
    106     new_inisol=$(echo "$new_inisol - $year_day" | bc -l)
    107 fi
    108 
    109101# Update the netCDF file
    110102# controle(15) = periheli ! min. Sun-Mars distance (Mkm)  ̃206.66
     
    117109         -s "controle(15)=$aphelie" \
    118110         -s "controle(16)=$peri_day" \
    119          -s "controle(2)=$new_inisol" \
    120111         $name_file $name_file
    121112
     
    123114echo "New obliquit     = $new_obl"
    124115echo "New eccentricity = $new_ecc -> new periheli = $periheli"
    125 echo "                              -> new aphelie  = $aphelie"
     116echo "                                         -> new aphelie  = $aphelie"
    126117echo "New Lsp          = $new_Lsp -> new peri_day = $peri_day"
    127 echo "New initial Ls   = $new_iniLs -> New initial sol = $new_inisol"
    128118echo "Done!"
  • trunk/LMDZ.COMMON/libf/evolution/deftank/lib_launchPEM.sh

    r3649 r3666  
    181181        else # Mode: submitting jobs
    182182            cp PCMrun.job PCMrun${iPCM}.job
    183             sed -i -E "s/($name_job[^0-9]*)[0-9]+([^0-9]*)$/\1${iPCM}\2/" PCMrun${iPCM}.job
     183            sed -i -E "/^$name_job/s/(.*[^0-9])([0-9]+)(_[^0-9]*)?$/\1${iPCM}\3/" PCMrun${iPCM}.job
    184184            sed -i "s/^k=[0-9]\+$/k=$(echo "$ii - $3 + 2" | bc)/" PCMrun${iPCM}.job
    185185            jobID=$(eval "$submit_job PCMrun${iPCM}.job")
     
    208208            else # Mode: submitting jobs
    209209                cp PCMrun.job PCMrun${iPCM}.job
    210                 sed -i -E "s/($name_job[^0-9]*)[0-9]+([^0-9]*)$/\1${iPCM}\2/" PCMrun${iPCM}.job
     210                sed -i -E "/^$name_job/s/(.*[^0-9])([0-9]+)(_[^0-9]*)?$/\1${iPCM}\3/" PCMrun${iPCM}.job
    211211                sed -i "s/^k=[0-9]\+$/k=$(echo "$i - $3 + 2" | bc)/" PCMrun${iPCM}.job
    212212                jobID=$(eval "$submit_dependjob=afterok:${jobID} PCMrun${iPCM}.job")
     
    234234            fi
    235235        else # Mode: submitting jobs
    236             sed -i -E "s/($name_job[^0-9]*)[0-9]+([^0-9]*)$/\1${iPEM}\2/" PEMrun.job
     236            sed -i -E "/^$name_job/s/(.*[^0-9])([0-9]+)(_[^0-9]*)?$/\1${iPEM}\3/" PEMrun.job
    237237            jobID=$(eval "$submit_job PEMrun.job")
    238238            # Create a file to cancel the dependent jobs of the cycle
     
    264264            fi
    265265        else # Mode: submitting jobs
    266             sed -i -E "s/($name_job[^0-9]*)[0-9]+([^0-9]*)$/\1${iPEM}\2/" PEMrun.job
     266            sed -i -E "/^$name_job/s/(.*[^0-9])([0-9]+)(_[^0-9]*)?$/\1${iPEM}\3/" PEMrun.job
    267267            jobID=$(eval "$submit_dependjob=afterok:${jobID} PEMrun.job")
    268268            echo $kill_job $jobID >> kill_launchPEM.sh
  • trunk/LMDZ.COMMON/libf/evolution/deftank/visu_evol_layering.py

    r3460 r3666  
    151151### Processing
    152152stratif_data, max_top_elevation, longitude, latitude = process_files(folder_path,base_name)
     153if dz > max_top_elevation:
     154    print('The discretization step is higher than the maximum top elevation: please provide a correct value!')
     155    exit()
    153156ref_grid, gridded_stratif_data = interpolate_data(stratif_data,max_top_elevation,dz)
    154157date_time = read_infofile(infofile)
Note: See TracChangeset for help on using the changeset viewer.