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] SnappyHexMesh and 2 Phase Modelling (https://www.cfd-online.com/Forums/openfoam-meshing/61488-snappyhexmesh-2-phase-modelling.html)

alexm September 21, 2008 06:13

SnappyHexMesh and 2 Phase Modelling
 
Hello All,

I would like to use OpenFOAM for shiptank-modeling, now after using icoFoam and turbFoam, with rasInterFoam. Now my actual problem, where I stuck, is to create a sharp interface in the model-mesh, which should act as boundary-surface of the two phases in the rasInterFoam case.

First with blockMesh I created a hexahedronal quadratic mesh with the dimensions of the tank. The ship-hull is available as a geometry in iges or step format. Gmesh (http://www.geuz.org/gmsh/) creates a triangular surface mesh out of this, which is saved as STL-File.

These parts are needed by snappyHexMesh to build the desired mesh of the model area. So far, this works fine (nevertheless until now not all arguments are perfectly understood by me) but the resulting mesh is satisfactory - for single phase modeling the top patch is set to the water-level, the part of the hull that lies over the surface will be truncated.

But for 2 phase modeling I think an internal face or patch is needed, which marks the water-level and separates these phases in the resulting mesh.

So far I've tried a lot of things. The last had been using snappyHexMesh first with the water-phase, then the same with the air-phase, then merging these resulting meshes with 'mergeMeshes' - but at last stitchMesh failed.

Now I hope, that someone here has an idea, suggestion or a solution for my problem.
Something like a "How-To" for creating an boundary layer between two phases for usage in snappyHexMesh would be great.
(what about the layer sub-dict in the snappyHexMeshDict? but here an internal face is needed?)

Maybe there is a simple apparently solution, but I can't see it ...

Thanks in advance for your help!

bye and greetings, Axel

alexm September 23, 2008 17:49

Hello All, now I've learned
 
Hello All,

now I've learned, how to create internal face. Even though it does not solve my problem, I would like to give a short description:

1. creating a hexahedronal mesh with blockMesh, not to forget to ensure, that there will be faces at the desired position

2. using faceSet with a faceSetDict, including:
name f0;
action new;
boxToFace // or another ...
{
box (x1, y1, z1) (x2, y2, z2);
}

3. adding the new face to "boundary":
n+1
{
.
.
.
{ intern-A
type patch;
nFaces 0;
startFace ;
}

4. createBaffles f0 intern-A

Don't forget -case <path> at each utility.

A more detailed description of this is here:
http://www.cfd-online.com/OpenFOAM_D...es/1/5108.html

But, unfortunately the result is not that what I wanted. snappyHexMesh realize these internal face as external boundary, not just as a flat plane in the interior of the new mesh --- as I hoped.

Any other idea?

greeting, Axel


... nevertheless, snappyHesMesh is a great tool.

erik023 September 25, 2008 10:45

oh, i think we have the same p
 
oh, i think we have the same problem, i did just post something above!
are you getting anywhere?

Erik Ekedahl

alexm September 25, 2008 15:24

the last thing I've tried had
 
the last thing I've tried had been partitioning the problem in two cases, one for the water-phase and one for the air-phase and applying snappyHexMesh on both cases. But so far, after merging both meshes, unfortunately stitchMesh failed.

=> http://www.cfd-online.com/OpenFOAM_D.../126/8450.html

nicoparo October 2, 2008 08:32

I'd also like to test snappyHe
 
I'd also like to test snappyHexMesh in the context of free-surface flows.

I'm encountering problems to understand how the tool works. Running the tutorial iglooWithFridges I'd like to see wath happen increasing the number of layers on the fridges from 1 to 5. The code runs through the different steps including the layers generation, and from the log it seems that a layer mesh is generated

Writing 8540 added cells to cellSet addedCells
Writing 6720 faces inside added layer to faceSet layerFaces
Layer mesh : cells:18953 faces:61079 points:23729

However, as far as I can see in paraFoam, no boundary layer mesh is showing up around the fridges.

Am I missing something ?

Thanks a lot.

nico

mattijs October 2, 2008 14:43

Try displaying the cellSet onl
 
Try displaying the cellSet only (convert with "foamToVTK -cellSet addedCells"). Use the clip filter in Paraview to e.g. cut through the fridge.

aunola October 3, 2008 00:35

Also, make sure you load the r
 
Also, make sure you load the right time directory; snappyHexMesh writes outputs from different stages to different time directories (probably unless you have purgeWrite in controlDict). The final mesh is in the last one.

bobatpurdue October 16, 2008 22:40

I want to use interFoam to mod
 
I want to use interFoam to model air/water transport. I have a STL file which contains the initial liquid region. I can use snappyHexMesh to create a mesh of the liquid. What do people recommend to add the mesh of the air? I've used mapFields to a new grid. However when viewed in paraview, it seems to not properly copy the wall patches from one grid to the target mesh.

mattijs October 17, 2008 04:18

Since you're doing interFoam y
 
Since you're doing interFoam you should generate both regions as one mesh and then set the fluid part using e.g. setFields or funkySetFields (see Wiki).

setFields can use any cell source that the cellSet application can so have a look at the sample cellSetDict in the application directory (mesh/manipulation/cellSet/cellSetDict). There is a surfaceToCell option there which might be useful.

bobatpurdue October 22, 2008 09:28

Thanks Mattijs for the suggest
 
Thanks Mattijs for the suggestion to use surfaceToCell. It works well but only sets gamma to 0 or 1. I've tried refineHexMesh to refine the mesh but to get a smooth interface requires a large number of cells. Essentially I want the gamma to vary as the fraction of the cell volume that is cut by the STL file. Is there anything out there? If not, where should I begin to write a code that performs this?

nicoparo November 10, 2008 07:09

Thanks Mattijs, and sorry for
 
Thanks Mattijs, and sorry for the late reply. I've been far from OF for a few weeks. I've actually understood the problem which is related to parafoam. When I load the case, it first shows the level 1 grid (before snapping), if I increase the mesh level to 2 it shows the snapped grid, but when I further increase to 3 nothing changes. To visualize the boundary layer grid, I have to go back to 2 and then again to 3 and magically my layer grid is there. Don't know why it behaves like this, but it works.

Now I have another question related to feature edges. Reading other posts, it seems that feature edges are not supported at the moment. On the other hand, it exists (and it is described in the user guide) a featureEdgeMesh option in the snappy dictionary which should allow refinement based on edge definition. Is this option inactive in the current release ?

If it is already active, is there any example showing how the file someLine.eMesh should be define ?

Thanks a lot.

nicola

mattijs November 10, 2008 13:18

There is only refinement based
 
There is only refinement based on feature edges. No snapping to feature edges.

Have a look at the source code for featureEdgeMesh so see how to read/write them or there is the surface/surfaceFeatureConvert utility. This is all still in state of flux though.

nicoparo November 11, 2008 04:18

Thanks Mattijs. If anyone as a
 
Thanks Mattijs. If anyone as already tried to use the featureEdgeMesh tool, I would be glad to see the format needed for the file someLine.eMesh to work.

thanks a lot.

nicola

markc December 9, 2008 02:45

Hello All, A problem simila
 
Hello All,

A problem similar to what is described here:
SHM works fine but know I want to add some cell layers which are aligned with the local surfaces, as described in the User Manual (hood of the car). It should be doable with the fields under "layer" in the SHMdict.
I tried it in the iglo tutorial. After some playing around I found that when adding 4 or more layers, the alyers are actually created. Probably with less than 4 some constraints are not met (?).
However, the added layers are not added in the actual mesh but stored separately in a layerFaces set.
The layers are visualised below:
http://www.cfd-online.com/OpenFOAM_D...es/1/10255.jpg
And the bottom of the iglo (in the final timestep):
http://www.cfd-online.com/OpenFOAM_D...es/1/10256.jpg

Question: how shall these layers be incorporated in the actual mesh?
For reference here the SHM dict:
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif snappyHexMeshDict

Thanks for any advice,

Mark

mattijs December 9, 2008 04:30

Short answer: since you can se
 
Short answer: since you can see the added faces in your faceSet they are also in the mesh. A faceSet/cellSet/pointSet is just a subset of mesh items.

You might look at where they are collapsed. Slice through your mesh and you'll see them.

wolle1982 February 18, 2009 05:05

here are some hints how to add
 
here are some hints how to add the layers.

the
finalLayerRatio 0.1;
is in my opinion is the thickness of the complete boundarlayer in ratio to the blockMesh-created cell thickness. don't make the value too big or small. otherwise the added layer do not have enough space to fit in. just play around with it a little bit.

according to the original size of the backgroundmesh, your
minThickness 0.000001;
should not bee the big. otherwise the added layers are too small and will not be created.

wolle1982 February 18, 2009 05:07

here are some hints how to add
 
here are some hints how to add the layers.

the
finalLayerRatio 0.1;
is in my opinion is the thickness of the complete boundarlayer in ratio to the blockMesh-created cell thickness. don't make the value too big or small. otherwise the added layer do not have enough space to fit in. just play around with it a little bit.

according to the original size of the backgroundmesh, your
minThickness 0.000001;
should not bee the big. otherwise the added layers are too small and will not be created.

wolle1982 February 18, 2009 05:14

Here I try to add image of the
 
Here I try to add image of the Igloo Tutorial with its snappyHexMeshDict.

As you can see, several boundary layers are being added.

http://www.cfd-online.com/OpenFOAM_D...es/1/11245.jpg

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif snappyHexMeshDict

wolle1982 February 18, 2009 05:26

some more information: it i
 
some more information:

it is a very unsure thing with the boun darylayer addition of snappyHexMesh, but furthermore I think, that the expansionRation mustn't be too small. if it is e.g. 1.0, meaning the layers won't grow at all, sHM has no chance to add those layers while the over all thickness (finalLayerRatio) is too small (e.g. also 1.0). in this case sHM doesn't add the layers.

So always pay attention, that the expansion factor as well as the overallthickness, as well as the minimumthickness is in a healthy balance with the thickness of the cells which are created with blockMesh. here I'm not sure which cells are meant, the original blockMesh cells or the already refined cells by sHM.

louisgag June 18, 2009 18:07

1 Attachment(s)
Hi Wolfgang,

First, thanks for posting all this information.

Second, are these prisms I see in the boundary layer? Or are they hexahedrons rendered as prisms by paraview? I am trying to mesh my boundary layer with mostly hexahedrons using snappyHexMesh but it seems all the boundary layer cells are 5-face prisms.

Any thoughts on this? Am I wasting my time trying to get hexahedrons because prisms are better? My colleagues here are all using hexahedrons in their boundary layers, not prisms...

thanks and have a good day!

-Louis


EDIT:

for clarification, here is the output of my checkMesh:

Number of cells of each type:
hexahedra: 143741
prisms: 1454
wedges: 0
pyramids: 0
tet wedges: 92
tetrahedra: 0
polyhedra: 43413


and I attach a screenshot of a slice through my vehicle.. Seems like paraview is only showing me prisms but there are only 1454 according to checkMesh... so I am confused! Thanks again.

-Louis


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