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

Macro expression in OpenFOAM 10

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By kakila
  • 2 Post By tniemi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 3, 2022, 11:17
Default Macro expression in OpenFOAM 10
  #1
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
Hi all,


I am trying to run the airfoil case of Sebastiano Stipa using OpenFOAM v10, however when I run blockMesh I get an error related with the macro expansion:


Code:
Creating block mesh from 
    "system/blockMeshDict" 


--> FOAM FATAL IO ERROR:  
Illegal dictionary entry or environment variable name ":aerofoil.xUpper" 
Valid dictionary entries are 1(type)
As far as I know, there is a bug related to this (link), where they complain about the wrong indications at the User Guide. Nevertheless, I'm trying different configurations but I always get the same error.


I have run blockMesh successfully with OpenFOAM v7 so I suppose that something has changed on the Macro expansion declaration but it is not clear the new formulation.


Has someone found a solution or walkaround to this problem?


Regards
Agustín
agustinvo is offline   Reply With Quote

Old   November 7, 2022, 05:35
Default
  #2
New Member
 
Kasper
Join Date: Sep 2017
Posts: 9
Rep Power: 8
KasperWayne is on a distinguished road
Take a look at the documentation for OF10 and you can see the difference :-)
https://doc.cfd.direct/openfoam/user...17-1320004.2.9
KasperWayne is offline   Reply With Quote

Old   November 7, 2022, 09:21
Default
  #3
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
Well, that is actually the bug I linked in the first post. It is said that there are mistakes on the macro definition.


If you check in the OF v7 documentation the same section, you will see that the sole difference is the 'slash' introduction in OF v10, and after that the 'dot' formulation is always applied.


If the contents of the Macro Expansion are mostly, why can't I run it properly? If there are changes, they are not correctly indicated in the documentation.
agustinvo is offline   Reply With Quote

Old   November 21, 2022, 04:19
Default
  #4
New Member
 
Juan Pablo Carbajal
Join Date: Jun 2021
Posts: 17
Rep Power: 4
kakila is on a distinguished road
I can confirm this. I have a set of parametrized files and they are not working anymore in OF10.
It seems that there is an undocumented change in the macro expansion.
Anybody knows what is this change?

Also the "/" (dot) in the documentation is also a bug. It is a dot or a slash? In OF10 it seems it is a slash https://bugs.openfoam.org/view.php?id=3877.


Update:
Form that bug: the dot notation is deprecated (not working in OF10).
Looking at the source code:https://cpp.openfoam.org/v10/diction...ce.html#l00897
I found that for the slash notation (what you need to use in OF10) the references to other levels also change (undocumented). so root level for slash notation is "!" not ":".
I cannot find whether the relative scopes (use of "..") are valid for the slash notation, it is not transparent from the source code.
agustinvo likes this.

Last edited by kakila; November 21, 2022 at 04:41. Reason: found a workaround
kakila is offline   Reply With Quote

Old   November 22, 2022, 01:29
Default
  #5
New Member
 
Timo Niemi
Join Date: Jun 2015
Posts: 5
Rep Power: 10
tniemi is on a distinguished road
The new slash syntax is documented in this commit message: https://github.com/OpenFOAM/OpenFOAM...3519b0d187e485

The documentation for OF10 is not yet fully updated and a bit confusing.

The reason for this change was to add flexibility and eg. support easily referring to entries which contain a dot (typical for multiphase simulations).

It is still possible revert to using the old syntax, either globally by editing etc/controlDict or locally case by case.
agustinvo and kakila like this.
tniemi is offline   Reply With Quote

Old   February 16, 2023, 04:54
Default
  #6
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
Thank you! I have been busy with other bussiness but I have checked your comment and it works!
agustinvo is offline   Reply With Quote

Old   April 15, 2024, 04:03
Default
  #7
New Member
 
Join Date: Dec 2019
Posts: 5
Rep Power: 6
moh raafat is on a distinguished road
Quote:
Originally Posted by agustinvo View Post
Thank you! I have been busy with other bussiness but I have checked your comment and it works!
I have the same issue, and tried to modify the syntax but in vain, can you provide exactly the required modification to the file.

Thanks in advance
moh raafat is offline   Reply With Quote

Old   April 15, 2024, 08:43
Default
  #8
New Member
 
Timo Niemi
Join Date: Jun 2015
Posts: 5
Rep Power: 10
tniemi is on a distinguished road
I have not run the case, but I just checked and basically to run blockMesh, do the following changes:

$: -> $!
domain. -> domain/
aerofoil. -> aerofoil/

So for example
$:aerofoil.xUpper -> $!aerofoil/xUpper

and a bit longer snippet:

geometry
{
aerofoil
{
type triSurfaceMesh;
file "NACA0012.obj";
}
cylinder
{
type searchableCylinder;
point1 ($!aerofoil/xUpper -1e3 0);
point2 ($!aerofoil/xUpper 1e3 0);
radius $!domain/zMax;
}
}

vertices
(
project ($aerofoil/xLower -0.1 $domain/zMin) (cylinder)
($aerofoil/xTrail -0.1 $domain/zMin)
($domain/xMax -0.1 $domain/zMin)
tniemi is offline   Reply With Quote

Old   April 17, 2024, 03:11
Default
  #9
New Member
 
Join Date: Dec 2019
Posts: 5
Rep Power: 6
moh raafat is on a distinguished road
thanks a lot, it works for blockeMesh, noting that the there other syntax errors for version s OF9 and OF10 included in the mentioned tutorials due to syntax changes, such as functions part in controlDict file, I will try generate the entire tutorial and make updates.
moh raafat is offline   Reply With Quote

Reply


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
Frequently Asked Questions about Installing OpenFOAM wyldckat OpenFOAM Installation 3 November 14, 2023 11:58
How to contribute to the community of OpenFOAM users and to the OpenFOAM technology wyldckat OpenFOAM 17 November 10, 2017 15:54
OpenFOAM Training Beijing 22-26 Aug 2016 cfd.direct OpenFOAM Announcements from Other Sources 0 May 3, 2016 04:57
Modifying CFD-Post macro to output a time-varying expression at every timestep lynnathere CFX 0 December 28, 2015 15:19
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 05:36


All times are GMT -4. The time now is 18:48.