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 Tree2Likes
  • 2 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: 756
Rep Power: 10
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,758
Rep Power: 29
alexeym will become famous soon enoughalexeym will become famous soon enough
Send a message via Skype™ to alexeym
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()
    ),
Elham and sharonyue like 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: 756
Rep Power: 10
sharonyue is on a distinguished road
@Alexey Matveichev

Solved! so quick! Thanks very much.!!
sharonyue is offline   Reply With Quote

Old   August 25, 2017, 14:43
Default error: ‘constrainP1’ was not declared in this scope constrainP1(p1, U1,rAU1)
  #4
New Member
 
Alireza
Join Date: Apr 2017
Posts: 1
Rep Power: 0
Alee reza is on a distinguished road
Hi guys,
I wanna solve some new equation with icoFoam so i added my new equation in icoFaom .When I wmake , it said:[icoOTDFoam.C:139:70: error: ‘constrainHbyA1’ was not declared in this scope
volVectorField HbyA1(constrainHbyA1(rAU1*U1Eqn.H(), U1, p1));][]
and this is my solver .C

[/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.

OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.

Application
icoFoam

Description
Transient solver for incompressible, laminar flow of Newtonian fluids.

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "pisoControl.H"

#include "pisoControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

pisoControl piso(mesh);

#include "createFields.H"
#include "initContinuityErrs.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;

while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

#include "CourantNo.H"

// Momentum predictor

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);

if (piso.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
}

// --- PISO loop
while (piso.correct())
{
volScalarField rAU(1.0/UEqn.A());

volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
///H/ap that is equal to U in old version
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rAU)*fvc::ddtCorr(U, phi)
);
///phiHbyA is like new phi
adjustPhi(phiHbyA, U, p);

// Update the pressure BCs to ensure flux consistency
constrainPressure(p, U, phiHbyA, rAU);

// Non-orthogonal pressure corrector loop
while (piso.correctNonOrthogonal())
{
// Pressure corrector

fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
);

pEqn.setReference(pRefCell, pRefValue);

pEqn.solve(mesh.solver(p.select(piso.finalInnerIte r())));

if (piso.finalNonOrthogonalIter())
{
phi = phiHbyA - pEqn.flux();
}
}

#include "continuityErrs.H"

U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions();
}
/////////////////////////////////////////////////////////%%%******
// first mode predictor

fvVectorMatrix U1Eqn
(
fvm::ddt(U1)
+ fvm::div(phi, U1)
+ fvm::div(phi1,U)
- fvm::laplacian(nu, U1)

);

if (piso.momentumPredictor())
{
solve(U1Eqn == -fvc::grad(p1));
}

// --- PISO loop
while (piso.correct())
{
volScalarField rAU1(1.0/U1Eqn.A());

volVectorField HbyA1(constrainHbyA1(rAU1*U1Eqn.H(), U1, p1));

surfaceScalarField phiHbyA1
(
"phiHbyA1",
fvc::flux(HbyA1)
+ fvc::interpolate(rAU1)*fvc::ddtCorr(U1, phi1)
);
///phiHbyA is like new phi
adjustPhi1(phiHbyA1, U1, p1);///Think

constrainP1(p1, U1, phiHbyA1, rAU1);

// Non-orthogonal pressure corrector loop
while (piso.correctNonOrthogonal())
{
// Pressure corrector

fvScalarMatrix p1Eqn
(
fvm::laplacian(rAU1, p1) == fvc::div(phiHbyA1)
);

p1Eqn.setReference(pRefCell, pRefValue);

p1Eqn.solve(mesh.solver(p1.select(piso.finalInnerI ter())));

if (piso.finalNonOrthogonalIter())
{
phi1 = phiHbyA1 - p1Eqn.flux();
}
}

#include "continuityErrs.H"

U1 = HbyA1 - rAU1*fvc::grad(p1);
U1.correctBoundaryConditions();
}



runTime.write();




Info<< "End\n" << endl;

return 0;
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

}


// ************************************************** *********************** //][/QUOTE]
what should I do? Thanks in advance.

Last edited by Alee reza; September 3, 2017 at 07:37. Reason: i did not mention my problem.
Alee reza 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
error compiling modified applications yvyan OpenFOAM Programming & Development 21 March 1, 2016 05:53
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
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 23:05.