CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Pre-Processing (
-   -   units OpenFOAM (

LM4112 June 5, 2013 07:37

units OpenFOAM
Good morning all

I have a doubt regarding how OpenFOAM reads the units. For example the velocity is always [0 1 -1 0 0 0 0], it doesn`t matter if I use meters or millimiters. Only the initial value (the number I mean) changes. Is it correct?

Lieven June 5, 2013 09:14

Hi Luca,

In principle OF can work with any system of units but by default it uses the SI units.
But it is pretty easy to deviate from it. The only thing you need to be aware of, is that you need to change the values of constants accordingly (e.g. viscosity in mm/s instead of m/s).

Have a look at for more information.



LM4112 June 5, 2013 09:27

Hi Lieven, thanks for the fast reply.
Then I have to change only the "numbers". I mean if I use mm instead of m I have to scale each value that concerns the length (for example pressure, velocity etc..) and I am not supposed to touch the numbers between the brackets that identify the dimension (for example the velocity is still 0 1 -1 0 0 0 as it means length per time and not meter per second).
I guess that the values are just "numbers" for the solver. They just have to be consistent. Do you agree?

Lieven June 5, 2013 09:37

Yep, that's how I see it.

But just to give you my opinion, if there is no reason except for 'convenience' to deviate from SI units, I would not do it. The chance you make errors with it are relatively big (especially with respect to post-processing).



LM4112 June 5, 2013 09:40

the problem is that my mesh is in mm, then I want to convert all the values in mm instead of convert the mesh in meters (that in my case is much more time demanding)

best regards,

colinB June 5, 2013 09:47

what kind of mesh do you have?

if it is a blockMesh mesh you have the entity convertToMeters
in the very beginning where you can choose the dimensions.

if the mesh is created with a stl in sHM you can scale down the stl with:

surfaceTransformPoints input.stl output.stl -scale '(0.1 0.1 0.1)'

where the three 0.1 's indicate the scaling in x y and z direction

Now if you happen to have a totally different mesh
use transformPoints in a similar way as surfaceTransformPoints.

for more detailed information on these commands type
e.g. transformPoint -help
or see the user guide in the utilities chapter where there
are further hints on other mesh manipulation utilities.

this should solve your problems with the mesh units


LM4112 June 5, 2013 09:52

I used ICEM to build the mesh. The problem is that I have different meshes up to 30 million size full hexa and it would be very time demanding to scale all of them. I guess it's easier to use mm.

best regards

colinB June 5, 2013 10:16

I don't get the problem.
If you convert the mesh to OF
and use transformPoints command the issue should be solved
within minutes even with 30 mio cells.
It is a fully automated process and gives completely satisfying results.


LM4112 June 5, 2013 10:19

sorry Colin I didn't read you reply properly. I will definitely try to use transformPoints. I'll let you know if it works properly, thanks

best regards

LM4112 June 5, 2013 11:20

Thanks a lot Colin, it worked perfectly.

best regards

All times are GMT -4. The time now is 08:33.