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

[snappyHexMesh] More geometries in snappyHexMesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 6, 2023, 05:36
Default More geometries in snappyHexMesh
  #1
New Member
 
Lucia Ligorio
Join Date: Feb 2022
Posts: 14
Rep Power: 4
lucia_995 is on a distinguished road
Hi, I try to design a rubble mound breakwater with OpenFOAM. My structure is composed by first and second layer, and a core.
When I see it in ParaView there is only the first layer and where there should be the core there isn't nothing.
On the left of ParaView screen in properties, in Mesh Parts appears only the core.
So I think there is a problem in SnappyHexMeshDict.
There is someone that can help me??




This is the SnappyHexMeshDict file.





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

// Which of the steps to run
castellatedMesh true;
snap true;
addLayers false;


// Geometry. Definition of all surfaces. All surfaces are of class
// searchableSurface.
// Surfaces are used
// - to specify refinement for any mesh cell intersecting it
// - to specify refinement for any mesh cell inside/outside/near
// - to 'snap' the mesh boundary to the surface
geometry
{

core.stl
{
type triSurfaceMesh;
name core;
}

primLayer.stl
{
type triSurfaceMesh;
name core;
}

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



// Settings for the castellatedMesh generation.
castellatedMeshControls
{

// Refinement parameters
// ~~~~~~~~~~~~~~~~~~~~~

// If local number of cells is >= maxLocalCells on any processor
// switches from from refinement followed by balancing
// (current method) to (weighted) balancing before refinement.
maxLocalCells 10000000;

// Overall cell limit (approximately). Refinement will stop immediately
// upon reaching this number so a refinement level might not complete.
// Note that this is the number of cells before removing the part which
// is not 'visible' from the keepPoint. The final number of cells might
// actually be a lot less.
maxGlobalCells 10000000;

// The surface refinement loop might spend lots of iterations refining just a
// few cells. This setting will cause refinement to stop if <= minimumRefine
// are selected for refinement. Note: it will at least do one iteration
// (unless the number of cells to refine is 0)
minRefinementCells 10;

// Allow a certain level of imbalance during refining
// (since balancing is quite expensive)
// Expressed as fraction of perfect balance (= overall number of cells /
// nProcs). 0=balance always.
maxLoadUnbalance 0.10;


// Number of buffer layers between different levels.
// 1 means normal 2:1 refinement restriction, larger means slower
// refinement.
nCellsBetweenLevels 3;



// Explicit feature edge refinement
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

// Specifies a level for any cell intersected by its edges.
// This is a featureEdgeMesh, read from constant/triSurface for now.
features
(
//{
//file "caisson.obj";
//level 2;
//}
);



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

// Specifies two levels for every surface. The first is the minimum level,
// every cell intersecting a surface gets refined up to the minimum level.
// The second level is the maximum level. Cells that 'see' multiple
// intersections where the intersections make an
// angle > resolveFeatureAngle get refined up to the maximum level.

refinementSurfaces
{

core
{
// Surface-wise min and max refinement level
level ( 0 0 );
}

primLayer
{
// Surface-wise min and max refinement level
level ( 0 0 );
}

secLayer
{
// Surface-wise min and max refinement level
level ( 0 0 );
}
}

// Resolve sharp angles
resolveFeatureAngle 65;


// Region-wise refinement
// ~~~~~~~~~~~~~~~~~~~~~~

// Specifies refinement level for cells in relation to a surface. One of
// three modes
// - distance. 'levels' specifies per distance to the surface the
// wanted refinement level. The distances need to be specified in
// descending order.
// - inside. 'levels' is only one entry and only the level is used. All
// cells inside the surface get refined up to the level. The surface
// needs to be closed for this to be possible.
// - outside. Same but cells outside.

refinementRegions
{

}

// Mesh selection
// ~~~~~~~~~~~~~~

// After refinement patches get added for all refinementSurfaces and
// all cells intersecting the surfaces get put into these patches. The
// section reachable from the locationInMesh is kept.
// NOTE: This point should never be on a face, always inside a cell, even
// after refinement.
locationInMesh (0.25 0.01 0.25);

// Whether any faceZones (as specified in the refinementSurfaces)
// are only on the boundary of corresponding cellZones or also allow
// free-standing zone faces. Not used if there are no faceZones.
allowFreeStandingZoneFaces true;
}



// Settings for the snapping.
snapControls
{
//- Number of patch smoothing iterations before finding correspondence
// to surface
nSmoothPatch 3;

//- Relative distance for points to be attracted by surface feature point
// or edge. True distance is this factor times local
// maximum edge length.
tolerance 4.0;

//- Number of mesh displacement relaxation iterations.
nSolveIter 30;

//- Maximum number of snapping relaxation iterations. Should stop
// before upon reaching a correct mesh.
nRelaxIter 5;
}



// Settings for the layer addition.
addLayersControls
{
// Are the thickness parameters below relative to the undistorted
// size of the refined cell outside layer (true) or absolute sizes (false).
relativeSizes true;

// Per final patch (so not geometry!) the layer information
layers
{
//batimetria_patch0
//{
// nSurfaceLayers 2; //was 1 //was 4
//}
}

// Expansion factor for layer mesh
expansionRatio 1.0;

//- Wanted thickness of final added cell layer. If multiple layers
// is the thickness of the layer furthest away from the wall.
// See relativeSizes parameter.
finalLayerThickness 0.3;

//- Minimum thickness of cell layer. If for any reason layer
// cannot be above minThickness do not add layer.
// Relative to undistorted size of cell outside layer.
minThickness 0.1;

//- If points get not extruded do nGrow layers of connected faces that are
// also not grown. This helps convergence of the layer addition process
// close to features.
nGrow 1;


// Advanced settings

//- When not to extrude surface. 0 is flat surface, 90 is when two faces
// make straight angle.
featureAngle 30;

//- Maximum number of snapping relaxation iterations. Should stop
// before upon reaching a correct mesh.
nRelaxIter 3;

// Number of smoothing iterations of surface normals
nSmoothSurfaceNormals 1;

// Number of smoothing iterations of interior mesh movement direction
nSmoothNormals 3;

// Smooth layer thickness over surface patches
nSmoothThickness 10;

// Stop layer growth on highly warped cells
maxFaceThicknessRatio 0.5;

// Reduce layer growth where ratio thickness to medial
// distance is large
maxThicknessToMedialRatio 0.3;

// Angle used to pick up medial axis points
minMedianAxisAngle 130;

// Create buffer region for new layer terminations
nBufferCellsNoExtrude 0;

// Overall max number of layer addition iterations
nLayerIter 50;
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
//- Maximum non-orthogonality allowed. Set to 180 to disable.
maxNonOrtho 65;

//- Max skewness allowed. Set to <0 to disable.
maxBoundarySkewness 20;
maxInternalSkewness 4;

//- Max concaveness allowed. Is angle (in degrees) below which concavity
// is allowed. 0 is straight face, <0 would be convex face.
// Set to 180 to disable.
maxConcave 80;

//- Minimum projected area v.s. actual area. Set to -1 to disable.
minFlatness 0.5;

//- Minimum pyramid volume. Is absolute volume of cell pyramid.
// Set to a sensible fraction of the smallest cell volume expected.
// Set to very negative number (e.g. -1E30) to disable.
minVol 1e-13;

//- Minimum quality of the tet formed by the face-centre
// and variable base point minimum decomposition triangles and
// the cell centre. This has to be a positive number for tracking
// to work. Set to very negative number (e.g. -1E30) to
// disable.
// <0 = inside out tet,
// 0 = flat tet
// 1 = regular tet
minTetQuality 1e-30;

//- Minimum face area. Set to <0 to disable.
minArea -1;

//- Minimum face twist. Set to <-1 to disable. dot product of face normal
//- and face centre triangles normal
minTwist 0.02;

//- minimum normalised cell determinant
//- 1 = hex, <= 0 = folded or flattened illegal cell
minDeterminant 0.001;

//- minFaceWeight (0 -> 0.5)
minFaceWeight 0.02;

//- minVolRatio (0 -> 1)
minVolRatio 0.01;

//must be >0 for Fluent compatibility
minTriangleTwist -1;


// Advanced

//- Number of error distribution iterations
nSmoothScale 4;
//- amount to scale back displacement at error points
errorReduction 0.75;
}


// Advanced

// Flags for optional output
// 0 : only write final meshes
// 1 : write intermediate meshes
// 2 : write volScalarField with cellLevel for postprocessing
// 4 : write current intersections as .obj files
debug 0;


// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1E-6;


// ************************************************** *********************** //
lucia_995 is offline   Reply With Quote

Old   February 7, 2023, 09:20
Default
  #2
Senior Member
 
M
Join Date: Dec 2017
Posts: 642
Rep Power: 12
AtoHM is on a distinguished road
Hello,
the provided information is a bit sparse to help directly. Can you attach some images of the separate parts you have, what the result looks like in Paraview and what volume you intend to mesh?


In general, snappyHexMesh will keep the cells that are enclosed by an STL file, if the locationInMesh resides within it. This could be the reason you only get 1 of 3 regions. However, the things I asked for above will help us to figure this out. Reason why you can see the "primLayer" and Paraview says "core" is present: you have the name "core" for core.stl and primLayer.stl.
AtoHM is offline   Reply With Quote

Old   February 7, 2023, 11:19
Default
  #3
New Member
 
Lucia Ligorio
Join Date: Feb 2022
Posts: 14
Rep Power: 4
lucia_995 is on a distinguished road
I have 3 different stl file; I try to combine in one STL file the 3 part of the structure, but I have the same problem. When I run snappyHexMesh then in paraView see only the first layer. I can see them in paraView if I open the files in a second moment. But first where I want the core there isn't nothing.
My purpose is measure the pressure inside the core, but I haven't the measures because there isn't nothing. I hope to explain me. I enclose images.


[IMG]https://ibb.co/FVz37bF
https://ibb.co/4ZH7Dyz
https://ibb.co/WKHG65F
https://ibb.co/Csv4WJ3[/IMG]
lucia_995 is offline   Reply With Quote

Old   February 7, 2023, 11:44
Default
  #4
Senior Member
 
M
Join Date: Dec 2017
Posts: 642
Rep Power: 12
AtoHM is on a distinguished road
Ok I understand your issue. Please use the forum attachment to attach images. People do not like to click links we do not know the target of.
AtoHM is offline   Reply With Quote

Old   February 7, 2023, 11:59
Default
  #5
New Member
 
Lucia Ligorio
Join Date: Feb 2022
Posts: 14
Rep Power: 4
lucia_995 is on a distinguished road
whatIsee.jpg

whatIwanttosee.jpg

thecore.jpg

thefirstlayer.jpg
lucia_995 is offline   Reply With Quote

Old   February 7, 2023, 12:00
Default
  #6
New Member
 
Lucia Ligorio
Join Date: Feb 2022
Posts: 14
Rep Power: 4
lucia_995 is on a distinguished road
So how can I resolve this problem??
lucia_995 is offline   Reply With Quote

Old   February 8, 2023, 02:44
Default
  #7
Senior Member
 
M
Join Date: Dec 2017
Posts: 642
Rep Power: 12
AtoHM is on a distinguished road
I am not totally sure what is what. Is it possible to zip the whole case and upload it here?
It looks like you try to mesh multiple separate regions (core, layers), but what you need is probably just one region - depending on the model you are going for.
AtoHM is offline   Reply With Quote

Old   February 8, 2023, 05:30
Default
  #8
New Member
 
Lucia Ligorio
Join Date: Feb 2022
Posts: 14
Rep Power: 4
lucia_995 is on a distinguished road
Yes, sure.

Lucia_test.zip
lucia_995 is offline   Reply With Quote

Old   February 8, 2023, 12:41
Default
  #9
Senior Member
 
M
Join Date: Dec 2017
Posts: 642
Rep Power: 12
AtoHM is on a distinguished road
I've had a look. I have no experience with 2d meshes, but I assume this is going to work, once we figure out what you really want and what you are currently doing.
So, to make things a bit clearer, I executed the case as is and displayed everything in Paraview. The result is shown in the attachment and it is what I presumed earlier.
You have a blockMesh consisting of 2 blocks (the inclined and the horizontal part). Your locationInMesh is somewhere near the left boundary. You have 3 fully closed STL parts. And here, I am not sure what you are trying to do. If you are going to simulate the flow (I assume it's water waves coming from the left and going up the wall), I do not understand what the secLayer and core parts are needed for.
If you need to mesh these parts nevertheless, you will need to tell snappy to mesh these parts. Per default, snappy will one mesh one region: the one that encloses the locationInMesh. This region is in your case defined by the blockMesh and ends at the upper surface of "primLayer.stl". The spaces enclosed by core and secLayer are separated regions and are therefore removed by snappy. If you want to keep these regions, you must use one of two options: use face- and cellZone creation in the refinement surfaces subdictionary (google how to do that). This option is available in the ESI and Foundation OpenFOAM versions. CellZone creation in my experience does not work w/o faceZone creation, so use both, no matter if you need a faceZone. Or provide multiple locationsInMesh (this is only available in ESI OpenFOAM). Then, snappy will keep the regions.
I hope this help a bit to understand what is going on.

Furthermore, if you really want to simulate this, the gap between the top boundary and primLayer is very narrow. If water gets there, it will probably reach the boundary and unrealistic stuff is going to happen.
Attached Images
File Type: png case_geo_and_res.PNG (70.9 KB, 8 views)
AtoHM is offline   Reply With Quote

Old   February 8, 2023, 14:21
Default
  #10
New Member
 
Lucia Ligorio
Join Date: Feb 2022
Posts: 14
Rep Power: 4
lucia_995 is on a distinguished road
No, all the three structures are on the right. But I understand what you tell. I will try to find on google how to use face- and cellZone creation in the refinement surfaces subdictionary.
If I have other questions I will write there.

Thank you very much!!!
lucia_995 is offline   Reply With Quote

Old   February 9, 2023, 03:17
Default
  #11
New Member
 
Lucia Ligorio
Join Date: Feb 2022
Posts: 14
Rep Power: 4
lucia_995 is on a distinguished road
Hi, i read again what you write me. My domain/region not finish upper the primLayer. I send you a screen of the domain without structure.

Screenshot (882).jpg
lucia_995 is offline   Reply With Quote

Old   February 9, 2023, 03:21
Default
  #12
Senior Member
 
M
Join Date: Dec 2017
Posts: 642
Rep Power: 12
AtoHM is on a distinguished road
I do not know what you have tried, but it appears this is only the blockMesh. Something probably went wrong in snappyHexMesh. Always check the log files when something like this happens.
AtoHM is offline   Reply With Quote

Old   February 9, 2023, 03:23
Default
  #13
New Member
 
Lucia Ligorio
Join Date: Feb 2022
Posts: 14
Rep Power: 4
lucia_995 is on a distinguished road
Yes, it's only the blockmesh, I know it, I send you it to replay what you say in the previous message ("This region is in your case defined by the blockMesh and ends at the upper surface of "primLayer.stl". ")
lucia_995 is offline   Reply With Quote

Old   February 9, 2023, 03:36
Default
  #14
Senior Member
 
M
Join Date: Dec 2017
Posts: 642
Rep Power: 12
AtoHM is on a distinguished road
Not sure what your point is, but, I want to point out again:
1) What I said about the region is kind of the viewing point of snappyHexMesh. The locationInMesh defines the region that is meshed. The primLayer upper surface basically cuts away all the other regions - they are outside the region that contains locationInMesh. If you want to keep them, use cellZones or locationsInMesh. But:
2) I doubt you need those regions, unless you plan to use some kind of porous model or something for the layers (I don't work in this field, so no experience if that is a valid approach or not). If the water never touches the core region, why do you try to mesh it? I cannot answer these questions, because I do not know what your simulation model shall be.
AtoHM is offline   Reply With Quote

Old   February 10, 2023, 06:53
Default
  #15
New Member
 
Lucia Ligorio
Join Date: Feb 2022
Posts: 14
Rep Power: 4
lucia_995 is on a distinguished road
OK. I need those regions. Those are porous resions and I want to measure pressures inside them. Infact I put inside them pressures gauges that not give me anything because the regions are cut.
lucia_995 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
MultiRegion SnappyHexMesh Workflow for complex geometries Dicanic Main CFD Forum 3 March 3, 2022 18:18
[snappyHexMesh] Can snappyHexMesh handle intersecting geometries? Attesz OpenFOAM Meshing & Mesh Conversion 5 January 16, 2022 18:39
[snappyHexMesh] Running snappyHexMesh in parallel - optimizing peterhess OpenFOAM Meshing & Mesh Conversion 2 January 3, 2018 02:54
[snappyHexMesh] Error in meshing process with snappyHexMesh and different geometries JoSchl OpenFOAM Meshing & Mesh Conversion 0 June 27, 2017 04:13
[snappyHexMesh] SnappyHexMesh complex geometries amp thin wall parts hsieh OpenFOAM Meshing & Mesh Conversion 0 September 22, 2008 17:34


All times are GMT -4. The time now is 17:10.