fileHandler

#!/bin/sh
cd “${0%/*}” || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#——————————————————————————

if isTest “$@”
then
# Reset the controlDict
if [ -f system/controlDict.orig ]
then
echo “$0: restoring the controlDict from controlDict.orig”
mv -f system/controlDict.orig system/controlDict
fi
fi

restore0Dir

runApplication blockMesh

application=$(getApplication)

#- Test writing collated format
#runApplication decomposePar -fileHandler collated
runParallel redistributePar -decompose -fileHandler collated
runParallel $application -fileHandler collated
#runApplication reconstructPar -latestTime -fileHandler collated
runParallel -s reconstruct redistributePar -reconstruct -latestTime -fileHandler collated

#- Test writing uncollated format
#runApplication -s uncollated decomposePar -fileHandler uncollated -force
runParallel -s uncollated redistributePar -decompose -fileHandler uncollated
runParallel -s uncollated $application -fileHandler uncollated

#- Test uncollated+distributed running: copy to different roots
rm -rf machineA/fileHandler
mkdir -p machineA/fileHandler
( cd machineA/fileHandler && \r
cp -rf ../../processor[0-1] . && \r
cp -rf ../../system . && \r
mkdir -p constant && cp ../../constant/* constant
)
#- Note: slave node does not need constant&system since these are global
rm -rf machineB/fileHandler
mkdir -p machineB/fileHandler
( cd machineB/fileHandler && \r
cp -rf ../../processor[2-3] .
)
#- Run with different roots
( d=$PWD && \r
cd machineA/fileHandler && \r
runParallel -s multiRoot $application \r
-fileHandler masterUncollated -ioRanks ‘0,2’ \r
-roots “(“$d/machineA” “$d/machineB” “$d/machineB”)”
)

#- Restart from uncollated
runParallel -s collated $application -fileHandler collated
runApplication -s collated reconstructPar -latestTime -fileHandler collated

#- Convert the parallel format to uncollated
runParallel foamFormatConvert -fileHandler uncollated

#- Restart with multiple IO ranks
runParallel -s multiCollated \r
$application -fileHandler collated -ioRanks ‘0,2’

#- Reconstruct the multi-rank format. Delete the collated directory
# since conflicts with the multi-collated directory
rm -rf processors4
runApplication -s multiCollated reconstructPar -latestTime \r
-fileHandler collated -ioRanks ‘0,2’

#- Convert the multi-rank format to uncollated
runParallel -s uncollated foamFormatConvert -fileHandler uncollated

#- Restart from multiCollated using collated
runParallel -s uncollated_from_multiCollated \r
$application -fileHandler uncollated

#- Test collated+distributed running: copy to different roots
# Important: make sure to copy uniform since we’re copying it

#- Delete all processor directories
runApplication -s collated decomposePar \r
-fileHandler collated -force -copyUniform

rm -rf machineA/fileHandler
mkdir -p machineA/fileHandler
( cd machineA/fileHandler && \r
cp -rf ../../processor* . && \r
cp -rf ../../system . && \r
mkdir -p constant && cp ../../constant/* constant
)
#- Note: slave node does not need constant&system since these are global
rm -rf machineB/fileHandler
mkdir -p machineB/fileHandler

#- Run with different roots
( d=$PWD && \r
cd machineA/fileHandler && \r
runParallel -s distributed_multiCollated $application \r
-fileHandler collated -ioRanks ‘0,2’ \r
-roots “(“$d/machineA” “$d/machineB” “$d/machineB”)”
)

#——————————————————————————

実行年月:08/02/2024