|
[Sponsors] | |||||
[blockMesh] Parametrizing BlockMesh (preferably without m4) |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|
|
#1 |
|
New Member
Join Date: Dec 2016
Posts: 24
Rep Power: 11 ![]() |
Hi everyone,
I have a tricky, maybe even impossible question. The goal is to mesh a quarter (axisymmetric) cylinder with fixed length and radius L and R. The cylinder wall is divided into N patches of equal length L/N (see the attached figure for N=5). Right now I create vertices and blocks manually. You can imagine that if N becomes large, I can spend the entire day making a single mesh. Therefore, I'd like to parametrize N and let the script do it for me. The problem is that loops are not a thing in the BlockMeshDict (at least not to my knowing). I know about m4 but the documentation is marginal. What is the best approach here? Thanks in advance! |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
|
||
|
|
|
|
|
|
|
#3 |
|
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 359
Rep Power: 29 ![]() ![]() |
If you only want to use variable parameters, and don't need the entire magic that Python-scripting has to offer, you can also use OpenFOAM's on-board tools, i.e., using variables in dictionaries, the code-stream magic.
A parametric blockMeshDict from the tutorials |
|
|
|
|
|
|
|
|
#4 | ||
|
New Member
Join Date: Dec 2016
Posts: 24
Rep Power: 11 ![]() |
Quote:
I installed and prioritized python 3.8 so not really sure where the error is originating from. Quote:
Code:
radius 0.0005;
Len 0.001;
nSegments 5.0;
radHalfAngle #calc "degToRad($halfAngle)";
y #calc "$radius*sin($radHalfAngle)";
minY #calc "-1.0*$y";
z #calc "$radius*cos($radHalfAngle)";
segmentLength #calc "$Len / $nSegments";
codeStream
#{
std::array<float, $nSegments> lenarray;
for (int i=1;i<$nSegments;i++)
{
lenarray[i] = $segmentLength*i;
}
#};
|
|||
|
|
|
|||
![]() |
| Tags |
| blockmeshdict |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [blockMesh] OpenFOAM blockMesh bus error | BRH | OpenFOAM Meshing & Mesh Conversion | 0 | April 12, 2021 12:02 |
| [OpenFOAM.org] blockMesh issue on openfoam6 startup - ubuntu 16.04 | bjdarrer | OpenFOAM Installation | 7 | August 25, 2020 20:15 |
| Is Playstation 3 cluster suitable for CFD work | hsieh | OpenFOAM | 9 | August 16, 2015 15:53 |
| [blockMesh] set of xyz data in blockMesh | psk | OpenFOAM Meshing & Mesh Conversion | 12 | August 27, 2013 09:37 |
| Blockmesh cavity error message | tonitoney | OpenFOAM Installation | 2 | March 17, 2008 12:59 |