|
[Sponsors] |
September 23, 2019, 09:51 |
Meshing of a circular cross-section
|
#1 |
New Member
Join Date: Sep 2019
Posts: 8
Rep Power: 7 |
Dear all,
this is my first contribution to this forum and as im fairly new to OpenFoam, my question might have a trivial answer. Im trying to mesh a geometry that that can be described as a U-pipe with a circular cross section, experiencing an internal-fluid flow. I know that i have to differentiate between inlet, outlet and wall geometry in the blockMeshDict. My question now is, how can i describe and insert those boundary patches in the Blockmeshdict correctly? is it enough to create STL-files in ASCII-format of each geometry-patch and simply copy-paste the patch'es code in the blockMeshDicht-file? best regards |
|
September 23, 2019, 19:26 |
|
#2 |
Senior Member
Peter Hess
Join Date: Apr 2011
Location: Austria
Posts: 250
Rep Power: 17 |
Hello!
I am not sure to understand the question right, anyway but the blockMeshDict I uploaded here and see the result in paraFoam... blockMesh is meshing the pipe and defines the boundaries. Regards Peter |
|
September 24, 2019, 04:29 |
|
#3 | |
Senior Member
Join Date: Jun 2012
Location: Germany, Bochum
Posts: 230
Rep Power: 16 |
Quote:
AFAIK you can not use stl files with blockMesh. You could do that with snappyHexMesh (unstructured meshes) |
||
September 24, 2019, 06:01 |
|
#4 | ||
Member
Piotr Ładyński
Join Date: Apr 2017
Posts: 55
Rep Power: 9 |
Quote:
Code:
geometry { myShape { type triSurfaceMesh; file "myGeometry.stl" //must be in [constant/geometry] directory } } Code:
//vertices... name myVertex01 project (0 0 0) (myShape) //edges... project myVertex01 myVertex02 (myShape) //faces... project (myVertex01 myVertex02 myVertex03 myVertex04) myShape Quote:
You should look at basic meshing tutorials: Code:
boundary // keyword ( inlet // patch name { type patch; // patch type for patch 0 faces ( (0 4 7 3) // block face in this patch ); } // end of 0th patch definition outlet // patch name { type patch; // patch type for patch 1 faces ( (1 2 6 5) ); } walls { type wall; faces ( (0 1 5 4) (0 3 2 1) (3 7 6 2) (4 5 6 7) ); } ); name myVertexName (0 0 0) and then: Code:
inlet { type patch; faces ( (myVertex00 myVertex01 myVertex02 myVertex03) ); } Last edited by piotr.mecht; September 28, 2019 at 04:51. |
|||
September 24, 2019, 06:11 |
|
#5 |
Senior Member
Join Date: Jun 2012
Location: Germany, Bochum
Posts: 230
Rep Power: 16 |
thanks for the info. interesting!
|
|
September 24, 2019, 07:59 |
|
#6 |
New Member
Join Date: Sep 2019
Posts: 8
Rep Power: 7 |
Hey all,
thanks alot! i looked at the code in the blockmesh tutorial for a pipe in open foam and still have a few questions: how is it possible address the coordinates of the edges and how do you address the coordinates of the inlet outlet and walls? are these informations written automatically in the blockmeshdict file when using snappy hex mesh or do i have to insert these informations manually? i think i still dont get the point of defining the actual geometry of the pipe in the blockmeshdict, when the snappyhexmeshdict cuts out the stl geometries anyway? best regards |
|
September 24, 2019, 08:44 |
|
#7 |
Member
Piotr Ładyński
Join Date: Apr 2017
Posts: 55
Rep Power: 9 |
If you are going to use snappyHexMesh anyway you need blockMesh only to provide background mesh (like simple domain-sized cuboid). You don't need to specify any patches in blockMeshDict in this case. You specify them in snappyHexMeshDict in geometry field: Code:
geometry { Geometry.stl { type triSurfaceMesh; name myGeometry; regions { region1 {name Inlet; } region2 {name Outlet; } regionbanana {name Wall; } } } } https://www.youtube.com/watch?v=_Sak...oOzmG5T9dvasG6 ============== blockMesh wasn't designed to fit complex geometries, but it is often useful for the proof-of-concept things. It is posible to fit some faces, edges and vertices onto your geometry with projection capabilities. Create some points with coordinates in proximity of place you want to fit (I don't remember wether you need to be exactly inside or outside this surface or if that matters), and project them onto your shape. You can project onto multiple surfaces (stl, box, cylinder, surface etc.) at once, so the vertex will fit a place, where your surfaces intersect (it is useful to add e.g. a plane to make sure your hex vertices fit your stl at certaint height/length). ============== |
|
September 26, 2019, 12:09 |
|
#8 |
New Member
Join Date: Sep 2019
Posts: 8
Rep Power: 7 |
thanks for your reply, but i still havent fully solved the problem.
I run my case in the following order: 1. blockMesh 2. surfaceFeatureExtract 3. snappyHexMesh 4. icoFoam I can see the meshing worked when i load it in paraView, but i still have some questions: 1. Is it correct that the programm writes out in two timesteps (0.01, 0.02) the meshing data? 2.is it possible to define initial and boundary conditions for the case even if the only appearence of the definition of the faces is in the SnappyHexMeshDict? i know only defined a Hexagonal cubemesh in the blockmeshdict, no specification of any surface in particular. Looking forward to your answers. best regards |
|
September 26, 2019, 16:11 |
|
#9 | ||
Member
Piotr Ładyński
Join Date: Apr 2017
Posts: 55
Rep Power: 9 |
Quote:
snappyHexMesh has 3 stages: castellated refinement, snappig to the surface and adding layers stage. It returns separate "timesteps" (they are just labeled according to your timestep set in controlDict) for each stage executed, so you can check each stage result separately. Each of this folder contains polyMesh folder, which you could copy to constant/ directory to account as your new mesh. In your case folder 0.01 probably contains castellated (minecraft-like) result and folder 0.02 is probably snapped mesh (without layers fitted to boundary). you can skip this and make your final mesh stage directly into constant/polyMesh folder by calling: Code:
snappyHexMesh -overwrite Quote:
I don't think I understand your question well. Your boundary (and initial) conditions are defined in 0/ directory for each of transported quantity. In case of icoFoam these are 0/p (which corresponds to kinematic pressure) and 0/U (which corresponds to velocity vector). pressure file might look like this: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1906 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 0; boundaryField { myInlet // name specified in snappyHexMeshDict { type zeroGradient; } myOutlet { type fixedValue; value uniform 0; } myWall { type zeroGradient; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1906 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (10 0 0); boundaryField { myInlet { type fixedValue; value uniform (10 0 0); } myOutlet { type zeroGradient; } myWall { type noSlip; } } // ************************************************************************* // To find tutorials directory type: Code:
echo $FOAM_TUTORIALS |
|||
September 27, 2019, 18:22 |
|
#10 |
New Member
Join Date: Sep 2019
Posts: 8
Rep Power: 7 |
Hello guys,
i again have one question regarding the snappyHexMesh dict. I already looked at several complete files, like the flange tutorial mesh or the one with the motorbike. Based on that i modelled my file for the internal pipe flow. The only main thing i removed is the refinement surface part and the refinement region part. Do i have to have these parts in my code do properly run the hexmesh command? my snappyhexmeshdict file looks like this /*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 7 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object snappyHexMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // castellatedMesh true; snap true; addLayers false; geometry { inlet { type triSurfaceMesh; file "inletm.stl"; } outlet { type triSurfaceMesh; file "outletm.stl"; } wand { type triSurfaceMesh; file "wandm.stl"; } }; castellatedMeshControls { maxLocalCells 100000; maxGlobalCells 2000000; minRefinementCells 10; maxLoadUnbalance 0.10; nCellsBetweenLevels 3; features ( {file "inletm.eMesh";level 6;} {file "outletm.eMesh";level 6;} {file "wandm.eMesh";level 6;} ); resolveFeatureAngle 30; locationInMesh (0.05 -0.04 0); allowFreeStandingZoneFaces true; } snapControls { nSmoothPatch 3; tolerance 2.0; nSolveIter 30; nRelaxIter 5; nFeatureSnapIter 10; implicitFeatureSnap false; explicitFeatureSnap true; multiRegionFeatureSnap false; } addLayersControls { relativeSizes true; layers { "(inlet)" {nSurfaceLayers 1;} "(wall)" {nSurfaceLayers 1;} "(outlet)" {nSurfaceLayers 1;} expansionRatio 1.0; finalLayerThickness 0.3; minThickness 0.1; nGrow 0; featureAngle 60; slipFeatureAngle 30; nRelaxIter 3; nSmoothSurfaceNormals 1; nSmoothNormals 3; nSmoothThickness 10; maxFaceThicknessRatio 0.5; maxThicknessToMedialRatio 0.3; minMedianAxisAngle 90; nBufferCellsNoExtrude 0; nLayerIter 50; nRelaxedIter 20; } meshQualityControls { #include "meshQualityDict" relaxed { maxNonOrtho 75; } } writeFlags ( scalarLevels layerSets layerFields ); mergeTolerance 1e-6; after running snappyHexMesh it responds with that error: --> FOAM FATAL IO ERROR: keyword refinementSurfaces is undefined in dictionary "/home/mi/Schreibtisch/OF7/openfoam7/Test-Tutorials/incompressible/icoFoam/cavity/urohr/system/snappyHexMeshDict.castellatedMeshControls" file: /snappyHexMeshDict.castellatedMeshControls from line 50 to line 149. From function const Foam::dictionary& Foam::dictionary::subDict(const Foam::word&) const in file db/dictionary/dictionary.C at line 708. FOAM exiting Do you have any idea why its not running? best regards Mi |
|
September 28, 2019, 04:43 |
|
#11 | |
Member
Piotr Ładyński
Join Date: Apr 2017
Posts: 55
Rep Power: 9 |
Quote:
Read your error messeges. There is no refinementSurfaces in castellatedMeshControls subdictionary Look at the Flange tutorial once again. This input tells us, that we want to refine our surface region (or not) Code:
refinementSurfaces { flange { // Surface-wise min and max refinement level level (2 2); // level (0 0); } } You're trying to provide multiple STLs insead of one STL with multiple regions. That might cause later issues, because sHM looks for one closed surface (not 4 separate ones) each of your stls can look like: Code:
solid regionName01 facet normal -1.000000e+00 0.000000e+00 0.000000e+00 outer loop vertex 0.000000e+00 0.000000e+00 0.000000e+00 vertex 0.000000e+00 0.000000e+00 5.000000e-02 vertex 0.000000e+00 5.000000e-02 0.000000e+00 endloop endfacet [............. multiple face definitions .............] facet normal 0.000000e+00 0.000000e+00 1.000000e+00 outer loop vertex 5.000000e-02 1.000000e-01 1.000000e-01 vertex 0.000000e+00 5.000000e-02 1.000000e-01 vertex 1.000000e-01 5.000000e-02 1.000000e-01 endloop endfacet endsolid regionName01 To merge your stls into one stl with regions you can copypaste its contents to one file or use linux concatenation command in the terminal: Code:
cat inletm.stl outletm.stl wandm.stl > myGeometry.stl Code:
geometry { myGeometry.stl { type triSurfaceMesh; name Geometry; regions { inletm {name inlet; } outletm {name outlet; } wandm {name wand; } } } } Code:
refinementSurfaces { Geometry { level (1 1); regions { inletm { level (0 1); patchInfo { type patch; }} outletm { level (0 1); patchInfo { type patch; }} wandm { level (1 2); patchInfo { type wall; }} } } } There is also a bracket "}" missing in your layer specification, it will yield strange error messages. |
||
September 30, 2019, 04:53 |
|
#12 |
New Member
Join Date: Sep 2019
Posts: 8
Rep Power: 7 |
Hey guys,
i fixed the problem with the meshing, running snappy hex mesh now works. But when i run the icofoam solver i am not able to view the results in paraView. After the simulation i inserted "paraFoam &" command to open up the results. it loads in the geometry but when i try to look at the first timestep it closes down paraview with the error: foam fatal error: size 17532 is not equal to the given value of 6706 file:../0.005/ p from line 18 to 117613 i assume that it has something to do with addressing my "p" boundary file but i dont know how to fix it. Do you have any ideas? best regards |
|
September 30, 2019, 14:50 |
|
#13 |
Member
Piotr Ładyński
Join Date: Apr 2017
Posts: 55
Rep Power: 9 |
If you used 'search' option you would find some threads with similiar issue, like:
Error size 400 is not equal to the given value of 1681 BUT I have this strange feeling that there might be some different thing happening. If you played with snappyHexMesh without -overwrite option before, you might have left some leftover mesh file (polyMesh folder) e.g. from castelated stage in 0.005 directory. Paraview tries to display your result, but it tries to map them on different mesh (with different number of cells, locted in 0.005 folder maybe). If my suspicion is correct, you should delete any unnecessary polyMesh folder in every timestep. The only polyMesh folder you need in icoFoam should be located in constant directory. It is possible in OpenFOAM to have separate meshes for each timestep in some solvers (with moving or adapting mesh) so Paraview interpretation is that you probably want to display your result that way. If my suspicion wasn't correct, please use search option. Someone has probably encountered similiar issue before. |
|
Tags |
meshing 3d, open foam, pre processing |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ansys Beginner, How to Make a cross section in a specific plane in design modeler | arrman | ANSYS | 2 | January 22, 2020 09:30 |
Meshing around a triangular cross section in ICEM | ujjwalmohanty | Mesh Generation & Pre-Processing | 6 | August 27, 2018 03:40 |
[Workbench] result in a cross section | ssmnd | ANSYS Meshing & Geometry | 0 | October 28, 2017 20:48 |
[Commercial meshers] converting Fluent mesh to openfoam standard mesh | deepesh | OpenFOAM Meshing & Mesh Conversion | 31 | March 29, 2017 06:59 |
+ shape circular pipe - meshing possible? | Selina Tracy | Main CFD Forum | 2 | January 16, 2003 14:31 |