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

How to locate this bug?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 13, 2014, 22:49
Default How to locate this bug?
  #1
Member
 
BO WANG
Join Date: Sep 2014
Posts: 37
Rep Power: 11
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, 03:51
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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, 03:34
Default
  #3
New Member
 
BO
Join Date: Dec 2014
Posts: 21
Rep Power: 11
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


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
dieselEngineFoam bug - OpenFOAM-1.6-ext novakm OpenFOAM Bugs 1 December 5, 2013 13:18
Serious bug in LES interface fs82 OpenFOAM Bugs 21 November 16, 2009 08: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 10:05
Forum y2k Bug Jonas Larsson Main CFD Forum 1 January 5, 2000 10:22


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