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] Creating baffes with snappyHexMesh (https://www.cfd-online.com/Forums/openfoam-meshing/220761-creating-baffes-snappyhexmesh.html)

BBack September 22, 2019 05:10

Creating baffes with snappyHexMesh
 
Helleo everyone,

I am working on a project in OF to model a fan as a pressurejump via a patch in steady state solved with simpleFoam.
However I have some problems. When I create a baffle via snappyHexMesh and process this one via createPatch the master and slave patch show up like expected in the Boundary file, however when I run reconstructParMesh it will remove the correct cyclics and replaces them with a wall which is based on the surface refinement given in the snappyHexMesh. Anybody seen this before or knows a solution?

Dicts for the snappyHexMesh and createPatch (reconstructParMesh has not been changed):



Code:


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

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


// Geometry. Definition of all surfaces. All surfaces are of class
// searchableSurface.
// Surfaces are used
// - to specify refinement for any mesh cell intersecting it
// - to specify refinement for any mesh cell inside/outside/near
// - to 'snap' the mesh boundary to the surface
geometry
{
   
        fan.stl
        {
                type triSurfaceMesh;
                name fanObject;
        }
   

}


// Settings for the castellatedMesh generation.
castellatedMeshControls
{

    // Refinement parameters
    maxLocalCells                1000000;
    maxGlobalCells                80000000;
    minRefinementCells                3000;
    maxLoadUnbalance                0.10;
    nCellsBetweenLevels                4;
    allowFreeStandingZoneFaces        true;
    resolveFeatureAngle                30;
    planarAngle                        30;
       
    features
    (

        {  file "fan.eMesh"; level 6; }       

    );



    // Surface based refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~

    refinementSurfaces
    { 
                fanObject
                {
                        level (1 1);
                        faceZone fanFaces;
                        faceType baffle;
                }

    }

    refinementRegions
    {


    }
    locationInMesh (3.0001 3.0001 0.43);
}



// Settings for the snapping.
snapControls
{
    nSmoothPatch 5;
    tolerance 2.0;
    nSolveIter 150;
    nRelaxIter 5;
    nFeatureSnapIter 15;
    implicitFeatureSnap false;
    explicitFeatureSnap true;
    multiRegionFeatureSnap false;
}



// Settings for the layer addition.
addLayersControls
{
    // Are the thickness parameters below relative to the undistorted
    // size of the refined cell outside layer (true) or absolute sizes (false).
    relativeSizes true;

    // Per final patch (so not geometry!) the layer information
    layers
    {

    }

    // Expansion factor for layer mesh
    expansionRatio 1.2;

    // Wanted thickness of final added cell layer. If multiple layers
    // is the thickness of the layer furthest away from the wall.
    // Relative to undistorted size of cell outside layer.
    // See relativeSizes parameter.
    finalLayerThickness 0.5;

    // 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.001;

    // 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.
    // Note: changed(corrected) w.r.t 1.7.x! (didn't do anything in 1.7.x)
    nGrow 0;

    // Advanced settings

    // When not to extrude surface. 0 is flat surface, 90 is when two faces
    // are perpendicular
    featureAngle 180;

    // At non-patched sides allow mesh to slip if extrusion direction makes
    // angle larger than slipFeatureAngle.
    slipFeatureAngle 75;

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

    // Number of smoothing iterations of surface normals
    nSmoothSurfaceNormals 3;

    // Number of smoothing iterations of interior mesh movement direction
    nSmoothNormals 4;

    // Smooth layer thickness over surface patches
    nSmoothThickness 10;

    // Stop layer growth on highly warped cells
    maxFaceThicknessRatio 0.5;

    // Reduce layer growth where ratio thickness to medial
    // distance is large
    maxThicknessToMedialRatio 0.3;

    // Angle used to pick up medial axis points
    // Note: changed(corrected) w.r.t 1.7.x! 90 degrees corresponds to 130
    // in 1.7.x.
    minMedialAxisAngle 90;


    // Create buffer region for new layer terminations
    nBufferCellsNoExtrude 0;


    // Overall max number of layer addition iterations. The mesher will exit
    // if it reaches this number of iterations; possibly with an illegal
    // mesh.
    nLayerIter 300;
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    #include "meshQualityDict"


    // Advanced

    //- Number of error distribution iterations
    nSmoothScale 4;
    //- Amount to scale back displacement at error points
    errorReduction 0.75;
}


// Advanced

// Write flags
writeFlags
(
    scalarLevels
    layerSets
    layerFields    // write volScalarField for layer coverage
);


// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1e-6;


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


Code:


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

// This application/dictionary controls:
// - optional: create new patches from boundary faces (either given as
//  a set of patches or as a faceSet)
// - always: order faces on coupled patches such that they are opposite. This
//  is done for all coupled faces, not just for any patches created.
// - optional: synchronise points on coupled patches.

// 1. Create cyclic:
// - specify where the faces should come from
// - specify the type of cyclic. If a rotational specify the rotationAxis
//  and centre to make matching easier
// - always create both halves in one invocation with correct 'neighbourPatch'
//  setting.
// - optionally pointSync true to guarantee points to line up.

// 2. Correct incorrect cyclic:
// This will usually fail upon loading:
//  "face 0 area does not match neighbour 2 by 0.0100005%"
//  " -- possible face ordering problem."
// - in polyMesh/boundary file:
//      - loosen matchTolerance of all cyclics to get case to load
//      - or change patch type from 'cyclic' to 'patch'
//        and regenerate cyclic as above

// Do a synchronisation of coupled points after creation of any patches.
// Note: this does not work with points that are on multiple coupled patches
//      with transformations (i.e. cyclics).
pointSync false;

// Patches to create.
patches
(

            { 
                // Name of new patch
                      name fan_in;

                // Dictionary to construct new patch from
                patchInfo
                { 
                            type cyclic;
                            neighbourPatch fan_out;

                            // Optional: explicitly set transformation tensor.
                            // Used when matching and synchronising points.
                            //transform rotational;
                    //rotationAxis (1 0 0);
                    //rotationCentre (0 0 0);
                    // transform translational;
                  // separationVector (1 0 0);

                    // Optional non-default tolerance to be able to define cyclics
                    // on bad meshes
                    //matchTolerance 1E-2;
                }

                // How to construct: either from 'patches' or 'set'
                constructFrom patches;

                // If constructFrom = patches : names of patches. Wildcards allowed.
                patches (fan);

                // If constructFrom = set : name of faceSet
                //set f0;
            }
            {
                // Name of new patch
                name fan_out;

                // Dictionary to construct new patch from
                patchInfo
                {
                            type cyclic;
                            neighbourPatch fan_in;

                            // Optional: explicitly set transformation tensor.
                            // Used when matching and synchronising points.
                            //transform rotational;
                            //rotationAxis    ( 0 0 1 );
                            //rotationCentre  ( 0.3 0 0 );
                }

                // How to construct: either from 'patches' or 'set'
                constructFrom patches;

                // If constructFrom = patches : names of patches. Wildcards allowed.
                patches (fan_slave);

                // If constructFrom = set : name of faceSet
                //set f0;
            }
);



All times are GMT -4. The time now is 15:23.