From 81f0620b7b32d49951a9bb2f1d9db166fba3356e Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Thu, 18 Jan 2024 11:20:52 +0100 Subject: [PATCH] TUT: fix mesh/parallel/cavity for Alltest mode - use foamListTimes instead of hard-coded time to track the redistribution point. Still slightly fragile... --- tutorials/Alltest | 3 ++- tutorials/mesh/parallel/cavity/Allrun | 23 +++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tutorials/Alltest b/tutorials/Alltest index 7ab903e7dea..9277189ab5f 100755 --- a/tutorials/Alltest +++ b/tutorials/Alltest @@ -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;/' \ diff --git a/tutorials/mesh/parallel/cavity/Allrun b/tutorials/mesh/parallel/cavity/Allrun index 49e9aa72a39..370935618e3 100755 --- a/tutorials/mesh/parallel/cavity/Allrun +++ b/tutorials/mesh/parallel/cavity/Allrun @@ -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 #------------------------------------------------------------------------------ -- GitLab