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] Using stl files with boundaryField (https://www.cfd-online.com/Forums/openfoam-meshing/233222-using-stl-files-boundaryfield.html)

Woo37830 January 18, 2021 13:04

Using stl files with boundaryField
 
I am trying to combine the roomWithRotatingFan ( minus the fan ), with the hotRoom tutorial. My problem is that I'm getting an error about finding patchField entries for various pieces. I'm using openFoam 2012, BTW.

blockMeshDict contains:
scale 1;

vertices
(
( -6.0 -0.5 -0.1)
( 0.5 -0.5 -0.1)
( 0.5 5.0 -0.1)
( -6.0 5.0 -0.1)
( -6.0 -0.5 2.9)
( 0.5 -0.5 2.9)
( 0.5 5.0 2.9)
( -6.0 5.0 2.9)
);

blocks
(
hex (0 1 2 3 4 5 6 7) (65 55 30) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
allBoundary
{
type patch;
faces
(
(3 7 6 2)
(0 4 7 3)
(2 6 5 1)
(1 5 4 0)
(0 3 2 1)
(4 5 6 7)
);
}
);

IN snappyHexMeshDict I have:

castellatedMesh true;
snap true;
addLayers false;

geometry
{
inlet.stl{ type triSurfaceMesh; name inlet;}
outlet.stl{ type triSurfaceMesh; name outlet;}
fixedWalls.stl{ type triSurfaceMesh; name fixedWalls;}
floor.stl{ type triSurfaceMesh; name floor;}
ceiling.stl{ type triSurfaceMesh; name ceiling;}
avatar.stl{ type triSurfaceMesh; name avatar;}
}

castellatedMeshControls
{
maxLocalCells 100000;
maxGlobalCells 8000000;
minRefinementCells 0;
maxLoadUnbalance 0.10;
nCellsBetweenLevels 2;

features
(
{ file "inlet.eMesh"; level 0;}
{ file "outlet.eMesh"; level 0;}
{ file "fixedWalls.eMesh"; level 0;}
{ file "avatar.eMesh"; level 1;}
{ file "floor.eMesh"; level 1;}
{ file "ceiling.eMesh"; level 1;}
);

refinementSurfaces
{
inlet{ level (0 0);}
outlet{ level (0 0);}
fixedWalls{ level (0 0);}
avatar{ level (1 1);}
floor{ level (1 1);}
ceiling{ level (1 1);}
}

resolveFeatureAngle 30;

refinementRegions
{
}

locationInMesh (0.1 0.0 0.01);
allowFreeStandingZoneFaces false;
}

surfaceFeatureExtractDict contains:

inlet.stl
{
extractionMethod extractFromSurface;
includedAngle 150;
}
outlet.stl
{
extractionMethod extractFromSurface;
includedAngle 150;
}
fixedWalls.stl
{
extractionMethod extractFromSurface;
includedAngle 150;
}
avatar.stl
{
extractionMethod extractFromSurface;
includedAngle 150;
}
floor.stl
{
extractionMethod extractFromSurface;
includedAngle 150;
}
ceiling.stl
{
extractionMethod extractFromSurface;
includedAngle 150;
}

And in 0.orig:

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
floor
{
type noSlip;
}

ceiling
{
type noSlip;
}

fixedWalls
{
type noSlip;
}
}

Any help identifying where I'm missing something or a place to look to clarify this would be appreciated.

petros January 20, 2021 10:26

Hi,

What is the error message that you get? From a first glance, it seems that you're missing the outlet and avatar patches in the 0.org directory.

Woo37830 January 20, 2021 10:36

Error message
 
Cannot find patchField entry for all allBoundary.
I added avatar and inlet, ceiling and floor to snappyHexMeshDict and to surfaceFeatureExtractDict and still get same error
When surfaceFeatureExtraction runs it shows allBoundary as created.

petros January 20, 2021 11:01

I see. The problem is that you have to remove the allBoundary entry. This is supposed to be done after you run

Code:

snappyHexMesh -overwrite
If you do run snappy with -overwrite and still get the allBoundary patch then it might help to run createPatch as it removes any patches with zero faces.

Best,
Petros

Woo37830 January 20, 2021 11:33

Removing allBoundary
 
I'm sorry, do you mean that blockMeshDict should NOT have:

scale 1;

vertices
(
( -6.0 -0.5 -0.1)
( 0.5 -0.5 -0.1)
( 0.5 5.0 -0.1)
( -6.0 5.0 -0.1)
( -6.0 -0.5 2.9)
( 0.5 -0.5 2.9)
( 0.5 5.0 2.9)
( -6.0 5.0 2.9)
);

blocks
(
hex (0 1 2 3 4 5 6 7) (65 55 30) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
allBoundary
{
type patch;
faces
(
(3 7 6 2)
(0 4 7 3)
(2 6 5 1)
(1 5 4 0)
(0 3 2 1)
(4 5 6 7)
);
}
);

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

Or, do you mean it should have that but remove it after running snappyHexMesh -overwrite?

I do run createPatch. Here is the last part of file I process with:

echo "Running blockMesh"
runApplication blockMesh
if [[ -e "constant/triMesh" ]]
then
echo "Running snappyHexMesh"
runApplication snappyHexMesh -overwrite

# - force removal of fields generated by snappy
rm -rf 0

# renumber the mesh
runApplication renumberMesh -overwrite

# - create the inlet/outlet and AMI patches
runApplication createPatch -overwrite
fi
echo "0/T.orig copied to 0/T"
cp 0/T.orig 0/T
echo "Running setFields"
runApplication setFields
# - set the initial fields
restore0
#----------------------------------------------
#runApplication decomposePar
#runParallel $(getApplication)
#runApplication reconstructPar
echo "Run $(getApplication)"
runApplication $(getApplication)
#----------------------------------------------
# convert output files to vtk for ParaView
foamToVTK



I really appreciate your help, BTW!

Woo37830 January 20, 2021 11:42

Removing allBoundary
 
If I remove allBoundary in blockMeshDict entirely from the beginning i get:

Code:

--> FOAM FATAL ERROR: (openfoam-2012)
Cannot find file "points" in directory "polyMesh" in times "0" down to constant


petros January 20, 2021 11:54

No you shouldn't remove the allBoundary entry from blockMeshDict. This creates the background mesh where snappyHexMesh will work on.

I will try to summarise the key points you need to satisfy:
  • Your allBoundary box should be larger than your stl geometries
  • You should place the locationMesh in snappyHexMesh inside your main geometry
  • Then I think snappyHexMesh -overwrite will do the job

In any case, if you study carefully the rotatingFanInRoom tutorial I am sure you will find your answers.

Best,
Petros

Woo37830 January 20, 2021 11:55

Explanation would be helpful
 
I think the problem I'm having is that I started with a tutorial hotRoom.

In that the simple box vertices, edges, faces etc. are in blockMeshDict and allBoundary referred to those. I'm trying to move to solving the same problem, but using stl files as input. Thus, the original blockMeshDict doesn't really describe the geometry as it is in the stl files. So, if I have stl files for floor, ceiling, and fixedWalls, how to I write blockMesh to handle that? I'm trying to automate feeding in different sets of stl files describing ceiling, floor, and fixed walls, then produce if necessary the blockMeshDict, etc. then run pimpleFoalm on the model generated this way.

Any suggestions on how to accomplish this?

petros January 20, 2021 11:58

See my previous post. I think it has all the information. All in all, you need to adjust your background mesh to enclose your stl geometry.


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