foamPostProcess: General replacement for postProcess supporting the new solver modules
Application
foamPostProcess
Description
Execute the set of functionObjects specified in the selected dictionary
(which defaults to system/controlDict) or on the command-line for the
selected set of times on the selected set of fields.
The functionObjects are either executed directly or for the solver
optionally specified as a command-line argument.
Usage
\b foamPostProcess [OPTION]
- \par -dict <file>
Read control dictionary from specified location
- \par -solver <name>
Solver name
- \par -libs '(\"lib1.so\" ... \"libN.so\")'
Specify the additional libraries loaded
-\par -region <name>
Specify the region
- \par -func <name>
Specify the name of the functionObject to execute, e.g. Q
- \par -funcs <list>
Specify the names of the functionObjects to execute, e.g. '(Q div(U))'
- \par -field <name>
Specify the name of the field to be processed, e.g. U
- \par -fields <list>
Specify a list of fields to be processed,
e.g. '(U T p)' - regular expressions not currently supported
- \par -time <ranges>
comma-separated time ranges - eg, ':10,20,40:70,1000:'
- \par -latestTime
Select the latest time
- \par -list
List the available configured functionObjects
Example usage:
- Print the list of available configured functionObjects:
\verbatim
foamPostProcess -list
\endverbatim
- Execute the functionObjects specified in the controlDict of the
fluid region for all the available times:
\verbatim
foamPostProcess -region fluid
\endverbatim
- Execute the functionObjects specified in the controlDict
for the 'fluid' solver in the 'cooling' region for the latest time only:
\verbatim
foamPostProcess -solver fluid -region cooling -latestTime
\endverbatim
A postProcess redirection script is provided for backward-compatibility.
This commit is contained in:
@ -0,0 +1,3 @@
|
|||||||
|
foamPostProcess.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/foamPostProcess
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume
|
||||||
@ -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) 2016-2022 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -22,17 +22,75 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
postProcess
|
foamPostProcess
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Execute the set of functionObjects specified in the selected dictionary
|
Execute the set of functionObjects specified in the selected dictionary
|
||||||
(which defaults to system/controlDict) or on the command-line for the
|
(which defaults to system/controlDict) or on the command-line for the
|
||||||
selected set of times on the selected set of fields.
|
selected set of times on the selected set of fields.
|
||||||
|
|
||||||
|
The functionObjects are either executed directly or for the solver
|
||||||
|
optionally specified as a command-line argument.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
\b foamPostProcess [OPTION]
|
||||||
|
- \par -dict <file>
|
||||||
|
Read control dictionary from specified location
|
||||||
|
|
||||||
|
- \par -solver <name>
|
||||||
|
Solver name
|
||||||
|
|
||||||
|
- \par -libs '(\"lib1.so\" ... \"libN.so\")'
|
||||||
|
Specify the additional libraries loaded
|
||||||
|
|
||||||
|
-\par -region <name>
|
||||||
|
Specify the region
|
||||||
|
|
||||||
|
- \par -func <name>
|
||||||
|
Specify the name of the functionObject to execute, e.g. Q
|
||||||
|
|
||||||
|
- \par -funcs <list>
|
||||||
|
Specify the names of the functionObjects to execute, e.g. '(Q div(U))'
|
||||||
|
|
||||||
|
- \par -field <name>
|
||||||
|
Specify the name of the field to be processed, e.g. U
|
||||||
|
|
||||||
|
- \par -fields <list>
|
||||||
|
Specify a list of fields to be processed,
|
||||||
|
e.g. '(U T p)' - regular expressions not currently supported
|
||||||
|
|
||||||
|
- \par -time <ranges>
|
||||||
|
comma-separated time ranges - eg, ':10,20,40:70,1000:'
|
||||||
|
|
||||||
|
- \par -latestTime
|
||||||
|
Select the latest time
|
||||||
|
|
||||||
|
- \par -list
|
||||||
|
List the available configured functionObjects
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
- Print the list of available configured functionObjects:
|
||||||
|
\verbatim
|
||||||
|
foamPostProcess -list
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
- Execute the functionObjects specified in the controlDict of the
|
||||||
|
fluid region for all the available times:
|
||||||
|
\verbatim
|
||||||
|
foamPostProcess -region fluid
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
- Execute the functionObjects specified in the controlDict
|
||||||
|
for the 'fluid' solver in the 'cooling' region for the latest time only:
|
||||||
|
\verbatim
|
||||||
|
foamPostProcess -solver fluid -region cooling -latestTime
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "timeSelector.H"
|
#include "timeSelector.H"
|
||||||
|
#include "solver.H"
|
||||||
#include "ReadFields.H"
|
#include "ReadFields.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
@ -135,9 +193,18 @@ void executeFunctionObjects
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Foam::timeSelector::addOptions();
|
argList::addOption
|
||||||
|
(
|
||||||
|
"solver",
|
||||||
|
"name",
|
||||||
|
"Solver name"
|
||||||
|
);
|
||||||
|
|
||||||
|
timeSelector::addOptions();
|
||||||
#include "addRegionOption.H"
|
#include "addRegionOption.H"
|
||||||
#include "addFunctionObjectOptions.H"
|
#include "addFunctionObjectOptions.H"
|
||||||
|
|
||||||
@ -156,11 +223,49 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
|
|
||||||
#include "createNamedMesh.H"
|
|
||||||
|
|
||||||
// Initialise the set of selected fields from the command-line options
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
|
word regionName = fvMesh::defaultRegion;
|
||||||
|
|
||||||
|
if (args.optionReadIfPresent("region", regionName))
|
||||||
|
{
|
||||||
|
Info
|
||||||
|
<< "Create mesh " << regionName << " for time = "
|
||||||
|
<< runTime.timeName() << nl << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info
|
||||||
|
<< "Create mesh for time = "
|
||||||
|
<< runTime.timeName() << nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
fvMesh mesh
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
regionName,
|
||||||
|
runTime.timeName(),
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Either the solver name is specified...
|
||||||
|
word solverName;
|
||||||
|
|
||||||
|
// ...or the fields are specified on the command-line
|
||||||
|
// or later inferred from the function arguments
|
||||||
HashSet<word> requiredFields;
|
HashSet<word> requiredFields;
|
||||||
|
|
||||||
|
if (args.optionReadIfPresent("solver", solverName))
|
||||||
|
{
|
||||||
|
libs.open("lib" + solverName + ".so");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Initialise the set of selected fields from the command-line options
|
||||||
if (args.optionFound("fields"))
|
if (args.optionFound("fields"))
|
||||||
{
|
{
|
||||||
args.optionLookup("fields")() >> requiredFields;
|
args.optionLookup("fields")() >> requiredFields;
|
||||||
@ -169,6 +274,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
requiredFields.insert(args.optionLookup("field")());
|
requiredFields.insert(args.optionLookup("field")());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Externally stored dictionary for functionObjectList
|
// Externally stored dictionary for functionObjectList
|
||||||
// if not constructed from runTime
|
// if not constructed from runTime
|
||||||
@ -205,6 +311,20 @@ int main(int argc, char *argv[])
|
|||||||
FatalIOError.throwExceptions();
|
FatalIOError.throwExceptions();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (solverName != word::null)
|
||||||
|
{
|
||||||
|
// Optionally instantiate the selected solver
|
||||||
|
autoPtr<solver> solverPtr;
|
||||||
|
|
||||||
|
solverPtr = solver::New(solverName, mesh);
|
||||||
|
|
||||||
|
functionsPtr->execute();
|
||||||
|
|
||||||
|
// Clear the objects owned by the mesh
|
||||||
|
mesh.objectRegistry::clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
executeFunctionObjects
|
executeFunctionObjects
|
||||||
(
|
(
|
||||||
@ -216,6 +336,7 @@ int main(int argc, char *argv[])
|
|||||||
timei == timeDirs.size()-1
|
timei == timeDirs.size()-1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (IOerror& err)
|
catch (IOerror& err)
|
||||||
{
|
{
|
||||||
Warning<< err << endl;
|
Warning<< err << endl;
|
||||||
@ -1,3 +0,0 @@
|
|||||||
postProcess.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/postProcess
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
EXE_INC = \
|
|
||||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
|
||||||
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
|
|
||||||
-I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
|
|
||||||
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
|
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
|
||||||
-I$(LIB_SRC)/fvModels/lnInclude \
|
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
|
||||||
-I$(LIB_SRC)/sampling/lnInclude
|
|
||||||
|
|
||||||
EXE_LIBS = \
|
|
||||||
-lmomentumTransportModels \
|
|
||||||
-lincompressibleMomentumTransportModels \
|
|
||||||
-lcompressibleMomentumTransportModels \
|
|
||||||
-lphysicalProperties \
|
|
||||||
-lfluidThermophysicalModels \
|
|
||||||
-lspecie \
|
|
||||||
-lfiniteVolume \
|
|
||||||
-lfvModels \
|
|
||||||
-lgenericPatchFields \
|
|
||||||
-lmeshTools \
|
|
||||||
-lsampling
|
|
||||||
43
bin/postProcess
Executable file
43
bin/postProcess
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# ========= |
|
||||||
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
# \\ / O peration | Website: https://openfoam.org
|
||||||
|
# \\ / A nd | Copyright (C) 2022 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/>.
|
||||||
|
#
|
||||||
|
# Script
|
||||||
|
# postProcess
|
||||||
|
#
|
||||||
|
# Description
|
||||||
|
# Script to inform the user that postProcess has been superseded
|
||||||
|
# and replaced by the more general foamPostProcess utility.
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
postProcess has been superseded and replaced by the more general foamPostProcess
|
||||||
|
utility which will be executed instead:
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
foamPostProcess $*
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
Reference in New Issue
Block a user