Ignore:
Timestamp:
Jul 18, 2013, 8:33:04 AM (11 years ago)
Author:
emillour
Message:

Mars GCM:

  • Bug fix: when running with photochemistry, ccns did not sediment! Fixed initracer.F. Also added that callsedim/newsedim use updated temperatures.
  • Converted run0 and run_mcd scripts to bash.

EM

Location:
trunk/LMDZ.MARS/deftank
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/deftank/run0

    r758 r1005  
    1 #!/bin/csh
     1#!/bin/bash
    22###########################################################################
    33# Script to perform several chained LMD Mars GCM simulations
    44# SET HERE the maximum total number of simulations
    55
    6 set nummax=1
     6nummax=1
    77
    88###########################################################################
     
    1212echo "starting run0"
    1313
    14 set dir=`pwd`
    15 set machine=`hostname`
    16 set address=`whoami`
     14dir=`pwd`
     15machine=`hostname`
     16address=`whoami`
    1717
    1818# Look for file "num_run" which should contain
    1919# the value of the previously computed season
    2020# (defaults to 0 if file "num_run" does not exist)
    21 if ( -f num_run ) then
    22  echo "found file num_run"
    23   set numold=`cat num_run`
     21if [[ -r num_run ]] ; then
     22  echo "found file num_run"
     23  numold=`cat num_run`
    2424else
    25   set numold=0
    26 endif
     25  numold=0
     26fi
    2727echo "numold is set to" ${numold}
    2828
    2929
    3030# Set value of current season
    31 set numnew=${numold}
    32 @ numnew = ${numnew} + 1
     31(( numnew = ${numold} + 1 ))
    3332echo "numnew is set to" ${numnew}
    3433
    3534# Look for initialization data files (exit if none found)
    36 if ( ( -f start${numold}.nc ) && ( -f startfi${numold}.nc ) ) then
     35if [[ ( -r start${numold}.nc  &&  -r startfi${numold}.nc ) ]] ; then
    3736   \cp -f start${numold}.nc start.nc
    3837   \cp -f startfi${numold}.nc startfi.nc
    39 else if ( ${numold} == 99999 ) then
     38else
     39   if (( ${numold} == 99999 )) ; then
    4040    echo "No run because previous run crashed ! (99999 in num_run)"
    4141    exit
    42 else
     42   else
    4343   echo "Where is file start"${numold}".nc??"
    4444   exit
    45 endif
     45   fi
     46fi
    4647
    4748
    4849# Run GCM
    49 gcm.e >! lrun${numnew}
     50gcm.e > lrun${numnew}
    5051
    5152
    5253# Check if run ended normaly and copy datafiles
    53 if ( ( -f restartfi.nc ) && ( -f restart.nc ) ) then
     54if [[ ( -r restartfi.nc  &&  -r restart.nc ) ]] ; then
    5455  echo "Run seems to have ended normaly"
    5556  \mv -f restartfi.nc startfi${numnew}.nc
    5657  \mv -f restart.nc start${numnew}.nc
    5758else
    58   if ( -f num_run ) then
     59  if [[ -r num_run ]] ; then
    5960    \mv -f num_run num_run.crash
    6061  else
    6162    echo "No file num_run to build num_run.crash from !!"
    6263    # Impose a default value of 0 for num_run
    63     echo 0 >! num_run.crash
    64   endif
    65  echo 99999 >! num_run
     64    echo 0 > num_run.crash
     65  fi
     66 echo 99999 > num_run
    6667############## To receive an Email message if the run crashes ########
    6768mail -s "crash run GCM" $address <<ENDMAIL
     
    7071############################################""
    7172 exit
    72 endif
     73fi
    7374
    7475# Copy other datafiles that may have been generated
    75 if ( -f diagfi.nc ) then
     76if [[ -r diagfi.nc ]] ; then
    7677  \mv -f diagfi.nc diagfi${numnew}.nc
    77 endif
    78 if ( -f diagsoil.nc ) then
     78fi
     79if [[ -r diagsoil.nc ]] ; then
    7980  \mv -f diagsoil.nc diagsoil${numnew}.nc
    80 endif
    81 if ( -f stats.nc ) then
     81fi
     82if [[ -r stats.nc ]] ; then
    8283  \mv -f stats.nc stats${numnew}.nc
    83 endif
    84 if ( -f profiles.dat ) then
     84fi
     85if [[ -f profiles.dat ]] ; then
    8586  \mv -f profiles.dat profiles${numnew}.dat
    8687  \mv -f profiles.hdr profiles${numnew}.hdr
    87 endif
     88fi
    8889
    8990# Prepare things for upcoming runs by writing
    9091# value of computed season in file num_run
    91 echo ${numnew} >! num_run
     92echo ${numnew} > num_run
    9293
    9394# If we are over nummax : stop
    94 if ( `expr $numnew + 1 \> $nummax ` == 1) then
     95if (( $numnew + 1 > $nummax )) ; then
    9596   exit
    9697else
    9798   \cp -f run0 exe_mars
    98    exe_mars
    99 endif
     99   ./exe_mars
     100fi
    100101
    101102
  • trunk/LMDZ.MARS/deftank/run_mcd

    r38 r1005  
    1 #!/bin/csh
     1#!/bin/bash
    22##############################################################################
    33# Script to run successive monthly (a month spans 30 deg. in Ls)
     
    2626
    2727# 12 martian months (=30°deg Ls) of unequal length (excentric orbit)
    28   sed s/9999/61/ run.def.ref >! run.def ; run0 >>& error     #1
    29   sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #2
    30   sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #3
    31   sed s/9999/65/ run.def.ref >! run.def ; run0 >>& error     #4
    32   sed s/9999/60/ run.def.ref >! run.def ; run0 >>& error     #5
    33   sed s/9999/54/ run.def.ref >! run.def ; run0 >>& error     #6
    34   sed s/9999/50/ run.def.ref >! run.def ; run0 >>& error     #7
    35   sed s/9999/46/ run.def.ref >! run.def ; run0 >>& error     #8
    36   sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #9
    37   sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #10
    38   sed s/9999/51/ run.def.ref >! run.def ; run0 >>& error     #11
    39   sed s/9999/56/ run.def.ref >! run.def ; run0 >>& error     #12
     28  sed s/9999/61/ run.def.ref > run.def ; run0 >> error     #1
     29  sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #2
     30  sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #3
     31  sed s/9999/65/ run.def.ref > run.def ; run0 >> error     #4
     32  sed s/9999/60/ run.def.ref > run.def ; run0 >> error     #5
     33  sed s/9999/54/ run.def.ref > run.def ; run0 >> error     #6
     34  sed s/9999/50/ run.def.ref > run.def ; run0 >> error     #7
     35  sed s/9999/46/ run.def.ref > run.def ; run0 >> error     #8
     36  sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #9
     37  sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #10
     38  sed s/9999/51/ run.def.ref > run.def ; run0 >> error     #11
     39  sed s/9999/56/ run.def.ref > run.def ; run0 >> error     #12
    4040#
    4141# 12 martian months (=30°deg Ls) of unequal length (excentric orbit)
    42 # sed s/9999/61/ run.def.ref >! run.def ; run0 >>& error     #13
    43 # sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #14
    44 # sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #15
    45 # sed s/9999/65/ run.def.ref >! run.def ; run0 >>& error     #16
    46 # sed s/9999/60/ run.def.ref >! run.def ; run0 >>& error     #17
    47 # sed s/9999/54/ run.def.ref >! run.def ; run0 >>& error     #18
    48 # sed s/9999/50/ run.def.ref >! run.def ; run0 >>& error     #19
    49 # sed s/9999/46/ run.def.ref >! run.def ; run0 >>& error     #20
    50 # sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #21
    51 # sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #22
    52 # sed s/9999/51/ run.def.ref >! run.def ; run0 >>& error     #23
    53 # sed s/9999/56/ run.def.ref >! run.def ; run0 >>& error     #24
     42# sed s/9999/61/ run.def.ref > run.def ; run0 >> error     #13
     43# sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #14
     44# sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #15
     45# sed s/9999/65/ run.def.ref > run.def ; run0 >> error     #16
     46# sed s/9999/60/ run.def.ref > run.def ; run0 >> error     #17
     47# sed s/9999/54/ run.def.ref > run.def ; run0 >> error     #18
     48# sed s/9999/50/ run.def.ref > run.def ; run0 >> error     #19
     49# sed s/9999/46/ run.def.ref > run.def ; run0 >> error     #20
     50# sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #21
     51# sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #22
     52# sed s/9999/51/ run.def.ref > run.def ; run0 >> error     #23
     53# sed s/9999/56/ run.def.ref > run.def ; run0 >> error     #24
    5454#
    5555# 12 martian months (=30°deg Ls) of unequal length (excentric orbit)
    56 # sed s/9999/61/ run.def.ref >! run.def ; run0 >>& error     #25
    57 # sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #26
    58 # sed s/9999/66/ run.def.ref >! run.def ; run0 >>& error     #27
    59 # sed s/9999/65/ run.def.ref >! run.def ; run0 >>& error     #28
    60 # sed s/9999/60/ run.def.ref >! run.def ; run0 >>& error     #29
    61 # sed s/9999/54/ run.def.ref >! run.def ; run0 >>& error     #30
    62 # sed s/9999/50/ run.def.ref >! run.def ; run0 >>& error     #31
    63 # sed s/9999/46/ run.def.ref >! run.def ; run0 >>& error     #32
    64 # sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #33
    65 # sed s/9999/47/ run.def.ref >! run.def ; run0 >>& error     #34
    66 # sed s/9999/51/ run.def.ref >! run.def ; run0 >>& error     #35
    67 # sed s/9999/56/ run.def.ref >! run.def ; run0 >>& error     #36
     56# sed s/9999/61/ run.def.ref > run.def ; run0 >> error     #25
     57# sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #26
     58# sed s/9999/66/ run.def.ref > run.def ; run0 >> error     #27
     59# sed s/9999/65/ run.def.ref > run.def ; run0 >> error     #28
     60# sed s/9999/60/ run.def.ref > run.def ; run0 >> error     #29
     61# sed s/9999/54/ run.def.ref > run.def ; run0 >> error     #30
     62# sed s/9999/50/ run.def.ref > run.def ; run0 >> error     #31
     63# sed s/9999/46/ run.def.ref > run.def ; run0 >> error     #32
     64# sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #33
     65# sed s/9999/47/ run.def.ref > run.def ; run0 >> error     #34
     66# sed s/9999/51/ run.def.ref > run.def ; run0 >> error     #35
     67# sed s/9999/56/ run.def.ref > run.def ; run0 >> error     #36
    6868
    6969# These last lines allow to reconstruct the last num_run after a model crash
    7070# (because after crash, num_run was set to 9999 so that no further simulation
    7171# Could be performed
    72    set number=`cat num_run`
    73    if ( $number == 99999) then
     72   number=`cat num_run`
     73   if (( $number == 99999)) ; then
    7474      set numold=`cat num_run.crash`
    75       echo '-----' >>& error
    76       echo 'Seasonal simulation aborted after starting from start'$numold >>& error
     75      echo '-----' >> error
     76      echo 'Seasonal simulation aborted after starting from start'$numold >> error
    7777      \mv -f num_run.crash num_run 
    78    endif
     78   fi
Note: See TracChangeset for help on using the changeset viewer.