CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   how can I declare variables - please help (

cfd-noob January 20, 2012 05:36

how can I declare variables - please help
I would like to declare a variable in blockMeshDict.

It should look like this:



with "int" it doesn't seem to work.

Thank you very much

colinB January 20, 2012 06:21


as far as I know creating blockMeshDict files including variables doesn't
work, though the file itself is written in C++ style.

If you want to use variables you better write yourself a small tool
(I'm not aware of one existing)
that creates a blockMeshDict file and with this tool you can create
insert values and variables in a blockMeshDict file, which are dependent
on each other.

For the case that I'm wrong, I would also be interested in how to include
variables in a different manor.


EDIT: This looks more like a topic for the blockMesh sub Forum than for
the running/solving sub Forum

anon_a January 20, 2012 06:40

I think that the "m4" macros are what you are looking for.
Just look for the corresponding tutorials
.../tutorials> find ./ -name *m4
and also in the forum.

I have not used this my self but it looks easy to understand.

cfd-noob January 20, 2012 07:39

Danke vielmals,
ich versuche es mal mit einem Matlab-Script.

morard January 20, 2012 13:30

You can also write a python script which creates blockMeshDict. It's very easy to write one, and works well.

All times are GMT -4. The time now is 06:40.