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

[mesh manipulation] createpatch not working when using layer addition in snappyHexMesh

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 3, 2020, 09:46
Question createpatch not working when using layer addition in snappyHexMesh
  #1
New Member
 
Max
Join Date: Sep 2019
Posts: 2
Rep Power: 0
Dikkeunit is on a distinguished road
I am running a CFD simulation of a fan that is located inside a box. To do this I use snappyHexMesh to generate a baffle that is edited in createpatch to make it cyclic. Before this, I used cyclicAMI which worked fine. Now I would like to use cyclic as that will enable me to use the fan BC. When I only have the fan patch in a domain with the fan BC it works fine. When I then load another part in the simulation, without running layer addition in snappyHexMesh, it works fine as well. However, when I turn on the layer addition for the other part, even if it is not near the fan patch, createPatch does not work anymore giving the following error:
Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1812                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : v1812 OPENFOAM=1812
Arch   : "LSB;label=32;scalar=64"
Exec   : createPatch -parallel -decomposeParDict system/decomposeParDict.6 -overwrite
Date   : Feb 03 2020
Time   : 15:01:40
Host   : urepower8
PID    : 59302
I/O    : uncollated
Case   : /home/URE14/OpenFOAM/URE14-v1812/run/Max/Experiment_Fancurve
nProcs : 50
Hosts  :
(
    (urepower8 50)
)
Pstream initialized with:
    floatTransfer      : 0
    nProcsSimpleSum    : 0
    commsType          : nonBlocking
    polling iterations : 0
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Reading "system/createPatchDict"

Adding new patch fan_in as patch 8 from 
{
    type            cyclic;
    neighbourPatch  fan_out;
}

Adding new patch fan_out as patch 9 from 
{
    type            cyclic;
    neighbourPatch  fan_in;
}


Moving faces from patch fan to patch 8
Moving faces from patch fan_slave to patch 9

Doing topology modification to order faces.

[19] Cannot find point in pts1 matching point 6 coord:(-0.26609 0.000615407 0.193233) in pts0 when using tolerance 7.7534e-08
[19] Searching started from:0 in pts1
[19] Cannot find point in pts1 matching point 20 coord:(-0.266101 0.00184115 0.193226) in pts0 when using tolerance 7.7501e-08
[19] Searching started from:0 in pts1
[19] Cannot find point in pts1 matching point 18 coord:(-0.266099 0.00308022 0.193227) in pts0 when using tolerance 7.69666e-08
[19] Searching started from:0 in pts1
[19] Cannot find point in pts1 matching point 4 coord:(-0.266091 0.00431021 0.193232) in pts0 when using tolerance 7.67744e-08
[19] Searching started from:0 in pts1
[19] Cannot find point in pts1 matching point 0 coord:(-0.266108 0.00554009 0.193221) in pts0 when using tolerance 7.81904e-08 
etc......
This is the code for snappyHexMesh:
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 fan;
	}
    fanbox.stl
    {
        type triSurfaceMesh;
	name fanbox;
    }


}


// 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 4; }
    {   file "fanbox.eMesh"; level 4; }

    );



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

    refinementSurfaces
    {

        fanbox
        {
            // Surface-wise min and max refinement level
            level (6 6);

            // Optional specification of patch type (default is wall). No
            // constraint types (cyclic, symmetry) etc. are allowed.
            patchInfo
            {
                type wall;
                inGroups (URE14Group);
            }
        }
        fan
		{
			level (7 7);
			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
    {
        "(fanbox).*"
        {
            nSurfaceLayers 6;
        }
    }


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


// ************************************************************************* //
And this is the code for createPatch:
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 true;

// 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 0.000000000001;
        	}

        	// 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 fan;
    	}
    	{
        	// 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 fan_slave;
    	}
);
Would anyone know what the problem is? I can supply more information if needed.
Many thanks,
Max
Dikkeunit is offline   Reply With Quote

Reply

Tags
baffle-snappyhexmesh, createpatch, cyclic, fan bc, snappyhexmesh

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] Triangular elements in boundary layers generated by snappyHexMesh mike.franky OpenFOAM Meshing & Mesh Conversion 0 June 3, 2018 09:46
[snappyHexMesh] Help with Snappy: no layers growing GianF OpenFOAM Meshing & Mesh Conversion 1 December 12, 2017 04:44
[snappyHexMesh] snappyHexMesh problem shengqiming OpenFOAM Meshing & Mesh Conversion 0 December 15, 2016 08:35
[snappyHexMesh] SnappyHexMesh segmentation Fault nithishgupta OpenFOAM Meshing & Mesh Conversion 1 December 18, 2014 04:03
[snappyHexMesh] Boundary layer generation problems ivan_cozza OpenFOAM Meshing & Mesh Conversion 0 October 6, 2010 13:47


All times are GMT -4. The time now is 12:22.