diff --git a/src/OpenFOAM/global/fileOperations/collatedFileOperation/OFstreamCollator.C b/src/OpenFOAM/global/fileOperations/collatedFileOperation/OFstreamCollator.C index 3f4621f540..6ee4bb36a8 100644 --- a/src/OpenFOAM/global/fileOperations/collatedFileOperation/OFstreamCollator.C +++ b/src/OpenFOAM/global/fileOperations/collatedFileOperation/OFstreamCollator.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017-2018 OpenFOAM Foundation - Copyright (C) 2019-2022 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -361,10 +361,13 @@ bool Foam::OFstreamCollator::write off_t totalSize = 0; label maxLocalSize = 0; { - for (const label recvSize : recvSizes) + if (UPstream::master(localComm_)) { - totalSize += recvSize; - maxLocalSize = max(maxLocalSize, recvSize); + for (const label recvSize : recvSizes) + { + totalSize += recvSize; + maxLocalSize = max(maxLocalSize, recvSize); + } } Pstream::broadcasts(localComm_, totalSize, maxLocalSize); } diff --git a/tutorials/IO/fileHandler_dynamicCode/Allrun b/tutorials/IO/fileHandler_dynamicCode/Allrun new file mode 100755 index 0000000000..e6d2620efd --- /dev/null +++ b/tutorials/IO/fileHandler_dynamicCode/Allrun @@ -0,0 +1,17 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions +#------------------------------------------------------------------------------ + +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 -fileHandler collated + +#------------------------------------------------------------------------------ diff --git a/tutorials/IO/fileHandler_dynamicCode/system/controlDict b/tutorials/IO/fileHandler_dynamicCode/system/controlDict index 4d2efdabad..4e3afc109a 100644 --- a/tutorials/IO/fileHandler_dynamicCode/system/controlDict +++ b/tutorials/IO/fileHandler_dynamicCode/system/controlDict @@ -75,7 +75,7 @@ runTimeModifiable true; functions { - fileUpdate + solverControls { type timeActivatedFileUpdate; libs (utilityFunctionObjects); @@ -90,6 +90,22 @@ functions ); } + fvSolution + { + type timeActivatedFileUpdate; + libs (utilityFunctionObjects); + writeControl timeStep; + writeInterval 1; + fileToUpdate "/fvSolution"; + + timeVsFile + ( + (-1 "/fvSolution.0" ) + ( 0.02 "/fvSolution.5" ) + ); + } + + // Wait a bit to make runTimeModifiable work. // - see also fileModificationSkew // - could also directly use system FO diff --git a/tutorials/IO/fileHandler_dynamicCode/system/fvSolution b/tutorials/IO/fileHandler_dynamicCode/system/fvSolution index 059a9f375c..ddbf2bf3f9 100644 --- a/tutorials/IO/fileHandler_dynamicCode/system/fvSolution +++ b/tutorials/IO/fileHandler_dynamicCode/system/fvSolution @@ -18,8 +18,8 @@ solvers { p { - solver PCG; - preconditioner DIC; + solver GAMG; + smoother symGaussSeidel; tolerance 1e-06; relTol 0.05; } diff --git a/tutorials/IO/fileHandler_dynamicCode/system/fvSolution.0 b/tutorials/IO/fileHandler_dynamicCode/system/fvSolution.0 new file mode 100644 index 0000000000..059a9f375c --- /dev/null +++ b/tutorials/IO/fileHandler_dynamicCode/system/fvSolution.0 @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2312 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0.05; + } + + pFinal + { + $p; + relTol 0; + } + + U + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-05; + relTol 0; + } +} + +PISO +{ + nCorrectors 2; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 0; +} + + +// ************************************************************************* // diff --git a/tutorials/IO/fileHandler_dynamicCode/system/fvSolution.5 b/tutorials/IO/fileHandler_dynamicCode/system/fvSolution.5 new file mode 100644 index 0000000000..ddbf2bf3f9 --- /dev/null +++ b/tutorials/IO/fileHandler_dynamicCode/system/fvSolution.5 @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2312 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + solver GAMG; + smoother symGaussSeidel; + tolerance 1e-06; + relTol 0.05; + } + + pFinal + { + $p; + relTol 0; + } + + U + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-05; + relTol 0; + } +} + +PISO +{ + nCorrectors 2; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 0; +} + + +// ************************************************************************* //