OpenFOAM guide/Use bananas

From OpenFOAMWiki

1 What options can I use?

A disadvantage of the runTimeSelection mechanism in OpenFOAM is it makes it difficult to determine what all the available RTS derived classes are. To make this easier, use a random word in the setting file and run the solver. Most RTS base classes, when given an invalid word, will fail by displaying all valid words to the console.

For example, in the icoFoam tutorial, "cavity", the pressure matrix solver is set in fvSolution:

   p PCG
   {
       preconditioner   DIC;
       tolerance        1e-06;
       relTol           0;
   };

Changing this to:

   p banana
   {
       preconditioner   DIC;
       tolerance        1e-06;
       relTol           0;
   };

will produce the following output:

Unknown symmetric matrix solver banana

Valid symmetric matrix solvers are :

13
(
ICCG
RREAMG
MPEAMG
GMRES
FPEAMG
smoothSolver
deflation
BICCG
PCG
amgSolver
CG
GAMG
BiCGStab
)


file: /TUTORIAL DIRECTORY/icoFoam/cavity/system/fvSolution::p at line 19.

    From function lduMatrix::solver::New
    in file matrices/lduMatrix/lduMatrix/lduMatrixSolver.C at line 84.

 FOAM exiting

Any of the displayed options can be used in place of "banana".

Some RTS base classes do not exhibit this behaviour. For example, the fvPatchField (boundary field) will accept unknown boundary conditions and create a "generic boundary condition". This is to prevent post-processors from crashing when viewing a custom boundary condition.


2 What about optional keywords?

Valid versions: OF Version 23x.png OF Version 24.png OF Version 30.png OF Version 4.png OF Version 30plus.png OF Version 1606plus.png OF Version 1612plus.png

The switch writeOptionalEnties was added to InfoSwitches in OpenFOAM 2.3.x in commit 97c56ba71c1 (before the release of OpenFOAM 2.4.0).

For more details on how set or add this entry, see Getting built-in feedback from OpenFOAM at HowTo_debugging, although keep in mind that the block for this entry is InfoSwitches and not DebugSwitches.