Time, functionObjectList: Refactored to simplify construction and switching-off functionObjects

This commit is contained in:
Henry Weller
2023-06-06 08:17:52 +01:00
parent 6b1278b544
commit 08544446e8
45 changed files with 205 additions and 309 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -39,8 +39,7 @@ int main(int argc, char *argv[])
#include "addRegionOption.H" #include "addRegionOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createNamedMesh.H" #include "createNamedMesh.H"
const bool write = args.optionFound("write"); const bool write = args.optionFound("write");

View File

@ -41,9 +41,8 @@ int main(int argc, char *argv[])
{ {
argList::validArgs.append("cloudName"); argList::validArgs.append("cloudName");
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
#include "createMesh.H" #include "createMesh.H"
runTime.functionObjects().off();
const word cloudName = args[1]; const word cloudName = args[1];

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -563,8 +563,7 @@ int main(int argc, char *argv[])
{ {
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createMeshNoChangers.H" #include "createMeshNoChangers.H"
// Read control dictionary // Read control dictionary

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,9 +84,7 @@ int main(int argc, char *argv[])
#include "addDictOption.H" #include "addDictOption.H"
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
instantList timeDirs = timeSelector::selectIfPresent(runTime, args); instantList timeDirs = timeSelector::selectIfPresent(runTime, args);
#include "createMeshNoChangers.H" #include "createMeshNoChangers.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -358,8 +358,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createPolyMesh.H" #include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -332,8 +332,7 @@ int main(int argc, char *argv[])
#include "addOverwriteOption.H" #include "addOverwriteOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createPolyMesh.H" #include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -69,8 +69,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
const bool overwrite = args.optionFound("overwrite"); const bool overwrite = args.optionFound("overwrite");
const bool minSet = args.optionFound("minSet"); const bool minSet = args.optionFound("minSet");

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -75,8 +75,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
Foam::word meshRegionName = polyMesh::defaultRegion; Foam::word meshRegionName = polyMesh::defaultRegion;
args.optionReadIfPresent("region", meshRegionName); args.optionReadIfPresent("region", meshRegionName);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -59,8 +59,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
const bool overwrite = args.optionFound("overwrite"); const bool overwrite = args.optionFound("overwrite");
const bool fields = !args.optionFound("noFields"); const bool fields = !args.optionFound("noFields");

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -545,8 +545,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createPolyMesh.H" #include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();

View File

@ -420,8 +420,7 @@ int main(int argc, char *argv[])
#include "addRegionOption.H" #include "addRegionOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
const bool patchFaces = args.optionFound("patchFaces"); const bool patchFaces = args.optionFound("patchFaces");
const bool patchEdges = args.optionFound("patchEdges"); const bool patchEdges = args.optionFound("patchEdges");

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -125,11 +125,10 @@ int main(int argc, char *argv[])
( (
Time::controlDictName, Time::controlDictName,
args.rootPath(), args.rootPath(),
args.caseName() args.caseName(),
false
); );
runTimeExtruded.functionObjects().off();
const ExtrudeMode surfaceFormat = ExtrudeModeNames[args[1]]; const ExtrudeMode surfaceFormat = ExtrudeModeNames[args[1]];
const bool overwrite = args.optionFound("overwrite"); const bool overwrite = args.optionFound("overwrite");

View File

@ -665,8 +665,7 @@ int main(int argc, char *argv[])
#include "addDictOption.H" #include "addDictOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
const bool overwrite = args.optionFound("overwrite"); const bool overwrite = args.optionFound("overwrite");
const bool checkGeometry = args.optionFound("checkGeometry"); const bool checkGeometry = args.optionFound("checkGeometry");

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -44,8 +44,7 @@ int main(int argc, char *argv[])
argList::noParallel(); argList::noParallel();
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createPolyMesh.H" #include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -75,8 +75,7 @@ int main(int argc, char *argv[])
argList::validArgs.append("feature angle[0-180]"); argList::validArgs.append("feature angle[0-180]");
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createPolyMesh.H" #include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();

View File

@ -361,8 +361,7 @@ int main(int argc, char *argv[])
#include "addRegionOption.H" #include "addRegionOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createNamedMesh.H" #include "createNamedMesh.H"
const polyBoundaryMesh& bMesh = mesh.boundaryMesh(); const polyBoundaryMesh& bMesh = mesh.boundaryMesh();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -94,8 +94,7 @@ int main(int argc, char *argv[])
} }
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
// Flag to determine whether or not patches are added to fields // Flag to determine whether or not patches are added to fields
bool fields; bool fields;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -468,8 +468,7 @@ int main(int argc, char *argv[])
#include "addRegionOption.H" #include "addRegionOption.H"
#include "addDictOption.H" #include "addDictOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
Foam::word meshRegionName = polyMesh::defaultRegion; Foam::word meshRegionName = polyMesh::defaultRegion;
args.optionReadIfPresent("region", meshRegionName); args.optionReadIfPresent("region", meshRegionName);

View File

@ -186,8 +186,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createNamedMesh.H" #include "createNamedMesh.H"
const bool overwrite = args.optionFound("overwrite"); const bool overwrite = args.optionFound("overwrite");

View File

@ -7,9 +7,9 @@
( (
Time::controlDictName, Time::controlDictName,
masterCasePath, masterCasePath,
masterCaseName masterCaseName,
false
); );
runTimeMaster.functionObjects().off();
const fileName addCasePath = addCase.path(); const fileName addCasePath = addCase.path();
const fileName addCaseName = addCase.name(); const fileName addCaseName = addCase.name();
@ -18,6 +18,6 @@
( (
Time::controlDictName, Time::controlDictName,
addCasePath, addCasePath,
addCaseName addCaseName,
false
); );
runTimeToAdd.functionObjects().off();

View File

@ -169,8 +169,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createNamedPolyMesh.H" #include "createNamedPolyMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();

View File

@ -619,8 +619,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
// Force linker to include zoltan symbols. This section is only needed since // Force linker to include zoltan symbols. This section is only needed since
// Zoltan is a static library // Zoltan is a static library

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,8 +62,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createNamedMesh.H" #include "createNamedMesh.H"
const bool overwrite = args.optionFound("overwrite"); const bool overwrite = args.optionFound("overwrite");

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -117,8 +117,7 @@ int main(int argc, char *argv[])
argList::validArgs.append("slavePatch"); argList::validArgs.append("slavePatch");
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createPolyMesh.H" #include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();

View File

@ -1469,10 +1469,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createNamedMesh.H" #include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -236,8 +236,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createNamedMesh.H" #include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -215,8 +215,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
Foam::word meshRegionName = polyMesh::defaultRegion; Foam::word meshRegionName = polyMesh::defaultRegion;
args.optionReadIfPresent("region", meshRegionName); args.optionReadIfPresent("region", meshRegionName);

View File

@ -339,13 +339,11 @@ int main(int argc, char *argv[])
// Make sure we do not use the master-only reading. // Make sure we do not use the master-only reading.
regIOobject::fileModificationChecking = regIOobject::timeStamp; regIOobject::fileModificationChecking = regIOobject::timeStamp;
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
// Allow override of time // Allow override of time
instantList times = timeSelector::selectIfPresent(runTime, args); instantList times = timeSelector::selectIfPresent(runTime, args);
runTime.setTime(times[0], 0); runTime.setTime(times[0], 0);
runTime.functionObjects().off();
word regionName = polyMesh::defaultRegion; word regionName = polyMesh::defaultRegion;
fileName meshSubDir; fileName meshSubDir;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -348,12 +348,11 @@ Foam::vtkPVFoam::vtkPVFoam
( (
Time::controlDictName, Time::controlDictName,
fileName(fullCasePath.path()), fileName(fullCasePath.path()),
fileName(fullCasePath.name()) fileName(fullCasePath.name()),
false
) )
); );
dbPtr_().functionObjects().off();
fileNameList configDictFiles = findEtcFiles("paraFoam", false); fileNameList configDictFiles = findEtcFiles("paraFoam", false);
forAllReverse(configDictFiles, cdfi) forAllReverse(configDictFiles, cdfi)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -233,12 +233,11 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
( (
Time::controlDictName, Time::controlDictName,
fileName(fullCasePath.path()), fileName(fullCasePath.path()),
fileName(fullCasePath.name()) fileName(fullCasePath.name()),
false
) )
); );
dbPtr_().functionObjects().off();
updateInfo(); updateInfo();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -202,8 +202,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
HashSet<word> selectedFields; HashSet<word> selectedFields;
if (args.optionFound("fields")) if (args.optionFound("fields"))

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -109,8 +109,7 @@ int main(int argc, char *argv[])
); );
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
const fileName surfFileName = args[1]; const fileName surfFileName = args[1];
const word distType = args[2]; const word distType = args[2];

View File

@ -332,19 +332,16 @@ void Foam::Time::setControls()
Foam::Time::Time Foam::Time::Time
( (
const word& controlDictName, const word& controlDictName,
const fileName& rootPath, const argList& args,
const fileName& caseName,
const word& systemName,
const word& constantName,
const bool enableFunctionObjects const bool enableFunctionObjects
) )
: :
TimePaths TimePaths
( (
rootPath, args.parRunControl().parRun(),
caseName, args.rootPath(),
systemName, args.globalCaseName(),
constantName args.caseName()
), ),
objectRegistry(*this), objectRegistry(*this),
@ -387,6 +384,105 @@ Foam::Time::Time
graphFormat_("raw"), graphFormat_("raw"),
cacheTemporaryObjects_(true), cacheTemporaryObjects_(true),
functionObjects_
(
*this,
enableFunctionObjects
? argList::validOptions.found("withFunctionObjects")
? args.optionFound("withFunctionObjects")
: !args.optionFound("noFunctionObjects")
: false
)
{
libs.open(controlDict_, "libs");
// Explicitly set read flags on objectRegistry so anything constructed
// from it reads as well (e.g. fvSolution).
readOpt() = IOobject::MUST_READ_IF_MODIFIED;
if (args.options().found("case"))
{
const wordList switchSets
(
{
"InfoSwitches",
"OptimisationSwitches",
"DebugSwitches",
"DimensionedConstants",
"DimensionSets"
}
);
forAll(switchSets, i)
{
if (controlDict_.found(switchSets[i]))
{
IOWarningInFunction(controlDict_)
<< switchSets[i]
<< " in system/controlDict are only processed if "
<< args.executable() << " is run in the "
<< args.path() << " directory" << endl;
}
}
}
setControls();
// Add a watch on the controlDict file after runTimeModifiable_ is set
controlDict_.addWatch();
}
Foam::Time::Time
(
const word& controlDictName,
const fileName& rootPath,
const fileName& caseName,
const bool enableFunctionObjects
)
:
TimePaths(rootPath, caseName),
objectRegistry(*this),
runTimeModifiable_(false),
controlDict_
(
IOobject
(
controlDictName,
system(),
*this,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
startTimeIndex_(0),
startTime_(0),
endTime_(0),
beginTime_(startTime_),
userTime_(userTimes::userTime::New(controlDict_)),
stopAt_(stopAtControl::endTime),
writeControl_(writeControl::timeStep),
writeInterval_(great),
purgeWrite_(0),
writeOnce_(false),
subCycling_(false),
sigWriteNow_(writeInfoHeader, *this),
sigStopAtWriteNow_(writeInfoHeader, *this),
writeFormat_(IOstream::ASCII),
writeVersion_(IOstream::currentVersion),
writeCompression_(IOstream::UNCOMPRESSED),
graphFormat_("raw"),
cacheTemporaryObjects_(true),
functionObjects_(*this, enableFunctionObjects) functionObjects_(*this, enableFunctionObjects)
{ {
libs.open(controlDict_, "libs"); libs.open(controlDict_, "libs");
@ -402,128 +498,15 @@ Foam::Time::Time
} }
Foam::Time::Time
(
const word& controlDictName,
const argList& args,
const word& systemName,
const word& constantName
)
:
TimePaths
(
args.parRunControl().parRun(),
args.rootPath(),
args.globalCaseName(),
args.caseName(),
systemName,
constantName
),
objectRegistry(*this),
runTimeModifiable_(false),
controlDict_
(
IOobject
(
controlDictName,
system(),
*this,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
startTimeIndex_(0),
startTime_(0),
endTime_(0),
beginTime_(startTime_),
userTime_(userTimes::userTime::New(controlDict_)),
stopAt_(stopAtControl::endTime),
writeControl_(writeControl::timeStep),
writeInterval_(great),
purgeWrite_(0),
writeOnce_(false),
subCycling_(false),
sigWriteNow_(writeInfoHeader, *this),
sigStopAtWriteNow_(writeInfoHeader, *this),
writeFormat_(IOstream::ASCII),
writeVersion_(IOstream::currentVersion),
writeCompression_(IOstream::UNCOMPRESSED),
graphFormat_("raw"),
cacheTemporaryObjects_(true),
functionObjects_
(
*this,
argList::validOptions.found("withFunctionObjects")
? args.optionFound("withFunctionObjects")
: !args.optionFound("noFunctionObjects")
)
{
libs.open(controlDict_, "libs");
// Explicitly set read flags on objectRegistry so anything constructed
// from it reads as well (e.g. fvSolution).
readOpt() = IOobject::MUST_READ_IF_MODIFIED;
if (args.options().found("case"))
{
const wordList switchSets
(
{
"InfoSwitches",
"OptimisationSwitches",
"DebugSwitches",
"DimensionedConstants",
"DimensionSets"
}
);
forAll(switchSets, i)
{
if (controlDict_.found(switchSets[i]))
{
IOWarningInFunction(controlDict_)
<< switchSets[i]
<< " in system/controlDict are only processed if "
<< args.executable() << " is run in the "
<< args.path() << " directory" << endl;
}
}
}
setControls();
// Add a watch on the controlDict file after runTimeModifiable_ is set
controlDict_.addWatch();
}
Foam::Time::Time Foam::Time::Time
( (
const dictionary& dict, const dictionary& dict,
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName,
const word& systemName,
const word& constantName,
const bool enableFunctionObjects const bool enableFunctionObjects
) )
: :
TimePaths TimePaths(rootPath, caseName),
(
rootPath,
caseName,
systemName,
constantName
),
objectRegistry(*this), objectRegistry(*this),
@ -585,18 +568,10 @@ Foam::Time::Time
( (
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName,
const word& systemName,
const word& constantName,
const bool enableFunctionObjects const bool enableFunctionObjects
) )
: :
TimePaths TimePaths(rootPath, caseName),
(
rootPath,
caseName,
systemName,
constantName
),
objectRegistry(*this), objectRegistry(*this),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -215,8 +215,7 @@ public:
( (
const word& name, const word& name,
const argList& args, const argList& args,
const word& systemName = "system", const bool enableFunctionObjects = true
const word& constantName = "constant"
); );
//- Construct given name of dictionary to read, rootPath and casePath //- Construct given name of dictionary to read, rootPath and casePath
@ -225,8 +224,6 @@ public:
const word& name, const word& name,
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName,
const word& systemName = "system",
const word& constantName = "constant",
const bool enableFunctionObjects = true const bool enableFunctionObjects = true
); );
@ -236,8 +233,6 @@ public:
const dictionary& dict, const dictionary& dict,
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName,
const word& systemName = "system",
const word& constantName = "constant",
const bool enableFunctionObjects = true const bool enableFunctionObjects = true
); );
@ -246,8 +241,6 @@ public:
( (
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName,
const word& systemName = "system",
const word& constantName = "constant",
const bool enableFunctionObjects = true const bool enableFunctionObjects = true
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -26,21 +26,26 @@ License
#include "TimePaths.H" #include "TimePaths.H"
#include "IOstreams.H" #include "IOstreams.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
const word TimePaths::systemName = "system";
const word TimePaths::constantName = "constant";
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::TimePaths::TimePaths Foam::TimePaths::TimePaths
( (
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName
const word& systemName,
const word& constantName
) )
: :
processorCase_(false), processorCase_(false),
rootPath_(rootPath), rootPath_(rootPath),
case_(caseName), case_(caseName)
system_(systemName),
constant_(constantName)
{ {
// Find out from case name whether a processor directory // Find out from case name whether a processor directory
std::string::size_type pos = caseName.find("processor"); std::string::size_type pos = caseName.find("processor");
@ -69,17 +74,13 @@ Foam::TimePaths::TimePaths
const bool processorCase, const bool processorCase,
const fileName& rootPath, const fileName& rootPath,
const fileName& globalCaseName, const fileName& globalCaseName,
const fileName& caseName, const fileName& caseName
const word& systemName,
const word& constantName
) )
: :
processorCase_(processorCase), processorCase_(processorCase),
rootPath_(rootPath), rootPath_(rootPath),
globalCaseName_(globalCaseName), globalCaseName_(globalCaseName),
case_(caseName), case_(caseName)
system_(systemName),
constant_(constantName)
{ {
if (!processorCase) if (!processorCase)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -54,21 +54,22 @@ class TimePaths
const fileName rootPath_; const fileName rootPath_;
fileName globalCaseName_; fileName globalCaseName_;
const fileName case_; const fileName case_;
const word system_;
const word constant_;
public: public:
// Static Data
static const word systemName;
static const word constantName;
// Constructors // Constructors
//- Construct given database name, rootPath and casePath //- Construct given database name, rootPath and casePath
TimePaths TimePaths
( (
const fileName& rootPath, const fileName& rootPath,
const fileName& caseName, const fileName& caseName
const word& systemName,
const word& constantName
); );
@ -78,9 +79,7 @@ public:
const bool processorCase, const bool processorCase,
const fileName& rootPath, const fileName& rootPath,
const fileName& globalCaseName, const fileName& globalCaseName,
const fileName& caseName, const fileName& caseName
const word& systemName,
const word& constantName
); );
@ -111,9 +110,9 @@ public:
} }
//- Return system name //- Return system name
const word& system() const static const word& system()
{ {
return system_; return systemName;
} }
//- Return system name for the case //- Return system name for the case
@ -121,9 +120,9 @@ public:
fileName caseSystem() const; fileName caseSystem() const;
//- Return constant name //- Return constant name
const word& constant() const static const word& constant()
{ {
return constant_; return constantName;
} }
//- Return constant name for the case //- Return constant name for the case

View File

@ -215,25 +215,6 @@ Foam::label Foam::functionObjectList::findObjectID(const word& name) const
} }
void Foam::functionObjectList::on()
{
execution_ = true;
}
void Foam::functionObjectList::off()
{
// For safety, also force a read() when execution is turned back on
updated_ = execution_ = false;
}
bool Foam::functionObjectList::status() const
{
return execution_;
}
bool Foam::functionObjectList::start() bool Foam::functionObjectList::start()
{ {
bool ok = read(); bool ok = read();

View File

@ -164,15 +164,6 @@ public:
//- Read and set the function objects if their data have changed //- Read and set the function objects if their data have changed
bool read(); bool read();
//- Switch the function objects on
void on();
//- Switch the function objects off
void off();
//- Return the execution status (on/off) of the function objects
bool status() const;
//- Called at the start of the time-loop //- Called at the start of the time-loop
bool start(); bool start();

View File

@ -0,0 +1,3 @@
Foam::Info<< "Create time\n" << Foam::endl;
Foam::Time runTime(Foam::Time::controlDictName, args, false);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -220,7 +220,6 @@ public:
{ {
return Hash<long>()(long(p)); return Hash<long>()(long(p));
} }
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -59,8 +59,6 @@ bool Foam::fileFormats::edgeMeshFormat::read
( (
".", // rootPath, ".", // rootPath,
".", // caseName, ".", // caseName,
"system", // systemName,
"constant", // constantName,
false // enableFunctionObjects false // enableFunctionObjects
); );
@ -166,8 +164,6 @@ void Foam::fileFormats::edgeMeshFormat::write
( (
".", // rootPath, ".", // rootPath,
".", // caseName, ".", // caseName,
"system", // systemName,
"constant", // constantName,
false // enableFunctionObjects false // enableFunctionObjects
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -105,8 +105,6 @@ bool Foam::fileFormats::VTKedgeFormat::read
( (
"dummyRoot", "dummyRoot",
"dummyCase", "dummyCase",
"system",
"constant",
false // enableFunctionObjects false // enableFunctionObjects
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -57,8 +57,6 @@ bool Foam::fileFormats::extendedEdgeMeshFormat::read
( (
".", // rootPath, ".", // rootPath,
".", // caseName, ".", // caseName,
"system", // systemName,
"constant", // constantName,
false // enableFunctionObjects false // enableFunctionObjects
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -90,8 +90,6 @@ bool Foam::fileFormats::VTKsurfaceFormat<Face>::read
( (
"dummyRoot", "dummyRoot",
"dummyCase", "dummyCase",
"system",
"constant",
false // enableFunctionObjects false // enableFunctionObjects
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2019-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,8 +49,7 @@ int main(int argc, char *argv[])
#include "addRegionOption.H" #include "addRegionOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTimeNoFunctionObjects.H"
runTime.functionObjects().off();
#include "createNamedMesh.H" #include "createNamedMesh.H"
// Read objects in time directory // Read objects in time directory