mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
TUT: fileOperation: bit more testing. See #2952
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -361,10 +361,13 @@ bool Foam::OFstreamCollator::write
|
|||||||
off_t totalSize = 0;
|
off_t totalSize = 0;
|
||||||
label maxLocalSize = 0;
|
label maxLocalSize = 0;
|
||||||
{
|
{
|
||||||
for (const label recvSize : recvSizes)
|
if (UPstream::master(localComm_))
|
||||||
{
|
{
|
||||||
totalSize += recvSize;
|
for (const label recvSize : recvSizes)
|
||||||
maxLocalSize = max(maxLocalSize, recvSize);
|
{
|
||||||
|
totalSize += recvSize;
|
||||||
|
maxLocalSize = max(maxLocalSize, recvSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Pstream::broadcasts(localComm_, totalSize, maxLocalSize);
|
Pstream::broadcasts(localComm_, totalSize, maxLocalSize);
|
||||||
}
|
}
|
||||||
|
|||||||
17
tutorials/IO/fileHandler_dynamicCode/Allrun
Executable file
17
tutorials/IO/fileHandler_dynamicCode/Allrun
Executable 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
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
@ -75,7 +75,7 @@ runTimeModifiable true;
|
|||||||
|
|
||||||
functions
|
functions
|
||||||
{
|
{
|
||||||
fileUpdate
|
solverControls
|
||||||
{
|
{
|
||||||
type timeActivatedFileUpdate;
|
type timeActivatedFileUpdate;
|
||||||
libs (utilityFunctionObjects);
|
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.
|
// Wait a bit to make runTimeModifiable work.
|
||||||
// - see also fileModificationSkew
|
// - see also fileModificationSkew
|
||||||
// - could also directly use system FO
|
// - could also directly use system FO
|
||||||
|
|||||||
@ -18,8 +18,8 @@ solvers
|
|||||||
{
|
{
|
||||||
p
|
p
|
||||||
{
|
{
|
||||||
solver PCG;
|
solver GAMG;
|
||||||
preconditioner DIC;
|
smoother symGaussSeidel;
|
||||||
tolerance 1e-06;
|
tolerance 1e-06;
|
||||||
relTol 0.05;
|
relTol 0.05;
|
||||||
}
|
}
|
||||||
|
|||||||
51
tutorials/IO/fileHandler_dynamicCode/system/fvSolution.0
Normal file
51
tutorials/IO/fileHandler_dynamicCode/system/fvSolution.0
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
51
tutorials/IO/fileHandler_dynamicCode/system/fvSolution.5
Normal file
51
tutorials/IO/fileHandler_dynamicCode/system/fvSolution.5
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user