|
[Sponsors] |
[blockMesh] Creating blockMeshDict from python |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#21 | |
Senior Member
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 211
Rep Power: 11 ![]() |
Quote:
What's planned next: - a revolve on a collection of faces, creating multiple blocks - a loft/elbow or something where you can also specify number of blocks in the lofted/revolved direction. this would allow you to create, for instance, a 360 degree torus from <n> blocks. you can do that now but you have to manually create those segments. |
||
![]() |
![]() |
![]() |
![]() |
#23 |
Senior Member
|
Greetings again.
Is there a function that allows to set in the file constant/polymesh/boundary the patch type entries for wall to "wall" instead of "patch" (as currently is the case)? Doing in manually is a bit of burden. Cheers, Domenico. |
|
![]() |
![]() |
![]() |
![]() |
#24 |
Senior Member
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 211
Rep Power: 11 ![]() |
No as there is no real need for that - just use the createPatch utility. Here's a sample system/createPatchDict that does just that. Also note that you can leave the most numerous faces out of the classy_blocks script - blockMesh will name them defaultFaces and you can capture them all with createPatch. Saves you quite a lot of lines of code!
Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object createPatchDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Do a synchronisation of coupled points after creation of any patches. // Note: this does not work with points that are on multiple coupled patches // with transformations (i.e. cyclics). pointSync false; // Patches to create. patches ( { name walls; patchInfo { type wall; } constructFrom patches; patches (defaultFaces); } ); // ************************************************************************* // |
|
![]() |
![]() |
![]() |
![]() |
#25 |
Senior Member
|
Greetings again.
Question: is there an easy way to easily obtain doubly graded meshes (see e.g. Section 2.6 https://openfoamwiki.net/index.php/B..._blockMeshDict) using classy_blocks, other then editting the blockMeshDict file? Thanks, Domern |
|
![]() |
![]() |
![]() |
![]() |
#26 |
Senior Member
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 211
Rep Power: 11 ![]() |
As of this moment, unfortunately not. More sophisticated grading functions will be added later. If your geometry isn't too complicated and you don't want to edit grading, you can add more simple-graded blocks...
|
|
![]() |
![]() |
![]() |
![]() |
#29 |
Member
Francisco T
Join Date: Nov 2011
Location: Melbourne, Australia
Posts: 64
Blog Entries: 1
Rep Power: 15 ![]() |
Greetings
I'm trying to build a geometry which has a cavity inside. Similar to the attached image. I guess I can figure out how to model the features outsid but I'm wondering about the cavity. The right image is a cut to see inside. How can we define a cavity? |
|
![]() |
![]() |
![]() |
![]() |
#30 |
Senior Member
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 211
Rep Power: 11 ![]() |
you need to slice your model into blocks. unfortunately with cavities, the number of blocks increases rapidly... but that's all i can help.
Unless you decide to use snappy/cfMesh and use blocks just to create geometry (inside): https://damogranlabs.com/2020/10/blo...xternal-flows/ |
|
![]() |
![]() |
![]() |
![]() |
#31 |
Member
Francisco T
Join Date: Nov 2011
Location: Melbourne, Australia
Posts: 64
Blog Entries: 1
Rep Power: 15 ![]() |
Thanks for your reply!
I want to avoid the stl creation for this case, therefore I think I will use blockMesh and a combination of topoSet + subsetMesh commands to delete internal elements and create the cavity. Cheers |
|
![]() |
![]() |
![]() |
![]() |
#32 |
Member
Pedro Gouveia
Join Date: Oct 2022
Location: Portugal
Posts: 65
Rep Power: 4 ![]() |
Hey,
I am working in Ubuntu 22.10, and I want to start using classy blocks to try and mesh the geometry in the atached picture. It is a turbopump, composed of a dual blade inducer, a radial impeller and a volute. The picture shown is of the fluid domain, not the actual pump solid. https://imgur.com/a/WpltVGL First question is, do you think that is doable or worth the time? Second question, and excuse me for the ignorance. I can't get the examples to run in the python script. It is giving me the following error: ModuleNotFoundError: No module named 'classy_blocks' when I copy the https://github.com/damogranlabs/classy_blocks into the examples folders, it gives me this new error https://github.com/damogranlabs/classy_blocks So, could you please do a quick explanation/guide on how to proceed to the setup of classy blocks on ubuntu? |
|
![]() |
![]() |
![]() |
![]() |
#33 |
Senior Member
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 211
Rep Power: 11 ![]() |
Hi, thank you for your interest in classy_blocks.
In fact, this whole thing started because I needed a better mesh for a centrifugal pump. I first wrote a simple script that tracked block points for me, then expanded it to what it is now. I do use classy_blocks to create a mesh of an impeller as part of my job so I can tell it is doable but cannot share the code. For me it was a huge success because I need a proper parametric model for automatic optimization but it took me around a year to whip it up (besides other nuisances I'm responsible for ![]() I use classy_blocks to to create a background mesh for a volute that fits inlet AMI ring and outlet mesh is oriented with the flow, but the spiral geometry is meshed with snappy. A volute can be meshed with pure-hexa blocks but at the moment I have no idea how. It's on my TODO list, though. Inducer is probably the easiest part but also most probably not worth the time. Just use snappy and feed it a cylindrical background mesh. About the examples: you probably didn't install the package correctly: see https://github.com/damogranlabs/clas...#how-to-use-it You can PM me if you decide to dive into this... but you have been warned ![]() |
|
![]() |
![]() |
![]() |
![]() |
#34 |
Member
Pedro Gouveia
Join Date: Oct 2022
Location: Portugal
Posts: 65
Rep Power: 4 ![]() |
Hey, thank you for the quick reply.
Honestly, after reading your point of view, I don't think it is worth the time at the moment. Mostly because I am working on my master thesis in partnership with a rocket company, so both me and them want to finish this kind of fast. I liked your sugestion of the cylindrical background mesh. This is my first big CFD project, so I didn't even think about that possibility. I will implement that and let you know, in a few days/weeks how it turned out. Thank you ![]() |
|
![]() |
![]() |
![]() |
![]() |
#35 |
Member
Pedro Gouveia
Join Date: Oct 2022
Location: Portugal
Posts: 65
Rep Power: 4 ![]() |
One question, the way you explained the stuff gave me the understanding that, usually, you mesh the components seperately. Is that right? If so, how do we make sure that the elements share the nodes between each other?
|
|
![]() |
![]() |
![]() |
![]() |
#36 |
Senior Member
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 211
Rep Power: 11 ![]() |
Yeah, if you need one mesh promptly, you need an automatic mesher. Try snappy and cfMesh, they will do the job.
In turbomachinery and other moving machinery you can't keep nodes together so static and moving mesh parts must be coupled in another way, AMI (ESI-CFD version), NCC (Foundation version) or GGI (foam-extend). See the Code:
incompressible/pimpleFoam/RAS/propeller |
|
![]() |
![]() |
![]() |
![]() |
#37 |
Member
|
Hi Nejc,
In classy_blocks, how does the chop specification propagate? Specifically, for instance, in the custom sketches example (https://damogranlabs.com/2024/11/cla...stom-sketches/), it is stated that "Direction 0 : Quad 0 will define all outer quads, that is 0 through 14" and "Direction 1 : Quad 0 will define 0, 3, and 2; Quad 1 will define 1, 3, 16, 11, and 9; Quads 4, 8 and 12 will define their respective corner buddies (which?? 7 & 6, 11 & 10, and 15 & 14??)". But this leaves out, 5, 7, 15, 16, 13. Better to say this: "Direction 1: Quad 0 will define 0, 3, and 2; and Quads 4, 8 and 12 their respective corner buddies 7 & 6, 11 & 10, and 15 & 14; and along the two diagonals, Quad 1 will define 1, 3, 16, 11, and 9; and Quad 5 will define 5, 7, 15, 16, 13." Right? Only then it makes sense to say in the example that defining variable chops = [[0], [0, 1, 4, 5, 8, 12]] is all it takes. Missing the statement about Quad 5 and its followers had made it very confusing for me before I figured this out. How does the above get implemented? Which class method propagates the direction-1 chopping from Quad 1 to 3 and from Quad 3 to 16 and so on? In fact, it seems defining the chopping on quad 0 directions 0 and 1 and quad 1 for direction 1 suffices to specify completely all the other quads by propagation, just by exploiting rotational symmetry. At this point, classy_blocks isn't doing this, right? Am trying to go thru the Python codes to understand how it works. Please help. Last edited by Mars409; March 13, 2025 at 16:43. Reason: To make it clearer. |
|
![]() |
![]() |
![]() |
![]() |
#38 |
Senior Member
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 211
Rep Power: 11 ![]() |
Hello,
propagation first finds block edges (called 'Wires') that are coincident (shared between blocks). Coincident wires obviously have to be chopped identically but also wires within the same block must at least have the same cell count. So if you take, for instance, block 0 from the tutorial sketch - this block has a wire from point 20 to point 0 (that's direction 0 for this block) and also 12-1 in the same direction. Block 1 also has that wire but this block's wire 13-2 must be chopped equally. This wire also touches block 2 and so on. Block 0's direction 1 has wires 0-1 and 20-12 which is shared by blocks 3 and 2. In the same way, blocks 4, 7, 6 sit in the same row of wires and blocks 8, 11, 10 and 12, 15, 14. When you do operation.chop() those parameters are stored and used when Operations are converted to Blocks. A Block has an Axis with 4 Wires in each direction. If there's a chop() (user-defined) available, the axis creates Grading objects and distributes it to its wires (items.wires.axis.Axis.grade()). If there's no chop(), it checks if any of their coincident blocks is already defined (items.wires.manager.WireManager.defined). If there is, wires are propagated from whatever was found. The same is repeated until all blocks have been graded properly (lists.block_list.BlockList.grade()). Hope this helps, let me know if you need more detailed explanation of anything. Last edited by kandelabr; March 13, 2025 at 16:26. Reason: Bad CODE formatting |
|
![]() |
![]() |
![]() |
![]() |
#40 |
Member
|
Thank you for your detailed explanation. The first three paragraphs on how the grading propagation works matches my understanding. I guess, armed with this understanding, this is all I need to use classy_blocks to create arbitrary custom sketch. But now that I have embarked on better understanding, I figure I will look deeper and follow the ropes given in your 4th paragraph. Indeed, items directory is what I will dive into next. Thank you very much.
Last edited by Mars409; March 13, 2025 at 17:59. Reason: Deleting question I just found answer for. |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blockMesh] Creating an axisymmetric piston cylinder in blockMeshDict | foadsf | OpenFOAM Meshing & Mesh Conversion | 10 | Yesterday 07:06 |
[blockMesh] Created a python package for generating blockMeshDict | grokkingStuff | OpenFOAM Meshing & Mesh Conversion | 3 | November 5, 2020 07:55 |
[blockMesh] Creating a blockmeshDict file | andrewlindsay | OpenFOAM Meshing & Mesh Conversion | 8 | August 15, 2020 09:56 |
[blockMesh] what commands should I use to start creating a blockMeshdict file? | Hojae | OpenFOAM Meshing & Mesh Conversion | 1 | November 12, 2014 16:58 |
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) | cfdonline2mohsen | OpenFOAM | 3 | October 21, 2013 09:28 |