CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   The Vector and Scaler (

liugx212 June 19, 2006 16:07

Hi Friends, I have a proble
Hi Friends,

I have a problem of the Vector and scalar when I process the Darcy velocity. The Darcy velocity is depended on the gradient of pressure. Pressure is the SCALAR, but Darcy VELOCITY is the VECTOR. So when I complier, I was told the operator is error.

My equation of the Darcy velocity is:

U = -K/nu(grad(P) - rho*g) where K is the permeability, nu is the viscosity, P is pressure and g is gravity.

I encoded as followsing in FOAM:
fvVectorMatrix UEqn // solving Darcy velocity
- (K/nu)*(fvc::grad(P) - rho*g)

The complier error is:
buoyantFoam.C:81: error: no match for 'operator-' in 'Foam::fvc::grad(const Foam::GeometricField<type,>&) [with Type = Foam::scalar]() - Foam::operator*(const Foam::GeometricField<foam::scalar,>&, const Foam::GeometricField<type,>&) [with Type = Foam::scalar, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::GeometricField<foam::scalar,>&)((const Foam::GeometricField<foam::scalar,>*)(& gh))))'
/home/liu/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude/dimensionSet.H:176: note: candidates are: Foam::dimensionSet Foam::operator-(const Foam::dimensionSet&)
/home/liu/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude/dimensionSet.H:188: note: Foam::dimensionSet Foam::operator-(const Foam::dimensionSet&, const Foam::dimensionSet&)
/home/liu/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude/dimensionedScalar.H:55: note: Foam::dimensionedScalar Foam::operator-(const Foam::dimensionedScalar&, Foam::scalar)
/home/liu/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude/dimensionedScalar.H:56: note: Foam::dimensionedScalar Foam::operator-(Foam::scalar, const Foam::dimensionedScalar&)
/home/liu/OpenFOAM/OpenFOAM-1.2/src/cfdTools/general/lnInclude/initContinuityErr s.H:38: warning: unused variable 'cumulativeContErr'
make: *** [Make/linuxGcc4Opt/buoyantFoam.o] Error 1

Could any friend help me?

Thanks so much.

gschaider June 20, 2006 06:21

Is it possible, that your g is
Is it possible, that your g is only a scalar? It should be a vector (gravity is pointing somewhere).

eugene June 20, 2006 06:45

Why are you building a matrix
Why are you building a matrix when the equation is explicit?

In any case, you haven't included U in the UEqn. What do you think you will be solving for?

liugx212 June 20, 2006 09:54

Hi, freinds, Many thanks fo
Hi, freinds,

Many thanks for your help.

I solve the UEqn for the Darcy`s velocity which is depended on the gradient pressure and gravity (for buoyancy). My whole solver is linked by ( So if not like my wroten, what it should be? Could you give more advice?

Thanks again.

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