Skip to content
Snippets Groups Projects
Commit bc2a37f2 authored by Lluis Fita Borrell's avatar Lluis Fita Borrell
Browse files

Introducing the use of the WRF4L structure

parent df051664
Branches
No related tags found
No related merge requests found
......@@ -41,6 +41,12 @@ mainn='launch_real_intel.bash'
#######
errormsg="ERROR -- error -- ERROR -- error"
## hdyra
wrf4lHOME=/home/lluis.fita/estudios/workflows/direct/WRF/hydra
shHOME=${wrf4lHOME}/../../../components/bats
pyHOME=${wrf4lHOME}/../../../components/python3
echo $(basename $BASH_SOURCE)
echo " input folder: "${idir}
echo " output folder: "${odir}
......@@ -115,7 +121,7 @@ if test ! -f ${lastwrfbdy}; then
echo " output folder: "${odir}
mv rsl.* ${odir}
cp namelist.input ${odir}
exit
exit -1
fi
mv wrf*d* ${odir}
......@@ -124,10 +130,11 @@ mv wrf*d* ${odir}
rsls='error out'
for rsln in ${rsls}; do
rm rsl.${rsln}.tar >& /dev/null
tar cvf rsl.${rsln}.tar rsl.${rsln}.*
if test $? -eq 0; then rm -f rsl.${rsln}.*; fi
tar cvf rsl.${rsln}.tar rsl.${rsln}.????
if test $? -eq 0; then rm -f rsl.${rsln}.????; fi
done
mv rsl.*.tar ${odir}
cp namelist.input ${odir}
cp namelist.output ${odir}
mv ${olog} ${odir}
......
......@@ -35,10 +35,17 @@ odir=/media/lluis/ExtDiskF_ext4/DATA/EXPS/Fastest/rlpg_cdxwrf2/run/outwrf
# Wether outpuit directory should be cleaned before moving outputs
clean=true
mainn='launch_wrf_intel.bash'
####### #######
## MAIN
#######
errormsg='ERROR -- error -- ERROR -- error'
errormsg="ERROR -- error -- ERROR -- error"
## hdyra
wrf4lHOME=/home/lluis.fita/estudios/workflows/direct/WRF/hydra
shHOME=${wrf4lHOME}/../../../components/bats
pyHOME=${wrf4lHOME}/../../../components/python3
echo $(basename $BASH_SOURCE)
echo " input folder: "${idir}
......@@ -53,15 +60,15 @@ cd $PBS_O_WORKDIR
#ulimit -s unlimited
echo $(basename $BASH_SOURCE)
echo " input folder: "${idir}
echo " output folder: "${odir}
execn='wrf'
olog=run_${execn}.log
mkdir -p ${odir}
if ${clean}; then
rm wrf*d*
rm rsl.*
rm ${odir}/*
rm ${olog}
rm rsl.*
rm ${PBS_JOBNAME}.o*
fi
......@@ -74,11 +81,20 @@ if test $? -ne 0; then
fi
echo "Period of simulation: "${period}
Ndom=`${shHOME}/namelist_value.bash namelist.input max_dom`
if test $? -ne 0; then
echo ${errormsg}
echo "Script failed !!"
echo ${shHOME}/namelist_value.bash namelist.input max_dom
exit -1
fi
NdomS=`printf "%02d" ${Ndom}`
startdate=`echo ${period} | tr '-' ' ' | awk '{print $1}'`
startdateWRF=`${shHOME}/dates_transform.bash ${startdate} YmdH WRFdate`
startdateS=`${shHOME}/dates_transform.bash ${startdate} YmdH YmdHMS`
firstrst=wrfrst_d01_${startdateWRF}
firstrst=wrfrst_d${NdomS}_${startdateWRF}
irst=wrfrst_${startdateS}.tar
isrestart=`${shHOME}/namelist_value.bash namelist.input restart`
if test $? -ne 0; then
......@@ -107,7 +123,7 @@ enddate=`echo ${period} | tr '-' ' ' | awk '{print $2}'`
enddateWRF=`${shHOME}/dates_transform.bash ${enddate} YmdH WRFdate`
enddateS=`${shHOME}/dates_transform.bash ${enddate} YmdH YmdHMS`
lastrst=wrfrst_d01_${enddateWRF}
lastrst=wrfrst_d${NdomS}_${enddateWRF}
if test -f ${odir}/${lastrst}; then
echo ${errormsg}
echo " Last restart file named '"${odir}/${lastrst}"' exists !!"
......@@ -118,13 +134,12 @@ fi
ln -s ${idir}/wrf*d* ./
execn='wrf'
ls -la ${execn}.exe
date
mpirun -np ${Nprocs} ./${execn}.exe >& run_${execn}.log
mpirun -np ${Nprocs} ./${execn}.exe >& ${olog}
if test $? -ne 0; then
echo ${errormsg}
echo ${execn}".exe failed !!"
echo " "${mainn}": ${execn}".exe failed !!"
mv rsl* ${odir}
cp namelist.input ${odir}
exit -1
......@@ -133,7 +148,6 @@ date
# Moving outputs
##
if test ! -f ${lastrst} && test ! -f ${lastrst}_0000; then
echo ${errormsg}
echo " Simulation failed !!"
......@@ -148,6 +162,7 @@ mv wrfout*d* ${odir}
mv wrfxtrm*d* ${odir}
mv wrfpres*d* ${odir}
mv wrfcdx*d* ${odir}
mv wrfhfcdx*d* ${odir}
orst=wrfrst_${enddateS}.tar
tar cvf ${orst} wrfrst_d*_${enddateWRF}*
if test $? -eq 0; then
......@@ -159,16 +174,17 @@ fi
rsls='error out'
for rsln in ${rsls}; do
rm rsl.${rsln}.tar >& /dev/null
tar cvf rsl.${rsln}.tar rsl.${rsln}.*
if test $? -eq 0; then rm -f rsl.${rsln}.*; fi
tar cvf rsl.${rsln}.tar rsl.${rsln}.????
if test $? -eq 0; then rm -f rsl.${rsln}.????; fi
done
mv rsl.*.tar ${odir}
mv run_${execn}.log ${odir}
cp namelist.input ${odir}
cp namelist.output ${odir}
mv ${olog} ${odir}
cp launch_mpi-wrf.bash ${odir}
Ntsfiles=`ls -1 *.d01.TS | wc -l | awk '{print $1}'`
Ntsfiles=`ls -1 *.d${NdomS}.TS | wc -l | awk '{print $1}'`
tsfiles=`ls -1 *.d*.TS`
tsfiletypes='PH:QV:TS:VV:PR:TH:UU:WW'
if test ${Ntsfiles} -ne 0; then
......@@ -186,5 +202,5 @@ if test ${Ntsfiles} -ne 0; then
done
fi
echo "Success simulation !!"
echo ${mainn}": Success simulation !!"
echo "All outputs are at "${odir}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment