CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

How to define macros in Dictionary files?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Display Modes
Old   April 24, 2013, 10:46
Default How to define macros in Dictionary files?
  #1
Member
 
David Long
Join Date: May 2012
Location: Germany
Posts: 55
Rep Power: 5
keepfit is on a distinguished road
Hi Foamers,

as the newest version of OpenFOAM 2.2.x supports Dictionary Macro Expansion, I wonder if it can be used for blockMeshDict:

....

xSize 10;
ySize 18;
zSize 15;

...

hex (0 22 24 11 37 47 35 40) (xSize ySize zSize) simpleGrading (0.5 0.5 1);

....

But when runing blockMesh, it says

Quote:
wrong token type - expected int, found on line 85 the word 'xSize1'..
So I wonder how to use Macros in OpenFoam correctly.

Best,

David



Edit1: Using predefined variables needs '$' .

Edit2: It would be great if mathematical operation is supported via macros, e.g.

a 5;
b 6;
c = $a + $b;

Last edited by keepfit; April 24, 2013 at 15:30.
keepfit is offline   Reply With Quote

Old   April 26, 2013, 20:29
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings David,

Quote:
Originally Posted by keepfit View Post
Edit2: It would be great if mathematical operation is supported via macros, e.g.

a 5;
b 6;
c = $a + $b;
That has been requested some time ago: http://www.openfoam.org/mantisbt/view.php?id=447 - and it might itself tell you how you can perform said calculation

Best regards,
Bruno
bhushanvelis likes this.
wyldckat is offline   Reply With Quote

Old   April 27, 2013, 15:38
Default
  #3
Member
 
David Long
Join Date: May 2012
Location: Germany
Posts: 55
Rep Power: 5
keepfit is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Greetings David,


That has been requested some time ago: http://www.openfoam.org/mantisbt/view.php?id=447 - and it might itself tell you how you can perform said calculation

Best regards,
Bruno
thanks very much Bruno.

Now it's very straightforward to define parameters in blockMeshdict, other than using .m4 file or blender Swiftblock.

Edit1: Does it support c++ math functions: e.g. sin( ), sqrt( ), log( ), etc.

Last edited by keepfit; April 28, 2013 at 20:30.
keepfit is offline   Reply With Quote

Old   December 16, 2013, 16:13
Default
  #4
New Member
 
bhushan
Join Date: Feb 2011
Location: Erlangen, Gremany
Posts: 7
Rep Power: 6
bhushanvelis is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Greetings David,


That has been requested some time ago: http://www.openfoam.org/mantisbt/view.php?id=447 - and it might itself tell you how you can perform said calculation

Best regards,
Bruno
Thanks Bruno ..
bhushanvelis is offline   Reply With Quote

Reply

Tags
dictionary, macros

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run time Selection Mechanism - Some help required to understand jaswi OpenFOAM Programming & Development 2 April 18, 2014 07:44
OpenFOAM15 paraFoam bug koen OpenFOAM Bugs 19 June 30, 2009 10:46
Missing math.h header Travis FLUENT 4 January 15, 2009 12:48
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 12:24
Results saving in CFD hawk Main CFD Forum 16 July 21, 2005 20:51


All times are GMT -4. The time now is 04:58.