|
[Sponsors] |
[mesh manipulation] Multi-region mesh from .stl files in OpenFoam V7 |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Carl Reilly
Join Date: Aug 2010
Posts: 25
Rep Power: 16 ![]() |
I’m relatively new to OpenFoam but have experience with other commercial CFD packages. I am trying to create a domain with multiple meshed regions using OpenFoam V7 and snappyHexMesh. But am struggling to find the required methodology to do this.
In openFoam v19.12 snappyHexMesh (sHM) allows the use of the command locationsInMesh, however this command does not seem to be available in the openFoamV7 release. Instead OFV7 uses locationInMesh to define a single region. I am able to move to coordinate of this to choose which single region (of the 3 regions) in the domain is meshed. All the tutorials I have found online show using topoSet and splitMesh functions to sub-divide the mesh into different regions / surfaces. However, these tutorials show simple mesh generated using block mesh, my geometry does not lend itself to this method, I want to be able to define the regions by .stl files. I can’t use snappyHexMesh to create the mesh before using topoSet and splitMesh, as I can’t get sHM to generate a full mesh domain to split. If I merge my geometry files into one stl, to produce a mesh of the whole domain, then the nodes/elements will not align (will not have been snapped to the surfaces) with the boundaries between the different regions, meaning I won’t be able to split the domain along the stl file boundaries. How do I create a multi-region mesh in OpenFoam V7 and snappyHexMesh using .stl files? Can this be done? I have attached an image of a simple case study geometry and the files required to mesh in using blockMesh and snappyHexMesh. These files result in only the leftmost part being meshed. The geometry I want to mesh is more complex, this is a simplified geometry to try and solve this issue. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 ![]() |
Hi!
You need closed surfaces for the regions as you can see in this example: https://github.com/OpenFOAM/OpenFOAM...ppyHexMeshDict In the refinementSurfaces entry you can define a cellZone for each region. It is more complicated than in the ESI version where you just tell shm the inisde points, but you can do it in the foundation version too. Good luck! ![]() |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Carl Reilly
Join Date: Aug 2010
Posts: 25
Rep Power: 16 ![]() |
Hi,
Thanks for the response. I've tried, but failed to make any progress, my latest files are attached. I have created a simple geometry. Fluid is in blue and PartA in grey. Currently I can only get PartA meshed. I did find another tutorial but this one is slightly different in that the external mesh volume is used with separate regions meshed inside. In my case I want to remove the external mesh and keep only the mesh defined inside the .stl files. https://holzmann-cfd.com/en/openfoam...-snappyhexmesh I have some questions which I'd be grateful for the answers too: 1) Can the .stl files for PartA and Fluid both be water tight. This would be my preference. Or do i have to delete the surface between Fluid/PartA in one of the files so that there are no duplicate surfaces? 2) Do I still need the locationInMesh variable, if so does it matter which component I specify it in? 3) Are the below definitions correct based on what I'm trying to achieve and is there something missing? Code:
geometry { Fluid_AllSurf.stl {type triSurfaceMesh; name Fluid;} PartA_AllSurf.stl {type triSurfaceMesh; name PartA;} }; castellatedMeshControls { features ( {file "Fluid_AllSurf.eMesh"; level 1;} {file "PartA_AllSurf.eMesh"; level 1;} ); refinementSurfaces { Fluid // Tried using .stl file name here, No improvement { level (1 1); faceZone faceFluid; cellZone cellFluid; cellZoneInside inside; // inside / outside / specified insidePoint boundary internal; } PartA { level (1 1); faceZone facePartA; cellZone cellPartA; cellZoneInside inside; boundary internal; } locationInMesh (0.02 0.02 -0.01); // located in PartA } |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,169
Rep Power: 27 ![]() |
Hi Carl,
I didn't run the case cause I don't have OF7 installed right now, but there is a chtMultiRegionFoam tutorial using snappyHexMesh in OF7 : https://github.com/OpenFOAM/OpenFOAM...eHeatExchanger The process is still the same : defining cellzones for each regions, meshing the whole domain, then using splitMeshRegions to split your initial mesh in one mesh by region. Removing the external region isn't a big deal: after splitting the mesh, you can simply delete the unwanted regions. Just pay attention to the boundaries, you may need to adjust the boundary types (wall, patch...) depending on your configuration. I hope this helps, Yann |
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
Carl Reilly
Join Date: Aug 2010
Posts: 25
Rep Power: 16 ![]() |
I have made some progress. I have broken my .stl files down into separate surfaces, so that I can define my patches.
I have got to the point where I can generate either a mesh in the two parts with no patches, or the mesh for 1 part including the patches, but not both. If I include the faceZone, CellZones and cellZoneInside, boundry lines I get both parts meshed. If I don't include them I get only PartA Meshed, but all the patches are correctly defined. Geometry Definition: Code:
geometry { Fluid.stl { type triSurfaceMesh; regions { Fluid_Inlet { name Fluid_Inlet; } Fluid_Sym { name Fluid_Sym; } Fluid_Env { name Fluid_Env; } Fluid_PartA { name Fluid_PartA; } } } PartA.stl { type triSurfaceMesh; regions { PartA_Inlet { name PartA_Inlet;} PartA_Sym { name PartA_Sym;} PartA_Env { name PartA_Env;} PartA_Fluid { name PartA_Fluid;} } } RefinementSurfaces: Code:
refinementSurfaces // Surface-wise min and max refinement level { Fluid.stl { level (1 1); regions { Fluid_Inlet { level (1 1); patchInfo { type patch; }} Fluid_Sym { level (1 1); patchInfo { type patch }} Fluid_Env { level (1 1); patchInfo { type wall; }} Fluid_PartA { level (1 1); patchInfo { type wall; }} } // faceZone faceFluid; // cellZone cellFluid; // cellZoneInside inside; // boundary internal; } PartA.stl { level (1 1); regions { PartA_Inlet { level (1 1); patchInfo { type patch; }} PartA_Sym { level (1 1); patchInfo { type patch }} PartA_Env { level (1 1); patchInfo { type wall; }} PartA_Fluid { level (1 1); patchInfo { type wall; }} } // faceZone facePartA; // cellZone cellPartA; // cellZoneInside inside; // boundary internal; } How do I generate the patch names and the two volumes? Am I correct in thinking that this can all be done in sHM, or do I have to do the patch and part definition in topoSet and splitMesh? I feel like i'm getting confused as there are multiple ways of doing the same thing, with each tutorial choosing a different method. Files attached. I would appreciate any help given. |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Senior Member
Niels Nielsen
Join Date: Mar 2009
Location: NJ - Denmark
Posts: 556
Rep Power: 27 ![]() |
Hi
If you look at the tutorial tutorials/heatTransfer/chtMultiRegionFoam/shellAndTubeHeatExchanger It will give you an idea of what you need to do. Basically you need to divide your geometry into "zones" containing a "closed" volume for each zone. The thing you need to do differently is to have the face between the "zones" being in a separate stl with not regions. On another note snappy is really not the best mesher for you case due to the pointy end.
__________________
Linnemann PS. I do not do personal support, so please post in the forums. |
|
![]() |
![]() |
![]() |
![]() |
#7 | |
Member
Jan Majcher
Join Date: Nov 2018
Posts: 39
Rep Power: 7 ![]() |
Quote:
May I ask you how did you separate your .stl file into regions? I have multiple .stl files forming one terrain surface and I would like to have them as one .stl file with multiple regions. EDIT: Ok, I got what I wanted using the cat command cat *.stl >> combined.stl. Easier than I thought. like this: Code:
Fluid.stl { type triSurfaceMesh; regions { Fluid_Inlet { name Fluid_Inlet; } Fluid_Sym { name Fluid_Sym; } Fluid_Env { name Fluid_Env; } Fluid_PartA { name Fluid_PartA; } } Jan |
||
![]() |
![]() |
![]() |
![]() |
#8 |
Senior Member
TWB
Join Date: Mar 2009
Posts: 403
Rep Power: 19 ![]() |
Thanks ppl, I got it to work too.
FYI, my stl was created using Pointwise and I can use the different domains to create the stl, which is separated into multi regions. The CAD was imported from Solidworks. |
|
![]() |
![]() |
![]() |
Tags |
multi-region mesh |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] Creating multi region mesh for chtMultiregionFoam | tclph | OpenFOAM Meshing & Mesh Conversion | 1 | December 8, 2020 15:25 |
decomposePar problem: Cell 0contains face labels out of range | vaina74 | OpenFOAM Pre-Processing | 37 | July 20, 2020 05:38 |
[snappyHexMesh] No layers in a small gap | bobburnquist | OpenFOAM Meshing & Mesh Conversion | 6 | August 26, 2015 09:38 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 06:20 |
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues | michele | OpenFOAM Meshing & Mesh Conversion | 2 | July 15, 2005 04:15 |