Skip to content

Commit

Permalink
Merge pull request #81 from zenotech/ProblemNomenclatureChange
Browse files Browse the repository at this point in the history
ZCFD-598 Updates to support change to zcfd command line ('problem' to 'mesh' change)
  • Loading branch information
mike-jt79 authored Mar 23, 2023
2 parents 10ce389 + d7a4960 commit 42f5413
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
12 changes: 11 additions & 1 deletion share/mycluster-zcfd-fsi.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ chmod +x abaqus.sub
srun --pack-group=1 --exclusive -n 1 -N 1 --ntasks-per-node=2 --cpus-per-task=1 $ZCFD_HOME/run_cse $FSI_XML > cse.log 2>&1 &
srun --pack-group=2 --exclusive -n 1 -N 1 --ntasks-per-node=2 --cpus-per-task=1 abaqus.sub &

$ZCFD_HOME/run_zcfd --ntask $NUM_TASKS --tpn $TASKS_PER_NODE -p $PROBLEM -c $CASE >& ${CASE}_log
# probably not needed but included for safety
if [ ! -z ${PROBLEM+x}]; then
if [ -z ${MESH+x}]; then
echo "Legacy nomenclature (PROBLEM not MESH) used. Setting MESH=PROBLEM."
MESH=${PROBLEM}
else
echo "Both PROBLEM and MESH set. MESH is the environment variable which will be used."
fi
fi

$ZCFD_HOME/run_zcfd --ntask $NUM_TASKS --tpn $TASKS_PER_NODE -m $MESH -c $CASE >& ${CASE}_log

exitcode=$?

Expand Down
22 changes: 16 additions & 6 deletions share/mycluster-zcfd.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,41 @@ source ${ZCFD_HOME:?"ZCFD_HOME has not been set. Please set it and run this scri

if [ -z ${OVERRIDE+x} ]; then

: ${PROBLEM:?"PROBLEM is not set. Please set it and run this script again"}

if [ ! -z ${PROBLEM+x}]; then
if [ -z ${MESH+x}]; then
echo "Legacy nomenclature (PROBLEM not MESH) used. Setting MESH=PROBLEM."
MESH=${PROBLEM}
else
echo "Both PROBLEM and MESH set. MESH is the environment variable which will be used."
fi
fi

: ${MESH:?"MESH is not set. Please set it and run this script again"}
: ${CASE:?"CASE is not set. Please set it and run this script again"}

OLDIFS=${IFS:-}
IFS=":"
set ${PROBLEM}
set ${MESH}
count=$#
set ${CASE}

if [ ! $count -eq $# ]; then
echo "Length of PROBLEM and CASE is not the same. Please check that the variables have the same number of entries."
echo "Length of MESH and CASE is not the same. Please check that the variables have the same number of entries."
exit 1
fi
IFS=${OLDIFS}

ZCFDARGS="-p ${PROBLEM//:/ } -c ${CASE//:/ }"
ZCFDARGS="-p ${MESH//:/ } -c ${CASE//:/ }"
REDIRECT_NAME="${CASE%%:*}_log"

else

ZCFDARGS="-f ${OVERRIDE}"
REDIRECT_NAME="${OVERRIDE}_log"

if [ ! -z ${PROBLEM+x} ]; then
echo "WARNING: \${PROBLEM} is set - this is ignored if \${OVERRIDE} is also set"
if [ ! -z ${MESH+x} ]; then
echo "WARNING: \${MESH} is set - this is ignored if \${OVERRIDE} is also set"
fi

if [ ! -z ${CASE+x} ]; then
Expand Down

0 comments on commit 42f5413

Please sign in to comment.