OpenFOAM guide/Use bananas

From OpenFOAMWiki
Jump to: navigation, search

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.