source: trunk/LMDZ.MARS/deftank/pem/run_PEM1D.sh @ 3026

Last change on this file since 3026 was 3026, checked in by jbclement, 17 months ago

Mars PCM/PEM 1D:
Small fixes to be able to run the Mars PCM 1D without "water" + Improvements/addition of scripts in deftank/pem to run the PEM 1D model according to Laskar orbital parameters.
JBC

File size: 4.4 KB
RevLine 
[2980]1#!/bin/bash
2# Partition to run on:
3#MSUB -q rome
4# project to run on
5#MSUB -A  gen10391
6# disks to use
7#MSUB -m  scratch,work,store
8# Job name
9#MSUB -r run_PEM
10# Job standard output:
11#MSUB -o run_PEM.%I
12# Job standard error:
13#MSUB -e run_PEM.%I
14# number of OpenMP threads c
15#MSUB -c 1
16# number of MPI tasks n
17#MSUB -n 1
18# number of nodes to use N
19#MSUB -N 1
20# max job run time T (in seconds)
21#MSUB -T 860
22#MSUB -Q test
23# request exclusive use of the node (128 cores)
24##MSUB -x
25
26# A few parameters that might need be changed depending on your setup:
[3023]27# Path to the arch.env to source:
[2980]28source ../trunk/LMDZ.COMMON/arch.env
29
[3023]30#------------------ Modify here the name of PEM exe --------------------
31## fill in the name of executable for PEM:
32exePEM=pem_29_phymars_seq.e
[2980]33
[3023]34#------------------ Modify here the name of GCM exe --------------------
35## fill in the name of executable for GCM:
36exeGCM=testphys1d_29_phymars_para.e
[2980]37
[3023]38#-------------- Modify here the name of reshape XIOS exe ---------------
39## fill in the name of executable for reshape XIOS:
40exeReshape=reshape_XIOS_output_64x48x29_phymars_seq.e
[2980]41
[3023]42#---------------- Modify here the number of PEM calls ------------------
43## set the number of PEM calls:
44nPEM=1000
[2980]45
[3023]46#---------------- Modify here the number of GCM calls ------------------
47## set the number of GCM calls between each PEM call:
48nGCM=2
[2980]49
50
51
[3023]52#--------- Check if files/directories exist to be able to run ----------
53echo Starting script to call PEM with GCM!
54if [ ! -d "profiles" ]; then
55    mkdir profiles
56else
57    rm profiles/*
[2980]58fi
[3023]59if [ ! -d "diagfis" ]; then
60    mkdir diagfis
61else
62    rm diagfis/*
[2980]63fi
[3023]64if [ ! -d "startfis" ]; then
65    mkdir startfis
66else
67    rm startfis/*
[2980]68fi
[3023]69if [ ! -r "context_lmdz_physics.xml" ]; then
70    echo File context_lmdz_physics.xml does not exist!
71    exit 0
[2980]72fi
[3023]73if [ ! -r "field_def_physics_mars.xml" ]; then
74    echo File field_def_physics_mars.xml does not exist!
75    exit 0
76fi
77if [ ! -r "file_def_physics_mars.xml" ]; then
78    echo File file_def_physics_mars.xml does not exist!
79    exit 0
80fi
81if [ ! -r "iodef.xml" ]; then
82    echo File iodef.xml does not exist!
83    exit 0
84fi
85if [ ! -r "run_PEM.def" ]; then
86    echo File diagfi_PEM.def does not exist!
87    exit 0
88fi
89if [ ! -r "run_GCM.def" ]; then
90    echo File diagfi_GCM.def does not exist!
91    exit 0
92fi
93if [ ! -r "run_PEM.def" ]; then
94    echo File diagfi_PEM.def does not exist!
95    exit 0
96fi
97if [ ! -r "run_GCM.def" ]; then
98    echo File diagfi_GCM.def does not exist!
99    exit 0
100fi
[2980]101
[3023]102#---------------------------- Initialization ---------------------------
103iPEM=1
104((iGCM = ($iPEM - 1)*$nGCM + 1))
105cp startfi.nc startfis/
106cp startfi_PEM.nc startfis/
107for file in profile_*; do
108    cp $file profiles/${file}_0
109done
[2980]110
[3023]111#---------------------- Main loop to call PEM/GCM ----------------------
112while [ $iPEM -le $nPEM ]; do
113    #--- Loop to run GCM year by year
114    cp run_GCM.def run.def
115    cp diagfi_GCM.def diagfi.def
116    for ((i = 1; i <= $nGCM; i++)); do
117        echo Run GCM $iGCM: call $i out of $nGCM...
118        ./$exeGCM > lrun${iGCM} 2>&1
119        mv diagfi.nc diagfis/diagfi${iGCM}.nc
120        cp Xdiurnalave.nc diagfis/Xdiurnalave${iGCM}.nc
121        mv Xdiurnalave.nc data2reshape${i}.nc
122        cp restartfi.nc startfis/startfi${iGCM}.nc
123        mv restartfi.nc startfi.nc
124        for file in profile_out_*; do
125            cp $file profiles/${file/_out/}_${iGCM}
126            mv $file ${file/_out/}
127        done
128        ((iGCM++))
129        echo Done!
130    done
131    #--- Reshaping GCM data with XIOS
132    echo Reshaping GCM data with XIOS...
133    for i in $(ls datareshaped*); do
134        rm $i
135    done
136    ./$exeReshape
137    for file in datareshaped*; do
138        mv $file ${file/reshaped/_GCM_Y}
139    done
140    echo Done!
141     #--- Running PEM
142    echo Run PEM $iPEM...
143    cp run_PEM.def run.def
144    cp diagfi_PEM.def diagfi.def
145    mv startfi.nc startfi_evol.nc
146    ./$exePEM > mrun${iPEM} 2>&1
147    mv diagfi.nc diagfis/diagfi_PEM${iPEM}.nc
148    cp restartfi_evol.nc startfis/startfi_postPEM${iPEM}.nc
149    mv restartfi_evol.nc startfi.nc
150    cp restartfi_PEM.nc startfis/startfi_PEM${iPEM}.nc
151    mv restartfi_PEM.nc startfi_PEM.nc
152    for file in profile_out_*; do
153        cp $file profiles/${file/_out/}PEM_${iPEM}
154        mv $file ${file/_out/}
155    done
156    mv info_run_PEM.txt info_run_PEM${iPEM}.txt
157    ((iPEM++))
158    echo Done!
159done
[2980]160
[3023]161#---------------------- Preparation for relaunch  ----------------------
162echo Reinitializing starting files...
163cp startfis/startfi.nc .
164for file in profiles/*_0; do
165    cp $file ${file/_0/}
166done
[2980]167
[3023]168echo Script finished.
Note: See TracBrowser for help on using the repository browser.