From eaadf34c068aa004ce821a7eab627ef1e8af2b7c Mon Sep 17 00:00:00 2001 From: Felix <feh7@hi.is> Date: Sat, 24 Apr 2021 17:57:53 +0000 Subject: [PATCH] script for running different scenarios --- openfoam2012/.gitignore | 1 + openfoam2012/freeCylinderFlow/continue.sh | 15 +++++++++++++++ openfoam2012/runmany.sh | 19 +++++++++++++++---- 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 openfoam2012/.gitignore create mode 100755 openfoam2012/freeCylinderFlow/continue.sh mode change 100644 => 100755 openfoam2012/runmany.sh diff --git a/openfoam2012/.gitignore b/openfoam2012/.gitignore new file mode 100644 index 0000000..eb4ce36 --- /dev/null +++ b/openfoam2012/.gitignore @@ -0,0 +1 @@ +wrong_velocities diff --git a/openfoam2012/freeCylinderFlow/continue.sh b/openfoam2012/freeCylinderFlow/continue.sh new file mode 100755 index 0000000..df6e6dc --- /dev/null +++ b/openfoam2012/freeCylinderFlow/continue.sh @@ -0,0 +1,15 @@ +#! /usr/bin/env sh +set -e +# f = force = do not error on nonexisting files +rm -rf 'postProcessing/patchAverage(name=cylinder,mag(grad(T)))' +rm -rf '0/grad(T)' +rm -rf '0/mag(grad(T))' + +decomposePar -force +foamJob -wait -p buoyantBoussinesqPimpleFoam +reconstructPar + +# Calculate the average of the magnitude of the temperature gradient +postProcess -func 'grad(T)' +postProcess -func 'mag(grad(T))' +postProcess -func 'patchAverage(name=cylinder,mag(grad(T)))' diff --git a/openfoam2012/runmany.sh b/openfoam2012/runmany.sh old mode 100644 new mode 100755 index e5c155b..09c532f --- a/openfoam2012/runmany.sh +++ b/openfoam2012/runmany.sh @@ -1,15 +1,26 @@ #! /usr/bin/env sh set -e -top="${pwd}" +echo "" >> runmany.archive +touch runmany.log +cat runmany.log >> runmany.archive 2> /dev/null +echo "" > runmany.log +top="$(pwd)" for n in 1 2 do - for logu in -1 0 1 2 + for logu in -2 -1 0 1 do + cd "${top}" new="freeCylinderFlow-N${n}-u${logu}" + if test -d "${new}" + then + echo "skip ${new}" >> runmany.log + continue # done in previous run, hopefully + fi + echo "copy and run ${new}" >> runmany.log cp -r freeCylinderFlow ${new} cd "${new}" - sed -i 's#^inVelocity .*;$#inVelocity 2e'"${logu}"';' parameters - grep --quiet "2e${logu}" parameters # should crash script if grep does not find it + sed -i 's#^inVelocity .*;$#inVelocity 5e'"${logu}"';#' parameters + grep --quiet "5e${logu}" parameters # should crash script if grep does not find it ./run.sh $n done done -- GitLab