|
[Sponsors] |
March 7, 2018, 21:33 |
about Hex at blockMeshDict
|
#1 |
New Member
Arisna Fauzia
Join Date: Feb 2018
Location: Aceh, Indonesia
Posts: 3
Rep Power: 8 |
Hello everyone,
Could you explain to me about hex ? for instance : blocks ( hex (0 1 5 4 12 13 17 16) (23 8 1) simpleGrading (1 1 1) hex (2 3 7 6 14 15 19 18) (19 8 1) simpleGrading (1 1 1) ... I dont know about (23 8 1), do you know? please tell me, thank you! |
|
March 7, 2018, 22:40 |
|
#2 |
Senior Member
Join Date: Aug 2013
Posts: 407
Rep Power: 16 |
Hi,
(23 8 1) in this case means 23 cells in the first direction (x or x1, however you want to call it), 8 cells in the second direction (y or x2) and 1 cell in the third direction (z or x3) You can find the details here: https://cfd.direct/openfoam/user-guide/blockmesh/ Cheers, Antimony |
|
March 8, 2018, 06:48 |
|
#3 | |
New Member
Arisna Fauzia
Join Date: Feb 2018
Location: Aceh, Indonesia
Posts: 3
Rep Power: 8 |
Thank you for your explain.
oh i see, that is to get the grid in 1 box or 1 volume ? best, arisna Quote:
|
||
May 31, 2018, 23:36 |
|
#4 |
Member
Andrew O. Winter
Join Date: Aug 2015
Location: Seattle, WA, USA
Posts: 78
Rep Power: 11 |
Those 3 numbers of cells in the x, y, and z directions only apply to a single hex. In your example, you have 2 hexes with each one having the same numbers of cells in the y and z directions, but different numbers of cells in the x direction. You would want the y and z cell numbers to be the same if you intended to connect the two hexes as a single mesh object. This approach is called face matching with the alternative being face merging; however, without seeing the rest of your blockMeshDict it is impossible to tell if this is the case. If you have more questions, you should post the entire blockMeshDict in a code block so it's easy to read.
|
|
August 31, 2018, 03:41 |
flow on the sharp crested triangle weir
|
#5 |
New Member
ceren cilavdaroğlu
Join Date: Aug 2018
Location: Turkey
Posts: 6
Rep Power: 8 |
i have a triangle weir. i am trying execute blockmeshdict. this is 3D. i cant do that unfortunately.
have you done it before or like this? i need guidance.. https://swmm5.org/2016/09/04/weir-background-equations-for-swmm5-and-infoswmm/ Last edited by ceren; September 1, 2018 at 05:18. Reason: i tried edding picture |
|
August 31, 2018, 16:03 |
|
#6 |
Member
Andrew O. Winter
Join Date: Aug 2015
Location: Seattle, WA, USA
Posts: 78
Rep Power: 11 |
Hi Ceren,
Can you post the details of your geometry and the blockMeshDict that you attempted to use? Then I can try to help you. As an initial suggestion though, if you want to make a triangular shaped hex region, you need to collapse nodes on top of each other so that 2 pairs of nodes overlap. This is demonstrated in the OpenFOAM User Guide (see image below). Your blockMeshDict entries for such a hex would be something like... hex (0 1 2 3 4 5 5 4) and the "collapsed" patch has an area of zero, which means you should give it the empty boundary condition for files in your 0 directory. The patches describing the hex faces should be something like... (0 1 2 3) (1 2 5 5) (0 3 4 4) (0 1 5 4) (2 5 4 3) (4 5 5 4) A more complete description can be found at... https://cfd.direct/openfoam/user-guide/v6-blockmesh/ ...and looking at section 5.3.5 Creating blocks with fewer than 8 vertices. Best, Andrew |
|
August 31, 2018, 16:18 |
|
#7 |
Member
Andrew O. Winter
Join Date: Aug 2015
Location: Seattle, WA, USA
Posts: 78
Rep Power: 11 |
Also, it might make some sense to just make a large rectangular channel using blockMesh and then import an .stl surface file that has your weir geometry using snappyHexMesh. I had forgotten what a triangle weir looks like and it might be a bit annoying to do using blockMesh alone.
You can make a 3D solid in a program like Autodesk's Inventor and then export it as an .stl file (stereolithography file, which makes a surface out of triangles using unit normal vectors and the coordinates of the triangle corner points). However, before using snappyHexMesh, you would need to extract data from the .stl file using the surfaceFeatureExtract command. Also, your .stl file would need to be placed in <yourCaseDirectory>/constant/trisurface and then you need surfaceFeatureExtractDict in <yourCaseDirectory>/system along with all of the other necessary files. Then you can build the case with the following commands... blockMesh surfaceFeatureExtract snappyHexMesh setFields If your model is very complex in terms of the amount cells you want to use or you want to refine certain regions a lot, then you can run snappyHexMesh in parallel as follows... decomposePar -copyZero mpirun -np <numberOfProcessors> snappyHexMesh -parallel reconstructParMesh -mergeTol 1e-06 -time <lastestTime> reconstructPar -time <latestTime> In the above commands, "latestTime" = (number of snappyHexMesh operations)*(time step from controlDict). The 3 possible snappyHexMesh operations are "castellatedMesh", "snap", and "addLayers", which are specified to be either true or false at the beginning of snappyHexMeshDict. The number of these operations that are set to be true is the amount to use when determining "latestTime". Good luck! |
|
September 1, 2018, 05:26 |
|
#8 |
New Member
ceren cilavdaroğlu
Join Date: Aug 2018
Location: Turkey
Posts: 6
Rep Power: 8 |
https://swmm5.files.wordpress.com/2016/09/image0096.jpg
hi Andrew, thank you for your answer. i tried adding picture. i am checking over your writing. I hope I can solve this problem. thanks again. ceren Last edited by ceren; September 1, 2018 at 05:27. Reason: about picture |
|
September 17, 2018, 22:00 |
Triangular Weir Example
|
#9 |
Member
Andrew O. Winter
Join Date: Aug 2015
Location: Seattle, WA, USA
Posts: 78
Rep Power: 11 |
Hey Ceren,
I had a chance to look over the triangular weir problem a bit more and make a demonstration of how to execute the suggestions I gave in my previous post. I attached the case directory I created so you can directly see everything discussed below. I used Autodesk's Inventor to draw the triangular weir shape with lines to create a closed shape outline and then extruded this shape as a 3D solid. Next I used the export option to save the model as an .stl file, which is how it should be saved for use with OpenFOAM. The image below illustrates the result of these steps. Triangle Weir Outline with Extruded 3D Solid: To create this example, the weirOverflow tutorial, for which the path should be something like ./OpenFOAM-x.x/tutorials/multiphase/interFoam/RAS/weirOverflow, where x.x is the version number, was copied and heavily modified to create what I hope is a reasonably straightforward example. In the constant directory, a directory named triSurface was added. Then the weir .stl file, TriangleWeir.stl, was placed in the triSurface directory. Additionally, the gravity file g was adjusted to be (0 0 -9.81) so that the acceleration vector was acting in the negative z-axis direction instead of the negative y-axis direction. This was necessary based on the coordinate system I chose to draw the triangle weir in. Next, the geometry and initial condition files were modified as described below. Note that the files decomposePar, meshQualityDict, surfaceFeatureExtractDict, and snappyHexMeshDict were added to the system directory of the tutorial. Also, the headers and all comments were omitted for each file in this post to save space, but they are included in the attached case files. Additionally, the domain was resized to be 2.0 m long (x-direction), 1.0 m wide (y-direction), and 1.0 m tall (z-direction) with the weir (25 mm thick in x-dir., 1.0 m wide in y-dir., 0.5 m tall in z-dir. with a 90 degree triangle that had its bottom 0.25 m above the bottom of the channel) placed in the middle of the channel. In the system directory, the following files were modified or added: blockMeshDict: Code:
convertToMeters 1; xI -1; xJ 1; yI -0.5; yJ 0.5; zI 0.0; zJ 1.0; vertices ( ($xI $yI $zI) ($xJ $yI $zI) ($xJ $yJ $zI) ($xI $yJ $zI) ($xI $yI $zJ) ($xJ $yI $zJ) ($xJ $yJ $zJ) ($xI $yJ $zJ) ); blocks ( hex (0 1 2 3 4 5 6 7) (100 50 50) simpleGrading (1 1 1) ); edges ( ); patches ( patch inlet ( (0 4 7 3) ) patch outlet ( (1 2 6 5) ) wall bottom ( (0 3 2 1) ) wall right ( (0 1 5 4) ) wall left ( (3 7 6 2) ) patch atmosphere ( (4 5 6 7) ) ); mergePatchPairs ( ); Code:
defaultFieldValues ( volScalarFieldValue alpha.water 0 ); regions ( boxToCell { box (-1 -0.5 0) (0 0.5 0.2); fieldValues ( volScalarFieldValue alpha.water 1 ); } ); Code:
// Which of the steps to run castellatedMesh true; snap true; addLayers false; geometry { TriangleWeir { type triSurfaceMesh; file "TriangleWeir.stl"; } }; castellatedMeshControls { maxLocalCells 10000000; maxGlobalCells 200000000; minRefinementCells 0; nCellsBetweenLevels 3; features ( ); refinementSurfaces { TriangleWeir { level (2 2); patchInfo { type wall; } } } // Resolve sharp angles resolveFeatureAngle 30; refinementRegions { } locationInMesh (0.314159 0.314159 0.314159); allowFreeStandingZoneFaces true; } snapControls { nSmoothPatch 10; // or 15; tolerance 4.0; // or 0.1; nSolveIter 30; nRelaxIter 10; nFeatureSnapIter 20; implicitFeatureSnap false; explicitFeatureSnap true; multiRegionFeatureSnap false; } addLayersControls { relativeSizes true; layers { suplat { nSurfaceLayers 2; } } expansionRatio 1.0; finalLayerThickness 0.3; minThickness 0.1; nGrow 0; featureAngle 60; slipFeatureAngle 30; nRelaxIter 3; nSmoothSurfaceNormals 1; nSmoothNormals 3; nSmoothThickness 10; maxFaceThicknessRatio 0.5; maxThicknessToMedialRatio 0.3; minMedianAxisAngle 90; nBufferCellsNoExtrude 0; nLayerIter 50; } meshQualityControls { #include "meshQualityDict" nSmoothScale 10; errorReduction 0.9; } mergeTolerance 1e-6; Code:
// Include defaults parameters from master dictionary #includeEtc "caseDicts/meshQualityDict" minFaceWeight 0.02; Code:
TriangleWeir.stl { extractionMethod extractFromSurface; extractFromSurfaceCoeffs { includedAngle 180; } subsetFeatures { nonManifoldEdges no; openEdges yes; } writeObj yes; } Code:
numberOfSubdomains 32; method scotch; simpleCoeffs { n ( 4 2 2 ); delta 0.001; } hierarchicalCoeffs { n ( 1 1 1 ); delta 0.001; order xyz; } metisCoeffs { processorWeights ( 1 1 1 1 ); } manualCoeffs { dataFile ""; } distributed no; roots (); include/initialConditions: Code:
inletFlowRate 0.02451; pressure 0; turbulentKE 4.14e-03; turbulentEpsilon 4.39e-05; alpha.water: Code:
#include "include/initialConditions" dimensions [0 0 0 0 0 0 0]; internalField uniform 0; boundaryField { inlet { type variableHeightFlowRate; lowerBound 0; upperBound 1; value uniform 0; } outlet { type zeroGradient; } bottom { type zeroGradient; } left { type zeroGradient; } right { type zeroGradient; } atmosphere { type inletOutlet; inletValue uniform 0; value uniform 0; } TriangleWeir { type zeroGradient; } defaultFaces { type empty; } } Code:
#include "include/initialConditions" dimensions [0 2 -3 0 0 0 0]; internalField uniform $turbulentEpsilon; boundaryField { inlet { type fixedValue; value $internalField; } outlet { type zeroGradient; //type inletOutlet; //inletValue $internalField; //value $internalField; } bottom { type epsilonWallFunction; value $internalField; } left { type epsilonWallFunction; value $internalField; } right { type epsilonWallFunction; value $internalField; } atmosphere { type inletOutlet; inletValue $internalField; value $internalField; } TriangleWeir { type epsilonWallFunction; value $internalField; } defaultFaces { type empty; } } Code:
#include "include/initialConditions" dimensions [0 2 -2 0 0 0 0]; internalField uniform $turbulentKE; boundaryField { inlet { type fixedValue; value $internalField; } outlet { type zeroGradient; //type inletOutlet; //inletValue $internalField; //value $internalField; } bottom { type kqRWallFunction; value $internalField; } left { type kqRWallFunction; value $internalField; } right { type kqRWallFunction; value $internalField; } atmosphere { type inletOutlet; inletValue $internalField; value $internalField; } TriangleWeir { type kqRWallFunction; value $internalField; } defaultFaces { type empty; } } Code:
dimensions [0 2 -1 0 0 0 0]; internalField uniform 0; boundaryField { inlet { type calculated; value uniform 0; } outlet { type calculated; value uniform 0; } bottom { type nutkWallFunction; value uniform 0; } left { type nutkWallFunction; value uniform 0; } right { type nutkWallFunction; value uniform 0; } atmosphere { type calculated; value uniform 0; } TriangleWeir { type nutkWallFunction; value uniform 0; } defaultFaces { type empty; } } Code:
#include "include/initialConditions" dimensions [1 -1 -2 0 0 0 0]; internalField uniform $pressure; boundaryField { inlet { type zeroGradient; } outlet { type fixedValue; value uniform 0; //type zeroGradient; } bottom { type fixedFluxPressure; } left { type fixedFluxPressure; } right { type fixedFluxPressure; } atmosphere { type totalPressure; p0 uniform 0; } TriangleWeir { type fixedFluxPressure; } defaultFaces { type empty; } } Code:
#include "include/initialConditions" dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { inlet { type variableHeightFlowRateInletVelocity; flowRate $inletFlowRate; alpha alpha.water; value uniform (0 0 0); } outlet { type zeroGradient; } bottom { type noSlip; } left { type noSlip; } right { type noSlip; } atmosphere { type pressureInletOutletVelocity; value uniform (0 0 0); } TriangleWeir { type noSlip; } defaultFaces { type empty; } } Code:
rm -r 0 cp -r 0.org 0 blockMesh > log.blockMesh surfaceFeatureExtract > log.surfFeatExt decomposePar -copyZero > log.decompPar_sHM mpirun -np 32 snappyHexMesh -parallel > log.sHM reconstructParMesh -mergeTol 1e-06 -time '0.002' > log.sHMreconParMesh reconstructPar -time '0.002' > log.reconPar_sHM cp -r ./0.002/polyMesh/* ./constant/polyMesh rm -r ./0.002 rm -r processor* setFields > log.setFields decomposePar > log.decompPar_run mpirun -np 32 interFoam -parallel > log.interFoam 2>&1 Finally, a pretty result image! This image was generated for the system state at 9 seconds of simulated time (I changed the writeInterval parameter in ./system/controlDict to be 1 instead of 2). Also, the surface was shaded according to the velocity magnitude. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blockMesh] --> FOAM FATAL ERROR: Trying to specify a boundary face | A.A. | OpenFOAM Meshing & Mesh Conversion | 41 | June 26, 2020 08:06 |
[blockMesh] Openfoam: Meshing, where do my defaultFaces come from | syntex | OpenFOAM Meshing & Mesh Conversion | 19 | December 10, 2018 08:21 |
[Other] mergeMatchPairs with arcs | vainilreb | OpenFOAM Meshing & Mesh Conversion | 1 | August 5, 2013 09:11 |
[blockMesh] apparently the mesh doesn't want to be created in one direction | Maxime Thomas | OpenFOAM Meshing & Mesh Conversion | 1 | August 18, 2012 07:05 |
CheckMeshbs errors | ivanyao | OpenFOAM Running, Solving & CFD | 2 | March 11, 2009 03:34 |