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)

matt.mech.eng July 12, 2012 02:10

Hex mesh
 
I want to create a hexahedral mesh of a channel with a parabolic profile..

Any suggestions on how to do this?

Salome geometry of this profile and extrusion is generated in two ways, spline for parabolic profile and also a number of vertices lying on the parabola joined by straight lines to approximate the profile.

I have been working on this for the last 2 weeks and have not figured out how to do it yet!!!!!

linnemann July 12, 2012 02:38

Please make a sketch of what you are trying to do, it will help us to help you.

matt.mech.eng July 12, 2012 20:27

2 Attachment(s)
Hi Niels, thank you very much for your reply!

I have attached 2 screenshots of the geometry basically im trying to mesh a 3D extrusion of this profile..

I have tried different ways of generating the profile; using a series of points connected by straight lines, or using a spline through all of those points to create the parabolic shape.

linnemann July 13, 2012 01:31

If you upload the hdf I can do that for you and give you the hdf back, so you can see what have been done.

matt.mech.eng July 13, 2012 02:16

I will post the hdf as soon as I can.

I have meshed this geometry in hexahedral cells using the body fitting algorithm + create boundary faces, hex (i,j,k) + quadrangle mapping, also automatic hexahedralisation methods of meshing. The problem I have is that I need to export to unv and then convert using unvToFoam.. The problem is that the export to export from Salome to unv doesn't handle certain type of cells; or the conversion from unv to openfoam does not work it give an error message as follows:

ideasUnvToFoam:*ideasUnvToFoam.C:881: int main(int, char**): Assertion `nrFaceCells[faceI] == 1 || nrFaceCells[faceI] == 2' failed.
Aborted

matt.mech.eng July 13, 2012 12:50

1 Attachment(s)
Hi Niels,

I have attached a dump of the hdf file. Kind Regards,
Matthew Skaras

linnemann July 15, 2012 05:46

2 Attachment(s)
Hello

It was not that difficult, see the attached dump and a little teaser screen.

The only thing missing was to split every face into something that has only 4 edges.

I can then create a 2D sketch and make segments of blocks that has 6 faces like a cube.

Then in the mesh you can use hypothesis automatic hex mesh.

Best

matt.mech.eng July 15, 2012 06:31

Hello Niels,

Thank you for your help, I have tried this method also, the problem is I need further refinement in some areas in order to control the aspect ratio of the cells.

The problem here is in the conversion process- I can convert the mesh to openfoam and view it in paraview but when I run checkMesh I get a long series of the following errors:

Checking topology...
Boundary definition OK.
--> FOAM Serious Error :
From function bool zone::checkDefinition(const label maxSize, const bool report) const
in file meshes/polyMesh/zones/zone/zone.C at line 207
Zone cellZone_0 contains invalid index label 32000
Valid index labels are 0..31999
--> FOAM Serious Error :
From function bool zone::checkDefinition(const label maxSize, const bool report) const
in file meshes/polyMesh/zones/zone/zone.C at line 207
Zone cellZone_0 contains invalid index label 32001
Valid index labels are 0..31999

and ends as follows:

--> FOAM Serious Error :

--> FOAM FATAL ERROR:
Too many errors

From function messageStream::operator OSstream&()
in file lnInclude/messageStream.C at line 200.

FOAM aborting

I want to run cyclic patches and I cannot because of these errors I believe

Kind Regards,

Matt

linnemann July 16, 2012 02:43

I think you need to give a sketch or something of what and where you want to refine.

You can create groups of edges in Salome Geo and use those to create submeshes of the overall mesh.

This is how I usually do it when making graded hex mesh in Salome.

matt.mech.eng July 16, 2012 08:02

First of all thank you very much for your help so far! It is much appreciated.

Sorry I think I may have been a bit unclear. I am not having trouble in creating submeshes for refinement.. The issue I have is when I do create submeshes (and export to unv then convert to OF) I get errors with cell zone references (see error message above) when running checkMesh. The same mesh exported to unv prior to creation of submeshes converts from unv to OF and running checkMesh gives no errors.

I am wondering if you could perhaps explain why this may be happening?

linnemann July 17, 2012 02:03

Can you post the py dump of the whole shebang with mesh?

matt.mech.eng July 17, 2012 03:59

1 Attachment(s)
Attached is a dump of the hdf,

Cheers

Matt

matt.mech.eng July 17, 2012 04:43

The steps I then take are to export the mesh to unv format then run ideasUnvToFoam <filename>.unv

Running checkMesh gives the above mentioned output.

Also note I have not named any of the boundary faces as I generated this mesh purely to test if it converted to OF without any errors. For the actual mesh I would use I would create groups of faces in the mesh (create group and select using selection filter, leaving the walls along the z-axis undefined and renaming the defaultFaces patch to walls) and then export as above.

Kind Regards

Matt

linnemann July 17, 2012 05:22

2 Attachment(s)
Hi

I get no problems at all.

Could you try and delete your constant/polyMesh folder before converting.

If that does not fix it something must be wrong in your OF install.

Here is the two output files.

matt.mech.eng July 17, 2012 06:00

Thank you for such a quick response!

I also get no errors after deleting constant/polyMesh- my output look the same as what you posted.

However after converting and changing constant/polyMesh/boundary to add cyclic patches and wall patches and rename defaultFaces patch I get the following output when running setFields and checkMesh:

matt@matt-desktop:~/Desktop/parabolicHex3D$ setFields
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.0.1-51f1de99a4bc
Exec : setFields
Date : Jul 17 2012
Time : 19:55:35
Host : matt-desktop
PID : 3581
Case : /home/matt/Desktop/parabolicHex3D
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

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

Create mesh for time = 0



--> FOAM FATAL ERROR:
face 0 area does not match neighbour by 91.7559% -- possible face ordering problem.
patch:front my area:0.000244545 neighbour area:0.000659134 matching tolerance:0.001
Mesh face:143500 fc:(-1.09222 0.697452 0.15)
Neighbour fc:(-0.28762 1.34188 0)
If you are certain your matching is correct you can increase the 'matchTolerance' setting in the patch dictionary in the boundary file.
Rerun with cyclic debug flag set for more information.

From function cyclicPolyPatch::calcTransforms()
in file meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C at line 220.

FOAM exiting

matt@matt-desktop:~/Desktop/parabolicHex3D$ checkMesh
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.0.1-51f1de99a4bc
Exec : checkMesh
Date : Jul 17 2012
Time : 19:55:46
Host : matt-desktop
PID : 3583
Case : /home/matt/Desktop/parabolicHex3D
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

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

Create polyMesh for time = 0



--> FOAM FATAL ERROR:
face 0 area does not match neighbour by 91.7559% -- possible face ordering problem.
patch:front my area:0.000244545 neighbour area:0.000659134 matching tolerance:0.001
Mesh face:143500 fc:(-1.09222 0.697452 0.15)
Neighbour fc:(-0.28762 1.34188 0)
If you are certain your matching is correct you can increase the 'matchTolerance' setting in the patch dictionary in the boundary file.
Rerun with cyclic debug flag set for more information.

From function cyclicPolyPatch::calcTransforms()
in file meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C at line 220.

FOAM exiting


I cannot figure out why this error is occuring!!!

linnemann July 17, 2012 06:12

Can you give med the case without the mesh and then a list of commands/edits you go through to obtain your final mesh now?

I think its in your general setup some minor thing is preventing it from working properly.

matt.mech.eng July 17, 2012 06:15

Attached is my case (below)


To convert to the final mesh I first run ideasUnvToFoam
I then run checkMesh- no errors
I then view with paraFoam
I then edit to constant/polyMesh/boundary file to what is given in the case
I then run setFields and get the error above
So I re-run checkMesh and get the error above again

I also tried changing the matchTolerance to 1 and it worked however the initial field is not correct..

Thank you for all your help so far!

Kind Regards

Matt

linnemann July 17, 2012 06:30

Hi

I see no files

matt.mech.eng July 17, 2012 06:31

1 Attachment(s)
Attached is the case directory

removed the polyMesh directory since it was too large

cheers

matt.mech.eng July 17, 2012 06:34

here is the boundary file again

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

5
(
front
{
type cyclic;
nFaces 5000;
startFace 143500;
matchTolerance 1e-3;
neighbourPatch back;
}
back
{
type cyclic;
nFaces 5000;
startFace 148500;
matchTolerance 1e-3;
neighbourPatch front;
}
outlet
{
type patch;
nFaces 1000;
startFace 153500;
}
inlet
{
type patch;
nFaces 4;
startFace 154500;
}
walls
{
type wall;
nFaces 1996;
startFace 154504;
}
)

// ************************************************** *********************** //

i JUst realised that you might need this

cheers


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