A (testing) application needs to do additional work depending on a simulation / test case. The decision to do additional work is decided by an option passed to the application.
This guide was written for OpenFOAM-dev. It might work on FOAM-extend too (if so, please add it to the tags of this article).
Boolean / switch options in OpenFOAM are not read from the input stream. Their existence is simply checked by the lookup function. Don’t try to use optionLookup
or optionLookupOrDefault
, they always return false.
Adding options in the OpenFOAM potentialFoam solver
argList::addOption
(
"pName",
"pName",
"Name of the pressure field"
);
argList::addBoolOption
(
"initialiseUBCs",
"Initialise U boundary conditions"
);
....
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
...
// Optionally write Phi
if (args.optionFound("writePhi"))
{
Phi.write();
}