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

[snappyHexMesh] 3D model multiple parts on snappyHexMesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 30, 2020, 07:35
Default 3D model multiple parts on snappyHexMesh
  #1
Member
 
X
Join Date: Jan 2019
Posts: 63
Rep Power: 7
mcfdma is on a distinguished road
Hello. Can anyone guide me on how to use snappyHexMesh for a 3D model going from Fig3 to Fig6?
Fig3.JPG
Fig6.JPG

To avoid complexity and get a good understanding, I have started off simple.

1. Using Solidworks, I made a cylinder (with thickness), extruded it and made a shell at the outlet end to allow fluid to enter. I also created a second unattached body (extractor ring) further downstream using reference plane geometry as shown in the figure. I saved it as a single stl file (ASCII and refine). The inlet side is closed as I assume it will help me make that surface as patch.
pip4.PNG
pip4_2.PNG

2. Following WolfDynamics and few other youtube videos, I use:
a. surfaceAutoPatch geometry/combined.stl output.stl 150 to get 9 patches (0 - 8)
patch0 - outer cylinder wall
patch1 - exit of cylinder (ring)
patch2 - inlet: back end of outer cylinder (fully covered)
patch3 - inner cylinder wall
patch4 - inlet: back end of inner cylinder
patch 5 - back extractor ring
patch6 - front extractor ring (facing the cylinder)
patch 7 -outer ring, patch8 - inner ring.

b. I am able to get view the two parts and patches on paraview using output.stl
own.JPG
c. The issue comes when I do snappyHexMesh -overwrite where I am getting the issue.
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.x                                   |
|   \\  /    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;
snap            true;
addLayers       true;

geometry
{
    output.stl
    {
        type triSurfaceMesh;
        name mixing_elbow;
         

// First entry in named region in the STL file
// Second entry is user-defined patch name
        regions
        {
            patch0 {name emitter;}
            patch1 {name emitter;}
            patch2 {name emitter;}
            patch3 {name emitter;}
            patch4 {name inlet;}
            patch5 {name extractor;}
            patch6 {name extractor;}
            patch7 {name extractor;}
            patch8 {name extractor;}
        }
    }

};

// Settings for the castellatedMesh generation.
castellatedMeshControls
{
    // Refinement parameters
    maxLocalCells 			100000;
    maxGlobalCells 			20000000;
    minRefinementCells 			10;
    maxLoadUnbalance 			0.10;
    nCellsBetweenLevels 		2;
    allowFreeStandingZoneFaces 		true;
    resolveFeatureAngle 		30;		
    planarAngle 			30;


    // Explicit feature edge refinement
    features
    (
        { file "pip4.eMesh"; level 0; }
    );

    // Surface based refinement
    refinementSurfaces
    {
        mixing_elbow
        {
            // Global surface-wise min and max refinement level
            level (0 0);

            // Local surface-wise min and max refinement level
			// You will need to use the name given in the STL file
            regions
			{
            	"(patch0|patch1|patch2|patch3)"	//emitter
                { level (1 1); patchInfo { type wall; } }

            	patch4				//inlet 
                { level (1 1); patchInfo { type patch; } }

            	"(patch5|patch6|patch7|patch8)"	//pipe
                { level (1 1); patchInfo { type wall; } }
			}
        }
    }


    // Region-wise refinement
    refinementRegions
    {
        mixing_elbow
        {
            mode distance;		//distance, inside, outside
            levels ((1e-4 0));
        }
    }


    // Mesh selection
    locationInMesh (0 18 20); 

}

// Settings for the snapping.
snapControls
{
    nSmoothPatch 	3;
    tolerance 		2.0;
    nSolveIter 		100;
    nRelaxIter 		5;

    // Feature snapping
	nFeatureSnapIter 10;

	implicitFeatureSnap false;
	explicitFeatureSnap true;

	// Detect features between multiple surfaces
	// (only for explicitFeatureSnap, default = false)
	multiRegionFeatureSnap false;
}

// Settings for the layer addition.
addLayersControls
{
    relativeSizes 		true;
	expansionRatio 		1.2;
	finalLayerThickness 	0.5;
	minThickness 		0.01;

    layers
    {
        pipe { nSurfaceLayers 5; }
    }


    // Advanced settings
    featureAngle 			30;	
    slipFeatureAngle 			30;

    nGrow 				0;

    nLayerIter 				50;
    nRelaxedIter 			20;
    nRelaxIter 				5;

    nSmoothSurfaceNormals 		1;
    nSmoothNormals 			3;
    nSmoothThickness 			10;
    maxFaceThicknessRatio 		0.5;
    maxThicknessToMedialRatio 		0.3;

    minMedialAxisAngle 			90;
    minMedianAxisAngle 			90;
    nMedialAxisIter           		10;

    nBufferCellsNoExtrude 		0;
    additionalReporting 		false;
}

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

    relaxed
    {
        maxNonOrtho 75;
    }

    //minFlatness 0.5;

    // Advanced
    nSmoothScale 4;
    errorReduction 0.75;
}

// Advanced
debug 0;

//// Debug flags
debugFlags
(
    //mesh            // write intermediate meshes
    //intersections   // write current mesh intersections as .obj files
    //featureSeeds    // write information about explicit feature edge 

refinement
    //attraction      // write attraction as .obj files
    //layerInfo       // write information about layers
);

//// Write flags
writeFlags
(
    //scalarLevels    // write volScalarField with cellLevel for postprocessing
    //layerSets       // write cellSets, faceSets of faces in layer
    //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;

// ************************************************************************* //
For some reason, I am getting the mesh cylinder but the extractor ring disappears? Could this be due to locationInMesh where I just mentioned the cylinder?

Any help is appreciated. Thank you
mcfdma is offline   Reply With Quote

Old   September 30, 2020, 07:38
Default
  #2
Member
 
X
Join Date: Jan 2019
Posts: 63
Rep Power: 7
mcfdma is on a distinguished road
Fig 4 shows the extractor ring which isn't present in Fig 3 or Fig6.
Fig3-5.png
mcfdma is offline   Reply With Quote

Old   October 3, 2020, 20:59
Default
  #3
Senior Member
 
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 151
Rep Power: 10
Marpole is on a distinguished road
You may need to mesh them separately, i.e making two meshes: one is for the cylinder and one for the ring.
Marpole is offline   Reply With Quote

Reply

Tags
3d model, openfoam, snappy hex mesh, solidworks


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] Creating multiple unconnected solid elements with snappyHexMesh Goddi OpenFOAM Meshing & Mesh Conversion 1 May 12, 2019 10:12
[snappyHexMesh] Creating multiple multiple cell zones with snappyHexMesh - a newbie in deep water! divergence OpenFOAM Meshing & Mesh Conversion 0 January 23, 2019 05:17
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 07:20
Overflow Error in Multiphase Modelling with Two Continuous Fluids ashtonJ CFX 6 August 11, 2014 15:32
about Subgrid-scale model impecca OpenFOAM Running, Solving & CFD 4 December 20, 2013 11:36


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