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)

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 08:14.