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/)
-   -   [snappyHexMesh] sHM layer reduction towards outlet (https://www.cfd-online.com/Forums/openfoam-meshing/171789-shm-layer-reduction-towards-outlet.html)

m0guib May 17, 2016 05:50

sHM layer reduction towards outlet
 
1 Attachment(s)
Hello Foamers,

I have a question regarding layer insertion in sHM:
I have a surface in my model which should be layered (e.g. wall) and an adjacent surface that should have no layer (e.g. an outlet), its 3dimensional, look at the picture below (outlet is at the bottom)
sHM is decreasing my layers towards the surface that has no layers - why?
I already played with some parameters like nGrow or featureAngle, but with no success. Maybe some of you have a hint.

cheers

m0guib May 19, 2016 09:33

no ideas? :(

me3840 May 19, 2016 18:37

Can you post your snappy dictionary? I'll bet it has to do with the angles in the prism layer setup.

m0guib May 20, 2016 07:14

4 Attachment(s)
Code:

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

// Which of the steps to run
castellatedMesh    true;
meshQuality        true;
snap                true;
addLayers          true;


geometry
{

var1e_swx_from_icem_flaechen_benannt_cutted.stl
        {
            type triSurfaceMesh;
        name var1e_swx_from_icem_flaechen_benannt_cutted;
        regions
        {
            OUTLETS        {    name outlets;}
            ROHRE        {    name rohre;}
            INLET        {    name inlet;}
            QUERKANAL1    {    name querkanal1;}
            QUERKANAL2    {    name querkanal2;}
            QUERKANAL3    {    name querkanal3;}
            KRUEMMER1    {    name kruemmer1;}
            /*KRUEMMER2    {    name kruemmer2;}
            KRUEMMER3    {    name kruemmer3;}
            KRUEMMER4    {    name kruemmer4;}*/
            HEADER1        {    name header1;}
            HEADER2        {    name header2;}
            HEADER3        {    name header3;}
            HEADER4        {    name header4;}
            HEADER5        {    name header5;}
            HEADER6        {    name header6;}
            HEADER7        {    name header7;}
            HEADER8        {    name header8;}
            /*HEADER9        {    name header9;}
            HEADER10    {    name header10;}
            HEADER11    {    name header11;}
            HEADER12    {    name header12;}*/
            SYMM        {    name symm;}
        }
    }


feinebox
    {
    type searchableBox;
    min (3    8    0);
    max (26    8.3    6);
    }
   
};


castellatedMeshControls
{
   
    maxGlobalCells    40000000;
    maxLocalCells        1000000;
    minRefinementCells 0;
    nCellsBetweenLevels 3;

    features
    (
        {    file    "var1e_swx_from_icem_flaechen_benannt_cutted.eMesh";            level 0;    }
       
       
       

);       

    refinementSurfaces
    {
    var1e_swx_from_icem_flaechen_benannt_cutted
    {
        level (2 3);
            regions
            {
                      rohre        {    level (2 3);        }
                      outlets        {    level (2 3);        }
                      inlet        {    level (2 3);        }
                      querkanal1    {    level (2 3);        }
                      querkanal2    {    level (2 3);        }
                      querkanal3    {    level (2 3);        }
                      kruemmer1    {    level (2 3);        }
                      /*kruemmer2    {    level (2 3);        }
                      kruemmer3    {    level (2 3);        }
                      kruemmer4    {    level (2 3);        }*/
                      header1        {    level (2 3);        }
                      header2        {    level (2 3);        }
                      header3        {    level (2 3);        }
                      header4        {    level (2 3);        }
                      header5        {    level (2 3);        }
                      header6        {    level (2 3);        }
                      header7        {    level (2 3);        }
                      header8        {    level (2 3);        }
                      symm        {    level (2 3);        }
                      inlet        {    level (2 3);        }
                      outlets        {    level (2 3);        }
                      //header12    {    level (2 3);        }

       
            }
        }
    }
    refinementRegions
        {   
        feinebox       
              {       
                    mode inside;
                    levels ((1E15 0));
            }
       
        } 
   
    resolveFeatureAngle 30;

    allowFreeStandingZoneFaces true; 

    locationInMesh (5.0005000511194281582016 9.007272265124 1.00005000014285523886);

    maxLoadUnbalance 0.10;
   
}


addLayersControls
{
      // Are the thickness parameters below relative to the undistorted
        // size of the refined cell outside layer (true) or absolute sizes (false).
    relativeSizes true;
        // Expansion factor for layer mesh
          // expansionRatio 1.1;
    //- Wanted thickness of final added cell layer. If multiple layers
        //  is the thickness of the layer furthest away from the wall.
    //  See relativeSizes parameter.
    thickness 0.2;
    firstLayerThickness 0.2;
    //- Minimum thickness of cell layer. If for any reason layer
      //  cannot be above minThickness do not add layer.
      //  Relative to undistorted size of cell outside layer. 
    minThickness 0.000001;


    /* möglich sind:
    first layer thickness ('firstLayerThickness') and overall thickness ('thickness') or
    first layer thickness ('firstLayerThickness') and expansion ratio ('expansionRatio') or
    final layer thickness ('finalLayerThickness') and expansion ratio ('expansionRatio') or
    final layer thickness ('finalLayerThickness') and overall thickness ('thickness') or
    overall thickness ('thickness') and expansion ratio ('expansionRatio'
    */

    layers
            {
            rohre        { nSurfaceLayers 1;  }       
            querkanal1    { nSurfaceLayers 1;  }   
            querkanal2    { nSurfaceLayers 1;  }   
            querkanal3    { nSurfaceLayers 1;  }   
            kruemmer1    { nSurfaceLayers 1;  }   
            /*kruemmer2    { nSurfaceLayers 1;  }   
            kruemmer3    { nSurfaceLayers 1;  }   
            kruemmer4    { nSurfaceLayers 1;  }*/
            header1        { nSurfaceLayers 1;  }
            header2        { nSurfaceLayers 1;  }   
            header3        { nSurfaceLayers 1;  }   
            header4        { nSurfaceLayers 1;  }   
            header5        { nSurfaceLayers 1;  }   
            header6        { nSurfaceLayers 1;  }   
            header7        { nSurfaceLayers 1;  }   
            header8        { nSurfaceLayers 1;  }   
            //symm        { nSurfaceLayers 1;  }   
            //inlet        { nSurfaceLayers 1;  }   
            outlets        { nSurfaceLayers 0;  }   
            //header12    { nSurfaceLayers 1;  }   


   
     
            }
    //- If points get not extruded do nGrow layers of connected faces that are
        //  also not grown. This helps convergence of the layer addition process
    //  close to features.
    //      This specifies the number of layers of connected faces that are not grown. This helps in convergence of the layer addition              process close to features.
    nGrow 0;

    // Advanced settings

        //- When not to extrude surface. 0 is flat surface, 90 is when two faces
        //  make straight angle.
    featureAngle 210; //180; //130   
    SlipFeatureAngle 75;
    //- Maximum number of snapping relaxation iterations. Should stop
      //  before upon reaching a correct mesh.
        nRelaxIter 40;
    // Number of smoothing iterations of surface normals
    nSmoothSurfaceNormals 6;//3
    // Number of smoothing iterations of interior mesh movement direction
    nSmoothNormals 6;//3
    // Smooth layer thickness over surface patches
    nSmoothThickness 30;//10
    // Stop layer growth on highly warped cells
    // This specifies the maximum allowable value of aspect ratio. Sometimes (especially in corners) the layers must be generated over            highly warped cells. The layer generation will stop for cells where aspect ratio is higher than this value.
    maxFaceThicknessRatio 50;//0.5;
    // Reduce layer growth where ratio thickness to medial
        // distance is large
    maxThicknessToMedialRatio 0.8;//0.3
    // Angle used to pick up medial axis points
    minMedianAxisAngle 90;   
    // Create buffer region for new layer terminations
    nBufferCellsNoExtrude 2; //0
    // Overall max number of layer addition iterations
    nLayerIter 50;
    // No of steps walking away from the surface (to stop dislocations walking through the mesh)
    nMedialAxisIter 1000; // default: 2^31 (unlimited)
}
 
snapControls
{

    nSmoothPatch 5;//3            von 3 im vgl zu #1


    tolerance 1.5; //vorher 1.5

    nSolveIter 300;

    explicitFeatureSnap        true;
    implicitFeatureSnap    false;
    multiRegionFeatureSnap    true;
    nRelaxIter 10;

    nFeatureSnapIter 10;
}

meshQualityControls
{
 
    maxNonOrtho 65;//180; //50; // 65

    maxBoundarySkewness 5;//-1;//20;    von 20 im vgl zu #1

    maxInternalSkewness 4;//-1;//4;    von 0.5 im vgl zu #1

    maxConcave 80;//180;//80;

    minVol 1e-13;//-1e-33;//1e-13;

    minTetQuality 1e-30;//-1e-30;//1e-30;

    minArea -1;

    minTwist 0.02;//-1e-30;  //0.02;

    minDeterminant 0.001;//-1; //0.001; //0.001

    minFaceWeight 0.02;//-1;  //0.02;

    minVolRatio 0.01;//-1;    //0.01;

    minTriangleTwist 0.01;//-1;

    nSmoothScale 4;

    errorReduction 0.75; //0.75;
}



debug 0;


mergeTolerance 1e-2;


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

Thank you for your answer, this is my sHM dict.
Reuslting from this sHM dict:
Picture #1 shows the transition of the BL from "rohre" to "symm" and pic #2 shows transition from "rohre" to "outlets". In both cases the BL should have been projected onto the face which should have no BL (i.e. symm and outlets respectively). In my sHM dict I tried to either comment out BL for symm or say "zero layers" for "outlets", both don't work.

When you talk about the feature angle.. I also attached 2 pictures that show a parametric study of this angle starting at 90° at the left going to 180° to the right (for the first picture) and a detailed study from 150° t165° to 180°. You can see that none of the cases is satisfying, since the BL either won't go around the corner or is not projected on the left wall where I don't want to have a BL.

fra76 May 21, 2016 03:51

Hi Hugo,

I think the answer to your question is in the code.
Have a look to
src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C

In the method Foam::autoLayerDriver::doLayers you can find:
// Per patch the number of layers (-1 or 0 if no layer)
const labelList& numLayers = layerParams.numLayers();


layerParams is an object containing what is read from sHMDict.

The difference between -1 or 0 can be seen in
// Construct pointVectorField with correct boundary conditions for adding
// layers
Foam::tmp<Foam:: pointVectorField>
Foam::autoLayerDriver::makeLayerDisplacementField


There, all the patches are set to slip:

wordList patchFieldTypes
(
pointPatches.size(),
slipPointPatchVectorField::typeName
);


Apart from the patches where numLayers is 0 or >0:

forAll(numLayers, patchI)
{
// 0 layers: do not allow slip so fixedValue 0
// >0 layers: fixedValue which gets adapted
if (numLayers[patchI] == 0)
{
patchFieldTypes[patchI] =
zeroFixedValuePointPatchVectorField::typeName;
}
else if (numLayers[patchI] > 0)
{
patchFieldTypes[patchI] = fixedValuePointPatchVectorField::typeName;
}
}


So, if you set nSurfaceLayers to -1 for the patches symm and outlets, they will be set to slip and the points should slide to accommodate the prisms grown on the adjacent patches.

Hope it helps,
Francesco

m0guib May 23, 2016 06:39

Hello Francesco,

thank you for your suggestion, I set nSurfaceLayers -1 for symm, inlet and outlets as you wrote, but it does´t work :(
Have you tried it?

regards

m0guib May 24, 2016 02:53

pls find the download link of a minimum example: https://we.tl/kjyiZhC6ZX

fra76 May 25, 2016 00:14

No, I haven't tried it recently and I don't know when I can try it again. What I am sure is that I had prisms doing what you want on a patch coming from blockMesh. In this case the patch is defined as symmetryPlane in blockMeshDict and it is not specified at all in the snappyHexMeshDict.

I don't know how much this could help you. I'll let you know if I manage to try your test case.

Francesco

m0guib June 17, 2016 03:42

still andybody has no ideas? :eek:


All times are GMT -4. The time now is 14:30.