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

[mesh manipulation] cell aspect ratio of 1:1:1 for snappy region

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 3, 2020, 14:35
Default cell aspect ratio of 1:1:1 for snappy region
  #1
New Member
 
David
Join Date: Oct 2020
Posts: 21
Rep Power: 6
fidu is on a distinguished road
Hi foamer

I need to achieve a cell aspect ratio 1:1:1 at the snappy region of my background mesh to the geometry at my ground. A I am able to adopt a previous code which already achieved this but I had to split the domain into two boxes, a near ground region and a ceiling region. My question now is, how can I achieve this in the best way? I am quite new to the entire CFD universe and so I am a bit confused. My approach would have been just to take the same multi-graded mesh in both boxes an keep the same amount of cells. As my near ground region is much smaller this would have the desired effect of having the finer mesh in this region. However I am firstly not quite sure if this fulfill the requirement of the desired cell aspect ratio and secondly I think this would not be a efficient solution....

So my blockMeshDict is right now this:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.4.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

backgroundMesh
{
    xMin   1.9; // L = 
    xMax   8.3;
    yMin   0.0054; // L = 
    yMax   1.9;
    zMin     0;   //-0.01875
    zTree   0.0.09375;      //15m/160
    zMax   1.61675;   //1.6
    xCells  141;    //141   800
    yCells  62;     //62  200
    zCells  32;    //32   200



}

//convertToMeters 1;

vertices
(
    ($:backgroundMesh.xMin $:backgroundMesh.yMin $:backgroundMesh.zMin)  //0
    ($:backgroundMesh.xMax $:backgroundMesh.yMin $:backgroundMesh.zMin) //1
    ($:backgroundMesh.xMax $:backgroundMesh.yMax $:backgroundMesh.zMin) //2
    ($:backgroundMesh.xMin $:backgroundMesh.yMax $:backgroundMesh.zMin) //3

    ($:backgroundMesh.xMin $:backgroundMesh.yMin $:backgroundMesh.zMax) //4
    ($:backgroundMesh.xMax $:backgroundMesh.yMin $:backgroundMesh.zMax) //5
    ($:backgroundMesh.xMax $:backgroundMesh.yMax $:backgroundMesh.zMax) //6
    ($:backgroundMesh.xMin $:backgroundMesh.yMax $:backgroundMesh.zMax) //7

    ($:backgroundMesh.xMin $:backgroundMesh.yMin $:backgroundMesh.zTree)    //8    new 4 
    ($:backgroundMesh.xMax $:backgroundMesh.yMin $:backgroundMesh.zTree)    //9     new 5
    ($:backgroundMesh.xMax $:backgroundMesh.yMax $:backgroundMesh.zTree)    //10    new 6
    ($:backgroundMesh.xMin $:backgroundMesh.yMax $:backgroundMesh.zTree)    //11    new 7

);

blocks
(
    hex (0 1 2 3 8 9 10 11)               //0 1 2 3 4 5 6 7   domain of ground to zTree
    (
        $:backgroundMesh.xCells
        $:backgroundMesh.yCells
        $:backgroundMesh.zCells
    ) 

    simpleGrading 
    (  
        ( 
            (0.109375 0.085106383 0.3)    // l% x-dir, % cells, expansion =  
            (0.53125  0.780141844 1)    // l% x-dir, % cells, expansion =  
            (0.359375 0.134751773 10) // l% x-dir, % cells, expansion =  
        ) 
        1                  // y-direction expansion ratio
        (                  
            (0.1572376 0.375 1)    // z% x-dir, % cells, expansion =      
            (0.8427624 0.625 8)    // z% x-dir, % cells, expansion =               
        )  
    ) 

    hex (8 9 10 11 4 5 6 7)               //0 1 2 3 4 5 6 7 domain of zTree to ceilling   hex (8 9 10 11 4 5 6 7)
    (
        $:backgroundMesh.xCells
        $:backgroundMesh.yCells
        $:backgroundMesh.zCells
    )


    simpleGrading 
    (  
        ( 
            (0.109375 0.085106383 0.3)    // l% x-dir, % cells, expansion =  
            (0.53125  0.780141844 1)    // l% x-dir, % cells, expansion =  
            (0.359375 0.134751773 10) // l% x-dir, % cells, expansion =  
        ) 
        1                  // y-direction expansion ratio
        (                  
            (0.1572376 0.375 1)    // z% x-dir, % cells, expansion =      
            (0.8427624 0.625 8)    // z% x-dir, % cells, expansion =               
        )  
    ) 

);

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 3 11 8)
            (8 11 7 4)       //(0 3 7 4)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (1 9 10 2)
            (9 5 6 10)       //(1 5 6 2)
        );
    }

    ground
    {
        type wall;
        faces
        (
            (0 1 2 3)       //(0 1 2 3)
        );
    }

    frontAndBack
    {
        type wall;
        faces
        (
            (0 8 9 1) (8 4 5 9)                 //front (0 4 5 1) 
            (3 2 10 11) (11 10 6 7)             //back (3 2 6 7)
            (4 7 6 5)                           //ceilling (4 7 6 5)
        );
    }

);



mergePatchPairs
(
);

// ************************************************************************* //
and my snappyhexmeshDict is:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.4.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#includeEtc "caseDicts/mesh/generation/snappyHexMeshDict.cfg"

castellatedMesh on;
snap            on;
addLayers       off;

geometry
{
    GltbuildingclusterWindtunnel.stl
    {
        scale 0.001;
        type triSurfaceMesh;
        name GltbuildingclusterWindtunnel;
    }

};

castellatedMeshControls
{
//    nCellsBetweenLevels 3;

    features
    (
      { file  "GltbuildingclusterWindtunnel.eMesh"; level 3; scale 0.001;}
    );

    refinementSurfaces
    {
        GltbuildingclusterWindtunnel
        {
            level (2 3);
            patchInfo { type wall; }
        }
    }

    refinementRegions
    {
        GltbuildingclusterWindtunnel
        {
            mode distance;
            levels ((0.077 2)); 
        }
    }

    locationInMesh (2 1 1);

    resolveFeatureAngle 60;
    allowFreeStandingZoneFaces true;

}

snapControls
{
    //- Number of patch smoothing iterations before finding correspondence
    //  to surface
    nSmoothPatch 3;

    //- Relative distance for points to be attracted by surface feature point
    //  or edge. True distance is this factor times local
    //  maximum edge length.
    tolerance 2.0;

    //- Number of mesh displacement relaxation iterations.
    nSolveIter 30;

    //- Maximum number of snapping relaxation iterations. Should stop
    //  before upon reaching a correct mesh.
    nRelaxIter 5;


    // Feature snapping

        //- Number of feature edge snapping iterations.
        //  Leave out altogether to disable.
        nFeatureSnapIter 10;

        //- Detect (geometric) features by sampling the surface (default=false)
        implicitFeatureSnap true;

        //- Use castellatedMeshControls::features (default = true)
        explicitFeatureSnap false;
}

addLayersControls
{
    layers
    {
        "CAD.*"
        {
            nSurfaceLayers 2;
        }
    }

    relativeSizes       true;
    expansionRatio      1.2;
    finalLayerThickness 0.5;
    minThickness        1e-3;
}

meshQualityControls
{

maxConcave 70;
minTetQuality 1E-12;
maxInternalSkewness 5;
maxBoundarySkewness 25;
}

writeFlags
(
    scalarLevels
    layerSets
    layerFields
);

mergeTolerance 1e-6;

// ************************************************************************* //
I hope this is not a too stupid question to ask and if you could recommend some literature which explains this a bit more I would be happy aswell. I also would like to increase the cell number in the bottom box but I am not able to achieve it. So far I tried to merge the both boxes with mergeparis and the master and slave condition with no sucess... Is even possible to have a different number of cells in one box than in the other?

Many thanks already in advance!!

Best
fid

Last edited by fidu; November 4, 2020 at 08:03.
fidu is offline   Reply With Quote

Reply

Tags
blockmeshdict, cell aspect ratio, simplegrading, snapphexmesh


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
[Commercial meshers] Using starToFoam clo OpenFOAM Meshing & Mesh Conversion 33 September 26, 2012 05:04
[Other] StarToFoam error Kart OpenFOAM Meshing & Mesh Conversion 1 February 4, 2010 05:38
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 09:19
mesh of large aspect ratio region marangoni FLUENT 0 May 25, 2003 00:18


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