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:
parent
224f014e96
commit
cc455173ff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,12 +41,12 @@ Description
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "postProcess.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
#include "createControls.H"
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
@ -0,0 +1 @@
|
||||
simpleControl simple(mesh);
|
@ -41,3 +41,5 @@ autoPtr<incompressible::turbulenceModel> turbulence
|
||||
(
|
||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
#include "createMRF.H"
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,14 +42,14 @@ Description
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#define CREATE_FIELDS_2 createPorousZones.H
|
||||
#include "postProcess.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
#include "createControls.H"
|
||||
#include "createFields.H"
|
||||
#include "createMRF.H"
|
||||
#include "createPorousZones.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,14 +39,13 @@ Description
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "postProcess.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
#include "createControls.H"
|
||||
#include "createFields.H"
|
||||
#include "createMRF.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "functionObjectList.H"
|
||||
#include "Time.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "argList.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -92,6 +93,42 @@ Foam::functionObjectList::functionObjectList
|
||||
{}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
|
||||
(
|
||||
const argList& args,
|
||||
const Time& runTime,
|
||||
dictionary& functionObjectsDict
|
||||
)
|
||||
{
|
||||
autoPtr<functionObjectList> functionObjectsPtr;
|
||||
|
||||
if (args.optionFound("dict"))
|
||||
{
|
||||
functionObjectsDict = IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
args["dict"],
|
||||
runTime,
|
||||
IOobject::MUST_READ_IF_MODIFIED
|
||||
)
|
||||
);
|
||||
|
||||
functionObjectsPtr.reset
|
||||
(
|
||||
new functionObjectList(runTime, functionObjectsDict)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
functionObjectsPtr.reset(new functionObjectList(runTime));
|
||||
}
|
||||
functionObjectsPtr->start();
|
||||
|
||||
return functionObjectsPtr;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjectList::~functionObjectList()
|
||||
|
@ -50,6 +50,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
class mapPolyMesh;
|
||||
class argList;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class functionObjectList Declaration
|
||||
@ -107,7 +108,6 @@ public:
|
||||
const bool execution=true
|
||||
);
|
||||
|
||||
|
||||
//- Construct from Time, a dictionary with "functions" entry
|
||||
// and the execution setting.
|
||||
// \param[in] t - the other Time instance to construct from
|
||||
@ -123,6 +123,19 @@ public:
|
||||
const bool execution=true
|
||||
);
|
||||
|
||||
//- Construct and return a functionObjectList for an application.
|
||||
//
|
||||
// If the "dict" argument is specified the functionObjectList is
|
||||
// constructed from that dictionary which is returned as
|
||||
// functionObjectsDict otherwise the functionObjectList is constructed
|
||||
// from the "functions" sub-dictionary of "system/controlDict"
|
||||
static autoPtr<functionObjectList> New
|
||||
(
|
||||
const argList& args,
|
||||
const Time& runTime,
|
||||
dictionary& functionObjectsDict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~functionObjectList();
|
||||
|
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
|
||||
|
||||
// ************************************************************************* //
|
@ -46,7 +46,7 @@ Foam::HashTable<Foam::string> Foam::argList::optionUsage;
|
||||
Foam::SLList<Foam::string> Foam::argList::notes;
|
||||
Foam::string::size_type Foam::argList::usageMin = 20;
|
||||
Foam::string::size_type Foam::argList::usageMax = 80;
|
||||
|
||||
Foam::word Foam::argList::postProcessOptionName("postProcess");
|
||||
|
||||
Foam::argList::initValidTables::initValidTables()
|
||||
{
|
||||
@ -162,7 +162,7 @@ void Foam::argList::printOptionUsage
|
||||
|
||||
if (strLen)
|
||||
{
|
||||
// minimum of 2 spaces between option and usage:
|
||||
// Minimum of 2 spaces between option and usage:
|
||||
if (string::size_type(location) + 2 <= usageMin)
|
||||
{
|
||||
for (string::size_type i = location; i < usageMin; ++i)
|
||||
@ -180,31 +180,31 @@ void Foam::argList::printOptionUsage
|
||||
}
|
||||
}
|
||||
|
||||
// text wrap
|
||||
// Text wrap
|
||||
string::size_type pos = 0;
|
||||
while (pos != string::npos && pos + textWidth < strLen)
|
||||
{
|
||||
// potential end point and next point
|
||||
// Potential end point and next point
|
||||
string::size_type curr = pos + textWidth - 1;
|
||||
string::size_type next = string::npos;
|
||||
|
||||
if (isspace(str[curr]))
|
||||
{
|
||||
// we were lucky: ended on a space
|
||||
// We were lucky: ended on a space
|
||||
next = str.find_first_not_of(" \t\n", curr);
|
||||
}
|
||||
else if (isspace(str[curr+1]))
|
||||
{
|
||||
// the next one is a space - so we are okay
|
||||
// The next one is a space - so we are okay
|
||||
curr++; // otherwise the length is wrong
|
||||
next = str.find_first_not_of(" \t\n", curr);
|
||||
}
|
||||
else
|
||||
{
|
||||
// search for end of a previous word break
|
||||
// Search for end of a previous word break
|
||||
string::size_type prev = str.find_last_of(" \t\n", curr);
|
||||
|
||||
// reposition to the end of previous word if possible
|
||||
// Reposition to the end of previous word if possible
|
||||
if (prev != string::npos && prev > pos)
|
||||
{
|
||||
curr = prev;
|
||||
@ -216,7 +216,7 @@ void Foam::argList::printOptionUsage
|
||||
next = curr + 1;
|
||||
}
|
||||
|
||||
// indent following lines (not the first one)
|
||||
// Indent following lines (not the first one)
|
||||
if (pos)
|
||||
{
|
||||
for (string::size_type i = 0; i < usageMin; ++i)
|
||||
@ -229,10 +229,10 @@ void Foam::argList::printOptionUsage
|
||||
pos = next;
|
||||
}
|
||||
|
||||
// output the remainder of the string
|
||||
// Output the remainder of the string
|
||||
if (pos != string::npos)
|
||||
{
|
||||
// indent following lines (not the first one)
|
||||
// Indent following lines (not the first one)
|
||||
if (pos)
|
||||
{
|
||||
for (string::size_type i = 0; i < usageMin; ++i)
|
||||
@ -251,17 +251,31 @@ void Foam::argList::printOptionUsage
|
||||
}
|
||||
|
||||
|
||||
bool Foam::argList::postProcess(int argc, char *argv[])
|
||||
{
|
||||
bool postProcessOption = false;
|
||||
|
||||
for (int i=1; i<argc; i++)
|
||||
{
|
||||
postProcessOption = argv[i] == '-' + postProcessOptionName;
|
||||
if (postProcessOption) break;
|
||||
}
|
||||
|
||||
return postProcessOption;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// convert argv -> args_
|
||||
// transform sequences with "(" ... ")" into string lists in the process
|
||||
// Convert argv -> args_
|
||||
// Transform sequences with "(" ... ")" into string lists in the process
|
||||
bool Foam::argList::regroupArgv(int& argc, char**& argv)
|
||||
{
|
||||
int nArgs = 0;
|
||||
int listDepth = 0;
|
||||
string tmpString;
|
||||
|
||||
// note: we also re-write directly into args_
|
||||
// Note: we also re-write directly into args_
|
||||
// and use a second pass to sort out args/options
|
||||
for (int argI = 0; argI < argc; ++argI)
|
||||
{
|
||||
@ -289,7 +303,7 @@ bool Foam::argList::regroupArgv(int& argc, char**& argv)
|
||||
}
|
||||
else if (listDepth)
|
||||
{
|
||||
// quote each string element
|
||||
// Quote each string element
|
||||
tmpString += "\"";
|
||||
tmpString += argv[argI];
|
||||
tmpString += "\"";
|
||||
@ -325,20 +339,20 @@ void Foam::argList::getRootCase()
|
||||
|
||||
if (casePath.empty() || casePath == ".")
|
||||
{
|
||||
// handle degenerate form and '-case .' like no -case specified
|
||||
// Handle degenerate form and '-case .' like no -case specified
|
||||
casePath = cwd();
|
||||
options_.erase("case");
|
||||
}
|
||||
else if (!casePath.isAbsolute() && casePath.name() == "..")
|
||||
{
|
||||
// avoid relative cases ending in '..' - makes for very ugly names
|
||||
// Avoid relative cases ending in '..' - makes for very ugly names
|
||||
casePath = cwd()/casePath;
|
||||
casePath.clean();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// nothing specified, use the current dir
|
||||
// Nothing specified, use the current dir
|
||||
casePath = cwd();
|
||||
}
|
||||
|
||||
@ -350,13 +364,13 @@ void Foam::argList::getRootCase()
|
||||
// Set the case and case-name as an environment variable
|
||||
if (rootPath_.isAbsolute())
|
||||
{
|
||||
// absolute path - use as-is
|
||||
// Absolute path - use as-is
|
||||
setEnv("FOAM_CASE", rootPath_/globalCase_, true);
|
||||
setEnv("FOAM_CASENAME", globalCase_, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// qualify relative path
|
||||
// Qualify relative path
|
||||
casePath = cwd()/rootPath_/globalCase_;
|
||||
casePath.clean();
|
||||
|
||||
@ -396,7 +410,7 @@ Foam::argList::argList
|
||||
}
|
||||
}
|
||||
|
||||
// convert argv -> args_ and capture ( ... ) lists
|
||||
// Convert argv -> args_ and capture ( ... ) lists
|
||||
// for normal arguments and for options
|
||||
regroupArgv(argc, argv);
|
||||
|
||||
@ -509,7 +523,7 @@ void Foam::argList::parse
|
||||
printUsage();
|
||||
}
|
||||
|
||||
// only display one or the other
|
||||
// Only display one or the other
|
||||
if (options_.found("srcDoc"))
|
||||
{
|
||||
displayDoc(true);
|
||||
@ -556,7 +570,7 @@ void Foam::argList::parse
|
||||
jobInfo.add("PPID", ppid());
|
||||
jobInfo.add("PGID", pgid());
|
||||
|
||||
// add build information - only use the first word
|
||||
// Add build information - only use the first word
|
||||
{
|
||||
std::string build(Foam::FOAMbuild);
|
||||
std::string::size_type found = build.find(' ');
|
||||
@ -581,7 +595,7 @@ void Foam::argList::parse
|
||||
// For the master
|
||||
if (Pstream::master())
|
||||
{
|
||||
// establish rootPath_/globalCase_/case_ for master
|
||||
// Establish rootPath_/globalCase_/case_ for master
|
||||
getRootCase();
|
||||
|
||||
// See if running distributed (different roots for different procs)
|
||||
@ -625,7 +639,7 @@ void Foam::argList::parse
|
||||
}
|
||||
}
|
||||
|
||||
// convenience:
|
||||
// Convenience:
|
||||
// when a single root is specified, use it for all processes
|
||||
if (roots.size() == 1)
|
||||
{
|
||||
@ -660,7 +674,7 @@ void Foam::argList::parse
|
||||
}
|
||||
|
||||
|
||||
// distributed data
|
||||
// Distributed data
|
||||
if (roots.size())
|
||||
{
|
||||
if (roots.size() != Pstream::nProcs()-1)
|
||||
@ -694,7 +708,7 @@ void Foam::argList::parse
|
||||
}
|
||||
options_.erase("case");
|
||||
|
||||
// restore [-case dir]
|
||||
// Restore [-case dir]
|
||||
if (hadCaseOpt)
|
||||
{
|
||||
options_.set("case", rootPath_/globalCase_);
|
||||
@ -747,7 +761,7 @@ void Foam::argList::parse
|
||||
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
fromMaster >> args_ >> options_;
|
||||
|
||||
// establish rootPath_/globalCase_/case_ for slave
|
||||
// Establish rootPath_/globalCase_/case_ for slave
|
||||
getRootCase();
|
||||
}
|
||||
|
||||
@ -756,7 +770,7 @@ void Foam::argList::parse
|
||||
}
|
||||
else
|
||||
{
|
||||
// establish rootPath_/globalCase_/case_
|
||||
// Establish rootPath_/globalCase_/case_
|
||||
getRootCase();
|
||||
case_ = globalCase_;
|
||||
}
|
||||
@ -764,7 +778,7 @@ void Foam::argList::parse
|
||||
|
||||
stringList slaveProcs;
|
||||
|
||||
// collect slave machine/pid
|
||||
// Collect slave machine/pid
|
||||
if (parRunControl_.parRun())
|
||||
{
|
||||
if (Pstream::master())
|
||||
@ -884,10 +898,10 @@ bool Foam::argList::setOption(const word& opt, const string& param)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// only allow valid options
|
||||
// Only allow valid options
|
||||
if (validOptions.found(opt))
|
||||
{
|
||||
// some options are to be protected
|
||||
// Some options are to be protected
|
||||
if
|
||||
(
|
||||
opt == "case"
|
||||
@ -903,10 +917,10 @@ bool Foam::argList::setOption(const word& opt, const string& param)
|
||||
|
||||
if (validOptions[opt].empty())
|
||||
{
|
||||
// bool option
|
||||
// Bool option
|
||||
if (!param.empty())
|
||||
{
|
||||
// disallow change of type
|
||||
// Disallow change of type
|
||||
FatalError
|
||||
<<"used argList::setOption to change bool to non-bool: '"
|
||||
<< opt << "'" << endl;
|
||||
@ -914,16 +928,16 @@ bool Foam::argList::setOption(const word& opt, const string& param)
|
||||
}
|
||||
else
|
||||
{
|
||||
// did not previously exist
|
||||
// Did not previously exist
|
||||
changed = !options_.found(opt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// non-bool option
|
||||
// Non-bool option
|
||||
if (param.empty())
|
||||
{
|
||||
// disallow change of type
|
||||
// Disallow change of type
|
||||
FatalError
|
||||
<<"used argList::setOption to change non-bool to bool: '"
|
||||
<< opt << "'" << endl;
|
||||
@ -931,7 +945,7 @@ bool Foam::argList::setOption(const word& opt, const string& param)
|
||||
}
|
||||
else
|
||||
{
|
||||
// existing value needs changing, or did not previously exist
|
||||
// Existing value needs changing, or did not previously exist
|
||||
changed = options_.found(opt) ? options_[opt] != param : true;
|
||||
}
|
||||
}
|
||||
@ -945,7 +959,7 @@ bool Foam::argList::setOption(const word& opt, const string& param)
|
||||
FatalError.exit();
|
||||
}
|
||||
|
||||
// set/change the option as required
|
||||
// Set/change the option as required
|
||||
if (changed)
|
||||
{
|
||||
options_.set(opt, param);
|
||||
@ -957,10 +971,10 @@ bool Foam::argList::setOption(const word& opt, const string& param)
|
||||
|
||||
bool Foam::argList::unsetOption(const word& opt)
|
||||
{
|
||||
// only allow valid options
|
||||
// Only allow valid options
|
||||
if (validOptions.found(opt))
|
||||
{
|
||||
// some options are to be protected
|
||||
// Some options are to be protected
|
||||
if
|
||||
(
|
||||
opt == "case"
|
||||
@ -974,7 +988,7 @@ bool Foam::argList::unsetOption(const word& opt)
|
||||
FatalError.exit();
|
||||
}
|
||||
|
||||
// remove the option, return true if state changed
|
||||
// Remove the option, return true if state changed
|
||||
return options_.erase(opt);
|
||||
}
|
||||
else
|
||||
@ -992,7 +1006,7 @@ bool Foam::argList::unsetOption(const word& opt)
|
||||
|
||||
void Foam::argList::printNotes() const
|
||||
{
|
||||
// output notes directly - no automatic text wrapping
|
||||
// Output notes directly - no automatic text wrapping
|
||||
if (!notes.empty())
|
||||
{
|
||||
Info<< nl;
|
||||
@ -1022,11 +1036,11 @@ void Foam::argList::printUsage() const
|
||||
|
||||
HashTable<string>::const_iterator iter = validOptions.find(optionName);
|
||||
Info<< " -" << optionName;
|
||||
label len = optionName.size() + 3; // length includes leading ' -'
|
||||
label len = optionName.size() + 3; // Length includes leading ' -'
|
||||
|
||||
if (iter().size())
|
||||
{
|
||||
// length includes space and between option/param and '<>'
|
||||
// Length includes space and between option/param and '<>'
|
||||
len += iter().size() + 3;
|
||||
Info<< " <" << iter().c_str() << '>';
|
||||
}
|
||||
@ -1048,9 +1062,7 @@ void Foam::argList::printUsage() const
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// place srcDoc/doc/help options at the end
|
||||
//
|
||||
// Place srcDoc/doc/help options at the end
|
||||
Info<< " -srcDoc";
|
||||
printOptionUsage
|
||||
(
|
||||
@ -1089,7 +1101,7 @@ void Foam::argList::displayDoc(bool source) const
|
||||
List<fileName> docDirs(docDict.lookup("doxyDocDirs"));
|
||||
List<fileName> docExts(docDict.lookup("doxySourceFileExts"));
|
||||
|
||||
// for source code: change foo_8C.html to foo_8C_source.html
|
||||
// For source code: change foo_8C.html to foo_8C_source.html
|
||||
if (source)
|
||||
{
|
||||
forAll(docExts, extI)
|
||||
@ -1127,7 +1139,7 @@ void Foam::argList::displayDoc(bool source) const
|
||||
{
|
||||
docDict.lookup("docBrowser") >> docBrowser;
|
||||
}
|
||||
// can use FOAM_DOC_BROWSER='application file://%f' if required
|
||||
// Can use FOAM_DOC_BROWSER='application file://%f' if required
|
||||
docBrowser.replaceAll("%f", docFile);
|
||||
|
||||
Info<< "Show documentation: " << docBrowser.c_str() << endl;
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -172,6 +172,9 @@ public:
|
||||
//- Max screen width for displaying usage (default: 80)
|
||||
static string::size_type usageMax;
|
||||
|
||||
//- Standard name for the post-processing option
|
||||
static word postProcessOptionName;
|
||||
|
||||
//! \cond internalClass
|
||||
class initValidTables
|
||||
{
|
||||
@ -367,6 +370,8 @@ public:
|
||||
//- Remove the parallel options
|
||||
static void noParallel();
|
||||
|
||||
//- Return true if the post-processing option is specified
|
||||
static bool postProcess(int argc, char *argv[]);
|
||||
|
||||
//- Set option directly (use with caution)
|
||||
// An option with an empty param is a bool option.
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,9 +29,6 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef compressibleCreatePhi_H
|
||||
#define compressibleCreatePhi_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "Reading/calculating face flux field phi\n" << endl;
|
||||
@ -49,8 +46,5 @@ surfaceScalarField phi
|
||||
linearInterpolate(rho*U) & mesh.Sf()
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,9 +29,6 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef createRhoUf_H
|
||||
#define createRhoUf_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "Reading/calculating face velocity rhoUf\n" << endl;
|
||||
@ -50,8 +47,4 @@ surfaceVectorField rhoUf
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -29,9 +29,6 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef createPhi_H
|
||||
#define createPhi_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "Reading/calculating face flux field phi\n" << endl;
|
||||
@ -49,8 +46,5 @@ surfaceScalarField phi
|
||||
fvc::flux(U)
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -29,9 +29,6 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef createPhiv_H
|
||||
#define createPhiv_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "Reading/calculating face flux field phiv\n" << endl;
|
||||
@ -49,8 +46,5 @@ surfaceScalarField phiv
|
||||
flux(U)
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,9 +29,6 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef createUf_H
|
||||
#define createUf_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "Reading/calculating face velocity Uf\n" << endl;
|
||||
@ -50,8 +47,4 @@ surfaceVectorField Uf
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
Loading…
Reference in New Issue
Block a user