CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: blockMesh

Cylindrical mesh with an odd number of circumferential cells

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   April 14, 2015, 09:37
Default Cylindrical mesh with an odd number of circumferential cells
  #1
New Member
 
Gregor Neuber
Join Date: Dec 2012
Posts: 2
Rep Power: 0
Eldor is on a distinguished road
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 is offline   Reply With Quote

Old   April 16, 2015, 04:21
Default
  #2
New Member
 
Gregor Neuber
Join Date: Dec 2012
Posts: 2
Rep Power: 0
Eldor is on a distinguished road
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
Eldor is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how should we remove the Concave cells from the mesh? s.m OpenFOAM Mesh Utilities 19 January 22, 2015 06:47
snappyhexmesh remove blockmesh geometry philipp1 OpenFOAM Running, Solving & CFD 2 December 12, 2014 11:58
Mesh Refinement Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Mesh Utilities 41 January 17, 2013 03:43
snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Native Meshers: snappyHexMesh and Others 2 March 27, 2011 21:11
BlockMeshmergePatchPairs hjasak OpenFOAM Native Meshers: blockMesh 11 August 15, 2008 07:36


All times are GMT -4. The time now is 20:35.