CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Debug switch (http://www.cfd-online.com/Forums/openfoam-solving/59588-debug-switch.html)

pierre October 18, 2005 14:16

Hi Everyone, There seem to
 
Hi Everyone,

There seem to be quite a few debug switches, that give extra information on the on-going calculations in the code. How does one turn on/off

Ex: In src/OpenFOAM/matrices/lduMatrix/solvers/ICCG.C
i want to turn on
if (lduMatrix::debug >= 2)
{
Info<< " Normalisation factor = " << normFactor << endl;
}
How do I do That?

Apologies if it's a stupid question?

Pierre

hjasak October 18, 2005 14:29

Edit ~/.OpenFOAM-1.2/controlDi
 
Edit ~/.OpenFOAM-1.2/controlDict and you will find some of the switches. For the full list, run the foamDebugSwitches app and it will print them out for you. (and read the manual) :-)

Enjoy,

Hrv

matlie November 7, 2005 09:28

Hi Pierre, I also first got
 
Hi Pierre,

I also first got stuck on the setting of debug switches. What I missed is that it is not necessary that the name of the debug switch in the file ~/.OpenFOAM-1.2/controlDict is not necessarily the same as the name of the variable in the code.

Example:
In the file: polyMeshMorph
In the code: morphDebug

The variable is created via the global function:
debug::debugSwitch

matlie November 7, 2005 09:31

Hi Pierre, I also first got
 
Hi Pierre,

I also first got stuck on the setting of debug switches. What I missed is that it is not necessary that the name of the debug switch in the file ~/.OpenFOAM-1.2/controlDict is not the same as the name of the variable in the code.

Example:
In the file: polyMeshMorph
In the code: morphDebug

The debug variable can be created via the global function:
debug::debugSwitch
It can also be created via the define:
DefineTypeNameAndDebug (in className.H)

mattijs November 8, 2005 05:01

Usually the names are similar
 
Usually the names are similar but look in the source code to make sure.

They are defined by a 'ClassName' macro in the .H file and a 'defineTypeNameAndDebug' macro in the .C file (for non-templated code). See e.g. dictionary.H, dictionary.C

This causes the name to be defined and put onto a big table of global names which get read in from the controlDict or get the default value specified in the 'defineTypeNameAndDebug' call.

This way one can add debugging switches to any code. The only limitation is that the name (i.e. the 'ClassName') should be unique.

maka July 5, 2007 19:38

if a class has: //- R
 
if a class has:
//- Runtime type information
TypeName("nuSgsWallFunction");
in its header file, like in nuSgsWallFunction.H
and we add:

// Declare name of the class and it's debug switch
ClassName("nuSgsWallFunctionSwitch");

then we get the error:

wallFunc/nuSgsWallFunction/nuSgsRoughWallFunctionFvPatchScalarField.H:67: error: 'static const
char* Foam::LESmodels::nuSgsRoughWallFunctionFvPatchScal arField::typeName_()' cannot be overloa
ded

it seems that both are doing the same thing.

then if I comment ClassName line and try to retrieve the name by member function type()

wallFunc/nuSgsWallFunction/nuSgsRoughWallFunctionFvPatchScalarField.C:44: error: expected initi
alizer before '::' token

It seems that I got something wrong. What is it?

Best regards,
Maka.


All times are GMT -4. The time now is 16:34.