mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
simpleFoam: Added experimental "-postProcess" option
Executes application functionObjects to post-process existing results.
If the "dict" argument is specified the functionObjectList is constructed
from that dictionary otherwise the functionObjectList is constructed from
the "functions" sub-dictionary of "system/controlDict"
Multiple time-steps may be processed and the standard utility time
controls are provided.
This functionality is equivalent to execFlowFunctionObjects but in a
more efficient and general manner and will be included in all the
OpenFOAM solvers if it proves effective and maintainable.
The command-line options available with the "-postProcess" option may be
obtained by
simpleFoam -help -postProcess
Usage: simpleFoam [OPTIONS]
options:
-case <dir> specify alternate case directory, default is the cwd
-constant include the 'constant/' dir in the times list
-dict <file> read control dictionary from specified location
-latestTime select the latest time
-newTimes select the new times
-noFunctionObjects
do not execute functionObjects
-noZero exclude the '0/' dir from the times list, has precedence
over the -withZero option
-parallel run in parallel
-postProcess Execute functionObjects only
-region <name> specify alternative mesh region
-roots <(dir1 .. dirN)>
slave root directories for distributed running
-time <ranges> comma-separated time ranges - eg, ':10,20,40:70,1000:'
-srcDoc display source code in browser
-doc display application documentation in browser
-help print the usage
Henry G. Weller
CFD Direct Ltd.
This commit is contained in:
138
src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H
Normal file
138
src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H
Normal file
@ -0,0 +1,138 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Global
|
||||
postProcess
|
||||
|
||||
Description
|
||||
Execute application functionObjects to post-process existing results.
|
||||
|
||||
If the "dict" argument is specified the functionObjectList is constructed
|
||||
from that dictionary otherwise the functionObjectList is constructed from
|
||||
the "functions" sub-dictionary of "system/controlDict"
|
||||
|
||||
Multiple time-steps may be processed and the standard utility time
|
||||
controls are provided.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifndef CREATE_MESH
|
||||
#define CREATE_MESH createMesh.H
|
||||
#endif
|
||||
|
||||
#ifndef CREATE_FIELDS_1
|
||||
#define CREATE_FIELDS_1 createFields.H
|
||||
#endif
|
||||
|
||||
#ifndef CREATE_CONTROLS
|
||||
#define CREATE_CONTROLS createControls.H
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define INCLUDE_FILE(X) INCLUDE_FILE2(X)
|
||||
#define INCLUDE_FILE2(X) #X
|
||||
|
||||
Foam::argList::addBoolOption
|
||||
(
|
||||
argList::postProcessOptionName,
|
||||
"Execute functionObjects only"
|
||||
);
|
||||
|
||||
if (argList::postProcess(argc, argv))
|
||||
{
|
||||
Foam::timeSelector::addOptions();
|
||||
#include "addRegionOption.H"
|
||||
#include "addDictOption.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
|
||||
#include INCLUDE_FILE(CREATE_MESH)
|
||||
#include INCLUDE_FILE(CREATE_CONTROLS)
|
||||
|
||||
// Externally stored dictionary for functionObjectList
|
||||
// if not constructed from runTime
|
||||
dictionary functionObjectsDict;
|
||||
|
||||
// Construct functionObjectList
|
||||
autoPtr<functionObjectList> functionObjectsPtr
|
||||
(
|
||||
functionObjectList::New(args, runTime, functionObjectsDict)
|
||||
);
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
if (mesh.readUpdate() != polyMesh::UNCHANGED)
|
||||
{
|
||||
// Update functionObjects if mesh changes
|
||||
functionObjectsPtr =
|
||||
functionObjectList::New(args, runTime, functionObjectsDict);
|
||||
}
|
||||
|
||||
#include INCLUDE_FILE(CREATE_FIELDS_1)
|
||||
|
||||
#ifdef CREATE_FIELDS_2
|
||||
#include INCLUDE_FILE(CREATE_FIELDS_2)
|
||||
#endif
|
||||
|
||||
#ifdef CREATE_FIELDS_3
|
||||
#include INCLUDE_FILE(CREATE_FIELDS_3)
|
||||
#endif
|
||||
|
||||
FatalIOError.throwExceptions();
|
||||
|
||||
try
|
||||
{
|
||||
functionObjectsPtr->execute(true);
|
||||
}
|
||||
catch (IOerror& err)
|
||||
{
|
||||
Warning<< err << endl;
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#undef INCLUDE_FILE
|
||||
#undef INCLUDE_FILE2
|
||||
|
||||
#undef CREATE_MESH
|
||||
#undef CREATE_FIELDS_1
|
||||
#undef CREATE_CONTROLS
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user