CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[cfMesh] Problem CfMesh 2D Mesh

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Clmkite

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 23, 2015, 17:35
Default Problem CfMesh 2D Mesh
  #1
New Member
 
Clement Mtrl
Join Date: Apr 2014
Posts: 12
Rep Power: 12
Clmkite is on a distinguished road
Hi,

I'm trying to mesh a car with cfMesh in 2D but I experience some problems.
Here is the geometry :

https://drive.google.com/file/d/0B0-...ew?usp=sharing
https://drive.google.com/file/d/0B0-...ew?usp=sharing

Here is my meshDict :

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                |
| \\      /  F ield         | OpenFOAM GUI Project: creativeFields           |
|  \\    /   O peration     | Version:  0.8.9.0                                  |
|   \\  /    A nd           | Web: www.c-fields.com                                       |
|    \\/     M anipulation  |                                                |
\*---------------------------------------------------------------------------*/

FoamFile
{
version    2;
format    ascii;
class    dictionary;
location    "system";
object    meshDict;
}

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

surfaceFile    "caronly3.ftr";

maxCellSize    100;
minCellSize     80;
//boundaryCellSize 200;

surfaceFile    "caronly3.ftr";


localRefinement
{
car
{
cellSize 50;
}
}

objectRefinements
{
box
{
type box;
cellsize 100;
centre (15000 3000 5);
lengthX 20000;
lengthY 5500;
lengthZ 10;
}
}


boundaryLayers
{
 patchboundaryLayers
 {
  car
   {   
    nLayers         10;
    thicknessRatio  1.2;
    maxFirstlayrThickness 0.01;
   }
 }
}
In fact I have 2 problems,
When the ratio between maxCellSize and minCellSize is too large I have the following error :

Code:
--> FOAM FATAL ERROR: 
This cannot be a 2D mesh

    From function void polyMeshGen2DEngine::findZMinOffsetPoints()
    in file utilities/meshes/polyMeshGen2DEngine/polyMeshGen2DEngine.C at line 174.

FOAM exiting
When the ration between maxCellSize and boundaryCellSize is too big I have this one :
Code:
Octree nodes 37794
Resizing points!
Segmentation fault (core dumped)
And it seems quite important to have a big ratio to reduce the number of cells far from the car.

My second problem is that my localRefinement / objectRefinements / boundaryLayers are completely ignored by the program (cartesian2DMesh).

At this point I didn,t find my answers anywhere...

Thanks a lot
Clmkite is offline   Reply With Quote

Old   September 27, 2015, 11:29
Default
  #2
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 17
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Hello,

The case did not produce the expected results because of some incorrect settings (mainly typos), and the crash was due to some bugs in the 1.1 version. Please upgrade to the 1.1.1 version available at SourceForge. We have resolved some problems reported by the people using the 2D mesher.
Please check the attached case and please let me know if it generates the required result.
There are a few suggestions that I would like to point out:
1. When you generate the features via surfaceFeatureEdges and export the results into an stl or an ftr file, it changes the names of the patches in the surface mesh. You need to use the new names for meshing or simply use the regular expressions. A non-existent patch name in meshDict results in the region being ignored.
2. Please pay attention to use the correct keywords. The settings are case-sensitive so you cannot use cellsize, it has to be cellSize. The same problem is with patchboundaryLayers, it shall be patchBoundaryLayers. This has caused the problem that box refinement region was ignored, and there was only one boundary layer.

I hope that this helps you.

Regards,

Franjo
Attached Files
File Type: zip case.zip (14.1 KB, 132 views)
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   September 28, 2015, 12:17
Default
  #3
New Member
 
Clement Mtrl
Join Date: Apr 2014
Posts: 12
Rep Power: 12
Clmkite is on a distinguished road
Hi Franjo,

Thanks for your answer.
I did upgrade myversion and since I didn't encounter my first error.
And you were right about my typo because now it works much better
It's not so long that I work in linux environnement and not used to take care so much of the typo !!!

Howevers I get a mesh loonking like I want (cf pictures).
My checkMesh is not really good and I don't really know how to play with parameters in order to get good quality mesh (I tried optimiseLayer but I didn't find may informations about it).

My MeshDict

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                |
| \\      /  F ield         | OpenFOAM GUI Project: creativeFields           |
|  \\    /   O peration     | Version:  0.8.9.0                                  |
|   \\  /    A nd           | Web: www.c-fields.com                                       |
|    \\/     M anipulation  |                                                |
\*---------------------------------------------------------------------------*/

FoamFile
{
version	2;
format	ascii;
class	dictionary;
location	"system";
object	meshDict;
}

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

surfaceFile	"caronly1.stl";


maxCellSize	600;
minCellSize     6;
boundaryCellSize 350;
boundaryCellSizeRefinementThickness 400;

localRefinement
{
car {cellSize 30;refinementThickness 200;}
}

objectRefinements
{
becquet {type sphere;cellSize 0.5;centre (10013 1732 5);radius 6;}
box1 {type box;cellSize 80;centre (11000 1300 5);lengthX 12500;lengthY 2600;lengthZ 20;}
box2 {type box;cellSize 200;centre (15000 2200 5);lengthX 25000;lengthY 4400;lengthZ 20;}
box3 {type box;cellSize 400;centre (25000 2500 5);lengthX 45000;lengthY 5000;lengthZ 20;}
}

boundaryLayers
{
 patchBoundaryLayers
 {
  car {nLayers 30;thicknessRatio 1.2;maxFirstLayerThickness 0.01;}
 }

optimiseLayer 1; // activates layer optimisation

// optional parameters
optimisationParameters
{
// number of iterations in the procedure for reducing normal-variation
nSmoothNormals 30;

// max number of total iterations
maxNumIterations 50;

// feature size factor. Reasonable range <0.2, 0.5>
// lower values force thinner layers
featureSizeFactor 0.3;

// shall the normal vectors be recalculated
reCalculateNormals 1;

// relative thickess variation between two hair nSmoothNormals
// lower value produce thinner and more uniform layers
relThicknessTol 0.01;
}
}
chekcMesh results

Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.4.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 2.4.0-f0842aea0e77
Exec   : checkMesh
Date   : Sep 28 2015
Time   : 11:04:32
Host   : "clement-desktop"
PID    : 2742
Case   : /home/clement/OpenFOAM/clement-2.4.0/run/etude/caronly
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

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

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:           244808
    internal points:  0
    faces:            479164
    internal faces:   237537
    cells:            118920
    faces per cell:   6.02675
    boundary patches: 7
    point zones:      0
    face zones:       0
    cell zones:       0

Overall number of cells of each type:
    hexahedra:     116196
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:     2724
    Breakdown of polyhedra by number of faces:
        faces   number of cells
            7   2269
            8   453
            9   2

Checking topology...
    Boundary definition OK.
 ***Total number of faces on empty patches is not divisible by the number of cells in the mesh. Hence this mesh is not 1D or 2D.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
                   Patch    Faces   Points                  Surface topology
                     car     2983     5966  ok (non-closed singly connected)
                   inlet       40       82  ok (non-closed singly connected)
                  ground      556     1114  ok (non-closed singly connected)
                     top      168      338  ok (non-closed singly connected)
                  outlet       40       82  ok (non-closed singly connected)
        bottomEmptyFaces   118920   122404  ok (non-closed singly connected)
           topEmptyFaces   118920   122404  ok (non-closed singly connected)

Checking geometry...
    Overall domain bounding box (0 0 0) (50000 12000 10)
    Mesh (non-empty, non-wedge) directions (0 0 0)
    Mesh (non-empty) directions (0 0 0)
 ***Number of edges not aligned with or perpendicular to non-empty directions: 291712
  <<Writing 212922 points on non-aligned edges to set nonAlignedEdges
    Boundary openness (3.33116e-20 4.09695e-20 4.28121e-14) OK.
 ***Open cells found, max cell openness: 1, number of open cells 1761
  <<Writing 1761 non closed cells to set nonClosedCells
 ***Zero or negative face area detected.  Minimum area: 0
  <<Writing 14895 zero area faces to set zeroAreaFaces
 ***Zero or negative cell volume detected.  Minimum negative volume: -0.0445, Number of negative volume cells: 4766
  <<Writing 4766 zero volume cells to set zeroVolumeCells
    Mesh non-orthogonality Max: 179.145 average: 34.9415
   *Number of severely non-orthogonal (> 70 degrees) faces: 26886.
 ***Number of non-orthogonality errors: 10474.
  <<Writing 37360 non-orthogonal faces to set nonOrthoFaces
 ***Error in face pyramids: 5229 faces are incorrectly oriented.
  <<Writing 4902 faces with incorrect orientation to set wrongOrientedFaces
 ***Max skewness = 8.75e+150, 6824 highly skew faces detected which may impair the quality of the results
  <<Writing 6824 skew faces to set skewFaces
    Coupled point location match (average 0) OK.

Failed 7 mesh checks.

End
Thanks again because I try cfMesh and sHM and I was about giving up on cfMesh whereas now I found it powerful and very efficient (if I can fix quality).
Attached Images
File Type: png 1.png (19.1 KB, 337 views)
File Type: png 2.png (37.3 KB, 278 views)

Last edited by Clmkite; September 28, 2015 at 15:09.
Clmkite is offline   Reply With Quote

Old   September 28, 2015, 15:30
Default
  #4
New Member
 
Clement Mtrl
Join Date: Apr 2014
Posts: 12
Rep Power: 12
Clmkite is on a distinguished road
I found the utility improveMeshQuality
in the userguide but is it possible to constrain it with qulity criteria instead of numbers of iterations ?

Is it normal to get the kind of results I attached after using improveMeshQuality ?

Thx a lot
Attached Images
File Type: jpg 3.jpg (153.7 KB, 287 views)
Clmkite is offline   Reply With Quote

Old   September 28, 2015, 18:14
Default
  #5
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 17
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Hi,

Can you please post the content of your controlDict? Do you save the mesh in the binary format? Can you please post the log of cartesian2DMesh?
It seems to me that the thickness of the first layer is smaller than the floating-point tolerance. Please increase the number of digits saved in a file or set the writeFormat to binary.

Quote:
Originally Posted by Clmkite View Post
I found the utility improveMeshQuality
in the userguide but is it possible to constrain it with qulity criteria instead of numbers of iterations ?
Not yet, we are working on that. It will be available in the next couple of days.

Quote:
Originally Posted by Clmkite View Post
Is it normal to get the kind of results I attached after using improveMeshQuality ?
Thx a lot
Your boundary layers are extremely thin and the algorithm is not designed to handle that.
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   September 29, 2015, 10:48
Default
  #6
New Member
 
Clement Mtrl
Join Date: Apr 2014
Posts: 12
Rep Power: 12
Clmkite is on a distinguished road
Hi Franjo,

Thanks for everything,
In fact I changed my wall function so I increase my first layer thickness and everything went well !
For next time I sill remember what you've said but how can I choose the writeFormat (just change ascii to binary in the header ?)

It's really great to have the support of the developer while discovering this great tool
franjo_j likes this.
Clmkite is offline   Reply With Quote

Old   September 29, 2015, 13:44
Smile
  #7
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 17
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Quote:
Originally Posted by Clmkite View Post
Hi Franjo,

Thanks for everything,
In fact I changed my wall function so I increase my first layer thickness and everything went well !
For next time I sill remember what you've said but how can I choose the writeFormat (just change ascii to binary in the header ?)
Yes, all you need is:
writeFormat binary;

My suggestion is to use the binary format because it does not lose information, that is extremely important for very thin layers. In addition, it also saves disk space.

Quote:
Originally Posted by Clmkite View Post
It's really great to have the support of the developer while discovering this great tool
Thank you! Happy meshing !
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   February 1, 2018, 02:37
Default
  #8
Member
 
Join Date: Jul 2010
Posts: 55
Rep Power: 16
ashkan is on a distinguished road
Hi Franjo,
I am trying to create a 2D case for flow around a pipe using cfmesh and openfoam v1712. However, it seems that I cannot get it working with "cartesian2DMesh" at all. It seems that the issue is on the stl/fra file as it consider it 3D.

Basically, I created a cylinder and mesh it in salome then created boundying box for it using "surfaceGenerateBoundingBox" and use that in the meshDict. Attached please find my case file with the "Allrun" file showing the steps I have taken.

I would highly appreciate your input on how to get it to work.

many thanks
Ashkan
Attached Files
File Type: zip 2D.zip (75.7 KB, 21 views)
ashkan is offline   Reply With Quote

Old   February 2, 2018, 01:37
Default
  #9
Member
 
Join Date: Jul 2010
Posts: 55
Rep Power: 16
ashkan is on a distinguished road
I managed to resolve my issues and generate the 2D mesh following the very helpful instructions given here
ashkan is offline   Reply With Quote

Old   February 14, 2018, 08:26
Question cfMesh different behaviour
  #10
Member
 
Hosein
Join Date: Nov 2011
Location: Germany
Posts: 94
Rep Power: 15
einstein_zee is on a distinguished road
Hi there foamers,

I didn't want to create a new thread cause the current name is good and applicable to my question as well. I just noticed that for the same geometry when I try to run cfMesh (I use cartesianMesh) for the first time it gave me 103 badCells. Then I just deleted the polymesh folder ($caseFile/constant/polymesh) and tried to run cfMesh for the second time and this time it gave me 64 badCells! this was weird for me and I tried for the third time and I got 115 badCells! I would appreciate if somebody can tell me why this happens?

I also tried to change the format of my original geometry (.stl file) to .fms (using surfaceToFMS). Guess what... after running cfMesh I got a different number of badCells. But at least for this one I can assume that there might be some slight changes during the conversion from one file format to another. However, for the first case all of the trials were completely identical (in .stl format). I'm using OF1712 and latest version of cfMesh, only if that matters!
einstein_zee is offline   Reply With Quote

Old   July 12, 2018, 05:02
Default No cells in mesh / segmentation fault
  #11
New Member
 
Jenna Vergeynst
Join Date: Aug 2016
Posts: 10
Rep Power: 10
jenna is on a distinguished road
Hi dear all,


I'm also having problems with the cartesian2D mesher.


The stl file (from Salome): https://drive.google.com/open?id=1X7...lLNXpFyP5PaS2p
The refined one: https://drive.google.com/open?id=1Yh...TCcGJ9QGa7UfAr


My meshDict only contains:



Code:
surfaceFile "Ham2D.stl";
maxCellSize 1;
I get the error:
Code:
--> FOAM FATAL ERROR: 
There are no cells in the mesh!
The reasons for this can be fwofold:
1. Inadequate mesh resolution.
2. You maxCellSize is a multiplier of the domain length. This can be reolved by reducing the maxCellSize by a fraction.i.e. 2.49999 instead of 2.5.
I made sure that the geometry was completely closed, as hinted here: Inadequate mesh resolution (CfMesh). But this didn't help.


Then I tried refining the mesh, but still the same error. When I change the maxCellSize parameter to 0.5, it runs but crashes and then gives
Code:
 segmentation fault

I also tried first converting to ftr with surfaceConvert, but this did not help either.


Any idea?
jenna is offline   Reply With Quote

Old   July 12, 2018, 06:00
Default
  #12
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 17
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Have a look at the hat case in the tutorial folder and prepare your geometry accordingly. In addition, you can find information about 2D geometries in the user guide.


You need to create a ribbon in order to use cartesian2DMesh.


It may help you to try keepCellsIntersectingBoundary 1 option.


However, it better to desing your geometry as a set of edges in the x-y plane and extrude it into a ribbon with the extrudeEdgesInto2DSurface utility.
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   July 12, 2018, 10:35
Default
  #13
New Member
 
Jenna Vergeynst
Join Date: Aug 2016
Posts: 10
Rep Power: 10
jenna is on a distinguished road
Hi franjo,


Thank you for the quick reply!
I exported only the edges from salome now, but extrudeEdgesInto2DSurface doesn't take it. Problem is that it is a vtk file, which contains VERTICES, causing the fatal error
Code:
Unsupported tag VERTICES
I tried to convert the vtk file to something foam-readable with vtkUnstructuredToFoam, but this gives the same error... Any ideas for this, or is it rather a salome thing?
jenna is offline   Reply With Quote

Old   July 12, 2018, 11:22
Default
  #14
Senior Member
 
Franjo Juretic
Join Date: Aug 2011
Location: Velika Gorica, Croatia
Posts: 124
Rep Power: 17
franjo_j is on a distinguished road
Send a message via Skype™ to franjo_j
Can you visualize the vtk file in ParaView? Do you see edges, only?


Any edge mesh format readable by OpenFOAM shall suffice.


Which version of OF do you use?
__________________
Principal Developer of cfMesh and CF-MESH+
www.cfmesh.com
Social media: LinkedIn, Twitter, YouTube, Facebook, Pinterest, Instagram
franjo_j is offline   Reply With Quote

Old   July 13, 2018, 04:39
Default
  #15
New Member
 
Jenna Vergeynst
Join Date: Aug 2016
Posts: 10
Rep Power: 10
jenna is on a distinguished road
The openfoam version is 2.3.0, cfmesh v1.1.1.


When I visualise the vtk file (https://drive.google.com/open?id=1IK...czL6ccbY2IZuus), I see the edges, but also the vertices.

I tried with deleting the vertices part => this visualises in paraview as only edges. But then extrudeEdgesInto2DSurface gives:


Code:
--> FOAM FATAL ERROR: 
bad size -2147483647
jenna is offline   Reply With Quote

Old   August 13, 2018, 12:07
Default
  #16
New Member
 
Jenna Vergeynst
Join Date: Aug 2016
Posts: 10
Rep Power: 10
jenna is on a distinguished road
Quote:
Originally Posted by franjo_j View Post
Can you visualize the vtk file in ParaView? Do you see edges, only?


Any edge mesh format readable by OpenFOAM shall suffice.


Which version of OF do you use?

Hi Franjo,


Still same trouble here... Maybe there is a problem with the edges file... Some details on what I'm trying to do: I have a closed PolyLine in Salome (which are the edges of my geometry), which I export in the Geometry module as a vtk file. However, this file cannot be read by extrudeEdgesInto2DSurface, as mentioned earlier. Can it be due to the type of element in Salome (PolyLine)? Is there a way to make Edges from a PolyLine? ...


Thanks,
Jenna
jenna is offline   Reply With Quote

Old   August 23, 2018, 04:27
Default
  #17
New Member
 
Jenna Vergeynst
Join Date: Aug 2016
Posts: 10
Rep Power: 10
jenna is on a distinguished road
Hi all,


To by-pass my problem with cartesian2DMesh, I changed the approach as follows:

instead of trying to read out edges from salome and later do extrudeEdgesInto2DSurface, I directly extruded the ribbon (in x-y plane) in the z-direction, within salome (for instance a polyline can be extruded with geompy.MakePrism).

Then I named the needed patches (geompy.CreateGroup) and also added them to the mesh after meshing (with GroupOnGeom).

Finally I exported the mesh as .fms by use of salomeTriSurf.py (notes on this also here).


And on this fms file, cartesian2DMesh works smoothly!
jenna is offline   Reply With Quote

Reply

Tags
boundarylayers, cfmesh, refinement


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
Dynamic Mesh Problem. Tom Clark FLUENT 10 June 21, 2021 05:27
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 19:57
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
[ICEM] ICEM Structured Mesh Problem OMJT ANSYS Meshing & Geometry 3 March 22, 2013 11:06
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 22:11


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