Commit ee11c05c authored by Michal Bursa's avatar Michal Bursa
Browse files

added scripts for stage1 gray model

parent a83fe13e
#!/bin/bash
cd "$(dirname "$0")"
REV=0
test "$1" == "1" && REV=1
# determine current, previous and next ring folder
THISID=$(basename `pwd` | sed -e 's/0\+//')
PREVID=$(printf "%04d" $(($THISID - 1)))
NEXTID=$(printf "%04d" $(($THISID + 1)))
#if [ ! -e stage.15 ]; then
# echo "$THISID: no fort.15 file - run LTE first"
# exit 1
#fi
#
#NAN=$(cat fort.15 | grep NaN | wc -l)
#if [ $NAN -eq "0" ]; then exit; fi
#test $NAN -eq "0" && (exit 1)
if [ -e stage1.15 ] && [ `grep "NaN" stage1.15 |wc -l` -eq 0 ]; then
echo "Ring $(basename `pwd`) seem to be converged ... skipping"
exit 1
fi
TEMP=$(cat param-T)
GRAV=$(cat param-Q)
SIGM=$(cat param-S)
echo 1 > fort.1
cp run.5.skeleton stage1.5
sed -i s/%TEMP%/$TEMP/g stage1.5
sed -i s/%GRAV%/$GRAV/g stage1.5
sed -i s/%SIGM%/$SIGM/g stage1.5
sed -i s/%LTE%/T/g stage1.5
sed -i s/%LTEGRAY%/F/g stage1.5
sed -i s/%PARAMS%/\'stage1.5.params\'/g stage1.5
sed -i s/%OUTPUT%/\'stage1\'/g stage1.5
cp run.params.skeleton stage1.5.params
sed -i s/%PARAMS%//g stage1.5.params
# try prev first: if it exists and has converged, copy stage1.7 from there and run again
echo "$THISID: testing lte-gray from prev"
if [ $REV -ne "1" ] && [ -e ../$PREVID/stage1.15 ] && [ -e ../$PREVID/stage1.7 ] && [ `grep "NaN" ../$PREVID/stage1.15|wc -l` -eq "0" ]; then
echo "$THISID: running lte-gray on $(basename `pwd`) from $PREVID"
cp ../$PREVID/stage1.7 ./fort.8
./t205 < stage1.5 > stage1.6 2>stage1.err
LANG= rename -f 's/fort/stage1/' fort.*
fi
# retest for converged result, if OK then exit
NAN=$(cat stage1.15 | grep NaN | wc -l)
if [ $NAN -eq "0" ]; then exit; fi
# try with next: if it exists and has converged, copy stage1.7 from there and run again
echo "$THISID: testing lte-gray from next"
if [ -e ../$NEXTID/stage1.15 ] && [ -e ../$NEXTID/stage1.7 ] && [ `grep "NaN" ../$NEXTID/stage1.15 |wc -l` -eq "0" ]; then
echo "$THISID: running lte-gray on $(basename `pwd`) from $NEXTID"
cp ../$NEXTID/stage1.7 ./fort.8
./t205 < stage1.5 > stage1.6 2>stage1.err
LANG= rename -f 's/fort/stage1/' fort.*
fi
# retest for converged result, if OK then exit
NAN=$(cat stage1.15 | grep NaN | wc -l)
if [ $NAN -ne "0" ]; then echo "$THISID: NO CONVERGENCE CAN BE REACHED"; fi
#!/bin/bash
cd "$(dirname "$0")"
REV=0
test "$1" == "1" && REV=1
# determine current, previous and next ring folder
THISID=$(basename `pwd` | sed -e 's/0\+//')
PREVID=$(printf "%04d" $(($THISID - 1)))
NEXTID=$(printf "%04d" $(($THISID + 1)))
if [ $REV -eq "0" ]; then
PREVID=$NEXTID
fi
#echo "$(pwd) $PREVID"
#sleep 5
#exit
#if [ ! -e stage.15 ]; then
# echo "$THISID: no fort.15 file - run LTE first"
# exit 1
#fi
#
#NAN=$(cat fort.15 | grep NaN | wc -l)
#if [ $NAN -eq "0" ]; then exit; fi
#test $NAN -eq "0" && (exit 1)
#
#if [ -e stage1.15 ] && [ `grep "NaN" stage1.15 |wc -l` -eq 0 ]; then
# echo "Ring $(basename `pwd`) seem to be converged ... skipping"
# exit 1
#fi
if [ $(cat ../$PREVID/stage1.15|grep NaN|wc -l) -ne "0" ]; then
echo "$THISID: NO CONVERGENCE CAN BE REACHED"
exit 0
fi
# ----- round one ------------------
TEMP=$(cat ../$PREVID/param-T)
GRAV=$(cat param-Q)
SIGM=$(cat param-S)
cp run.5.skeleton stage1.5
sed -i s/%TEMP%/$TEMP/g stage1.5
sed -i s/%GRAV%/$GRAV/g stage1.5
sed -i s/%SIGM%/$SIGM/g stage1.5
sed -i s/%LTE%/T/g stage1.5
sed -i s/%LTEGRAY%/F/g stage1.5
sed -i s/%PARAMS%/\'stage1.5.params\'/g stage1.5
sed -i s/%OUTPUT%/\'stage1\'/g stage1.5
cp run.params.skeleton stage1.5.params
sed -i s/%PARAMS%//g stage1.5.params
echo "$THISID: running lte-gray on $(basename `pwd`) from $PREVID - phase 1"
echo 1 > fort.1
cp ../$PREVID/stage1.7 ./fort.8
./t205 < stage1.5 > stage1.6 2>stage1.err
if [ $(cat stage1.15|grep NaN|wc -l) -ne "0" ]; then
echo "$THISID: NO CONVERGENCE CAN BE REACHED"
exit 0
fi
# ----- round two ------------------
TEMP=$(cat param-T)
GRAV=$(cat param-Q)
SIGM=$(cat param-S)
cp run.5.skeleton stage1.5
sed -i s/%TEMP%/$TEMP/g stage1.5
sed -i s/%GRAV%/$GRAV/g stage1.5
sed -i s/%SIGM%/$SIGM/g stage1.5
sed -i s/%LTE%/T/g stage1.5
sed -i s/%LTEGRAY%/F/g stage1.5
sed -i s/%PARAMS%/\'stage1.5.params\'/g stage1.5
sed -i s/%OUTPUT%/\'stage1\'/g stage1.5
cp run.params.skeleton stage1.5.params
sed -i s/%PARAMS%//g stage1.5.params
echo "$THISID: running lte-gray on $(basename `pwd`) from $PREVID - phase 2"
echo 1 > fort.1
cp ./stage1.7 ./fort.8
./t205 < stage1.5 > stage1.6 2>stage1.err
if [ $(cat stage1.15|grep NaN|wc -l) -ne "0" ]; then
echo "$THISID: NO CONVERGENCE CAN BE REACHED"
exit 0
fi
#!/bin/bash
SRCMODELDIR=$1
if [ "$SRCMODELDIR" == "" ]; then
echo "Specify src dir"
exit 0
fi
if [ ! -e $SRCMODELDIR ]; then
echo "Invalid src dir"
exit 0
fi
cd "$(dirname "$0")"
if [ -e stage1.15 ] && [ $(cat stage1.15 | grep NaN | wc -l) -eq "0" ]; then
echo "$(dirname "$0") OK ... skipping"
exit 0
fi
SRCTEMP=$(cat $SRCMODELDIR/param-T)
SRCGRAV=$(cat $SRCMODELDIR/param-Q)
SRCSIGM=$(cat $SRCMODELDIR/param-S)
TEMP=$(cat param-T)
GRAV=$(cat param-Q)
SIGM=$(cat param-S)
rm -f fort.* stage1.*
echo 1 > fort.1
cp $SRCMODELDIR/stage1.7 ./stage1.7
for W in 0.01 0.02 0.05 0.1 0.2 0.4 0.6 0.8 0.9 1.0; do
CURRENT_TEMP=$(perl -e "printf('%.5e',$SRCTEMP*(1.0-$W) + $TEMP*$W)")
CURRENT_GRAV=$(perl -e "printf('%.5e',$SRCGRAV*(1.0-$W) + $GRAV*$W)")
CURRENT_SIGM=$(perl -e "printf('%.5e',$SRCSIGM*(1.0-$W) + $SIGM*$W)")
echo "W:$W T:$CURRENT_TEMP/$TEMP T:$CURRENT_GRAV/$GRAV T:$CURRENT_SIGM/$SIGM"
cp run.5.skeleton stage1.5
sed -i s/%TEMP%/$CURRENT_TEMP/g stage1.5
sed -i s/%GRAV%/$CURRENT_GRAV/g stage1.5
sed -i s/%SIGM%/$CURRENT_SIGM/g stage1.5
sed -i s/%LTE%/T/g stage1.5
sed -i s/%LTEGRAY%/F/g stage1.5
sed -i s/%PARAMS%/\'stage1.5.params\'/g stage1.5
sed -i s/%OUTPUT%/\'stage1\'/g stage1.5
cp run.params.skeleton stage1.5.params
sed -i s/%PARAMS%//g stage1.5.params
cp stage1.7 fort.8
./t205 < stage1.5 > stage1.6 2>stage1.err
LANG= rename -f 's/fort/stage1/' fort.*
if [ ! -e stage1.15 ] || [ $(cat stage1.15 | grep NaN | wc -l) -ne "0" ]; then
echo "NO CONVERGENCE"
exit 0
fi
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment