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

How to define macros in Dictionary files?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2013, 11:46
Default How to define macros in Dictionary files?
  #1
Senior Member
 
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 14
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 16:30.
keepfit is offline   Reply With Quote

Old   April 26, 2013, 21:29
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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, 16:38
Default
  #3
Senior Member
 
David Long
Join Date: May 2012
Location: Germany
Posts: 104
Rep Power: 14
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 21: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: 9
Rep Power: 15
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


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 Off
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 3 October 29, 2015 14:42
OpenFOAM15 paraFoam bug koen OpenFOAM Bugs 19 June 30, 2009 11: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 13:24
Results saving in CFD hawk Main CFD Forum 16 July 21, 2005 21:51


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