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/)
-   -   [blockMesh] Cylindrical mesh with an odd number of circumferential cells (https://www.cfd-online.com/Forums/openfoam-meshing/151637-cylindrical-mesh-odd-number-circumferential-cells.html)

Eldor April 14, 2015 09:37

Cylindrical mesh with an odd number of circumferential cells
 
Hello everyone,

I want to create a cylindrical mesh with an odd number of equidistant distributed circumferential cells, to be more precise there must be 17 of them.

I tried a lot but did not get a solution, for example:

i) with one block, but you'll end up by ether an block inconsistency error or an arc definition error "Invalid arc definition - are the points co-linear? Denom =0"
ii) two blocks, but since the face numbers between these blocks are different at the centerline, I get also an error message.

Is there an intelligent way to do it? It looks like a very easy problem, but I can not get a solution.

Thanks for any help!

Regards,
Gregor

Eldor April 16, 2015 04:21

Here is one solution, which is definitely not very elegant:

Code:

/*--------------------------------*- C++ -*-------------------------------------*\
 * | =========                |                                                |
 * | \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
 * |  \\    /  O peration    | Version:  1.7.1                                |
 * |  \\  /    A nd          | Web:      www.OpenFOAM.com                      |
 * |    \\/    M anipulation  |                                                |
 * \*---------------------------------------------------------------------------*/

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}

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

convertToMeters      1;

pi                  3.141592653589793;
rad                  #calc "2.0*$pi/360.0";

D                    0.005;

nCircumveratialCells 17;

// positions * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

inlet                0.0;

outlet              #calc "40*$pi*$D";

domain              #calc "12*$pi*$D";

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

alpha1              #calc "360/$nCircumveratialCells*$rad";
alpha2              #calc "$alpha1+($nCircumveratialCells-1)/2*360/$nCircumveratialCells*$rad";
alpha3              #calc "$alpha2+($nCircumveratialCells-1)/2*360/$nCircumveratialCells*$rad";

domainx1            #calc  "$domain*cos($alpha1)";
domainy1            #calc  "$domain*sin($alpha1)";

domainx2            #calc  "$domain*cos($alpha2)";
domainy2            #calc  "$domain*sin($alpha2)";

domainx3            #calc  "$domain*cos($alpha3)";
domainy3            #calc  "$domain*sin($alpha3)";

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

vertices
(
    ($domainx1  $domainy1  $inlet)  // 0
    ($domainx2  $domainy2  $inlet)  // 1
    ($domainx3  $domainy3  $inlet)  // 2
   
    ($domainx1  $domainy1  $outlet)  // 3
    ($domainx2  $domainy2  $outlet)  // 4
    ($domainx3  $domainy3  $outlet)  // 5
   
    (0.0        0.0        $inlet)  // 6
    (0.0        0.0        $outlet)  // 7
);

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

nCircumveratialPoints1 #calc "($nCircumveratialCells-1)/2";
nCircumveratialPoints2 #calc "$nCircumveratialPoints1";
nCircumveratialPoints3 1;

// radial resolution
nRadialPoints          10;
sRadialInlet          0.1;
sRadialOutlet          1;

// axial resolution
nDomain                32;
sDomain                7.544161191700337;

blocks
(
    // nozzle
    hex ( 0  1  6  6  3  4  7  7) ($nCircumveratialPoints1 $nRadialPoints $nDomain)  edgeGrading (1 1 1 1 $sRadialInlet $sRadialInlet $sRadialOutlet $sRadialOutlet $sDomain $sDomain $sDomain $sDomain) 
    hex ( 1  2  6  6  4  5  7  7) ($nCircumveratialPoints2 $nRadialPoints $nDomain)  edgeGrading (1 1 1 1 $sRadialInlet $sRadialInlet $sRadialOutlet $sRadialOutlet $sDomain $sDomain $sDomain $sDomain) 
    hex ( 2  0  6  6  5  3  7  7) ($nCircumveratialPoints3 $nRadialPoints $nDomain)  edgeGrading (1 1 1 1 $sRadialInlet $sRadialInlet $sRadialOutlet $sRadialOutlet $sDomain $sDomain $sDomain $sDomain)
);

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

beta1  #calc "360/$nCircumveratialCells*$rad+$rad";
beta2  #calc "3/2*$beta1+($nCircumveratialCells-1)/2*360/$nCircumveratialCells*$rad";
beta3  #calc "$beta2+($nCircumveratialCells-1)/2*360/$nCircumveratialCells*$rad";

// domain
circDomainx1          #calc "$domain*cos($beta1)";
circDomainy1          #calc "$domain*sin($beta1)";
circDomainx2          #calc "$domain*cos($beta2)";
circDomainy2          #calc "$domain*sin($beta2)";
circDomainx3          #calc "$domain*cos($beta3)";
circDomainy3          #calc "$domain*sin($beta3)";

edges
(   
    arc  0  1 ($circDomainx1  $circDomainy1  $inlet)
    arc  1  2 ($circDomainx2  $circDomainy2  $inlet)
    arc  2  0 ($circDomainx3  $circDomainy3  $inlet)
       
    arc  3  4 ($circDomainx1  $circDomainy1  $outlet)
    arc  4  5 ($circDomainx2  $circDomainy2  $outlet)
    arc  5  3 ($circDomainx3  $circDomainy3  $outlet)
);

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

boundary

    inletJet
    {
        type patch;
        physicalType noParticleOutflow;
        faces
        (
            ( 0  1  6  6)
            ( 1  2  6  6)
            ( 2  0  6  6)
        );
    }
   
    outlet
    {
        type patch;
        physicalType particleOutflow;
        faces
        (
            ( 3  4  7  7)
            ( 4  5  7  7)
            ( 5  3  7  7)
        );
    }
   
    side
    {
        type patch;
        physicalType noParticleOutflow;
        faces
        (
            (0  3  4  1)
            (1  4  5  2)
            (2  5  3  0)
        ); 
    }
);

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

Since this is only working for odd circumferential cell numbers, I have to add one block if I want to have for example 14 circumferential cells.

Does anyone have an idea on a more elegant version?

Best regards,
Gregor


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