CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[blockMesh] Flow Over A Cylinder Mesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 16, 2023, 10:37
Default Flow Over A Cylinder Mesh
  #1
New Member
 
amarzooq
Join Date: Mar 2023
Posts: 1
Rep Power: 0
amarzooq is on a distinguished road
Hello,

I am new to openfoam, and I have been trying to mesh a cylinder inside a square to study turbulence around it. I made the overall shape (I think it is correct) but when I want to define the boundaries, I get an error when I put the face on the right wall (51 34 2 19) (line 215 in the code below). I appreciate any help and advise.

Also, is it possible that because the mesh quality is bad I get this error? I dont think it is related but who knows...

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2212                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

scale   1;

// Geometric parameters
rInner  0.5;
rOuter  1;
//xmax    7.5;
xmax_n  10*$rInner; //left wall location as a function of radius
xmax_p  50*$rInner;//right wall location as a function of radius 
ymax    16*$rInner;
zmin   -0.5;  // Back/front locations
zmax    0.5;

// Divisions: Radial, quarter circumference, outer region and z-directions.
nRadial  20; //cylinder cells
nQuarter 10;//the region above, right and left to the cylinder (wake and drag region)
nxOuter  40;//x direction cells (cylinder not included)
nxOuterRight 200;//x direction cells (cylinder not included) in the right of the cylinder 
nyOuter  50;//y direction cells (cylinder not included)
nz       1;

// ----------------

// Derived quantities
rInner45    ${{ $rInner * sqrt(0.5) }};
rOuter45    ${{ $rOuter * sqrt(0.5) }};

vertices #codeStream
{
    codeInclude
    #{
        #include "pointField.H"
    #};

    code
    #{
        pointField points
        ({
	     /*0*/ { $rInner, 0, $zmin },
            /* 1*/ { $rOuter, 0, $zmin },
            /* 2*/ { $xmax_p, 0, $zmin },//right wall x positive 
            /* 3*/ { $xmax_p, $rOuter45, $zmin }, //right wall xpositive
            /* 4*/ { $rOuter45, $rOuter45, $zmin },
            /* 5*/ { $rInner45, $rInner45, $zmin },
            /* 6*/ { $xmax_p, $ymax, $zmin },//right wall x positive 
            /* 7*/ { $rOuter45, $ymax, $zmin },
            /* 8*/ { 0, $ymax, $zmin },
            /* 9*/ { 0, $rOuter, $zmin },
            /*10*/ { 0, $rInner, $zmin },
            /*11*/ { -$rInner, 0, $zmin },
            /*12*/ { -$rOuter, 0, $zmin },
            /*13*/ { -$xmax_n, 0, $zmin },
            /*14*/ { -$xmax_n, $rOuter45, $zmin },
            /*15*/ { -$rOuter45, $rOuter45, $zmin },
            /*16*/ { -$rInner45, $rInner45, $zmin }, //left wall xnegative
            /*17*/ { -$xmax_n, $ymax, $zmin },//left wall xnegative
            /*18*/ { -$rOuter45, $ymax, $zmin },//left wall xnegative


	  //*19*/ {-$rInner, 0, -$zmin }, // 19 will be exactly as point 0 // deleted
	  //  /* 20*/ { -$rOuter, 0, -$zmin },//20 will be exactly as point 1  //deleted
          //  /* 21*/ { -$xmax_p, 0, -$zmin },//right wall x positive // 21 will be exactly as point 2 /deleted

	    /*19*/ { $xmax_p, -$rOuter45, $zmin }, //right wall xpositive
            /* 20*/ { $rOuter45, -$rOuter45, $zmin },
            /* 21*/ { $rInner45, -$rInner45, $zmin },
            /* 22*/ { $xmax_p, -$ymax, $zmin },//right wall x positive 
            /* 23*/ { $rOuter45, -$ymax, $zmin },
            /* 24*/ { 0, -$ymax, $zmin },
            /* 25*/ { 0, -$rOuter, $zmin },
            /*26*/ { 0, -$rInner, $zmin }, 

	    // /*30*/ { $rInner, 0, -$zmin },// 30 will be exactly as point 11 // deleted
	    //  /*31*/ { $rOuter, 0, -$zmin },//31 will be exactly as point 12 //deleted
	    //   /*32*/ { $xmax_n, 0, -$zmin },//32 will be exactly as point 13 // deleted

	    /*27*/ { -$xmax_n, -$rOuter45, $zmin },
            /*28*/ { -$rOuter45, -$rOuter45, $zmin },
            /*29*/ { -$rInner45, -$rInner45, $zmin }, //left wall xnegative
            /*30*/ { -$xmax_n, -$ymax, $zmin },//left wall xnegative
            /*31*/ { -$rOuter45, -$ymax, $zmin }//left wall xnegative


	});

        // Duplicate z points for zmax
        const label sz = points.size();
        points.resize(2*sz);
        for (label i = 0; i < sz; ++i)
        {
            const point& pt = points[i];
            points[i + sz] = point(pt.x(), pt.y(), $zmax);
        }

        os  << points;
    #};
};

// Can remove unneeded variables
#remove ( "r(Inner|Outer).*"  "[xy](min|max)" )

blocks

(

 // +Y blocks 
 /*0*/ hex (5 4 9 10 37 36 41 42)    ($nRadial  $nQuarter $nz) grading (1 1 1)       //cylinder
 /*1*/ hex (0 1 4 5 32 33 36 37)     ($nRadial  $nQuarter $nz) grading (1 1 1)       //cylinder
 /*2*/ hex (1 2 3 4 33 34 35 36)     ($nxOuterRight  $nQuarter $nz) grading (2 1 1)  //+ right
 /*3*/ hex (4 3 6 7 36 35 38 39)     ($nxOuterRight  $nyOuter  $nz) grading (2 1 1)  //corner right
 /*4*/ hex (9 4 7 8 41 36 39 40)     ($nQuarter $nyOuter  $nz) grading (1 1 1)       //+ top right
 /*5*/ hex (15 16 10 9 47 48 42 41)  ($nRadial  $nQuarter $nz) grading (1 1 1)       //cylinder
 /*6*/ hex (12 11 16 15 44 43 48 47) ($nRadial  $nQuarter $nz) grading (1 1 1)       //cylinder
 /*7*/ hex (13 12 15 14 45 44 47 46) ($nxOuter  $nQuarter $nz) grading (1 1 1)       //+ left left
 /*8*/ hex (14 15 18 17 46 47 50 49) ($nxOuter  $nyOuter  $nz) grading (1 1 1)       //+corner left
 /*9*/ hex (15 9 8 18 47 41 40 50)   ($nQuarter $nyOuter  $nz) grading (1 1 1)       //+ top left

   //-Y blocks
 /*10*/ hex (20 21 26 25 52 53 58 57) ($nRadial  $nQuarter $nz) grading (1 1 1)      //cylinder
 /*11*/ hex (21 20 1 0 53 52 33 32)   ($nRadial  $nQuarter $nz) grading (1 1 1)      //cylinder 
 /*12*/ hex (20 19 2 1 51 34 33 52)   ($nQuarter $nxOuterRight $nz) grading (2 1 1)   //+ right right
 /*13*/ hex (23 22 19 20 55 54 51 52) ($nxOuterRight  $nyOuter  $nz) grading (2 1 1) //corner right
 /*14*/ hex (24 23 20 25 56 55 52 57) ($nQuarter $nyOuter  $nz) grading (1 1 1)      //+ bottom right
 /*15*/ hex (25 26 29 28 57 58 61 60) ($nRadial  $nQuarter $nz) grading (1 1 1)      //cylinder 
 /*16*/ hex (28 29 11 12 60 61 43 44) ($nRadial  $nQuarter $nz) grading (1 1 1)      //cylinder
 /*17*/ hex (27 28 12 13 59 60 44 45) ($nxOuter  $nQuarter $nz) grading (1 1 1)      //+left left
 /*18*/ hex (30 31 28 27 62 63 60 59) ($nxOuter  $nyOuter  $nz) grading (1 1 1)      //corner left
 /*19*/ hex (31 24 25 28 63 56 57 60)   ($nQuarter $nyOuter  $nz) grading (1 1 1)    //+bottom left
   
);

edges
(
 //  Inner cylinder
    arc  0  5 origin (0 0 $zmin)
    arc  5 10 origin (0 0 $zmin)
    arc  1  4 origin (0 0 $zmin)
    arc  4  9 origin (0 0 $zmin)

    arc  0  21 origin (0 0 $zmin)
    arc  21 26 origin (0 0 $zmin)
    arc  1 20 origin (0 0 $zmin)
    arc  20 25 origin (0 0 $zmin)

    arc  32 53 origin (0 0 $zmax)
    arc  53 58 origin (0 0 $zmax)
    arc  33 52 origin (0 0 $zmax)
    arc  52 57 origin (0 0 $zmax)

    arc 32 37 origin (0 0 $zmax)
    arc 37 42 origin (0 0 $zmax)
    arc 33 36 origin (0 0 $zmax)
    arc 36 41 origin (0 0 $zmax)
    
    // Intermediate cylinder
    arc 11 16 origin (0 0 $zmin)
    arc 16 10 origin (0 0 $zmin)
    arc 12 15 origin (0 0 $zmin)
    arc 15  9 origin (0 0 $zmin)

    arc 43 48 origin (0 0 $zmax)
    arc 48 42 origin (0 0 $zmax)
    arc 44 47 origin (0 0 $zmax)
    arc 47 41 origin (0 0 $zmax)

    arc 11 29 origin (0 0 $zmin)
    arc 29 26 origin (0 0 $zmin)
    arc 12 28 origin (0 0 $zmin)
    arc 28 25 origin (0 0 $zmin)

    arc 43 61 origin (0 0 $zmax)
    arc 61 58 origin (0 0 $zmax)
    arc 44 60 origin (0 0 $zmax)
    arc 60 57 origin (0 0 $zmax)

);

boundary
(
    down
    {
        type symmetryPlane;
        faces
        (
            (30 31 63 62) 
            (31 24 56 63) 
            (24 23 55 56) 
            (23 22 54 55) 
        );
    }
    right
    {
        type patch;
        faces
        (
       	 (38 6 3 35)
	 (35 3 2 34)
	 
	 (51 19 22 54)
	(51 34 2 19) //This is the line that is producing the error
        );
    }
    up
    {
        type symmetryPlane;
        faces
        (
	 (17 18 50 49)
	 (18 8 40 50)
	 (8 7 39 40)
	 (7 6 38 39)
        );
    }
    
    Left
    {
        type patch;
        faces
        (
	 (17 14 46 49)
	 (14 13 45 46)
	 (13 27 59 45)
	 (27 30 62 59)
        );
    }

    cylinder
    {
        type wall;
        faces
        (
         
          (10 5 37 42)
          (5 0 32 37)
          (16 10 42 48)
          (11 16 48 43)

	  (0 21 53 32)
	  (21 26 58 53)
	  (26 29 61 58)
	  (29 11 43 61)
        

	 );
    }
);

mergePatchPairs
(
);


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



when I run checkMesh (while ignoring the line that produces the error) I get:

Code:
Create time

Create mesh for time = 0

Time = 0

Mesh stats
    points:           66462
    internal points:  0
    faces:            130430
    internal faces:   63970
    cells:            32400
    faces per cell:   6
    boundary patches: 6
    point zones:      0
    face zones:       0
    cell zones:       0

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

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: 2
    The mesh has multiple regions which are not connected by any face.
  <<Writing region information to "0/cellToRegion"
  <<Writing region 0 with 30400 cells to cellSet region0
  <<Writing region 1 with 2000 cells to cellSet region1

Checking patch topology for multiply connected surfaces...
    Patch               Faces    Points   Surface topology
    down                260      522      ok (non-closed singly connected)
    right               110      224      ok (non-closed singly connected)
    up                  260      522      ok (non-closed singly connected)
    Left                120      242      ok (non-closed singly connected)
    cylinder            80       160      ok (non-closed singly connected)
    defaultFaces        65630    66462    ok (non-closed singly connected)

Checking faceZone topology for multiply connected surfaces...
    No faceZones found.

Checking basic cellZone addressing...
    No cellZones found.

Checking basic pointZone addressing...
    No pointZones found.

Checking geometry...
    Overall domain bounding box (-5 -8 -0.5) (25 8 0.5)
    Mesh has 0 geometric (non-empty/wedge) directions (0 0 0)
    Mesh has 0 solution (non-empty) directions (0 0 0)
 ***Number of edges not aligned with or perpendicular to non-empty directions: 34501
  <<Writing 18040 points on non-aligned edges to set nonAlignedEdges
    Boundary openness (-4.81024e-19 -2.92463e-17 9.85443e-15) OK.
    Max cell openness = 2.16877e-15 OK.
    Max aspect ratio = -1 OK.
    Minimum face area = 0.00100526. Maximum face area = 2.00203.  Face area magnitudes OK.
    Min volume = 0.00100526. Max volume = 0.0245554.  Total volume = 473.538.  Cell volumes OK.
    Mesh non-orthogonality Max: 87.9602 average: 20.2095
   *Number of severely non-orthogonal (> 70 degrees) faces: 3790.
    Non-orthogonality check OK.
  <<Writing 3790 non-orthogonal faces to set nonOrthoFaces
    Face pyramids OK.
 ***Max skewness = 58.4839, 2486 highly skew faces detected which may impair the quality of the results
  <<Writing 2486 skew faces to set skewFaces
    Coupled point location match (average 0) OK.

Failed 2 mesh checks.

End


The face that doesnt mesh: mesh.JPG
amarzooq is offline   Reply With Quote

Reply

Tags
#mesh /blockmesh


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
unable to run dynamic mesh(6dof) and wave UDF shedo Fluent UDF and Scheme Programming 0 July 1, 2022 17:22
FLow past cylinder. Mesh independency test beattacz FLUENT 6 April 26, 2020 15:44
[ICEM] Bad Quality Hybrid Mesh External Flow tim13 ANSYS Meshing & Geometry 0 March 8, 2020 02:22
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
benchmark: flow over a circular cylinder goodegg Main CFD Forum 12 January 22, 2013 11:47


All times are GMT -4. The time now is 03:13.