|
[Sponsors] |
[snappyHexMesh] STL file for snappyHexMesh |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 28, 2020, 18:14 |
STL file for snappyHexMesh
|
#1 |
Member
Tommaso M.
Join Date: Sep 2018
Location: Milan, Italy
Posts: 67
Rep Power: 8 |
Hi All,
I need to create a mesh by using snappyHexMesh. I create the CAD file as an assembly and convert it into an STL. When I open such STL file it contains only a single "solid", while it should be composed by two solids, i.e. wall and cylinder. In this way I cannot distinguish them as different patches while making the mesh. Does anyone know how to generate an STL file (from CAD) which contains the parts as different solids and not as a single object? Best, Tommy |
|
September 29, 2020, 10:22 |
|
#2 |
Member
Petros Ampatzidis
Join Date: Oct 2018
Location: Bath, UK
Posts: 64
Rep Power: 8 |
Hi Tommy,
What you usually want to do is (1) to export the differet parts of your geometry in different STL files and (2) combine them in a single STL file and use it in snappyHexMesh. 1. Open the STL files with a text editor and check that the name of the boundary is correct. E.g.: instead of Code:
solid Exported from Blender-2.83.2 facet normal -1.000000 0.000000 0.000000 outer loop ... ... endloop endfacet endsolid Exported from Blender-2.83.2 Code:
solid inlet facet normal -1.000000 0.000000 0.000000 outer loop ... ... endloop endfacet endsolid inlet Code:
cat *.stl >> combined.stl Best, Petros |
|
September 29, 2020, 10:23 |
|
#3 | |
Senior Member
Franco
Join Date: Nov 2019
Location: Compiègne, France
Posts: 129
Rep Power: 7 |
Quote:
it depends in what CAD software you are using, from what I know, salomé, and blender (for sure) and maybe freecad? can do this. if you are working with a different cad software than the ones i mentioned before, you have two possibilities (i recomend the fist one): 1. export your file (the complete geometry) in STEP format, import it to salomé (in the geometry section) and from there create groups with the faces that you want to be differentiated and then mesh it with 2D meshes, separatly, export them in separate stls and then use the command cat to create a combined stl. this way snappy will recognize the different groups you created. a good guide https://www.youtube.com/watch?v=CeuF...el=HolzmannCFD 2. use topoSet after doing the snappy by selecting the desired group of faces, the problem with this is that you are not going to be able to add the boundary layer in a specific patch. https://www.youtube.com/watch?v=l_ea...hannel=TheoOng also recommend you to read the pinned post Creating waterproof STL using snappyHexMesh or salome good luck! franco |
||
September 30, 2020, 10:49 |
|
#4 | |
Member
Tommaso M.
Join Date: Sep 2018
Location: Milan, Italy
Posts: 67
Rep Power: 8 |
Quote:
I did not think about it but your solution is very simple and smart. Thank you very much for the tip! Best, Tommy |
||
September 30, 2020, 10:54 |
|
#5 | |
Member
Tommaso M.
Join Date: Sep 2018
Location: Milan, Italy
Posts: 67
Rep Power: 8 |
Quote:
I use Autodesk Inventor and SolidWorks. Anyway, as far as I know, Salome and Blender are free, so I can consider to download one of them. The solution suggested by Petros is great but things could come to be complex when you are modelling an assembly composed by tens of parts (at the moment it is not my case), and an automatic way to generate solids in the same STL could be very useful. Thanks! Tommy |
||
September 30, 2020, 14:25 |
|
#6 | |
Senior Member
Franco
Join Date: Nov 2019
Location: Compiègne, France
Posts: 129
Rep Power: 7 |
Quote:
the problem with petros way, and it really depends in the software (i dont know with solidworks and autodesk) is that when you do this without previously doing a remeshing of the surface you risk that your STL is not watertight. thats why you go to salome to remeshed and then export it separatly . please have a look at this post Creating waterproof STL using snappyHexMesh or salome thats why i was telling you to go thought salomé, but you can try actually to export your different patches (in ASCII stl format!!!)directly from the cad software and use cat command ( you place all the stls in same folder, you modify them with a text editor and change the names as petros said, and then use the command (cat *.stl >> completeModel.stl). actually it is the same workflow as doing the salome path but the difference is that depending on the software where you export it, it is or not going to be watertight. and there you are going to have a only stl file (completeModel.stl) that it is going to have the boundaries (you should name them in the snappyHexDict too) franco. |
||
September 30, 2020, 14:43 |
|
#7 |
Member
Petros Ampatzidis
Join Date: Oct 2018
Location: Bath, UK
Posts: 64
Rep Power: 8 |
Franco is right. When I wrote my first post I assumed that the geometry is exported from a mesher like Salome or Blender. And by the way, you can always import CAD files into these software for manipulation.
Petros |
|
October 1, 2020, 11:40 |
|
#8 |
Member
Tommaso M.
Join Date: Sep 2018
Location: Milan, Italy
Posts: 67
Rep Power: 8 |
Hi,
ok, I will learn to use Salome. Thank you both for your hints, they are very helpful! Best, Tommy |
|
October 2, 2020, 05:40 |
|
#9 |
New Member
Bradon
Join Date: Jun 2020
Location: Berlin
Posts: 1
Rep Power: 0 |
I generally use FreeCAD with their mesh option, to export my stl files. Which if you are a solidworks user you pretty get familiar with.
|
|
March 8, 2022, 12:13 |
STL file
|
#10 |
New Member
Afshin Davarpanah
Join Date: Oct 2021
Posts: 5
Rep Power: 5 |
Hello everyone
I export an STL file from surface Evolution to use for snappyHexMesh. Unfortunately, after running the snappyHexMesh command, it does not recognize the STL file and it is only show blockmesh in the form of rectangular channel. Could you please help me how to proceed with that? |
|
March 9, 2022, 09:02 |
|
#11 | |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Quote:
The problem is that you are doing things wrong: code snippets from snappyHexMeshDict Code:
geometry { interface.stl { type triSurfaceMesh; name interface; } ... } castellatedMeshControls { ... refinementSurfaces { interface.stl /// <<< wrong. Its simply: interface { // Surface-wise min and max refinement level level (2 5); } } ... } Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Read mesh in = 0.495 s Overall mesh bounding box : (-0.5 0 0) (0.5 1.5 1) Relative tolerance : 1e-06 Absolute matching distance : 2.06155e-06 Reading refinement surfaces. --> FOAM Warning : From function Foam::refinementSurfaces::refinementSurfaces(const Foam::searchableSurfaces&, const Foam::dictionary&, Foam::label) in file refinementSurfaces/refinementSurfaces.C at line 215 Reading "D:/Paper5-OpenFoam/Afshin/InterfaceShapes/RectangularChannelIncludeInterface/system/snappyHexMeshDict/castellatedMeshControls/refinementSurfaces" from line 124 to line 124 Not all entries in refinementSurfaces dictionary were used. The following entries were not used : 1(interface.stl) Read refinement surfaces in = 0.005 s
__________________
Keep foaming, Tobias Holzmann |
||
April 18, 2022, 03:06 |
|
#12 |
New Member
Lakshmi
Join Date: Mar 2022
Posts: 3
Rep Power: 4 |
Hi Tobi,
I am Lakshmi, from India. I am currently working on modeling a packed bed reactor for non-particulate systems. I wanted to contact you to know how to use OpenFOAM for meshing a packed bed geometry as I came across your discussions on this forum. I created my bed using blender 3D software and I shall export the geometry in the .stl format. I successfully created a blockmesh and I and facing the following error for snappyHexMesh (FOAM FATAL IO ERROR: keyword locationInMesh is undefined in dictionary "/home/hp/OpenFOAM/hp-9/run/testcase_1/system/snappyHexMeshDict/castellatedMeshControls" ). Kindly help me if you know how to resolve this error. Looking forward to hearing from you. Thank you. Regards, Lakshmi |
|
April 18, 2022, 03:07 |
|
#13 |
New Member
Lakshmi
Join Date: Mar 2022
Posts: 3
Rep Power: 4 |
/*--------------------------------*- C++ -*----------------------------------*\
========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 9 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { format ascii; class dictionary; object snappyHexMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #includeEtc "caseDicts/mesh/generation/snappyHexMeshDict.cfg" castellatedMesh on; snap off; addLayers off; geometry { fluid { type triSurfaceMesh; file "mesh.stl"; regions { wall { name wall; } obj1 { name obj1; } obj2 { name obj2; } obj3 { name obj3; } obj4 { name obj4; } } } } castellatedMeshControls { features ( // { file "CAD.eMesh"; level 1; } ); refinementSurfaces { #include "meshQualityDict" fluid { level (0 0) regions{ wall { level (0 0); patchInfo { type wall; } } obj1 { level (1 1); patchInfo { type wall; } } obj2 { level (1 1); patchInfo { type wall; } } obj3 { level (1 1); patchInfo { type wall; } } obj4 { level (1 1); patchInfo { type wall; } } } } } refinementRegions { } locationInMesh (-1 -1 -1); // Offset from (0 0 0) to avoid // coinciding with face or edge nCellsBetweenLevels 1; } snapControls { // explicitFeatureSnap true; // implicitFeatureSnap false; } addLayersControls { layers { "CAD.*" { nSurfaceLayers 2; } } relativeSizes true; // false, usually with firstLayerThickness expansionRatio 1.2; finalLayerThickness 0.5; minThickness 1e-3; // firstLayerThickness 0.01; // maxThicknessToMedialRatio 0.6; } writeFlags ( // scalarLevels layerSets layerFields ); meshQualityControls { #include "meshQualityDict" 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; } mergeTolerance 1e-6; // ************************************************** *********************** // |
|
Tags |
cad, snappy, stl |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using PengRobinsonGas EoS with sprayFoam | Jabo | OpenFOAM Running, Solving & CFD | 36 | July 16, 2024 04:52 |
how to calculate mass flow rate on patches and summation of that during the run? | immortality | OpenFOAM Post-Processing | 104 | February 16, 2021 09:46 |
what is swap4foam ?? | AB08 | OpenFOAM | 28 | February 2, 2016 02:22 |
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 | Seroga | OpenFOAM Community Contributions | 9 | June 12, 2015 18:18 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 20:08 |