Skip to content

Commit

Permalink
Simplify Spiegelman run script
Browse files Browse the repository at this point in the history
  • Loading branch information
gassmoeller committed Nov 22, 2024
1 parent c938b83 commit c85dd7b
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,48 +28,45 @@ for i_BV in "1e23" "1e24" "5e24"; do # Background viscosity


# Now run Newton solver models with varying solver paramters
for i_NSP in "SPD" "none"; do # Newton stabilization preconditioner
for i_NSA in "SPD" "none"; do # Newton stabilization A block of matrix
for i_UFS in "false"; do # Use Newton failsafe
for i_P in 0 5 15 25 150; do # Minimum Picard iterations, note 150 represents pure defect-correction Picard
for i_MLT in "9e-1" "1e-8"; do # Maximum linear tolerance
for i_RSM in "false"; do # Residual scaling method
for i_stabilization in "SPD" "none"; do # Newton stabilization
for i_UFS in "false"; do # Use Newton failsafe
for i_P in 0 5 15 25 150; do # Minimum Picard iterations, note 150 represents pure defect-correction Picard
for i_MLT in "9e-1" "1e-8"; do # Maximum linear tolerance
for i_RSM in "false"; do # Residual scaling method
U="7.92219116e-11"
if [ $i_vel == 25 ]; then
U="7.92219116e-11"
if [ $i_vel == 25 ]; then
U="7.92219116e-11"
elif [ $i_vel == 50 ]; then
U="1.58443823e-10"
elif [ $i_vel == 125 ]; then
U="3.96109558e-10"
fi
elif [ $i_vel == 50 ]; then
U="1.58443823e-10"
elif [ $i_vel == 125 ]; then
U="3.96109558e-10"
fi

dirname_base="singleAdvectionandNewtonStokes""_UFS_${i_UFS}_NSP_${i_NSP}_NSA_${i_NSA}_mLT_${i_MLT}_P${i_P}_RSM_${i_RSM}_vel_${i_vel}_BV_${i_BV}"
dirname="results/$dirname_base"
infilename="${dirname}/input.prm"
outfilename="${dirname}/output.log"
errorfilename="${dirname}/error.log"
outplotfilename="${dirname}/plot.dat"
echo "Starting $dirname"
mkdir -p $dirname
cp "$infile" "$dirname/$infile"
dirname_base="singleAdvectionandNewtonStokes""_UFS_${i_UFS}_NS_${i_stabilization}_mLT_${i_MLT}_P${i_P}_RSM_${i_RSM}_vel_${i_vel}_BV_${i_BV}"
dirname="results/$dirname_base"
infilename="${dirname}/input.prm"
outfilename="${dirname}/output.log"
errorfilename="${dirname}/error.log"
outplotfilename="${dirname}/plot.dat"

echo "Starting $dirname"
mkdir -p $dirname
cp "$infile" "$dirname/$infile"

sed \
-e "s/set Function expression = if(x<60e3,.*/ set Function expression = if(x<60e3,$U,-$U);0/g" \
-e "s/set Reference viscosity .*/ set Reference viscosity = $i_BV/g" \
-e "s/set Output directory .*/set Output directory = results\/$dirname_base/g" \
-e "s/set Max pre-Newton nonlinear iterations .*/ set Max pre-Newton nonlinear iterations = $i_P/g" \
-e "s/set Use Newton failsafe .*/set Use Newton failsafe = $i_UFS/g" \
-e "s/set Stabilization preconditioner .*/set Stabilization preconditioner = $i_NSP/g" \
-e "s/set Stabilization velocity block .*/set Stabilization velocity block = $i_NSA/g" \
-e "s/set Maximum linear Stokes solver tolerance .*/set Maximum linear Stokes solver tolerance = $i_MLT/g" \
-e "s/set Use Newton residual scaling method .*/ set Use Newton residual scaling method = $i_RSM/g" \
input.prm > "$infilename"
sed \
-e "s/set Function expression = if(x<60e3,.*/ set Function expression = if(x<60e3,$U,-$U);0/g" \
-e "s/set Reference viscosity .*/ set Reference viscosity = $i_BV/g" \
-e "s/set Output directory .*/set Output directory = results\/$dirname_base/g" \
-e "s/set Max pre-Newton nonlinear iterations .*/ set Max pre-Newton nonlinear iterations = $i_P/g" \
-e "s/set Use Newton failsafe .*/set Use Newton failsafe = $i_UFS/g" \
-e "s/set Stabilization preconditioner .*/set Stabilization preconditioner = $i_stabilization/g" \
-e "s/set Stabilization velocity block .*/set Stabilization velocity block = $i_stabilization/g" \
-e "s/set Maximum linear Stokes solver tolerance .*/set Maximum linear Stokes solver tolerance = $i_MLT/g" \
-e "s/set Use Newton residual scaling method .*/ set Use Newton residual scaling method = $i_RSM/g" \
input.prm > "$infilename"

nohup mpirun -np $processes ./aspect-release $infilename > $outfilename 2>$errorfilename
grep "Relative nonlinear residual " $outfilename > $outplotfilename

done
nohup mpirun -np $processes ./aspect-release $infilename > $outfilename 2>$errorfilename
grep "Relative nonlinear residual " $outfilename > $outplotfilename
done
done
done
Expand Down
Loading

0 comments on commit c85dd7b

Please sign in to comment.