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

Dimension Problem in If Condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 25, 2013, 04:05
Default Dimension Problem in If Condition
  #1
Senior Member
 
sfigato's Avatar
 
Marco Longhitano
Join Date: Jan 2013
Location: Aachen
Posts: 103
Rep Power: 13
sfigato is on a distinguished road
Send a message via Skype™ to sfigato
Hi Foamers,

I would like to implement a new cavitation solver in openFoam! I added a transport equation for mass fraction where I need to compare my local pressure (p) with a scalar experimental value pEq!

During the compiling of the code I got a dimension error!
Can anyone help me to fix it?

Here is the transport equation code:


Quote:
// Solve Mass Fraction Equation for the Gas Air (undissolved)
{
#include "sourceTerms.H"

//Scalar Transport Equation for Mass Fraction
if (pEq > p) //p)
{
fvScalarMatrix f4Eqn
(
fvm::ddt(rho, f4)
+ fvm::div(rhoPhi /*phi*/, f4)
- fvm::laplacian(Gamma4,f4)
//+ fvm::Sp(AaL,f4)
+ fvm::Sp(AdL,f4)

);

f4Eqn.relax();
solve( f4Eqn /*== AaL*fGlim*/);
}
else
{
fvScalarMatrix f4Eqn
(
fvm::ddt(rho, f4)
+ fvm::div(rhoPhi /*phi*/, f4)
- fvm::laplacian(Gamma4,f4)
+ fvm::Sp(AaL,f4)
//+ fvm::Sp(AdL,f4)

);

f4Eqn.relax();
solve( f4Eqn == AaL*fGlim);
}

//Update of All Phases Coeffcients
//rho == scalar(1)/((f1+f4)/rho1 + f2/rho2 + f3/rho3);
//rhoPhi == rho*phi;
}
Here the declarations for pEq and p

Quote:
Info<< "Reading thermodynamicProperties\n" << endl;

IOdictionary thermodynamicProperties
(
IOobject
(
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);

dimensionedScalar pEq(thermodynamicProperties.lookup("pEq"));
Quote:
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
The compiling error is:

Quote:
Making dependency list for source file ifasFCMfoam.C
Making dependency list for source file incompressibleFourPhaseMixture/fourPhaseMixture.C
SOURCE=ifasFCMfoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/OpenFOAM/OpenFOAM-2.1.x/src/turbulenceModels/incompressible/turbulenceModel -I/opt/OpenFOAM/OpenFOAM-2.1.x/src/transportModels -I/opt/OpenFOAM/OpenFOAM-2.1.x/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.1.x/src/meshTools/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.1.x/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/ifasFCMfoam.o
In file included from ifasFCMfoam.C:76:0:
f4Eqn.H: In function ‘int main(int, char**)’:
f4Eqn.H:6:11: error: no match for ‘operator>’ in ‘pEq > p’
f4Eqn.H:6:11: note: candidates are:
In file included from /opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/VectorSpace.H:164:0,
from /opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dimensionedType.H:41,
from /opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dimensionedScalar.H:38,
from /opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/TimeState.H:38,
from /opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Time.H:47,
from /opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvCFD.H:6,
from ifasFCMfoam.C:36:
/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/VectorSpaceI.H:650:13: note: template<class Form, class Cmpt, int nCmpt> bool Foam:perator>(const Foam::VectorSpace<Form, Cmpt, nCmpt>&, const Foam::VectorSpace<Form, Cmpt, nCmpt>&)
/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/VectorSpaceI.H:650:13: note: template argument deduction/substitution failed:
In file included from ifasFCMfoam.C:76:0:
f4Eqn.H:6:11: note: ‘Foam::dimensionedScalar {aka Foam::dimensioned<double>}’ is not derived from ‘const Foam::VectorSpace<Form, Cmpt, nCmpt>’
In file included from /opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dimensionedType.H:298:0,
from /opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dimensionedScalar.H:38,
from /opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/TimeState.H:38,
from /opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Time.H:47,
from /opt/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvCFD.H:6,
from ifasFCMfoam.C:36:
/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dimensionedType.C:450:6: note: template<class Type> bool Foam:perator>(const Foam::dimensioned<Type>&, const Foam::dimensioned<Type>&)
/opt/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/dimensionedType.C:450:6: note: template argument deduction/substitution failed:
In file included from ifasFCMfoam.C:76:0:
f4Eqn.H:6:11: note: ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ is not derived from ‘const Foam::dimensioned<Type>’
In file included from ifasFCMfoam.C:49:0:
createFields.H:106:30: warning: unused variable ‘rho4’ [-Wunused-variable]
make: *** [Make/linux64GccDPOpt/ifasFCMfoam.o] Fehler 1
sfigato is offline   Reply With Quote

Old   March 26, 2013, 08:03
Default
  #2
Senior Member
 
fumiya's Avatar
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 18
fumiya is on a distinguished road
I am not sure if you can construct the fvScalarMatrix f4Eqn in the way just you described.

The following is an example:
Code:
// Declare the volScalarField coeff1
volScalarField coeff1
(
    IOobject
    (
        "coeff1",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
    mesh,
    dimensionedScalar
    (
        "coeff1",
        AdL.dimensions(),
        0
    )
);

forAll(coeff1, i)
{
    if (pEq.value() > p[i])
    {
        coeff1[i] = AdL; // or AdL[i]
    }
    else
    {
        coeff1[i] = AaL; // or AaL[i]
    }
}

fvScalarMatrix f4Eqn
(
      fvm::ddt(rho, f4)
    + fvm::div(rhoPhi /*phi*/, f4)
    - fvm::laplacian(Gamma4,f4) 
    + fvm::Sp(coeff1,f4)
);

***
Hope this helps,
Fumiya
fumiya is offline   Reply With Quote

Old   March 26, 2013, 08:13
Default
  #3
Senior Member
 
sfigato's Avatar
 
Marco Longhitano
Join Date: Jan 2013
Location: Aachen
Posts: 103
Rep Power: 13
sfigato is on a distinguished road
Send a message via Skype™ to sfigato
Hi Fumija,

First of all, thanks for the reply! Why are you not sure?

I would ask you a more question about phi and rhoPhi in the divergence term! My model has a variable density! The other multiphase solver use rhoPhi!
I did not understand its meaning! Is it required just when VOF method is used?

Can I leave just phi of I must adjust this value with my mixture density?

I hope that you (or some else foamers) can explain to me!

Thanks in advance

Regards
Marco
sfigato 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
Boundary condition for compressible flow ( cavity lid problem) pike@91 Main CFD Forum 2 June 2, 2012 17:04
Boundary condition problem ali hemmati FLUENT 0 May 23, 2012 13:12
Problem with a periodic boundary condition chuck209 CFX 10 May 9, 2012 16:15
Transient Simulation: Boundary Condition Problem Shafiul CFX 7 January 11, 2011 16:40
boundary condition problem maxims Main CFD Forum 4 October 10, 2010 21:34


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