TUT: fileOperation: bit more testing. See #2952

This commit is contained in:
mattijs 2023-12-08 09:12:41 +00:00
parent 1844f87a0d
commit bc5aafa0d9
6 changed files with 145 additions and 7 deletions

View File

@ -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);
}

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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 "<system>/fvSolution";
timeVsFile
(
(-1 "<system>/fvSolution.0" )
( 0.02 "<system>/fvSolution.5" )
);
}
// Wait a bit to make runTimeModifiable work.
// - see also fileModificationSkew
// - could also directly use system FO

View File

@ -18,8 +18,8 @@ solvers
{
p
{
solver PCG;
preconditioner DIC;
solver GAMG;
smoother symGaussSeidel;
tolerance 1e-06;
relTol 0.05;
}

View File

@ -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;
}
// ************************************************************************* //

View File

@ -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;
}
// ************************************************************************* //