CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [snappyHexMesh] About snappyHexMesh (https://www.cfd-online.com/Forums/openfoam-meshing/106097-about-snappyhexmesh.html)

wyldckat August 18, 2012 05:55

About snappyHexMesh
 
A page dedicated to describing how to use snappyHexMesh has been finally created at openfoamwiki.net: http://openfoamwiki.net/index.php/SnappyHexMesh

Feel free to contribute to that page. I only gave it a stern kick off, but a lot more can be added to that page!

I've stickyfied this thread, to make easier for people to find it.
Here can be discussed how to add content to the wiki page and about this thread; but on this specific "About snappyHexMesh" thread will not be answered questions on how to use snappyHexMesh! ;)

Tobi August 31, 2012 03:19

Hey bruno,

I created some sHM tutorials too. Is it possible to link it?

wyldckat August 31, 2012 04:57

Hi Tobi,

Like I wrote above:
Quote:

Originally Posted by wyldckat (Post 377625)
Feel free to contribute to that page.

Best regards,
Bruno

Tobi September 1, 2012 06:28

Quote:

Originally Posted by wyldckat (Post 379652)
Hi Tobi,

Like I wrote above:


Best regards,
Bruno

Hey bruno,

i updated the wikipage but the changes will not be accepted after save it?
What do I wrong?

wyldckat September 1, 2012 06:59

Hi Tobi,

Didn't you notice the question on the top after your first save?
It asks what OpenFOAM field name file corresponds to the field it asks.
It's a captcha question.

Best regards,
Bruno

Tobi September 1, 2012 16:41

No not really but now I see it :)

Thanks
Tobi

gschaider September 2, 2012 16:50

Quote:

Originally Posted by Tobi (Post 379853)
No not really but now I see it :)

Sorry about the inconvenience with the Captcha but without it the number of spam edits would be as big as the number of valid edits ...

Tobi September 4, 2012 12:42

Quote:

Originally Posted by gschaider (Post 379914)
Sorry about the inconvenience with the Captcha but without it the number of spam edits would be as big as the number of valid edits ...

Well thats not a problem :)
I am new to the wiki and dont see that chapta code at the beginning. But if you know it, its not a problem. Its okay couse I know that spam too. Its a good way to filter it.

Good day
Tobi

m5m5kh January 25, 2013 05:06

Quote:

Originally Posted by Tobi (Post 379641)
Hey bruno,

I created some sHM tutorials too. Is it possible to link it?

would you please share your snappyHexMesh tutorial with me??

Tobi January 25, 2013 05:42

Hi,

here are my old Cases:

http://holzmann-cfd.de/index.php/en/openfoamen/

I am working on some new cases!
Tobi

m5m5kh January 25, 2013 13:17

Hi
Thank you Tobi for your help :) I think they will be useful for a beginner like me ;)

Tobi July 6, 2013 11:15

Hi all,

please notice that all snappyHexMesh tutorials are now avaiable on my new homepage.

http://www.holzmann-cfd.de/index.php/tutorials

I updated the wiki, too.


Thanks, fun
Tobi

s.m September 19, 2013 03:23

Quote:

Originally Posted by Tobi (Post 438140)
Hi all,

please notice that all snappyHexMesh tutorials are now avaiable on my new homepage.

http://www.holzmann-cfd.de/index.php/tutorials

I updated the wiki, too.


Thanks, fun
Tobi

Thank you Tobi, but the site that you adressed didn't open for me:(

Tobi September 19, 2013 07:01

Hi,

thanks for the hint.
The links was wrong (not tutorials --> turorial) :)

http://www.holzmann-cfd.de/index.php/tutorial

Tobi September 19, 2013 14:57

Hi All,


I made a dynamic mesh fan and want to share it with you.
After I set up my new server I will upload and clean that case :)

CFDUser_ August 11, 2014 12:42

Hi Tobi,

None of your links are working :-|

xoitx March 14, 2016 11:44

Tutorial by Jens H. at personal blog: snappyHexMesh Tutorial (part 1)

link not working

wyldckat March 19, 2016 15:49

Quote:

Originally Posted by xoitx (Post 589622)
Tutorial by Jens H. at personal blog: snappyHexMesh Tutorial (part 1)

link not working

Many thanks for reporting! I've replaced the link for Jens' more recent blog posts at SourceFlux.de.

afshindpe October 27, 2021 11:23

STL files
 
Hello everyone

I want to open a STL file in OpenFoam and proceed with, however, it does not show anything. I'm a but confused how can I do this in snappyHexmesh.

Regards

Rohitsingh November 28, 2022 06:41

Meshing of porous cylinder using snappyHexMesh
 
1 Attachment(s)
Problem statement: Meshing to simulate Flow past porous cylinder using snappyHexMesh utility.

Questions and doubts:

How to mesh both porous cylinder (internal + external) as well as surrounding together?
I am able to mesh it either inside porous cylinder (mesh from surrounding got removed) or surrounding (mesh inside cylinder got removed) but I am not getting how to get both at the same time.

Yann November 28, 2022 07:23

Hi,

In snappyHexMeshDict, you need to define the porous cylinder as a cellZone in the refinementSurfaces section:

Code:

refinementSurfaces
{
    yourCylinder
    {
        level (0 0);
        faceZone cylinderFaces;
        cellZone cylinderVolume;
        cellZoneInside inside;
    }
}

Regards,
Yann

Rohitsingh November 28, 2022 09:46

Quote:

Originally Posted by Yann (Post 840149)
Hi,

In snappyHexMeshDict, you need to define the porous cylinder as a cellZone in the refinementSurfaces section:

Code:

refinementSurfaces
{
    yourCylinder
    {
        level (0 0);
        faceZone cylinderFaces;
        cellZone cylinderVolume;
        cellZoneInside inside;
    }
}

Regards,
Yann

Dear Yann,

For your reference i am attaching my case set up. It would be great if you can tell me my mistake.

I have tried the approach suggested by you.

Regards


https://drive.google.com/drive/folde...usp=share_link

Yann November 28, 2022 10:39

You should have a stl file defined in geometry. I'm going to assume you stl file is named "poroussphere.stl":

Code:

geometry
{
    poroussphere.stl
    {
        type triSurfaceMesh;
        name Interface;

    }
    refinementBox
    {
        type searchableBox;
        min (-4 -4 -4);
        max (4 4 4);
    }
};

In geometry, you defined the name of the poroussphere.stl as "Interface", then you need to use this name is the following sections of snappyHexMeshDict:

Code:

Interface
{
        level (0 0);
        faceZone anyNameYouWant;
        cellZone anyOtherNameYouWant;
        cellZoneInside inside;
}

I hope this helps,
Yann

PS: as your question is pretty specific, you might want to create a dedicated thread to discuss it.

giuseppedalla January 16, 2023 05:42

Problem with extrudeMesh
 
Hi, I'm new on this forum. I have to do an university exams and i have a problem with the function extrudeMesh. When I compile I have a FATALERROR:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

--> FOAM Warning :
From virtual Foam::Istream &Foam::ISstream::read(Foam::word &)
in file db/IOstreams/Sstreams/ISstream.C at line 886
Reading "system/controlDict" at line 51
Missing 1 closing ')' while parsing

residuals(p,

--> FOAM Warning :
From static bool Foam::functionObjectList::readFunctionObject(const Foam::string &, Foam::dictionary &, HashSet<Foam::wordRe> &, const Foam::word &)
in file db/functionObjects/functionObjectList/functionObjectList.C at line 288
Cannot find functionObject file residuals
--> FOAM Warning :
Reading "system/controlDict" at line 51
Too many closing ')' ... was a ';' forgotten?


--> FOAM FATAL IO ERROR: (openfoam-2212)
Unexpected '}' while reading dictionary entry

file: system/controlDict at line 64.

From static bool Foam::entry::New(Foam::dictionary &, Foam::Istream &, const entry::inputMode, const int)
in file db/dictionary/entry/entryIO.C at line 156.

FOAM exiting

someone can help me?

Thanks

Yann January 16, 2023 06:12

Hello,

There are likely typos in your controlDict:

Code:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

--> FOAM Warning :
From virtual Foam::Istream &Foam::ISstream::read(Foam::word &)
in file db/IOstreams/Sstreams/ISstream.C at line 886
Reading "system/controlDict" at line 51
Missing 1 closing ')' while parsing

residuals(p,


--> FOAM Warning :
From static bool Foam::functionObjectList::readFunctionObject(const Foam::string &, Foam::dictionary &, HashSet<Foam::wordRe> &, const Foam::word &)
in file db/functionObjects/functionObjectList/functionObjectList.C at line 288
Cannot find functionObject file residuals
--> FOAM Warning :
Reading "system/controlDict" at line 51
Too many closing ')' ... was a ';' forgotten?


[...]

Look for missing brackets in your controlDict file, and post it here if you cannot find the error.

Regards,
Yann

giuseppedalla January 16, 2023 06:18

Yann, thanks for your help.

I needed to add a Func for WallShearStress so now i put that for controlDict:

FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application simpleFoam;

startFrom latestTime;

startTime 0;

stopAt endTime;

endTime 3000;

deltaT 1;

writeControl runTime;

writeInterval 3000;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

functions
{

#includeFunc residuals(p, U, k, omega)

#includeFunc "wallShearStress"

forces
{
type forces;
libs ("libforces.so");
writeControl timeStep;
writeInterval 1;
log yes;
patches (wing);
rho rhoInf;
rhoInf 1;
CofR (0.4974612746 -0.01671895744 0.125);
}
}


and the error now is:

Create time

--> FOAM Warning :
From virtual Foam::Istream &Foam::ISstream::read(Foam::word &)
in file db/IOstreams/Sstreams/ISstream.C at line 886
Reading "system/controlDict" at line 51
Missing 1 closing ')' while parsing

residuals(p,

--> FOAM Warning :
From static bool Foam::functionObjectList::readFunctionObject(const Foam::string &, Foam::dictionary &, HashSet<Foam::wordRe> &, const Foam::word &)
in file db/functionObjects/functionObjectList/functionObjectList.C at line 288
Cannot find functionObject file residuals
--> FOAM Warning :
Reading "system/controlDict" at line 51
Too many closing ')' ... was a ';' forgotten?


--> FOAM FATAL ERROR: (openfoam-2212)
Unknown functionEntry 'includeFunc' in "system/controlDict" near line 53

Valid functionEntries :
10(calc codeStream eval include includeEtc includeIfPresent message sinclude sincludeEtc word)

From static bool Foam::functionEntry::execute(const Foam::word &, const Foam::dictionary &, Foam::primitiveEntry &, Foam::Istream &)
in file db/dictionary/functionEntries/functionEntry/functionEntry.C at line 161.

FOAM exiting


Maybe I have to tell you that last week this program worked with Openfoam v10 ... now I have Openfoam v2212 ... maybe it could be usefull for you.

Regards,

Giuseppe

Yann January 16, 2023 06:44

This line seems to be wrong:

Code:

#includeFunc residuals(p, U, k, omega)
Which OpenFOAM version are you using?

giuseppedalla January 16, 2023 06:45

Hi,

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

giuseppedalla January 16, 2023 06:48

I chance this line with

#includeFunc residuals(p,U,k,omega)

and seems this one error is resolve but still this

Create time

--> FOAM Warning :
From static bool Foam::functionObjectList::readFunctionObject(const Foam::string &, Foam::dictionary &, HashSet<Foam::wordRe> &, const Foam::word &)
in file db/functionObjects/functionObjectList/functionObjectList.C at line 288
Cannot find functionObject file residuals


--> FOAM FATAL IO ERROR: (openfoam-2212)
Unexpected '}' while reading dictionary entry

file: system/controlDict at line 67.

From static bool Foam::entry::New(Foam::dictionary &, Foam::Istream &, const entry::inputMode, const int)
in file db/dictionary/entry/entryIO.C at line 156.

FOAM exiting


and i check every } missing ...

giuseppedalla January 16, 2023 06:50

It's strange because when i run one line like "extrudeMesh" i see that:

/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2212 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

So v2212, but when i open controlDict it's:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

v1812 .... it could be this the error?

Yann January 16, 2023 08:19

OK so first thing: you are using openFoam-v2212, as you can see here:
Code:

--> FOAM FATAL IO ERROR: (openfoam-2212)
Unexpected '}' while reading dictionary entry

file: system/controlDict at line 67.

From static bool Foam::entry::New(Foam::dictionary &, Foam::Istream &, const entry::inputMode, const int)
in file db/dictionary/entry/entryIO.C at line 156.

FOAM exiting

You can also see it in the terminal when running any command, or with this command: foamVersion
The files header not being up to date don't matter, but you might face issues if you try to run cases from an older version to a new one due to syntax or functionalities changes between versions.

This being said, the residuals function object has been replaced by solverInfo since v1906 so you should replace this:

Code:

#includeFunc residuals(p, U, k, omega)
with this

Code:

#includeFunc solverInfo
And it should be fine, at least for this error.

Regards,
Yann

giuseppedalla January 16, 2023 09:03

Yann, you're a lifesaver.

So the problem was this line #includeFunc residuals(p, U, k, omega) that change with the new version of Openfoam.

I changed with the new line and now it work all well and print me all the dates that i need.
Thank you so much for the help.

Regards,

Giuseppe

AlexandrosVouros May 18, 2023 03:23

1 Attachment(s)
Dear All,


Could you please provide some advice on better snapping the interface in the picture below!


It comes from a temperature probe that I need to put within the fluid pipe flow. All the procedure described by Tobi for a watertight etc. outline geometry has been followed -although meshing at the interface nodes is indeed compatible - it seems not so uniform enough I admit (please check salome file).



In the final output a small number of cells are included in opposite zones, e.g fluid/probeWall or probe/fluidWall.


I saw that in other versions (I am finally using OF 9 now in Ubunti 22.04 lts under wsl win 11) there are several tricks like "stealing" the problematic cells from one zone to another -so that boundary files are consistent with the supposed geometry the physical problem but I would be very happy to avoid it and have a better cell treatment.


My questions are summarized below:


1) How stiff should be a mesh produced by salome in order to avoid "bad or scratched" cells at the interface? Is it adequate that nodes "communicate" or the mesh just behind the interface play a role also?


2) How exactly the combination of the settings work in snappy?
(I have gone through Tobi's excellent video series with smoking pipe but I am still confused; perhaps this is my problem, but still some simple rules and guidelines would be very helpful


3) Does this problem has a solution or I am hitting my head to the wall?



Case files can be downloaded from here:

https://drive.google.com/file/d/1-DA...usp=share_link



I think the next step is the edge refinement example (available in Holzmann CFD page). But is there an accompanying pdf for this one? I still cannot undestand how that line was constructed (it does not appear but only in paraview in my case) and also, what is the logic behind this moderate number of steps before exporting the stl files. Finally, does someone needs the blender file as well in order to check how the refinement edge is produced?)





Thank you for your time and your awesome work!


Alex

AlexandrosVouros May 18, 2023 08:53

Before any response, I would like to post a link to another excellent video for mesh refinement.


https://holzmann-cfd.com/community/t...haust-manifold



Maybe I should look better before bothering you...


All the best !

H_SheikhShoaie July 12, 2023 04:39

Adding layers to interior stls of multiregion meshes in snappyHexMesh
 
1 Attachment(s)
Dear Foamers,

I'm currently struggling with snappyHexMesh and creating layers on the interior boundary layers of a multiregion mesh, I need to set 30 < y+ < 300. I've tried adjusting various parameters, but so far, I haven't been successful. I was wondering if you could offer any suggestions.

The snappyHexMeshDict is observable below:

Quote:

FoamFile
{
version 2;
format ascii;
class dictionary;
object snappyHexMeshDict;
}

castellatedMesh on;

snap on;

addLayers on;

geometry
{
"burnerinlet.stl"
{
type triSurfaceMesh;
name burnerinlet;
}
"burneroutlet.stl"
{
type triSurfaceMesh;
name burneroutlet;
}
"surfaceburner.stl"
{
type triSurfaceMesh;
name surfaceburner;
}
"surfacegas.stl"
{
type triSurfaceMesh;
name surfacegas;
}
"gasinlet.stl"
{
type triSurfaceMesh;
name gasinlet;
}
"gasoutlet.stl"
{
type triSurfaceMesh;
name gasoutlet;
}
}

castellatedMeshControls
{
maxLocalCells 100000;
maxGlobalCells 100000000;
minRefinementCells 10;
maxLoadUnbalance 0.1;
nCellsBetweenLevels 2;
resolveFeatureAngle 15;
allowFreeStandingZoneFaces true;
features ( );
refinementSurfaces
{
surfaceburner
{
level ( 1 1 );
faceZone faceZone1;
cellZone cellZone1;
cellZoneInside inside;
boundary internal;
}
surfacegas
{
level ( 1 1 );
faceZone faceZone2;
cellZone cellZone2;
cellZoneInside inside;
boundary internal;
}
burnerinlet
{
level ( 1 1 );
patchInfo
{
type patch;
}
}
burneroutlet
{
level ( 1 1 );
patchInfo
{
type patch;
}
}
gasinlet
{
level ( 1 1 );
patchInfo
{
type patch;
}
}
gasoutlet
{
level ( 1 1 );
patchInfo
{
type patch;
}
}
}
refinementRegions
{
}
locationInMesh ( 1 0.008 0.015 );
}

snapControls
{
nSmoothPatch 3;
tolerance 2;
nSolveIter 100;
nRelaxIter 5;
nFeatureSnapIter 10;
explicitFeatureSnap false;
multiRegionFeatureSnap false;
implicitFeatureSnap true;
}

addLayersControls
{
featureAngle 100;
slipFeatureAngle 30;
nLayerIter 50;
nRelaxedIter 20;
nRelaxIter 5;
nGrow 0;
nSmoothSurfaceNormals 1;
nSmoothNormals 3;
nSmoothThickness 10;
maxFaceThicknessRatio 0.5;
maxThicknessToMedialRatio 0.3;
minMedialAxisAngle 90;
nMedialAxisIter 10;
nBufferCellsNoExtrude 0;
additionalReporting false;
layers
{
gasinlet
{
nSurfaceLayers 3;
mergeFaces true;
}
gasoutlet
{
nSurfaceLayers 3;
mergeFaces true;
}
surfaceburner
{
nSurfaceLayers 3;
mergeFaces true;
}
surfacegas
{
nSurfaceLayers 3;
mergeFaces true;
}
burnerinlet
{
nSurfaceLayers 3;
mergeFaces true;
}
burneroutlet
{
nSurfaceLayers 3;
mergeFaces true;
}
}
relativeSizes true;
expansionRatio 1.2;
finalLayerThickness 0.5;
minThickness 0.001;
}

meshQualityControls
{
maxNonOrtho 65;
maxBoundarySkewness 20;
maxInternalSkewness 4;
maxConcave 80;
minVol 1e-13;
minTetQuality -1;
minArea -1;
minTwist 0.02;
minDeterminant 0.001;
minFaceWeight 0.05;
minVolRatio 0.01;
minTriangleTwist -1;
nSmoothScale 4;
errorReduction 0.75;
relaxed
{
}
}

debug 0;

mergeTolerance 1e-06;


Also, I have attached a screenshot from Paraview.

Thank you in advance, and please let me know if you need any additional information.

AlexandrosVouros July 14, 2023 04:45

I think that there is an openfoam tutorial withinh the folder tutorials snappy for meshing a pipe. You could start with that.

In addition, there is a (more complicated) pipe meshing tutorial in Tobias Holzmann page.

H_SheikhShoaie July 15, 2023 05:05

2 Attachment(s)
Thank you dear Alexander;

I've already checked samples. In my opinion this case is different because I can add layers to shell's wall. However, It's impossible to add layer to the interior walls of inner regions.
I think the picture was not as clear as enough. So I would like to explain the case further. It involves a shell that surrounds two pipe lines, one in a serpentine shape and the other in a U shape. The mesh used for the simulation is three-dimensional and consists of at least one million cells.

I have attached a picture of enclosed regions.

I would be grateful for any guidance you can provide.

H_SheikhShoaie July 22, 2023 19:04

Dear Formers,

Finding a way to add a boundary layer mesh to the interior STLs mentioned above is crucial to me. Please let me know if it is impossible to create such parts with snappyHexMesh. I would appreciate it if someone could introduce a better solution, even if it involves using other meshing tools.

Thank you in advance.

Yann July 23, 2023 05:24

Hello,

The answer depends on the OpenFOAM version you are using.
(if you are not sure, you can type the foamVersion command in a terminal)

Regards,
Yann

H_SheikhShoaie July 23, 2023 17:33

Hi,

Dear Yann, I'm grateful for your prompt response. The mesh has been generated through OpenFOAM 7.

I appreciate your help. Thank you again.


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