CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Meshing problem (http://www.cfd-online.com/Forums/openfoam/83862-meshing-problem.html)

 Andrea_85 January 13, 2011 10:33

Meshing problem

3 Attachment(s)
Hi all,

I am trying to build a structured mesh around some discs (2D problem) using gmsh for construct the geometry and the mesh.
Here my .geo file.

// Gmsh project created on Tue Jan 11 13:20:10 2011

lc=0.001;
dx=0.001;
dy=0.001;

c1x=0.0005;
c1y=0.0005;
r1=0.0002;

c2x=0.0004;
c2y=0.0015;
r2=0.00025;

c3x=0.0016;
c3y=0.0014;
r3=0.0003;

c4x=0.0013;
c4y=0.0002;
r4=0.0001;

Function CheeseHole

lc=0.001;
p1 = newp; Point(p1)={x,y,z,lc};
p2 = newp; Point(p2)={x+r,y,z,lc};
p3 = newp; Point(p3)={x-r,y,z,lc};
p4 = newp; Point(p4)={x,y+r,z,lc};
p5 = newp; Point(p5)={x,y-r,z,lc};

p6 = newp; Point(p6)={dx1,y,z,lc};
p7 = newp; Point(p7)={dx2,y,z,lc};
p8 = newp; Point(p8)={x,dy1,z,lc};
p9 = newp; Point(p9)={x,dy2,z,lc};

p10 = newp; Point(p10)={dx1,dy1,z,lc};
p11 = newp; Point(p11)={dx1,dy2,z,lc};
p12 = newp; Point(p12)={dx2,dy1,z,lc};
p13 = newp; Point(p13)={dx2,dy2,z,lc};

c1 = newreg; Circle(c1) = {p2,p1,p4};
c2 = newreg; Circle(c2) = {p3,p1,p4};
c3 = newreg; Circle(c3) = {p3,p1,p5};
c4 = newreg; Circle(c4) = {p2,p1,p5};

l1 = newl; Line(l1) = {p13,p7};
l2 = newl; Line(l2) = {p7,p2};
l3 = newl; Line(l3) = {p4,p9};
l4 = newl; Line(l4) = {p9,p13};
l5 = newl; Line(l5) = {p9,p11};
l6 = newl; Line(l6) = {p11,p6};
l7 = newl; Line(l7) = {p6,p3};
l8 = newl; Line(l8) = {p10,p6};
l9 = newl; Line(l9) = {p8,p10};
l10 = newl; Line(l10) = {p5,p8};
l11 = newl; Line(l11) = {p8,p12};
l12 = newl; Line(l12) = {p12,p7};

lp1 = newreg; Line Loop(lp1) = {l1,l4,l3,c1,l2}; Plane Surface(newreg) = {lp1};
lp2 = newreg; Line Loop(lp2) = {l3,l5,l6,c2,l7}; Plane Surface(newreg) = {lp2};
lp3 = newreg; Line Loop(lp3) = {l7,l8,l9,c3,l10}; Plane Surface(newreg) = {lp3};
lp4 = newreg; Line Loop(lp4) = {l10,l11,l12,c4,l2}; Plane Surface(newreg) = {lp4};

Transfinite Line {l1} = n1;
Transfinite Line {l2} = n2;
Transfinite Line {l3} = n2;
Transfinite Line {l4} = n4;
Transfinite Line {l5} = 42-n4;
Transfinite Line {l6} = n1;
Transfinite Line {l7} = n2;
Transfinite Line {l8} = 42-n1;
Transfinite Line {l9} = 42-n4;
Transfinite Line {l10} = n2;
Transfinite Line {l11} = n4;
Transfinite Line {l12} = 42-n1;

Transfinite Line {c1} = n1+n4-1;
Transfinite Line {c2} = 42-n4+n1-1;
Transfinite Line {c3} = 84-n1-n4-1;
Transfinite Line {c4} = 42-n1+n4-1;

Transfinite Surface {lp1+1} = {p9,p4,p2,p7};
Transfinite Surface {lp2+1} = {p9,p4,p3,p6};
Transfinite Surface {lp3+1} = {p6,p3,p5,p8};
Transfinite Surface {lp4+1} = {p7,p2,p5,p8};
Recombine Surface {lp1+1,lp2+1,lp3+1,lp4+1};

Extrude {0, 0, 0.00001} {
Surface{lp1+1,lp2+1,lp3+1,lp4+1};
Layers{1};
Recombine;
}

Return

n2=30; //internal point

//n1 : point on boundary y direction
//n4 : point on boundary x direction

x=c1x; y=c1y; z=0; r=r1; dx1=0; dx2=0.001; dy1=0; dy2=0.001; n1=21; n4=21;
Call CheeseHole ;
x=c2x; y=c2y; z=0; r=r2; dx1=0; dx2=dx; dy1=dy; dy2=2*dy; n1=21; n4=25;
Call CheeseHole ;
x=c3x; y=c3y; z=0; r=r3; dx1=dx; dx2=2*dx; dy1=dy; dy2=2*dy; n1=25; n4=17;
Call CheeseHole ;
x=c4x; y=c4y; z=0; r=r4; dx1=dx; dx2=2*dx; dy1=0; dy2=dy; n1=33; n4=29;
Call CheeseHole ;

Physical Surface("frontback") = {166, 333, 255, 368, 65, 232, 50, 251, 364, 461, 383, 446, 34, 465, 123, 500, 152, 210, 150, 183, 156, 264, 237, 154, 342, 284, 315, 282, 288, 396, 369, 286, 414, 447, 474, 416, 51, 18, 78, 20, 105, 22, 132, 24, 501, 418, 528, 420};
Physical Surface("top") = {197, 182, 329, 314};
Physical Surface("bottom") = {515, 496, 119, 100};
Physical Surface("left") = {201, 236, 69, 104};
Physical Surface("right") = {298, 387, 430, 519};
Physical Surface("obstacle") = {174, 209, 224, 263, 77, 42, 131, 92, 306, 341, 356, 395, 473, 438, 527, 488};
Physical Volume("internal") = {6, 5, 8, 7, 2, 1, 10, 11, 12, 9, 13, 14, 15, 16, 4, 3};

Are four circles surrounded by four squares (is the only way I found to keep the grid structured). In the "frontback" patch there are also the internal surface that separate the 4 squares because otherwise openfoam adds these automatically to the "DefaultFaces" (..with other error).
Seems that open foam has a problem on the internal surfaces that separate a square and the other or maybe i defined a wrong geometry. when i check the mesh with the checkMesh utility i found:

Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
points: 38386
internal points: 0
faces: 74880
internal faces: 36480
cells: 18560
boundary patches: 7
point zones: 0
face zones: 0
cell zones: 1

Overall number of cells of each type:
hexahedra: 18560
prisms: 0
wedges: 0
pyramids: 0
tet wedges: 0
tetrahedra: 0
polyhedra: 0

Checking topology...
Boundary definition OK.
Point usage OK.
Upper triangular ordering OK.
Face vertices OK.
*Number of regions: 4
The mesh has multiple regions which are not connected by any face.
<<Writing region information to "0/cellToRegion"

Checking patch topology for multiply connected surfaces ...
Patch Faces Points Surface topology
frontback 37440 38386 multiply connected (shared edge)
obstacle 640 1280 ok (non-closed singly connected)
left 80 162 ok (non-closed singly connected)
bottom 80 162 ok (non-closed singly connected)
top 80 162 ok (non-closed singly connected)
right 80 162 ok (non-closed singly connected)
defaultFaces 0 0 ok (empty)
<<Writing 2 conflicting points to set nonManifoldPoints

Checking geometry...
Overall domain bounding box (0 0 0) (0.002 0.002 1e-05)
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: 73294
<<Writing 38352 points on non-aligned edges to set nonAlignedEdges
Boundary openness (-1.0427e-19 -2.39822e-18 -1.77514e-19) OK.
Max cell openness = 3.24449e-16 OK.
Max aspect ratio = 8.43589 OK.
Minumum face area = 1.62992e-11. Maximum face area = 6.1562e-10. Face area magnitudes OK.
Min volume = 1.62992e-16. Max volume = 6.1562e-15. Total volume = 3.364e-11. Cell volumes OK.
Mesh non-orthogonality Max: 74.3236 average: 27.2494
*Number of severely non-orthogonal faces: 159.
Non-orthogonality check OK.
<<Writing 159 non-orthogonal faces to set nonOrthoFaces
Face pyramids OK.
Max skewness = 2.59138 OK.

Failed 1 mesh checks.

End

I guess that the error is on the internal faces.
For the centers of the discs I used only discrete positions to ensure that the mesh matches itself on the edge.
Could it be that the interior lines and points are defined twice (once for each square)??
I have attached my geometry and my .geo (txt) file.

Thanks
Andrea

 Andrea_85 January 13, 2011 10:36

This is the error if i launch the simulation using interFoam:

FOAM FATAL ERROR:
[3] This mesh contains patches of type empty but is not 1D or 2D
by virtue of the fact that the number of faces of this
empty patch is not divisible by the number of cells.
[3]
[3] From function emptyFvPatchField<Type>::updateCoeffs()
[3] in file fields/fvPatchFields/constraint/empty/emptyFvPatchField.C at line 150.

 All times are GMT -4. The time now is 12:34.