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/)
-   -   [mesh manipulation] Hex mesh (https://www.cfd-online.com/Forums/openfoam-meshing/104547-hex-mesh.html)

linnemann July 17, 2012 06:51

2 Attachment(s)
Hi

Your setup is really not good. Looking at the boundaries in paraview from the file you have provided give me the following view.


If I use autoPatch 5 on the other hand I get the last picture.
Then you can always rename the patch names in the boundary file in the new time folder.

So its no wonder why checkMesh and setFields complains.

To avoid autoPatch you need to export the BC names from Salome using "create groups from geometry" option in the mesh module.

You need to define your groups in the GEO module. Right click the geo and select "Create group" use faces, select each face for the individual BC's and then in Mesh module use create groups from geometry and use the groups in the geo module in the tree structure.

matt.mech.eng July 17, 2012 23:47

2 Attachment(s)
Hello,

Given your last post, I must divide the parabolic curve into 2 parts (2 half parabolas) with a box in the middle to allow me to create a group on the geometry for the inlet see images for clarification (underside shows the inlet and middle box more clearly)..

This makes meshing the entire domain more difficult as I need to create many submeshes to ensure relatively uniform cell sizes when using the nb segments 1d hypothesis for wire dicretisation algorithm.

As you can understand this is very tedious.. so what I would like to know is can I mesh the 2 volumes either side of the box in the middle with salome and use blockmesh to generate the middle box and then use mergeMesh to create the overall mesh?

OR is there a more efficient way of doing this problem in Salome?

Also a question regarding export of salome mesh to unv.. there are certain cell type the export utility in salome does not handle, is this correct? If so what are they?- Mainly concerned with triangular prisms, since quadrangle mapping the geometry shown creates some triangles

I am struggling!! I have been working on this for weeks now and have been unable to find a good solution.. There must be an easier way to do this in salome!!!

Kind Regards

Matt

linnemann July 18, 2012 01:45

Hi

You can also use the mesh as is and use surfaceToPatch command.

This takes an stl/obj as input and will convert the faces that matches the surface file into a patch.

You might have to play with the -tol option so that it doesnt pick faces that are part of the cyclic patches.

matt.mech.eng July 18, 2012 02:19

Quote:

Originally Posted by linnemann (Post 372034)
Hi

You can also use the mesh as is and use surfaceToPatch command.

This takes an stl/obj as input and will convert the faces that matches the surface file into a patch.

You might have to play with the -tol option so that it doesnt pick faces that are part of the cyclic patches.


By use the mesh "as is" do you mean the mesh I sent you (.py dump) or my new mesh without any groups of faces added to the mesh?

I have tried surfaceToPatch with no success im not sure if I am using it correctly?- I just exported my mesh to both unv and stl then converted the unv mesh and ran surfaceToPatch with the stl file I created.

I also tried creating groups from geometry in the mesh module- this does not work either I still have issues with face match tolerance for front and back faces!!

linnemann July 18, 2012 02:25

Yes to the first.

You need to make stl files that only cover the BC's, so for the inlet you would export only the face to an stl that has the inlet faces.

You can export directly to stl from the geo module. So just explode the geometry in your previous post into faces and export the small strip which I assume is the inlet to an stl.

If you just export one stl for the whole geometry it will create a patch with all the boundary faces.

matt.mech.eng July 18, 2012 02:53

So just to clarify..

I should use the geometry with no groups of faces and then create stl files for each boundary and then use surfaceToPatch to name the boundaries?
I have tried this but every time I run surfaceToPatch i get a new time directory with a new polyMesh dir, can I merge them all into 1?

Or do use the original geometry (ie the a single parabolic curve for the curved profile) i sent you with named groups for all boundaries except for inlet (which does not yet exist) and then use surfaceToPatch for the inlet only?

linnemann July 18, 2012 03:04

I would go for the last method.

And you just move the new polyMesh from the new time directory back into constant. Just remember to rename constant/polyMesh to constant/polyMesh.bak that way you have a backup if something gets screwed up.

You can also use paraview to select the faces you want to be in the inlet bc and then triangulate those cells using a filter then go to files save data and you can save to stl.

This way you wont have to use Salome to create the stl and you are sure that the stl lies exactly on the faces you want.

http://www.vgtc.org/PDF/slides/2008/..._selection.pdf

matt.mech.eng July 18, 2012 03:15

So I have used Paraview to generate the stl file for the inlet and everything works well except for one problem I use setFields to initialize alpha I get the following error:

--> FOAM FATAL ERROR:
More than six unsigned transforms detected:
6(((2.18444 0 -0.15) (1 0 0 0 1 0 0 0 1) 0) ((2.18702 0 -0.15) (1 0 0 0 1 0 0 0 1) 0) ((2.18952 0 -0.15) (1 0 0 0 1 0 0 0 1) 0) ((2.19195 0 -0.15) (1 0 0 0 1 0 0 0 1) 0) ((2.19431 0 -0.15) (1 0 0 0 1 0 0 0 1) 0) ((2.1966 0 -0.15) (1 0 0 0 1 0 0 0 1) 0))

From function void Foam::globalIndexAndTransform::determineTransforms ()
in file primitives/globalIndexAndTransform/globalIndexAndTransform.C at line 185.

FOAM exiting

linnemann July 18, 2012 03:55

I just set up the case using the autoPatch approach and renamed the BC's and ran bubbleFoam on it without an inlet and it runs fine for a couple of iterations without any cyclic errors.

I think your patches have just been defined wrong so that front patch does not match back patch because faces from the wall/outlet etc is also in the cyclic patches.

matt.mech.eng July 18, 2012 04:00

sorry.. I edited the post above. It now works only problem is with paraview as mentioned above after running setFields

linnemann July 18, 2012 04:42

2 Attachment(s)
I dont get any errors after running setFields.

Here is the final case. I've disabled turbulence as it make it run very unstable.

https://dl.dropbox.com/u/15968063/case.tar.gz

I think something is wrong with your specification of the densities as is seems alpha1 mixes in a strange way, see the pics.

EDIT: Its not the densities its the BC specification in the 0 folder, look to the bubbleColumn tutorial case for the right setup.

EDIT2: I would also consider making the mesh more "straight" and refine around the interface. Having these coarse cells which are angled to the alpha interface is bound to give you stability issues.
Also is the mesh in m or mm, because checkMesh says it has the extend of roughly 2.24m wide and 1.5m high, and the mesh seems quite coarse for such large dimensions.

matt.mech.eng July 18, 2012 23:32

Hello,

Thank you for supplying the mesh,

I have a customized version of bubbleFoam to account for turbulence when the phases are separated ie where the phase fraction approaches 1. I have run this solver on a column geometry meshed with blockMesh and it is quite stable with turbulence ON. When I come to running on this parabolic geometry it is not so stable and I have tried on tet meshes and the hex mesh you have posted.

In regards to EDIT 2, yes I agree, I have been having trouble with this for the last few weeks and the mesh you got working for me was only an initial first run... However it proved unstable also. Yes the mesh is very coarse- the domain is in m.

Can you suggest a more appropriate solution for meshing this domain?
It apparently more difficult than it seems!

Ps I can send you the modified bubbleFoam solver if you would like to have a look


Kind Regards,

Matt

linnemann July 19, 2012 01:40

Hi

After using a laminar approach for the case with modified BC's and ran it for about 40s I can see that the domain is filling with alpha0. Since you have alpha0 set as 0.6 at the inlet you will start filling the domain.

Don't know if this is what you intended?

To get this case being more stable you can try the following things.
  • Refine mesh at interface
  • Make the mesh to be more parallel to the interface, at the interface
  • Change the fvSchemes to upwind for k/epsilon and maybe even for Ua and Ub
  • Change the cyclics to symmetryPlanes, just to see if it influences stability.
  • Make the height of the alpha1 portion bigger to help numerics at the outlet

linnemann July 19, 2012 07:58

3 Attachment(s)
Hi, tried changing all but the cyclic option in my list and no change in convergence (maybe a little but still crashes).

After changing the cyclics to symmetryPlanes there is absolutely no issues.
So somehow the cyclics are screwing with the convergence.

We have discussed a similar behaviour here.

http://www.cfd-online.com/Forums/ope...lgorithms.html

matt.mech.eng July 19, 2012 21:30

Quote:

Originally Posted by linnemann (Post 372273)
Hi

After using a laminar approach for the case with modified BC's and ran it for about 40s I can see that the domain is filling with alpha0. Since you have alpha0 set as 0.6 at the inlet you will start filling the domain.

Don't know if this is what you intended?

To get this case being more stable you can try the following things.
  • Refine mesh at interface
  • Make the mesh to be more parallel to the interface, at the interface

By alpha0 I assume you mean the phase fraction alpha (dispersed/gas phase) to be 0?

The reason for setting to 0.6 at the inlet was to increase the flow rate of air into the domain without having to increase the velocity.. Should I leave this as 0.5 and then alter velocity only to achieve the desire inlet flow rate?

REgarding refinement at the interface would you suggest having "straight/parallel" cells below and above the interface or will it suffice to have this refinement only above the interface?

Quote:

Originally Posted by linnemann (Post 372359)
Hi, tried changing all but the cyclic option in my list and no change in convergence (maybe a little but still crashes).

After changing the cyclics to symmetryPlanes there is absolutely no issues.
So somehow the cyclics are screwing with the convergence.

We have discussed a similar behaviour here.

http://www.cfd-online.com/Forums/ope...lgorithms.html


So it appears that the cyclic boundaries were causing the issues..

I looked at your mesh and would like to reproduce it using the autoPatch method. Every time I run autoPatch I am unable to determine which patch has been allocated to which face since paraview crashes every time I run paraFoam..
Could you outline the way you do it?

Just an aside, I also tried running with symmetryPlane patches on a relatively coarse tet mesh without any improvements in stability, (note I had also changed gradschemes to cellLimited leastSquares in fvSchemes- to improve stability on the unstructured grid)

Thanks for your help with everything I very much appreciate it!

Kind Regards

Matt

linnemann July 20, 2012 02:15

2 Attachment(s)
Hi

Well I do it the way you were trying to do it with paraview, if that don't work your back at guessing or you need to make a stl for every surface and run surfaceToPatch on all of them.

I would highly recommend getting paraview to work though.
just Install paraview manually and skip the whole paraFoam stuff.

Just open paraview and open system/controlDict and if it asks about file type just choose openfoam, as paraview > 3.12 has native support for OF.

Setting alpha to 0.6 is fine, after thinking a little about the physics its clear that the domain has to start filling since alpha0 has no where to go until it hits the outlet so probably adding outlets as shown in the pics (black bars) will be a good idea.

I've also made the case available to you and the study dump for Salome.
I had to create a 2D mesh and extrude it. If I didn't I got the OF errors about the cyclics not matching, but if you are to use symmetryPlanes it does not matter.

https://dl.dropbox.com/u/15968063/Case2.tar.gz

matt.mech.eng July 20, 2012 03:57

Quote:

Originally Posted by linnemann (Post 372525)
Hi


I've also made the case available to you and the study dump for Salome.
I had to create a 2D mesh and extrude it. If I didn't I got the OF errors about the cyclics not matching, but if you are to use symmetryPlanes it does not matter.


How do you create a 2d mesh and then extrude? I have been trying to do this for a while but the method I have used instead (due to lack of knowledge on extruding a mesh) is to use quadrangle mapping and then Hexahedron(i,j,k) algorithm.

Thanks for helping me out with this! It look like I'm going to have to play around with salome and ill most likely use autoPatch to name the boundaries.

One other point; I downloaded the latest Paraview (3.14.1) and tried to open the first case you sent me.. it seemed to have trouble with the fact that there were multiple entries for walls in the boundary file, however using paraFoam to open the case from the case directory had no issues. This wont really matter because after running autoPatch there wont be any duplicated entries in the boundary file, and after I name them I will be able to view them using paraFoam.


Kind Regards,

Matt

linnemann July 20, 2012 06:04

Go to the mesh module.

Mesh -> create mesh -> assign a set of hypotheses -> 2d: Automatic quadrangulation -> specify number of segments -> apply and close

Mesh -> Compute

Modification -> extrusion -> select triangle at top -> tick select whole mesh, submesh or group (select mesh if not already selected in the tree) -> Extrusion to distance -> Z = 0.01 -> Number of steps = 15 -> Apply and close

matt.mech.eng July 21, 2012 00:00

Thank you!

That makes meshing so much easier!!

I have a question regarding naming patches- Using paraFoam to view the mesh allows the mesh to be read even though there are multiple patches with the same name however it only displays the first one in the list in the boundary file. Using the latest version of paraview and opening the controlDict will not display the mesh since there are multiple patches with the same name.

My question is when solving does OpenFOAM recognise multiple wall patches with the same name?

Kind Regards

Matt

linnemann July 21, 2012 03:12

It can for serial run.

For parallel runs you need to use wildcards and name each wall patch by itself.

You can see how I have used wildcards in the Case2.tar.gz case.

So look in the boundary file and f.ex the 0/U file you will see how wildcards work.

If you want them all in one singular partch you can use the createPatch utility.

There is a sample dict for that in the OF install folder just do this under the OF install folder

Code:

cd OFinstallFolder
find ./ -name createPatchDict

Should get you the location of it


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