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

[snappyHexMesh] Patches disappearing after SHM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 13, 2023, 04:38
Default Patches disappearing after SHM
  #1
New Member
 
Filippo Pucci
Join Date: Aug 2023
Posts: 17
Rep Power: 2
filpucfd is on a distinguished road
Good morning everyone,

I am trying to mesh a multiregion case with SnappyHexMesh.

My input STL files have already the definition of the inlet, outlet and wall sections of my fluid domains. I extract the solid domain giving the name "solid" to the blockMesh cellZone.

However, after I run the snappyhexmesh for castellatedmesh and snapping, my patches do not get read, although I define inlet and outlet as patches, and wall as wall.
I only get one patch, "inlet", which actually includes all the other patches (outlet, walls).

Does anyone know how I can actually get these patches to work as they should?

Does the bounding box of the blockMesh have to be greater than the one of the fluid domains or the same? or smaller?

Thank you in advance!

My snappyHexMeshDict:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2306                                 |
|   \\  /    A nd           | Website:  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       false;


radius #calc "0.1";
pipeThickness #calc "0.05 * $radius";
solRad #calc "$radius + $pipeThickness";


geometry
{
    
    unrem_fluid1_cat.stl
    {
    	type triSurfaceMesh; 
    	name fluid1;
    	
		
    	regions
    	{
    		inlet1  { name inlet1; };
    		outlet1 { name outlet1; };
    		walls1  { name walls1; };
    	}
		
    	
    }
	
    unrem_fluid2_cat.stl
    {
    	type triSurfaceMesh;
    	name fluid2;
    	
    	regions
    	{
			
    		inlet2  { name inlet2; };
    		outlet2 { name outlet2; };
    		walls2  { name walls2; };
		
    	}
    	
    }
}


// Settings for the castellatedMesh generation.
castellatedMeshControls
{

    // Refinement parameters
    // ~~~~~~~~~~~~~~~~~~~~~

   
    maxLocalCells 999999999;
    maxGlobalCells 999999999;


    minRefinementCells 0;

    nCellsBetweenLevels 2; //2
    
    //interfaceRefine true;
    maxLoadUnbalance 0.1;
    

    features
    (
    );



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

    // Specifies two levels for every surface. The first is the minimum level,
    // every cell intersecting a surface gets refined up to the minimum level.
    // The second level is the maximum level. Cells that 'see' multiple
    // intersections where the intersections make an
    // angle > resolveFeatureAngle get refined up to the maximum level.

    refinementSurfaces
    {
    	
        fluid1
        {
            // Surface-wise min and max refinement level
            level (0 0);
            
            regions 
            {
            
            	inlet1     { level ( 0 0 ); patchInfo { type patch; }; };
            	outlet1    { level ( 0 0  ); patchInfo { type patch; }; };
				walls1    { level ( 0 0  ); patchInfo { type wall; }; };
	    
            }
            
            faceZone fluid1;
            faceType boundary; //baffle
            cellZone fluid1;
            cellZoneInside inside;
            
        }
		
        fluid2
        {
            // Surface-wise min and max refinement level
            level (0 0);
			
            regions 
            {
            
            	inlet2     { level ( 0 0 ); patchInfo { type patch; }; };
            	outlet2    { level ( 0 0 ); patchInfo { type patch; }; };
				walls2     { level ( 0 0 ); patchInfo { type wall; }; };
			
            }
			
            faceZone fluid2;
            faceType boundary; //baffle boundary
            cellZone fluid2;
            cellZoneInside inside;
            
        }    
		
    }

    // Resolve sharp angles
    resolveFeatureAngle 0;
    

    // Region-wise refinement
    // ~~~~~~~~~~~~~~~~~~~~~~

   

    refinementRegions
    {
    }
    
    
    
    // Mesh selection
    // ~~~~~~~~~~~~~~

    // After refinement patches get added for all refinementSurfaces and
    // all cells intersecting the surfaces get put into these patches. The
    // section reachable from the locationInMesh is kept.
    // NOTE: This point should never be on a face, always inside a cell, even
    // after refinement.
    locationInMesh (0.0001 0.0001 0.0001); // Offset from (0 0 0) to avoid 
                                           //coinciding with face or edge

    // Whether any faceZones (as specified in the refinementSurfaces)
    // are only on the boundary of corresponding cellZones or also allow
    // free-standing zone faces. Not used if there are no faceZones.
    allowFreeStandingZoneFaces false; //false
	
	
}



// Settings for the snapping.
snapControls
{
    //- Number of patch smoothing iterations before finding correspondence
    //  to surface
    nSmoothPatch 3; // 15
    nSmoothInternal $nSmoothPatch; 

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

    //- Highly experimental and wip: number of feature edge snapping
    //  iterations. Leave out altogether to disable.
    //  Of limited use in this case since faceZone faces not handled.
    nFeatureSnapIter 10; //15
    
    implicitFeatureSnap false;
    explicitFeatureSnap false;
    multiRegionFeatureSnap true; //default false;
    
}
And the blockmesh
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  11
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    
    version	2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

scale 1;
convertToMeters 1;


radius #calc "0.1";
pipeThickness #calc "0.05 * $radius";
//solidR #calc "$radius + $pipeThickness";
radSolid #calc "$radius + $pipeThickness";
radSolidNeg #calc "-1.0 * $radSolid";
orthSolCoord #calc "0.3 * $radSolid";
orthSolCoordNeg #calc "-1.0 * $orthSolCoord";

radAngleCoord #calc "$radSolid * cos(degToRad(45))";
radAngleCoordNeg #calc "-1.0 * $radSolid * cos(degToRad(45))";

zMax 1.;
zMin 0.; //-0.2
zMaxB 1.52;
zMinA -0.52;
vertices
(
        //--------------- CENTRAL ------------------------//     
        //block0 http://www.wolfdynamics.com/wiki/meshing_OF_blockmesh.pdf
	($orthSolCoordNeg  $orthSolCoord   $zMin) //0
	($radAngleCoordNeg $radAngleCoord  $zMin) //1
	( $radAngleCoord $radAngleCoord  $zMin) //2
	( $orthSolCoord  $orthSolCoord   $zMin) //3
	($orthSolCoordNeg  $orthSolCoord   $zMax) //4
	($radAngleCoordNeg $radAngleCoord  $zMax) //5
	( $radAngleCoord $radAngleCoord  $zMax) //6
	( $orthSolCoord  $orthSolCoord   $zMax) //7
	
	//block1
	( $orthSolCoord  $orthSolCoordNeg   $zMin) //8
	( $radAngleCoord $radAngleCoordNeg  $zMin) //9
	( $orthSolCoord  $orthSolCoordNeg   $zMax) //10
	( $radAngleCoord $radAngleCoordNeg  $zMax) //11
	
	//block2 
	($orthSolCoordNeg  $orthSolCoordNeg   $zMin) //12
	($radAngleCoordNeg $radAngleCoordNeg  $zMin) //13
	($orthSolCoordNeg  $orthSolCoordNeg   $zMax) //14
	($radAngleCoordNeg $radAngleCoordNeg  $zMax) //15
	
	//--------------- NEGATIVE AND POSITIVE ------------------------// 
	// block0A ( 0, 1, 2, 3, 16, 17, 18, 19)
	// block0B ( 4, 5, 6, 7, 20, 21, 24, 25)
	($orthSolCoordNeg  $orthSolCoord   $zMinA) //16 n
	($radAngleCoordNeg $radAngleCoord  $zMinA) //17 n 
	( $radAngleCoord $radAngleCoord  $zMinA) //18 n
	( $orthSolCoord  $orthSolCoord   $zMinA) //19 n
	
	// block1A ( 8, 9,  22, 23)
	// block1B ( 10, 11, 28,29)
	($orthSolCoordNeg  $orthSolCoord $zMaxB) //20 p
	($radAngleCoordNeg $radAngleCoord $zMaxB) //21 p
	( $orthSolCoord  $orthSolCoordNeg  $zMinA) //22 n 
	( $radAngleCoord $radAngleCoordNeg   $zMinA) //23 n
	
	
	//block2A ( 12, 13, 26, 27) 
	//block2B ( 14, 15, 30, 31)
	($radAngleCoord $radAngleCoord  $zMaxB) //24 p
	($orthSolCoord  $orthSolCoord   $zMaxB) //25 p
	($orthSolCoordNeg  $orthSolCoordNeg   $zMinA) //26 n 
	($radAngleCoordNeg $radAngleCoordNeg  $zMinA) //27 n 
	($orthSolCoord  $orthSolCoordNeg   $zMaxB) //28 p
	($radAngleCoord $radAngleCoordNeg  $zMaxB) //29 p
	($orthSolCoordNeg  $orthSolCoordNeg   $zMaxB) //30 p
	($radAngleCoordNeg $radAngleCoordNeg  $zMaxB) //31 p
	
);


xcells 30; //20, 100
ycells 60;
zcells 120;

xcells1 30;
ycells1 30;
zcells1 120;

zcellsExt 60; //100

stretch 0.25;

blocks
(
	//--------------- CENTRAL ------------------------//    
        // block0
	hex (0 3 2 1 4 7 6 5) solid ($xcells $ycells $zcells) simpleGrading ( 1 $stretch 1 )  
	// block1
	hex (3 8 9 2 7 10 11 6) solid ($xcells $ycells $zcells) simpleGrading ( 1 $stretch 1 ) 
	// block2
	hex (8 12 13 9 10 14 15 11) solid ($xcells $ycells $zcells) simpleGrading ( 1 $stretch 1 ) 
	// block3
	hex (12 0 1 13 14 4 5 15) solid ($xcells $ycells $zcells) simpleGrading ( 1 $stretch 1 ) 
	// block4
	hex (0 12 8 3 4 14 10 7) solid ($xcells1 $ycells1 $zcells1) simpleGrading ( 1 1 1 ) 
	
	
	//--------------- NEGATIVE ------------------------//    
	// block0A
	hex (16 19 18 17 0 3 2 1)  ($xcells $ycells $zcellsExt) simpleGrading ( 1 $stretch 1 )  
	// block1A
	hex (19 22 23 18 3 8 9 2)  ($xcells $ycells $zcellsExt) simpleGrading ( 1 $stretch 1 ) 
	// block2A
	hex (22 26 27 23 8 12 13 9)  ($xcells $ycells $zcellsExt) simpleGrading ( 1 $stretch 1 ) 
	// block3A
	hex (26 16 17 27 12 0 1 13)  ($xcells $ycells $zcellsExt) simpleGrading ( 1 $stretch 1 ) 
	// block4A
	hex (16 26 22 19 0 12 8 3)  ($xcells1 $ycells1 $zcellsExt) simpleGrading ( 1 1 1 ) 
	
	//--------------- POSITIVE ------------------------//
	//block0B
	hex (4 7 6 5 20 25 24 21) ($xcells $ycells $zcellsExt) simpleGrading ( 1 $stretch 1 )  
	// block1B
	hex (7 10 11 6 25 28 29 24) ($xcells $ycells $zcellsExt) simpleGrading ( 1 $stretch 1 ) 
	// block2B
	hex (10 14 15 11 28 30 31 29) ($xcells $ycells $zcellsExt) simpleGrading ( 1 $stretch 1 ) 
	// block3B
	hex (14 4 5 15 30 20 21 31) ($xcells $ycells $zcellsExt) simpleGrading ( 1 $stretch 1 ) 
	// block4B
	hex (4 14 10 7 20 30 28 25) ($xcells1 $ycells1 $zcellsExt) simpleGrading ( 1 1 1 ) 
);

edges
(
	//--------------- CENTRAL ------------------------//    
	//block0 arc
	arc  1  2 ( 0 $radSolid $zMin )
	arc  5  6 ( 0 $radSolid $zMax )
	//block1 arc
	arc  2  9 ( $radSolid 0  $zMin )
        arc  6 11 ( $radSolid 0 $zMax )
	//block2 arc
	arc  9 13 ( 0 $radSolidNeg  $zMin )
        arc 11 15 ( 0 $radSolidNeg $zMax )
	//block3 arc
	arc  1 13 ( $radSolidNeg 0 $zMin )
        arc  5 15 ( $radSolidNeg 0 $zMax )
        
        
        //--------------- NEGATIVE ------------------------//    
        //block0A arc
	arc 17 18  ( 0 $radSolid $zMinA )
	//arc  1  2  ( 0 $radSolid $zMin )
	//block1A arc
	arc 18 23  ( $radSolid 0  $zMinA )
        //arc  2  9  ( $radSolid 0 $zMin )
	//block2A arc
	arc 23 27  ( 0 $radSolidNeg  $zMinA )
        //arc  9 13  ( 0 $radSolidNeg $zMin )
	//block3A arc
	arc 17 27  ( $radSolidNeg 0 $zMinA )
        //arc  1 13  ( $radSolidNeg 0 $zMin )
	
	
	//--------------- POSITIVE ------------------------//
	//block0A arc
	//arc  5  6 ( 0 $radSolid $zMax )
	arc 21 24 ( 0 $radSolid $zMaxB )
	//block1A arc
	//arc  6 11 ( $radSolid 0  $zMax )
        arc 24 29 ( $radSolid 0 $zMaxB )
	//block2A arc
	//arc 11 15 ( 0 $radSolidNeg  $zMax )
        arc 29 31 ( 0 $radSolidNeg $zMaxB )
	//block3A arc
	//arc  5 15 ( $radSolidNeg 0 $zMax )
        arc 21 31 ( $radSolidNeg 0 $zMaxB )
);

/*
defaultPatch
{
    type patch;
}
*/

boundary
(
	/*
	backFace
	{
		type empty;
		faces
		(
			(0 1 2 3)
			(2 3 8 9)
			(8 9 13 12)
			(13 12 0 1)
			(0 3 8 12)
		);
	}
	frontFace
	{
		type empty;
		faces
		(
			(4 5 6 7)
			(6 7 10 11)
			(15 11 10 14)
			(15 14 4 5)
			(4 7 10 14)
		);
	}
	*/
	//--------------- CENTRAL ------------------------//    
	
	heatingArea
	{
		type wall;
		faces
		(
			(1 5 6 2)
			(2 6 11 9)
			(9 11 15 13)
			(1 5 15 13)
			/*
			//pos
			(5 21 24 6)
			(6 24 29 11)
			(11 29 31 15)
			(5 21 31 15)
			//neg
			(17 1 2 18)
			(18 2 9 23)
			(23 9 13 27)
			(17 1 13 27)
			*/
		);
	}
	
	 negInlet
	{
		type empty;
		faces
		(
			(20 21 24 25)
			(24 25 28 29)
			(31 30 20 21)
			(20 25 28 30)
			(28 29 31 30)
		);
	}
	
	posOutlet
	{
		type empty;
		faces
		(
			(16 17 18 19)
			(18 19 22 23)
			(27 26 16 17)
			(16 19 22 26)
			(22 23 27 26)
		);
	} 
	
	 discard
	{
		type empty;
		faces
		(
			//POS
			(5 21 24 6)
			(6 24 29 11)
			(11 29 31 15)
			(5 21 31 15)
			
			//(16 17 18 19)
			//(18 19 22 23)
			//(27 26 16 17)
			//(16 19 22 26)
			//(22 23 27 26)
			// NEG
			(17 1 2 18)
			(18 2 9 23)
			(23 9 13 27)
			(17 1 13 27)
			
			//(20 21 24 25)
			//(24 25 28 29)
			//(31 30 20 21)
			//(20 25 28 30)
			//(28 29 31 30)
		);
	} 
	
);

mergePatchPairs
(
);

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

Last edited by filpucfd; November 13, 2023 at 05:53.
filpucfd is offline   Reply With Quote

Reply


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
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 92 May 21, 2024 07:56
Problem using AMI vinz OpenFOAM Running, Solving & CFD 298 November 13, 2023 08:19
[Other] [cfMesh] Error when creating AMI patches propeller gabrielfelix OpenFOAM Community Contributions 2 July 5, 2023 20:54
Possible bug with stitchMesh and cyclics in OpenFoam Jack001 OpenFOAM Pre-Processing 0 May 21, 2016 08:00
[snappyHexMesh] Boundaries condition in a sHM mesh (32770 undesired patches) MartinBlx OpenFOAM Meshing & Mesh Conversion 5 June 17, 2015 10:28


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