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

‘mesh’ was not declared in this scope

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

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Display Modes
Old   April 8, 2014, 03:04
Default ‘mesh’ was not declared in this scope
  #1
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 675
Rep Power: 8
sharonyue is on a distinguished road
Hi guys,

I wanna change d0 as a dimensionedScalar to a volScalarField. So I revise the code:

in solvers/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/isothermalDiameter.C

Code:
class isothermal
:
    public diameterModel
{
    // Private data

        //- Reference diameter for the isothermal expansion
        //dimensionedScalar d0_; This is original
        volScalarField d0_;
    

        //- Reference pressure for the isothermal expansion
        dimensionedScalar p0_;
	
	//- Reference pressure for the isothermal expansion
        dimensionedScalar n0_;


public:
.....................
in solvers/compressibleTwoPhaseEulerFoam/phaseModel/diameterModels/isothermalDiameter.H
Code:
// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

Foam::diameterModels::isothermal::isothermal
(
    const dictionary& dict,
    const phaseModel& phase
)
:
    diameterModel(dict, phase),
    d0_
    (
        IOobject
        (
            "d0",
            mesh.time().timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    ),   
    //d0_("d0", dimLength, dict.lookup("d0")), This is original
    p0_("p0", dimPressure, dict.lookup("p0")),
    n0_("n0", dimDensity, dict.lookup("n0"))
{}


// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
When I wmake libso, it said:
Code:
SOURCE=diameterModels/isothermalDiameter/isothermalDiameter.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam222/src/finiteVolume/lnInclude -I/opt/openfoam222/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam222/src/transportModels/incompressible/lnInclude -IlnInclude -I. -I/opt/openfoam222/src/OpenFOAM/lnInclude -I/opt/openfoam222/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/isothermalDiameter.o
diameterModels/isothermalDiameter/isothermalDiameter.C: In constructor ‘Foam::diameterModels::isothermal::isothermal(const Foam::dictionary&, const Foam::phaseModel&)’:
diameterModels/isothermalDiameter/isothermalDiameter.C:63:13: error: ‘mesh’ was not declared in this scope
make: *** [Make/linux64GccDPOpt/isothermalDiameter.o] Error 1
a@a:~/OpenFOAM/myCase/solvers/compressibleTwoPhaseEulerFoam/phaseModel$
So how should I handle this? Thanks in advance.
sharonyue is offline   Reply With Quote

Old   April 8, 2014, 03:28
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,114
Rep Power: 19
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

as phase is a child class of volScalarField it has mesh() method which will return constant reference to the mesh. So the code can be:

Code:
    d0_
    (
        IOobject
        (
            "d0",
            phase.mesh().time().timeName(),
            phase.mesh(),
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        phase.mesh()
    ),
or

Code:
    d0_
    (
        IOobject
        (
            "d0",
            phase.time().timeName(),
            phase.db(),
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        phase.mesh()
    ),
sharonyue likes this.
alexeym is offline   Reply With Quote

Old   April 8, 2014, 03:33
Default
  #3
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 675
Rep Power: 8
sharonyue is on a distinguished road
@Alexey Matveichev

Solved! so quick! Thanks very much.!!
sharonyue 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
Compile calcMassFlowC aurore OpenFOAM Programming & Development 12 March 18, 2014 05:22
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31
error compiling modified applications yvyan OpenFOAM Programming & Development 18 December 17, 2011 15:39
checking the system setup and Qt version vivek070176 OpenFOAM Installation 22 June 1, 2010 12:34
How to get the max value of the whole field waynezw0618 OpenFOAM Running, Solving & CFD 4 June 17, 2008 05:07


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