CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Incompatible dimensions.... (

Amiga500 March 19, 2010 17:20

Incompatible dimensions....
Hi all. A CFX and Fluent user having a go at OpenFOAM, and currently making a right hash of it! :o

OK, simply put, I'm trying to take the existing simpleFoam tutorial pitzDaily and use it on a different mesh (a NACA0012) to get me started. However, I keep getting the following error:

incompatible dimensions for operation

[U[0 1 -2 0 0 0 0] ] == [-grad(p)[0 -3 -2 0 0 0 0] ]

From function checkMethod(const fvMatrix<Type>&, const GeometricField<Type, fvPatchField, volMesh>&)
in file ..\..\src\finiteVolume\lnInclude/..\fvMatrices\fvMatrix\/fvMatrix.C at line 1208.

Obviously, I assumed it was inconsistent dimensions on by "boundary" files within the /0/ folder, however, the dimensions are correct, and are exactly the same as within the OpenFOAM tutorial folder.

After which, I have tried to check whether my mesh is at fault, but checkMesh comes back ok - but I suppose it will not be checking my boundary file within /constant/. I've tried various different mesh, including those available from Polito* for use with AeroFoam - modified for simpleFoam usage, with no success.


Anyone any ideas? Even just of where exactly I am being stupid!

Amiga500 March 20, 2010 07:17

In addition to the above, I can obtain results using potentialFoam... where just U & p are required.

From that, I am guessing that the error lies in how I am relating my boundary conditions to the solver. Either within the /constant/ or /system/ directory, however none of the files within those directories leaps out at me as being the culprit.

Amiga500 March 20, 2010 08:06

Another post.

Of course, the solver can be got running by screwing around with the dimensions of the input files... (icoFoam used below)

But is it expected to run at p (pressure?) dimensions of

[ 0 2 -2 0 0 0 0]

As as as I am aware, that is m^2/s^2 ?!?!

Whereas I would be expecting:

[ 1 -1 -2 0 0 0 0]

i.e. kg/m/s^2

shirazbj March 20, 2010 22:25

For airfoil, why not try the airFoil2d example under the same simpleFoam folder?

I thought p is p/density with that dimension. I have the same question about the cavity example under the potentialFoam.

gwierink March 21, 2010 06:24


I thought p is p/density with that dimension.
Yes, indeed, both icoFoam and potentialFoam assume incompressible fluids and use the "density normalized" pressure, making the unit mē/sē instead of the unit of kg/msē of "real" pressure.

Amiga500 March 21, 2010 07:19

Ahh, thanks folks. :)

kongfu January 19, 2011 05:21

one question

Originally Posted by gwierink (Post 250989)
Yes, indeed, both icoFoam and potentialFoam assume incompressible fluids and use the "density normalized" pressure, making the unit mē/sē instead of the unit of kg/msē of "real" pressure.

Hi gwierink,

I have one question on that. If I run my simulation with rhoSimpleFoam, based on the results of simpleFoam, i.e., I set my startTime to latestTime. Then I have to modify the pressure units. (From density normalized to normal pressure.) Do I also have to change the values of the field?

Thank you very much.


gwierink January 19, 2011 05:52

Hi Tao,

I suppose yes, since the pressure used in simpleFoam is actually pressure divided by density (see also Section 3.1.2 of the OpenFOAM Wiki) (and this thread with followup).

fcollonv January 20, 2011 05:45

Hi Tao,

As said by Gijs, you have to put the real value for the pressure. Indeed in a compressible solver an equation of state is used (usually the perfect gas law) and the density will be deduced from the temperature and the pressure using that law. In case of the perfect law:
rho = p/rT
In the code: line 73



linch July 7, 2011 04:20


is there a way to get the dimension of a vol/surfaceScalarField?

fcollonv July 7, 2011 04:50

Hello Illya,

Yes, you have to call the functions dimensions. For example U.dimensions(). Or you can just write the field by calling the function write (e.g. p.write() ). Then the dimensions are explicitly appearing at the begin of the file (keyword dimensions).

Best regards,

Frederic Collonval

linch July 7, 2011 05:06

Thanks Frederic for the rapid answer!

Another question: I have a surface scalar field:

surfaceScalarField DN2Rhof
                dimensionedScalar("DN2Rho", dimensionSet(1,-1,-1,0,0,0,0), 0.0)

so the dimensions are [1 -1 -1 0 0 0 0]

but when I build the divergence

volScalarField Test = fvc::div(DN2Rhof)
I get the dimensions [1 -4 -1 0 0 0 0].

I thought, the divergence operator has the dimension 1/m, so div(DN2Rhof) should be [1 -2 -1 0 0 0 0], but it doesn't.. Could someone please give me a hint?

fcollonv July 11, 2011 05:27

Hello Illya,

The surfaceField are presumed to be equal to field*Aface (have a look for example to phi in incompressible flow; phi = U*Aface [m^3/s]). So the div operator is simply the sum of surfaceField on each cell-surfaces finally divided by the mesh volume.

Best regards,


despaired student June 1, 2012 07:20

SimpleFoam or potentialFoam

I'm thinking about using potentialFoam instead of simpleFoam. In my case I have an incompressible, isothermal and slow (Re<10) flow. I've read somewhere that one can use for very slow and incompressible flows the "potetial theory" to calculate it.
Is this correct and does this mean that I can use potentialFoam to compute the flux in OpenFoam?

best regards

All times are GMT -4. The time now is 12:54.