# Dimension Problem in If Condition

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

March 25, 2013, 05:05
Dimension Problem in If Condition
#1
Senior Member

Marco Longhitano
Join Date: Jan 2013
Location: Aachen
Posts: 103
Rep Power: 6
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 bool Foam:perator>(const Foam::VectorSpace&, const Foam::VectorSpace&) /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}’ is not derived from ‘const Foam::VectorSpace’ 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 bool Foam:perator>(const Foam::dimensioned&, const Foam::dimensioned&) /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}’ is not derived from ‘const Foam::dimensioned’ 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

 March 26, 2013, 09:03 #2 Senior Member   Fumiya Nozaki Join Date: Jun 2010 Location: Yokohama, Japan Posts: 217 Blog Entries: 1 Rep Power: 11 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

 March 26, 2013, 09:13 #3 Senior Member     Marco Longhitano Join Date: Jan 2013 Location: Aachen Posts: 103 Rep Power: 6 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

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post pike@91 Main CFD Forum 2 June 2, 2012 17:04 ali hemmati FLUENT 0 May 23, 2012 13:12 chuck209 CFX 10 May 9, 2012 16:15 Shafiul CFX 7 January 11, 2011 17:40 maxims Main CFD Forum 4 October 10, 2010 21:34

All times are GMT -4. The time now is 10:57.