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

[snappyHexMesh] Problems meshing multi-parts solids

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 5, 2020, 20:21
Default Problems meshing multi-parts solids
  #1
New Member
 
Marc-Antoine
Join Date: Oct 2020
Posts: 4
Rep Power: 6
Marki22 is on a distinguished road
Hi Foamers,


I am facing some problems to mesh a CAD composed of many pieces from a mass-transfer problem.

Image 1 represents the CAD (from FreeCAD 0.18.4) I need to mesh to run some simulations. It is composed of a solid (blue part) that need to be considered as a wall. Also, it is composed of two solids (red and yellow cylinders) which will be use to evaluate mass-transfer inside later on.



I exported the objects from FreeCAD into STL (ASCII) files. Following the (well-explained) video «OpenFOAM SnappyHexMesh Tutorial» by Calum Douglas on YouTube, I managed to mesh every individual parts of my CAD using snappyHexMesh (blockMesh=*> surfaceFeatureExtract=> decomposePar=> mpirun -np 4 snappyHexMesh -overwrite -parallel => reconstructParMesh -constant) .



The problem occurs when I try to mesh multiple parts at the same time or to merge individual meshes I made. I've tried both methods and none of them worked.


When I try to merge individuals meshes, it appears to me this Error Message:



--> FOAM FATAL ERROR:
Problem : Patch gel starts at 532500
Current face counter at 519700
Are patches in incremental order?

From function void Foam:olyTopoChange::addMesh(const Foam:olyMesh&, const labelList&, const labelList&, const labelList&, const labelList&)
in file polyTopoChange/polyTopoChange/polyTopoChange.C at line 2456.

FOAM aborting
...


When I mesh multiple parts at a same time, some parts on my mesh seems to disappear, specially where the objects touch together. Image 2 and 3 are a test I've made with blue and red parts at the same time. Red part should be a complete cylinder as Image4. My snappyHexMeshDict is following at the end of the thread.



Question 1: What is the best method to mesh multi-parts CAD? Is it to mesh it all at once or to mesh individual parts and merge them together afterwards? Is cfmesh a possibility?



Question 2: Following the question 1, do you have some solutions to make an accurate and well-defined mesh of my CAD geometry?


Thank you very much!



snappyHexMeshDict:




| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.2.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Which of the steps to run
castellatedMesh true; // make basic mesh ?
snap true; // decide to snap back to surface ?
addLayers false; // decide to add viscous layers ?


geometry
{
red.stl {type triSurfaceMesh; name red;}

blue.stl {type triSurfaceMesh; name blue;}
};

castellatedMeshControls
{
maxLocalCells 8000000;
maxGlobalCells 30000000;
minRefinementCells 0;
maxLoadUnbalance 0.0;
nCellsBetweenLevels 1;

// Explicit feature edge refinement
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
features
(
{file "red.eMesh"; level 3;}
{file "blue.eMesh"; level 3;}
);

// Surface based refinement
// ~~~~~~~~~~~~~~~~~~~~~~~~

refinementSurfaces
{

red {level (2 3);}
blue {level (2 3);}
}


resolveFeatureAngle 20;
refinementRegions
{
}
locationInMesh (0.0 0.0 0.004);
allowFreeStandingZoneFaces true;
}


// Settings for the snapping.
snapControls
{
nSmoothPatch 5;
tolerance 1.0;
nSolveIter 300;
nRelaxIter 10
nFeatureSnapIter 5;

// New settings from openfoam 2.2 onwards for SHMesh

implicitFeatureSnap false; // default is false - detects without doing surfaceFeatureExtract
explicitFeatureSnap true; // default is true
multiRegionFeatureSnap true; // deafault is false - detects features between multiple surfaces
}

// Settings for the layer addition.
addLayersControls
{
relativeSizes false;
layers
{
red
{nSurfaceLayers 2;}
blue
{nSurfaceLayers 2;}
}

expansionRatio 1.05;
finalLayerThickness 0.0001;
minThickness 0.00005;
nGrow 0;


// Advanced settings

featureAngle 85; .
nRelaxIter 5;
nSmoothSurfaceNormals 4;
nSmoothNormals 3;
nSmoothThickness 10;
maxFaceThicknessRatio 0.5;
maxThicknessToMedialRatio 0.2; /
minMedianAxisAngle 90;
nBufferCellsNoExtrude 0;
nLayerIter 50;
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
maxNonOrtho 65;
maxBoundarySkewness 20;
maxInternalSkewness 4;
maxConcave 80;
minFlatness 0.5;
minVol 1e-13;
minTetQuality 1e-9;
minArea -1;
minTwist 0.02;
minDeterminant 0.001;
minFaceWeight 0.02;
minVolRatio 0.01;
minTriangleTwist -1;

// Advanced

nSmoothScale 4;
errorReduction 0.75;
}

// Advanced

debug 0;

mergeTolerance 1E-6;
Attached Images
File Type: png Image1.png (63.6 KB, 21 views)
File Type: png Image2.png (38.6 KB, 20 views)
File Type: png Image3.png (20.2 KB, 20 views)
File Type: png Image4.png (28.0 KB, 16 views)

Last edited by Marki22; October 7, 2020 at 12:44.
Marki22 is offline   Reply With Quote

Old   October 7, 2020, 04:00
Default
  #2
Senior Member
 
M
Join Date: Dec 2017
Posts: 700
Rep Power: 12
AtoHM is on a distinguished road
Can you maybe explain in more detail what exactly the fluid domain is from the parts seen in your images? Do you really need multiple meshes/bodies here?
AtoHM is offline   Reply With Quote

Old   October 7, 2020, 12:47
Default
  #3
New Member
 
Marc-Antoine
Join Date: Oct 2020
Posts: 4
Rep Power: 6
Marki22 is on a distinguished road
Hi AtoHM,


The geometry showed is part a bigger geometry (Image5). My fluid domains are the yellow part, the red part and "inside" the grey part. There is a fluid (similar to water) coming through the inlet (left part of the tube) and going out by the outlet (right part of the tube). The fluid can also goes inside the holes in the blue part. The yellow and the red parts are "porous" solid which mean that the fluid can go through them. I need to evaluate the transient distribution of concentration in the red and yellow parts, considering that the yellow part has an initial concentration and the fluid is an «infinite-sink».



So, in my opinion of a student learning how to works with CFD, I need to mesh the three fluid domains (inside and outside for the boundary condition) that I've mentioned and the grey and blue solid parts (solid domain). What do you think about it?



Thank you very much for your attention!
Attached Images
File Type: png Image5.png (92.9 KB, 17 views)
Marki22 is offline   Reply With Quote

Old   October 8, 2020, 02:56
Default
  #4
Senior Member
 
M
Join Date: Dec 2017
Posts: 700
Rep Power: 12
AtoHM is on a distinguished road
Seems like a tricky simulation, especially for a beginner in CFD. I have no experience in working with porous domains, but as far as I know there are two ways to model them: mesh the whole thing including cavities (which gets you an enormous mesh) or create a zone of cells and apply a source term equivalent to the flow resistant the material creates. From your images I assume you are going for the second one. In that case, I think you can create 1 mesh for everything and use cellZones to apply the resistance. To get your parts properly represented in the mesh, use surfaceRefinement for the individual stl regions.



My approach might be wrong though, I haven't done something similar yet.
AtoHM is offline   Reply With Quote

Old   October 9, 2020, 16:31
Default
  #5
New Member
 
Marc-Antoine
Join Date: Oct 2020
Posts: 4
Rep Power: 6
Marki22 is on a distinguished road
Thanks for your answer AtoMH,

The porous solids are going to be considered later in the simulations. At the beginning, I'm going to considered them as solids.

Just a little question with the use of surfaceRefinement. Will I be able to define my fluid domain "inside the grey part" but outside of the volume of blue, yellow and red parts with this strategy? Do you know tutorials where this kind of operation are done?

Your help is really appreciate!
Marki22 is offline   Reply With Quote

Old   October 10, 2020, 05:10
Default
  #6
Senior Member
 
M
Join Date: Dec 2017
Posts: 700
Rep Power: 12
AtoHM is on a distinguished road
If you consider them as solids, you can cut them out of the grey part within your CAD tool, you don't need to mesh parts that are solid. Remember the volume you have to build for a cfd model is the fluid body, not the walls with thickness. I am not compeletely sure looking at your images, but it looks like you are modeling the walls instead of the fluid volume.

The surfaceRefinement has nothing to do with what is inside/outside. It just gives you an opportunity to refine surfaces that are inside the mesh but don't act e.g. as walls. The snappyHexMeshDict parameter locationInMesh tells snappy what part should be meshed. It should lay within/outside a volume bounded by the STL file. Then everything outside/inside of the STL file is removed during meshing.


That was by the way the aim of my first post, where I doubted you need multiple bodies here.
AtoHM is offline   Reply With Quote

Reply

Tags
freecad, multi, multi-parts


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
[ICEM] Problems with coedge curves and surfaces tommymoose ANSYS Meshing & Geometry 6 December 1, 2020 12:12
[ANSYS Meshing] 3-D meshing with multiple parts pokhrel ANSYS Meshing & Geometry 0 June 26, 2016 17:44
[ICEM] Meshing Multi Solid Body for CFD marauder ANSYS Meshing & Geometry 0 March 18, 2015 07:32
[snappyHexMesh] New multi region meshing tutorial with sHM Tobi OpenFOAM Meshing & Mesh Conversion 0 November 24, 2014 18:42
Independent Meshing for parts in an assembly [ANSYS 14.0] winfoor ANSYS 0 August 12, 2014 12:46


All times are GMT -4. The time now is 04:55.