CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Dimension Problem in If Condition (https://www.cfd-online.com/Forums/openfoam-programming-development/115146-dimension-problem-if-condition.html)

 sfigato March 25, 2013 05:05

Dimension Problem in If Condition

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::operator>(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::operator>(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

 fumiya March 26, 2013 09:03

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

 sfigato March 26, 2013 09:13

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!

Regards
Marco

 All times are GMT -4. The time now is 21:38.