CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Finding the corresponding debug switch

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By wwzhao
  • 1 Post By wwzhao

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 12, 2017, 07:12
Default Finding the corresponding debug switch
  #1
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,667
Blog Entries: 6
Rep Power: 48
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi all,

I never got the point of the correct debug switch name that we can manipulate either global or local. In some particular cases it is obvious e.g. ODE solvers have the ODE or ODESolver debug switch. Lets assume we want to activate the debug output in the fvMatrix class e.g. to output the stuff in the relax(const scalar alpha) function. Right now, I was always checking the TypeName info to activate the debug output (this is also mentioned by sourceflux here http://www.sourceflux.de/blog/openfoam-debug-switch/). However, for the fvMatrix class there is actually no debug switch that I could figure out which is responsible for that class. I also went through older threads but there it was obvious which debug switch we should use.

In the following thread (Debug switch) it is mentioned that we build the debug switch using:
Code:
defineTypeNameAndDebug
However, for the fvMatrix class I cannot find any of them. I also checked the friend classes but without success and if, the debug switch for the fvMatrix was never activated. To be honest, there is no time for me to check it out so I would be very happy to have someone which can tell me the missing information because as far as I got it, the fvMatrix isnot in the debug switches, right?
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 12, 2017, 08:47
Default
  #2
New Member
 
Weiwen Zhao
Join Date: Dec 2013
Posts: 19
Rep Power: 10
wwzhao is on a distinguished road
Hello Tobias,

fvMatrix<Type> is a class template. I believe the debug switches are controlled by the specialization of fvMatrix<Type>, e.g., fvScalarMatrix, fvVectorMatrix and fvTensorMatrix etc. Examples can be found in $FOAM_ETC/controlDict.


Best,
Weiwen
Tobi likes this.
wwzhao is offline   Reply With Quote

Old   July 12, 2017, 08:50
Default
  #3
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,667
Blog Entries: 6
Rep Power: 48
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi Weiwen,

well that is really funny. So simple. I was thinking about the template character but I never searched for a fv<Type>Matrix debug switch in the controlDict. Thank you very much. That is the solution.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   April 3, 2019, 09:24
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,667
Blog Entries: 6
Rep Power: 48
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi all,

I am facing again the same situation for the compressible::turbulentTemperatureCoupledBaffleMix ed boundary condition. In the source code, we find the debug switch:
Code:
    if (debug)
    {
        scalar Q = gSum(kappa(*this)*patch().magSf()*snGrad());

        Info<< patch().boundaryMesh().mesh().name() << ':'
            << patch().name() << ':'
            << this->internalField().name() << " <- "
            << nbrMesh.name() << ':'
            << nbrPatch.name() << ':'
            << this->internalField().name() << " :"
            << " heat transfer rate:" << Q
            << " walltemperature "
            << " min:" << gMin(*this)
            << " max:" << gMax(*this)
            << " avg:" << gAverage(*this)
            << endl;
    }
However, I cannot figure out which debug switch corresponds to that boundary condition. Any suggestion on how to proceed here? I still did not get the logic here.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   April 3, 2019, 10:02
Default
  #5
Member
 
Andrew Coughtrie
Join Date: May 2011
Posts: 51
Rep Power: 13
Andrew.Coughtrie is on a distinguished road
Hi Tobi,

As far as I can tell in general the debug switch for a patchField is defined through the makePatchTypeField macro at the end of the .C file as you know.

so even though the debug switch for turbulentTemperatureCoupledBaffleMixedFvPatchScala rField isn't in the controlDict it should still be that as far as i can tell.

I haven't tested it though so....

Andrew

Last edited by Andrew.Coughtrie; April 3, 2019 at 10:50. Reason: reread previous posts
Andrew.Coughtrie is offline   Reply With Quote

Old   April 3, 2019, 10:16
Default
  #6
New Member
 
Weiwen Zhao
Join Date: Dec 2013
Posts: 19
Rep Power: 10
wwzhao is on a distinguished road
Dear Tobi,

I think you should add "compressible::turbulentTemperatureCoupledBaffleMi xed 1;" to DebugSwitches sub-dictionary in system/controlDict.

Best,
Weiwen
Andrew.Coughtrie likes this.
wwzhao is offline   Reply With Quote

Old   April 29, 2019, 10:49
Default
  #7
New Member
 
Orcun Kozaka
Join Date: Dec 2009
Posts: 6
Rep Power: 14
excolade is on a distinguished road
Hi all,


I am trying to turn on the debug switch in cyclicAMIPolyPatch.C. As far as I understood


Code:
namespace Foam
{
    defineTypeNameAndDebug(cyclicAMIPolyPatch, 0);

    addToRunTimeSelectionTable(polyPatch, cyclicAMIPolyPatch, word);
    addToRunTimeSelectionTable(polyPatch, cyclicAMIPolyPatch, dictionary);
}

if I set cyclicAMIPolyPatch to 1 in controlDict DebugSwitches subDictionary it will turn the debug switches on for that part of the code. Is this correct? Or do I have to compile the openfoam with certain debug definitions turned on? I am on OpenFoam 5.x by the way.


Cheers,


Orçun
excolade is offline   Reply With Quote

Old   June 20, 2020, 04:07
Default
  #8
New Member
 
Join Date: May 2020
Posts: 27
Blog Entries: 1
Rep Power: 4
Mars409 is on a distinguished road
I ran into a weird debug switch error when I run MPPICFoam. It didn't happen until yesterday.
Code:
$ MPPICFoam
debug::switchSet(const char*, dictionary*&):
    Cannot find DebugSwitches in dictionary IStringStream.sourceFile
Yesterday I cloned my RaspberryPi-4 OpenFoam7 build to replicate on another RaspberryPi-4. Fortunately, and strangely, MPPICFoam runs fine there.

Today I was tinkering around with how to run MPI over multiple machines and setting up an NFS directory to place a clone case directory there. As soon as I tried running mpirun -np 7 --hosts <machinesfile> MPPICFoam -parallel, I got this error. So I tried running just MPPICFoam without MPI, still the same error.

And it's not just in this NFS directory, but happens also on a similar clone directory elsewhere on the same node. But running MPPICFoam from the clone node on the same NFS directory ran just fine.

It could be a file corruption somewhere under the OpenFoam directory. I still have the tarball for the OpenFoam build cloning purpose, so I could untar to overwrite my OpenFoam-7 directory and try again.

But perhaps before I take that drastic step someone in this thread could give me a tip-off as to where to look for the offending file?

===============

The problem went away as mysteriously as it had arrived. After powering it down, powering back up to do some unrelated work, powering down again, and finally powering back up 2nd time to re-try MPPICFoam, it runs without a hitch.

Last edited by Mars409; June 20, 2020 at 13:19. Reason: New observation.
Mars409 is offline   Reply With Quote

Old   October 14, 2020, 09:23
Default
  #9
jmt
Member
 
Julian
Join Date: Sep 2019
Posts: 31
Rep Power: 5
jmt is on a distinguished road
Quote:
Originally Posted by wwzhao View Post
Dear Tobi,

I think you should add "compressible::turbulentTemperatureCoupledBaffleMi xed 1;" to DebugSwitches sub-dictionary in system/controlDict.

Best,
Weiwen
I wanted to write a note to follow up that Weiwen is correct and I just followed this procedure for OpenFoam-5.x. In the main controlDict file,
Code:
$FOAM_ETC/system/controlDict
you can add the key to the list of debugSwitches:

Code:
DebugSwitches
{
    ...
    compressible::turbulentTemperatureCoupledBaffleMixed  1;
    ...
}
In the screen or log file output, you can now see the heat transfer rate and interface temperature. Thanks all!

Last edited by jmt; October 14, 2020 at 09:25. Reason: missed a tag
jmt is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 19 June 11, 2020 15:54
create the file *.foam phongstar OpenFOAM 12 October 14, 2018 18:06
[swak4Foam] segmentation faults when using the debug switch "ExpressionResult" Astrodan OpenFOAM Running, Solving & CFD 1 February 21, 2016 16:29
Eclipse - case debug error Bufacchi OpenFOAM 1 February 7, 2012 15:15
Debug switch pierre OpenFOAM Running, Solving & CFD 5 July 5, 2007 19:38


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