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

[snappyHexMesh] About snappyHexMesh

Register Blogs Community New Posts Updated Threads Search

Like Tree21Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 28, 2022, 08:23
Default
  #21
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,206
Rep Power: 28
Yann will become famous soon enough
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
Yann is offline   Reply With Quote

Old   November 28, 2022, 10:46
Default
  #22
New Member
 
Rohit
Join Date: Mar 2020
Location: IIT, Delhi, India
Posts: 9
Rep Power: 6
Rohitsingh is on a distinguished road
Send a message via Skype™ to Rohitsingh
Quote:
Originally Posted by Yann View Post
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

Last edited by Rohitsingh; November 28, 2022 at 10:53. Reason: File attachment
Rohitsingh is offline   Reply With Quote

Old   November 28, 2022, 11:39
Default
  #23
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,206
Rep Power: 28
Yann will become famous soon enough
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.
AtoHM and 865618910 like this.
Yann is offline   Reply With Quote

Old   January 16, 2023, 06:42
Exclamation Problem with extrudeMesh
  #24
New Member
 
Giuseppe Dalla Vecchia
Join Date: Jan 2023
Posts: 6
Rep Power: 3
giuseppedalla is on a distinguished road
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
giuseppedalla is offline   Reply With Quote

Old   January 16, 2023, 07:12
Default
  #25
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,206
Rep Power: 28
Yann will become famous soon enough
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 likes this.
Yann is offline   Reply With Quote

Old   January 16, 2023, 07:18
Default
  #26
New Member
 
Giuseppe Dalla Vecchia
Join Date: Jan 2023
Posts: 6
Rep Power: 3
giuseppedalla is on a distinguished road
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:rimitiveEntry &, 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
giuseppedalla is offline   Reply With Quote

Old   January 16, 2023, 07:44
Default
  #27
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,206
Rep Power: 28
Yann will become famous soon enough
This line seems to be wrong:

Code:
#includeFunc residuals(p, U, k, omega)
Which OpenFOAM version are you using?
Yann is offline   Reply With Quote

Old   January 16, 2023, 07:45
Default
  #28
New Member
 
Giuseppe Dalla Vecchia
Join Date: Jan 2023
Posts: 6
Rep Power: 3
giuseppedalla is on a distinguished road
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 is offline   Reply With Quote

Old   January 16, 2023, 07:48
Default
  #29
New Member
 
Giuseppe Dalla Vecchia
Join Date: Jan 2023
Posts: 6
Rep Power: 3
giuseppedalla is on a distinguished road
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 is offline   Reply With Quote

Old   January 16, 2023, 07:50
Default
  #30
New Member
 
Giuseppe Dalla Vecchia
Join Date: Jan 2023
Posts: 6
Rep Power: 3
giuseppedalla is on a distinguished road
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?
giuseppedalla is offline   Reply With Quote

Old   January 16, 2023, 09:19
Default
  #31
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,206
Rep Power: 28
Yann will become famous soon enough
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 likes this.
Yann is offline   Reply With Quote

Old   January 16, 2023, 10:03
Default
  #32
New Member
 
Giuseppe Dalla Vecchia
Join Date: Jan 2023
Posts: 6
Rep Power: 3
giuseppedalla is on a distinguished road
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
Yann likes this.
giuseppedalla is offline   Reply With Quote

Old   May 18, 2023, 04:23
Default
  #33
New Member
 
Alexandros
Join Date: Oct 2016
Posts: 21
Rep Power: 10
AlexandrosVouros is on a distinguished road
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
Attached Images
File Type: jpg interface.jpg (158.1 KB, 20 views)
AlexandrosVouros is offline   Reply With Quote

Old   May 18, 2023, 09:53
Default
  #34
New Member
 
Alexandros
Join Date: Oct 2016
Posts: 21
Rep Power: 10
AlexandrosVouros is on a distinguished road
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 !
AlexandrosVouros is offline   Reply With Quote

Old   July 12, 2023, 05:39
Default Adding layers to interior stls of multiregion meshes in snappyHexMesh
  #35
New Member
 
Hossein Sheikhshoaie
Join Date: Sep 2022
Posts: 6
Rep Power: 4
H_SheikhShoaie is on a distinguished road
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.
Attached Images
File Type: jpg Screenshot from 2023-07-12 11-56-58.jpg (120.9 KB, 18 views)
H_SheikhShoaie is offline   Reply With Quote

Old   July 14, 2023, 05:45
Default
  #36
New Member
 
Alexandros
Join Date: Oct 2016
Posts: 21
Rep Power: 10
AlexandrosVouros is on a distinguished road
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.
AlexandrosVouros is offline   Reply With Quote

Old   July 15, 2023, 06:05
Default
  #37
New Member
 
Hossein Sheikhshoaie
Join Date: Sep 2022
Posts: 6
Rep Power: 4
H_SheikhShoaie is on a distinguished road
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.
Attached Images
File Type: jpg Screenshot from 2023-07-15 12-33-41.jpg (100.1 KB, 19 views)
File Type: jpg Screenshot from 2023-07-15 12-33-33.jpg (101.4 KB, 14 views)
H_SheikhShoaie is offline   Reply With Quote

Old   July 22, 2023, 20:04
Default
  #38
New Member
 
Hossein Sheikhshoaie
Join Date: Sep 2022
Posts: 6
Rep Power: 4
H_SheikhShoaie is on a distinguished road
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.
H_SheikhShoaie is offline   Reply With Quote

Old   July 23, 2023, 06:24
Default
  #39
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,206
Rep Power: 28
Yann will become famous soon enough
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
Yann is offline   Reply With Quote

Old   July 23, 2023, 18:33
Default
  #40
New Member
 
Hossein Sheikhshoaie
Join Date: Sep 2022
Posts: 6
Rep Power: 4
H_SheikhShoaie is on a distinguished road
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.
H_SheikhShoaie 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
[CAD formats] Creating waterproof STL using snappyHexMesh or salome Tobi OpenFOAM Meshing & Mesh Conversion 58 May 13, 2020 07:01
[snappyHexMesh] Running snappyHexMesh in parallel - optimizing peterhess OpenFOAM Meshing & Mesh Conversion 2 January 3, 2018 03:54
[snappyHexMesh] Tutorial crashes: snappyHexMesh floating point exception. jasv OpenFOAM Meshing & Mesh Conversion 4 May 10, 2016 03:55
[snappyHexMesh] snappyhexmesh doesn't creat mesh in parallel issue? klausb OpenFOAM Meshing & Mesh Conversion 1 March 7, 2015 12:55
[snappyHexMesh] stitchMesh and snappyHexMesh gdbaldw OpenFOAM Meshing & Mesh Conversion 0 December 23, 2009 03:09


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