|
[Sponsors] |
Inactive debug switches for fvOption SemiImplicitSource |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 27, 2014, 14:22 |
Inactive debug switches for fvOption SemiImplicitSource
|
#1 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
I seem to be unable to report an issue with the mantis system. However, I post the information here, and will report it later, unless someone has an alternative explanation.
When I run the injection tutorial case from the twoPhaseEulerFoam tutorials and I add the following lines to controlDict no debug information is printed: Code:
DebugSwitches { scalarSemiImplicitSource 1; vectorSemiImplicitSource 1; } The class SemiImplicitSource contains some debug output like this: Code:
if (debug) { Info<< "SemiImplicitSource<" << pTraits<Type>::typeName << ">::addSup for source " << name_ << endl; } The file semiImplicitSource.C contains the following "macro call" Code:
makeFvOption(SemiImplicitSource, scalar); Code:
#define makeFvOption(Option, Type) \ \ defineTemplateTypeNameAndDebugWithName \ ( \ Option<Type>, \ #Type#Option, \ 0 \ ); \ \ option::adddictionaryConstructorToTable<Option<Type> > \ add##Option##Type##dictionary##ConstructorTooptionTable_ Code:
#Type#Option the macro argument is Code:
"scalar""SemiImplicitSource" The macro Code:
makeFvOption(SemiImplicitSource, scalar); Code:
template<> const ::Foam::word SemiImplicitSource<scalar>::typeName("scalar""SemiImplicitSource"); template<> int SemiImplicitSource<scalar>::debug(::Foam::debug::debugSwitch("scalar""SemiImplicitSource", 0)); option::adddictionaryConstructorToTable<SemiImplicitSource<scalar> > addSemiImplicitSourcescalardictionaryConstructorTooptionTable_; I wonder why there is no compiler error message, however, the debug switch does not work. I think Code:
#Type#Option Code:
Type##Option |
|
August 31, 2014, 19:21 |
|
#2 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Greetings Gerhard,
Fortunately there is no bug, but in fact it's a missing feature. The problem is that the flags defined in the case's "system/controlDict" only work in some situations. In this situation, you will need to define it at the level of the global "controlDict" or similar, such as: Code:
$HOME/.OpenFOAM/2.3.x/controlDict Quote:
As for your suggestion of using "Type##Option" instead of "#Type#Option", that's incorrect. The interpretation of the two is as follows:
Bruno
__________________
|
||
September 1, 2014, 03:59 |
|
#3 | |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
Quote:
My guess was that the macros that create all this debug run-time magic need to get the data type passed instead of a string. I will take another close look and compare the workings of the pre-processor magic with non-templated and templated classes. Anyway, I will post my findings when I had a look. |
||
September 1, 2014, 04:55 |
|
#4 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
Some time ago I took a look at the non-templated macro magic of the SchillerNaumann drag model class, see the attached pdf.
There the macro Code:
/* Layout-provided Styles */ div.standard { margin-bottom: 2ex; }defineTypeNameAndDebug(SchillerNaumann, 0); The macro above is defined as Code:
/* Layout-provided Styles */ div.standard { margin-bottom: 2ex; } //- Define the typeName and debug information #define defineTypeNameAndDebug(Type, DebugSwitch) \ defineTypeName(Type); \ defineDebugSwitch(Type, DebugSwitch) Code:
/* Layout-provided Styles */ div.standard { margin-bottom: 2ex; } defineTypeNameWithName(Type, Type::typeName_()) /* Layout-provided Styles */ div.standard { margin-bottom: 2ex; } int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch)) /* Layout-provided Styles */ div.standard { margin-bottom: 2ex; } registerDebugSwitchWithName(Type, Type, Type::typeName_()) The argument Type is needed to correctly address namespaces and datatypes. However, I still have to look more closely into the templated stuff. |
|
March 22, 2015, 08:06 |
|
#5 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Hi Gerhard,
The ability to also control the debug flags for template classes has been implemented in the OpenFOAM-dev repository: https://github.com/OpenFOAM/OpenFOAM-dev/ It was implemented in this commit: https://github.com/OpenFOAM/OpenFOAM...09b8cb4b967baa Best regards, Bruno |
|
March 23, 2015, 04:07 |
|
#6 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
Hi Bruno,
thanks for the hint. Allow me a related off-topic question. Is the OpenFOAM-dev repo something new or newly made public? I started noticing links and references to this repo a few month ago. Cheers Gerhard |
|
March 28, 2015, 17:06 |
|
#7 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Quote:
|
||
Tags |
debugswitch, fvoptions, semi-implicit-source |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
create the file *.foam | phongstar | OpenFOAM | 12 | October 14, 2018 19:06 |
[OpenFOAM] could not open file .vtk in paraview | ali_atrian | ParaView | 8 | August 27, 2014 11:31 |
Debug Switches | Peter Müller | OpenFOAM Programming & Development | 2 | September 30, 2013 03:23 |
Eclipse - case debug error | Bufacchi | OpenFOAM | 1 | February 7, 2012 16:15 |