TUT: fix mesh/parallel/cavity for Alltest mode

- use foamListTimes instead of hard-coded time to track the
  redistribution point. Still slightly fragile...
This commit is contained in:
Mark Olesen 2024-01-18 11:20:52 +01:00
parent 7b7dde0a6d
commit 81f0620b7b
2 changed files with 19 additions and 7 deletions

View File

@ -7,7 +7,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017-2023 OpenCFD Ltd.
# Copyright (C) 2017-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -150,6 +150,7 @@ modifyCaseControlDict()
{
for dict in $(find . -name "controlDict*" -type f)
do
case "${dict}" in (*.orig) continue;; esac
cp -f "${dict}" "${dict}.orig"
sed \
-e 's/\(startFrom[ \t]*\)[^ \t;]*;/\1 latestTime;/' \

View File

@ -25,16 +25,27 @@ runParallel -s random icoFoam $fileHandler
# Pick up last result
cp system/controlDict-latestTime system/controlDict
# Redistribute to 5 processors. Note that new processors only get written
# a mesh to the current time (0.505). Use -overwrite instead to write the
# mesh to constant.
# Redistribute to 5 processors.
# Note that new processors only get written with a mesh at the current time.
# Use -overwrite instead to write the mesh to constant
runParallel -s 5 $decompDict5 redistributePar -cellDist $fileHandler
latestTime=$(foamListTimes -processor -latestTime)
echo "New mesh distribution. Time = $latestTime"
# Run a bit more
runParallel -s 5 $decompDict5 icoFoam $fileHandler
# Reconstruct mesh and results. Note the time argument to make sure we
# only pick up the new decomposition
runParallel -s reconstruct -np 5 redistributePar -reconstruct -time 0.505: $fileHandler
# Reconstruct mesh and results.
# The time argument to make sure we only pick up the new decomposition
if [ -n "$latestTime" ]
then
runParallel -s reconstruct -np 5 redistributePar -reconstruct \
-time "${latestTime}:" $fileHandler
else
runParallel -s reconstruct -np 5 redistributePar -reconstruct \
-latestTime $fileHandler
fi
#------------------------------------------------------------------------------