Commit 02e33f49 authored by Henry Weller's avatar Henry Weller Committed by Andrew Heather
Browse files

Replace foamList utility with -list.* options

Provides better context for the available boundary conditions, fvOptions,
functionObjects etc. and thus returns only those available to and compatible
with the particular application.

e.g.

pimpleFoam -help

Usage: pimpleFoam [OPTIONS]
options:
  -case <dir>       specify alternate case directory, default is the cwd
  -listFunctionObjects
                    List functionObjects
  -listFvOptions    List fvOptions
  -listRegisteredSwitches
                    List switches registered for run-time modification
  -listScalarBCs    List scalar field boundary conditions (fvPatchField<scalar>)
  -listSwitches     List switches declared in libraries but not set in
                    etc/controlDict
  -listTurbulenceModels
                    List turbulenceModels
  -listUnsetSwitches
                    List switches declared in libraries but not set in
                    etc/controlDict
  -listVectorBCs    List vector field boundary conditions (fvPatchField<vector>)
  -noFunctionObjects
                    do not execute functionObjects
  -parallel         run in parallel
  -postProcess      Execute functionObjects only
  -roots <(dir1 .. dirN)>
                    slave root directories for distributed running
  -srcDoc           display source code in browser
  -doc              display application documentation in browser
  -help             print the usage

pimpleFoam listTurbulenceModels

pimpleFoam -listTurbulenceModels
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  dev                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : dev-39c46019e44f
Exec   : pimpleFoam -listTurbulenceModels
Date   : Jun 10 2017
Time   : 21:37:49
Host   : "dm"
PID    : 675
Case   : /home/dm2/henry/OpenFOAM/OpenFOAM-dev
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
SetNaN : Initialising allocated memory to NaN (FOAM_SETNAN).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Turbulence models
3
(
LES
RAS
laminar
)

RAS models
18
(
LRR
LamBremhorstKE
LaunderSharmaKE
LienCubicKE
LienLeschziner
RNGkEpsilon
SSG
ShihQuadraticKE
SpalartAllmaras
kEpsilon
kOmega
kOmegaSST
kOmegaSSTLM
kOmegaSSTSAS
kkLOmega
qZeta
realizableKE
v2f
)

LES models
10
(
DeardorffDiffStress
Smagorinsky
SpalartAllmarasDDES
SpalartAllmarasDES
SpalartAllmarasIDDES
WALE
dynamicKEqn
dynamicLagrangian
kEqn
kOmegaSSTDES
)

Further work will be needed to support the -listTurbulenceModels option in
multiphase solvers.
parent 5cc03052
EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lbarotropicCompressibilityModel \
-lblockMesh \
-lchemistryModel \
-lcoalCombustion \
-lcombustionModels \
-lcompressibleTransportModels \
-lcompressibleTurbulenceModels \
-lconversion \
-ldecompose \
-ldecompositionMethods \
-ldistributed \
-ldistributionModels \
-lDPMTurbulenceModels \
-ldriftFluxRelativeVelocityModels \
-ldriftFluxTransportModels \
-lDSMC \
-ldynamicFvMesh \
-ldynamicMesh \
-lengine \
-lextrudeModel \
-lfieldFunctionObjects \
-lfileFormats \
-lfiniteVolume \
-lfluidThermophysicalModels \
-lforces \
-lfvMotionSolvers \
-lfvOptions \
-lgenericPatchFields \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModels \
-llagrangian \
-llagrangianFunctionObjects \
-llagrangianIntermediate \
-llagrangianSpray \
-llagrangianTurbulence \
-llaminarFlameSpeedModels \
-lmeshTools \
-lmolecularMeasurements \
-lmolecule \
-lODE \
-lpairPatchAgglomeration \
-lpotential \
-lpyrolysisModels \
-lradiationModels \
-lreactingEulerianInterfacialCompositionModels \
-lreactingEulerianInterfacialModels \
-lreactingPhaseSystem \
-lreactingTwoPhaseSystem \
-lreactionThermophysicalModels \
-lreconstruct \
-lregionCoupled \
-lregionCoupling \
-lregionModels \
-lrenumberMethods \
-lrhoCentralFoam \
-lrigidBodyDynamics \
-lrigidBodyMeshMotion \
-lsampling \
-L$(FOAM_LIBBIN)/dummy -lscotchDecomp \
-lsixDoFRigidBodyMotion \
-lSLGThermo \
-lsnappyHexMesh \
-lsolidChemistryModel \
-lsolidParticle \
-lsolidSpecie \
-lsolidThermo \
-lsolverFunctionObjects \
-lspecie \
-lsurfaceFilmDerivedFvPatchFields \
-lsurfaceFilmModels \
-lsurfMesh \
-lthermalBaffleModels \
-lthermophysicalProperties \
-ltopoChangerFvMesh \
-lturbulenceModels \
-ltwoPhaseMixture \
-ltwoPhaseReactingTurbulenceModels \
-lutilityFunctionObjects
/*
Combinations of the following libs leads to corruption errors... ?
-limmiscibleIncompressibleTwoPhaseMixture \
-linterfaceProperties \
-lphaseChangeTwoPhaseMixtures \
-ltwoPhaseMixtureThermo \
-ltwoPhaseProperties \
*/
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
Application
foamList
Description
Print the table of contents of selectable switches, classes etc. in the
OpenFOAM libraries
Usage
\b foamList [OPTION]
Options:
- \par -switches
Print the DebugSwitches, InfoSwitches and OptimisationSwitches
- \par -registeredSwitches
Print the registered DebugSwitches, InfoSwitches and
OptimisationSwitches supporting run-time modification
- \par -unset
print switches declared in libraries but not set in etc/controlDict
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "dictionary.H"
#include "simpleObjectRegistry.H"
#include "IFstream.H"
#include "IOobject.H"
#include "HashSet.H"
#include "etcFiles.H"
#include "fvPatchField.H"
#include "functionObject.H"
#include "fvOption.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
using namespace Foam;
void listSwitches
(
const wordList& debugSwitches,
const wordList& infoSwitches,
const wordList& optSwitches,
const bool unset
)
{
if (unset)
{
fileNameList controlDictFiles = findEtcFiles("controlDict", true);
dictionary controlDict;
forAllReverse(controlDictFiles, cdfi)
{
controlDict.merge(dictionary(IFstream(controlDictFiles[cdfi])()));
}
wordHashSet controlDictDebug
(
controlDict.subDict("DebugSwitches").sortedToc()
);
wordHashSet controlDictInfo
(
controlDict.subDict("InfoSwitches").sortedToc()
);
wordHashSet controlDictOpt
(
controlDict.subDict("OptimisationSwitches").sortedToc()
);
IOobject::writeDivider(Info);
wordHashSet hashset;
hashset = debugSwitches;
hashset -= controlDictDebug;
Info<< "Unset DebugSwitches" << hashset.sortedToc() << endl;
hashset = infoSwitches;
hashset -= controlDictInfo;
Info<< "Unset InfoSwitches" << hashset.sortedToc() << endl;
hashset = optSwitches;
hashset -= controlDictOpt;
Info<< "Unset OptimisationSwitches" << hashset.sortedToc() << endl;
}
else
{
IOobject::writeDivider(Info);
Info<< "DebugSwitches" << debugSwitches << endl;
Info<< "InfoSwitches" << infoSwitches << endl;
Info<< "OptimisationSwitches" << optSwitches << endl;
}
}
void listSwitches(const argList& args)
{
if (args.optionFound("registeredSwitches"))
{
listSwitches
(
debug::debugObjects().sortedToc(),
debug::infoObjects().sortedToc(),
debug::optimisationObjects().sortedToc(),
args.optionFound("unset")
);
}
else
{
listSwitches
(
debug::debugSwitches().sortedToc(),
debug::infoSwitches().sortedToc(),
debug::optimisationSwitches().sortedToc(),
args.optionFound("unset")
);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::noParallel();
argList::addBoolOption
(
"switches",
"List switches declared in libraries but not set in etc/controlDict"
);
argList::addBoolOption
(
"registeredSwitches",
"List switches registered for run-time modification"
);
argList::addBoolOption
(
"unset",
"List switches declared in libraries but not set in etc/controlDict"
);
argList::addBoolOption
(
"scalarBCs",
"List scalar field boundary conditions (fvPatchField<scalar>)"
);
argList::addBoolOption
(
"vectorBCs",
"List vector field boundary conditions (fvPatchField<vector>)"
);
argList::addBoolOption
(
"functionObjects",
"List functionObjects"
);
argList::addBoolOption
(
"fvOptions",
"List fvOptions"
);
argList::addBoolOption
(
"incompressibleTurbulenceModels",
"List incompressible turbulenceModels"
);
argList::addBoolOption
(
"compressibleTurbulenceModels",
"List compressible turbulenceModels"
);
argList args(argc, argv);
if (!args.options().size())
{
args.printUsage();
return 0;
}
if
(
args.optionFound("switches")
|| args.optionFound("registeredSwitches")
)
{
listSwitches(args);
}
if (args.optionFound("scalarBCs"))
{
Info<< "scalarBCs"
<< fvPatchField<scalar>::dictionaryConstructorTablePtr_->sortedToc()
<< endl;
}
if (args.optionFound("vectorBCs"))
{
Info<< "vectorBCs"
<< fvPatchField<vector>::dictionaryConstructorTablePtr_->sortedToc()
<< endl;
}
if (args.optionFound("functionObjects"))
{
Info<< "functionObjects"
<< functionObject::dictionaryConstructorTablePtr_->sortedToc()
<< endl;
}
if (args.optionFound("fvOptions"))
{
Info<< "fvOptions"
<< fv::option::dictionaryConstructorTablePtr_->sortedToc()
<< endl;
}
if (args.optionFound("incompressibleTurbulenceModels"))
{
Info<< "Turbulence models"
<< incompressible::turbulenceModel::
dictionaryConstructorTablePtr_->sortedToc()
<< endl;
Info<< "RAS models"
<< incompressible::RASModel::
dictionaryConstructorTablePtr_->sortedToc()
<< endl;
Info<< "LES models"
<< incompressible::LESModel::
dictionaryConstructorTablePtr_->sortedToc()
<< endl;
}
if (args.optionFound("compressibleTurbulenceModels"))
{
Info<< "Turbulence models"
<< compressible::turbulenceModel::
dictionaryConstructorTablePtr_->sortedToc()
<< endl;
Info<< "RAS models"
<< compressible::RASModel::
dictionaryConstructorTablePtr_->sortedToc()
<< endl;
Info<< "LES models"
<< compressible::LESModel::
dictionaryConstructorTablePtr_->sortedToc()
<< endl;
}
return 0;
}
// ************************************************************************* //
......@@ -39,6 +39,10 @@ License
#include "sigSegv.H"
#include "foamVersion.H"
#include "simpleObjectRegistry.H"
#include "HashSet.H"
#include "etcFiles.H"
#include <cctype>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -1294,6 +1298,88 @@ void Foam::argList::displayDoc(bool source) const
}
void Foam::argList::listSwitches
(
const wordList& debugSwitches,
const wordList& infoSwitches,
const wordList& optSwitches,
const bool unset
)
{
if (unset)
{
fileNameList controlDictFiles = findEtcFiles("controlDict", true);
dictionary controlDict;
forAllReverse(controlDictFiles, cdfi)
{
controlDict.merge(dictionary(IFstream(controlDictFiles[cdfi])()));
}
wordHashSet controlDictDebug
(
controlDict.subDict("DebugSwitches").sortedToc()
);
wordHashSet controlDictInfo
(
controlDict.subDict("InfoSwitches").sortedToc()
);
wordHashSet controlDictOpt
(
controlDict.subDict("OptimisationSwitches").sortedToc()
);
IOobject::writeDivider(Info);
wordHashSet hashset;
hashset = debugSwitches;
hashset -= controlDictDebug;
Info<< "Unset DebugSwitches" << hashset.sortedToc() << endl;
hashset = infoSwitches;
hashset -= controlDictInfo;
Info<< "Unset InfoSwitches" << hashset.sortedToc() << endl;
hashset = optSwitches;
hashset -= controlDictOpt;
Info<< "Unset OptimisationSwitches" << hashset.sortedToc() << endl;
}
else
{
IOobject::writeDivider(Info);
Info<< "DebugSwitches" << debugSwitches << endl;
Info<< "InfoSwitches" << infoSwitches << endl;
Info<< "OptimisationSwitches" << optSwitches << endl;
}
}
void Foam::argList::listSwitches(const bool unset) const
{
listSwitches
(
debug::debugSwitches().sortedToc(),
debug::infoSwitches().sortedToc(),
debug::optimisationSwitches().sortedToc(),
unset
);
}
void Foam::argList::listRegisteredSwitches(const bool unset) const
{
listSwitches
(
debug::debugObjects().sortedToc(),
debug::infoObjects().sortedToc(),
debug::optimisationObjects().sortedToc(),
unset
);
}
bool Foam::argList::check(bool checkArgs, bool checkOpts) const
{
bool ok = true;
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
......@@ -160,6 +160,15 @@ class argList
// return true if any "(" ... ")" sequences were captured
bool regroupArgv(int& argc, char**& argv);
//- List debug switches
static void listSwitches
(
const wordList& debugSwitches,
const wordList& infoSwitches,
const wordList& optSwitches,
const bool unset
);
public:
......@@ -421,6 +430,12 @@ public:
// Optionally display the application source code
void displayDoc(bool source=false) const;
//- List debug switches
void listSwitches(const bool unset) const;
//- List registered debug switches
void listRegisteredSwitches(const bool unset) const;
// Check
......
argList::addBoolOption
(
"listSwitches",
"List switches declared in libraries but not set in etc/controlDict"
);
argList::addBoolOption
(
"listRegisteredSwitches",
"List switches registered for run-time modification"
);
argList::addBoolOption
(
"listUnsetSwitches",
"List switches declared in libraries but not set in etc/controlDict"
);
#ifdef fvPatchField_H
argList::addBoolOption
(
"listScalarBCs",
"List scalar field boundary conditions (fvPatchField<scalar>)"
);
argList::addBoolOption
(
"listVectorBCs",
"List vector field boundary conditions (fvPatchField<vector>)"
);
#endif
#ifdef functionObject_H
argList::addBoolOption
(
"listFunctionObjects",
"List functionObjects"
);
#endif
#ifdef fvOption_H
argList::addBoolOption
(
"listFvOptions",
"List fvOptions"
);
#endif
#if defined(turbulentTransportModel_H) || defined(turbulentFluidThermoModel_H)
argList::addBoolOption
(
"listTurbulenceModels",
"List turbulenceModels"
);
#endif
bool listOptions = false ;
if
(
args.optionFound("listSwitches")
)
{
args.listSwitches(args.optionFound("includeUnsetSwitches"));
listOptions = true;
}
if
(
args.optionFound("listRegisteredSwitches")
)
{
args.listRegisteredSwitches(args.optionFound("includeUnsetSwitches"));
listOptions = true;
}
#ifdef fvPatchField_H
if (args.optionFound("listScalarBCs"))
{
Info<< "scalarBCs"
<< fvPatchField<scalar>::dictionaryConstructorTablePtr_->sortedToc()
<< endl;
listOptions = true;
}
if (args.optionFound("listVectorBCs"))
{
Info<< "vectorBCs"
<< fvPatchField<vector>::dictionaryConstructorTablePtr_->sortedToc()
<< endl;
listOptions = true;
}
#endif
#ifdef functionObject_H
if (args.optionFound("listFunctionObjects"))