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

How to locate this bug?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 13, 2014, 23:49
Default How to locate this bug?
  #1
Member
 
BO WANG
Join Date: Sep 2014
Posts: 37
Rep Power: 4
wang219910611 is on a distinguished road
Hi everyone,

While I am trying to test my own solver on a new case, following error appears:
Code:
Reading/calculating face flux field phi

Reading transportProperties

--> FOAM FATAL ERROR: 
LHS and RHS of - have different dimensions
     dimensions : [0 0 0 0 0 0 0] - [1 -1 -1 0 0 0 0]

    From function operator-(const dimensionSet&, const dimensionSet&)
    in file dimensionSet/dimensionSet.C at line 499.

FOAM aborting
with the help of the info statement, I believe the error should be somewhere in the following code, which is in the creatField.H file :

Code:
Info<< "Reading transportProperties\n" << endl;

    incompressibleTwoPhaseMixture twoPhaseProperties(U, phi/*, "Ybar"*/);
    const dimensionedScalar& rho1 = twoPhaseProperties.rho1();

    Info<< "Done Reading transportProperties\n" << endl;
The strange part is that I can't find any "-" in the above code or in the incompressibleTwoPhaseMixture file ( they are the original ones ). Any clues where can I locate this error?

Many thanks. : )
wang219910611 is offline   Reply With Quote

Old   December 14, 2014, 04:51
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,659
Blog Entries: 39
Rep Power: 99
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings wang219910611,

My advice is to make sure that you're debugging the correct lines. Change that piece of code to this:
Code:
    Info<< "Reading transportProperties\n" << endl;

Info<< "Got here 00" << endl;

    incompressibleTwoPhaseMixture twoPhaseProperties(U, phi/*, "Ybar"*/);

Info<< "Got here 01" << endl;

    const dimensionedScalar& rho1 = twoPhaseProperties.rho1();

Info<< "Got here 02" << endl;

    Info<< "Done Reading transportProperties\n" << endl;
Why am I suggesting this? Because there might be more than one piece of code that gives the output "Reading transportProperties", and in addition, it will give a clearer notion of where exactly the problem is located.


The other suggestion is to look at the dictionary files that are loaded by this piece of code. My guess is that there isn't only one file and that a bug might be present in any of those dictionary files.


Beyond this: http://openfoamwiki.net/index.php/HowTo_debugging

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   December 18, 2014, 04:34
Default
  #3
New Member
 
BO
Join Date: Dec 2014
Posts: 21
Rep Power: 3
xianqiejiao is on a distinguished road
Hi Bruno, sorry for the late reply. I turned back to learn more about gdb and c++ these days, trying to fix the bug.

I think I have managed to locate the bugs to my visThermo. This is a new thermo type I tried to set up by copying the way of psiThermo. Here is what I got from gdb:
Code:
Program received signal SIGSEGV, Segmentation fault.
0x00000000005219d8 in Foam::HashTable<Foam::autoPtr<Foam::visThermo> (*)(Foam::fvMesh const&, Foam::word const&), Foam::word, Foam::string::hash>::find (
    this=0x0, key=...)
    at /home/bo/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/HashTable.C:143
143        if (nElmts_)
(gdb) frame 0
#0  0x00000000005219d8 in Foam::HashTable<Foam::autoPtr<Foam::visThermo> (*)(Foam::fvMesh const&, Foam::word const&), Foam::word, Foam::string::hash>::find (
    this=0x0, key=...)
    at /home/bo/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/HashTable.C:143
143        if (nElmts_)
(gdb) frane 1
Undefined command: "frane".  Try "help".
(gdb) frame 1
#1  0x0000000000520ef0 in Foam::basicThermo::lookupThermo<Foam::visThermo, Foam::HashTable<Foam::autoPtr<Foam::visThermo> (*)(Foam::fvMesh const&, Foam::word const&), Foam::word, Foam::string::hash> > (thermoDict=..., tablePtr=0x0)
    at /home/bo/OpenFOAM/OpenFOAM-2.3.0/src/thermophysicalModels/basic/lnInclude/basicThermoTemplates.C:68
68            typename Table::iterator cstrIter = tablePtr->find(thermoTypeName);
I have attached the visThermo file in the attachment. I think I have copied most of the line from psiThermo except the last few ones, which are member function. In my visThermo, I have got Ybar ( phase density), rho, mu1 for phase 1, mu2 for phase 2 and mu. Should I set the member functions in visThermo like the following ?
Code:
  virtual const volScalarField& Ybar() const;
            virtual const scalarField& Ybar(const label patchi) const;
            virtual tmp<volScalarField> rho() const
            virtual tmp<scalarField> rho(const label patchi) const;
            virtual volScalarField& rho();
            virtual const scalarField& mu1 const;
            virtual const scalarField& mu2 const;
            virtual const volScalarField& mu() const;
            virtual const scalarField& mu(const label patchi) const;
            virtual const volScalarField& Ybar() const;
            virtual const scalarField& Ybar(const label patchi) const;
Attached Files
File Type: h visThermo.H (3.3 KB, 1 views)
File Type: c visThermo.C (3.7 KB, 1 views)
xianqiejiao is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
dieselEngineFoam bug - OpenFOAM-1.6-ext novakm OpenFOAM Bugs 1 December 5, 2013 14:18
Serious bug in LES interface fs82 OpenFOAM Bugs 21 November 16, 2009 09:15
a cone injection,please help me!! satum FLUENT 0 July 2, 2008 02:38
Bug reports Mattijs Janssens (Mattijs) OpenFOAM 0 January 10, 2005 11:05
Forum y2k Bug Jonas Larsson Main CFD Forum 1 January 5, 2000 11:22


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