Guest User

Untitled

a guest
Jul 13th, 2023
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.39 KB | Software | 0 0
  1. /*--------------------------------*- C++ -*----------------------------------*\
  2.   =========                 |
  3.   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
  4.    \\    /   O peration     | Website:  https://openfoam.org
  5.     \\  /    A nd           | Version:  10
  6.      \\/     M anipulation  |
  7. \*---------------------------------------------------------------------------*/
  8. FoamFile
  9. {
  10.     format      ascii;
  11.     class       dictionary;
  12.     object      snappyHexMeshDict;
  13. }
  14. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  15.  
  16. // Which of the steps to run
  17. castellatedMesh true;
  18. snap            true;
  19. addLayers       true;
  20.  
  21.  
  22. // Geometry. Definition of all surfaces. All surfaces are of class
  23. // searchableSurface.
  24. // Surfaces are used
  25. // - to specify refinement for any mesh cell intersecting it
  26. // - to specify refinement for any mesh cell inside/outside/near
  27. // - to 'snap' the mesh boundary to the surface
  28. geometry
  29. {
  30.     motorBike
  31.     {
  32.         type triSurfaceMesh;
  33.         file "motorBike.obj";
  34.     }
  35.  
  36.     refinementBox
  37.     {
  38.         type searchableBox;
  39.         min (-1.3 0 -1.2);
  40.         max ( 0 0.5 1.2);
  41.     }
  42. };
  43.  
  44.  
  45.  
  46. // Settings for the castellatedMesh generation.
  47. castellatedMeshControls
  48. {
  49.  
  50.     // Refinement parameters
  51.     // ~~~~~~~~~~~~~~~~~~~~~
  52.  
  53.     // If local number of cells is >= maxLocalCells on any processor
  54.     // switches from from refinement followed by balancing
  55.     // (current method) to (weighted) balancing before refinement.
  56.     maxLocalCells 100000;
  57.  
  58.     // Overall cell limit (approximately). Refinement will stop immediately
  59.     // upon reaching this number so a refinement level might not complete.
  60.     // Note that this is the number of cells before removing the part which
  61.     // is not 'visible' from the keepPoint. The final number of cells might
  62.     // actually be a lot less.
  63.     maxGlobalCells 4000000;
  64.  
  65.     // The surface refinement loop might spend lots of iterations refining just a
  66.     // few cells. This setting will cause refinement to stop if <= minimumRefine
  67.     // are selected for refinement. Note: it will at least do one iteration
  68.     // (unless the number of cells to refine is 0)
  69.     minRefinementCells 30;
  70.  
  71.     // Allow a certain level of imbalance during refining
  72.     // (since balancing is quite expensive)
  73.     // Expressed as fraction of perfect balance (= overall number of cells /
  74.     // nProcs). 0=balance always.
  75.     maxLoadUnbalance 0.10;
  76.  
  77.  
  78.     // Number of buffer layers between different levels.
  79.     // 1 means normal 2:1 refinement restriction, larger means slower
  80.     // refinement.
  81.     nCellsBetweenLevels 2;
  82.  
  83.  
  84.  
  85.     // Explicit feature edge refinement
  86.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  87.  
  88.     // Specifies a level for any cell intersected by its edges.
  89.     // This is a featureEdgeMesh, read from constant/geometry for now.
  90.     features
  91.     (
  92.         {
  93.             file "motorBike.eMesh";
  94.             level 5;
  95.         }
  96.     );
  97.  
  98.  
  99.  
  100.     // Surface based refinement
  101.     // ~~~~~~~~~~~~~~~~~~~~~~~~
  102.  
  103.     // Specifies two levels for every surface. The first is the minimum level,
  104.     // every cell intersecting a surface gets refined up to the minimum level.
  105.     // The second level is the maximum level. Cells that 'see' multiple
  106.     // intersections where the intersections make an
  107.     // angle > resolveFeatureAngle get refined up to the maximum level.
  108.  
  109.     refinementSurfaces
  110.     {
  111.         motorBike
  112.         {
  113.             // Surface-wise min and max refinement level
  114.             level (4 5);
  115.  
  116.             // Optional specification of patch type (default is wall). No
  117.             // constraint types (cyclic, symmetry) etc. are allowed.
  118.             patchInfo
  119.             {
  120.                 type wall;
  121.                 inGroups (motorBikeGroup);
  122.             }
  123.         }
  124.     }
  125.  
  126.     // Resolve sharp angles
  127.     resolveFeatureAngle 30;
  128.  
  129.  
  130.     // Region-wise refinement
  131.     // ~~~~~~~~~~~~~~~~~~~~~~
  132.  
  133.     // Specifies refinement level for cells in relation to a surface. One of
  134.     // three modes
  135.     // - distance. 'levels' specifies per distance to the surface the
  136.     //   wanted refinement level. The distances need to be specified in
  137.     //   descending order.
  138.     // - inside. 'levels' is only one entry and only the level is used. All
  139.     //   cells inside the surface get refined up to the level. The surface
  140.     //   needs to be closed for this to be possible.
  141.     // - outside. Same but cells outside.
  142.  
  143.     refinementRegions
  144.     {
  145.         refinementBox
  146.         {
  147.             mode    inside;
  148.             level   3;
  149.         }
  150.     }
  151.  
  152.  
  153.     // Mesh selection
  154.     // ~~~~~~~~~~~~~~
  155.  
  156.     // After refinement patches get added for all refinementSurfaces and
  157.     // all cells intersecting the surfaces get put into these patches. The
  158.     // section reachable from the insidePoint is kept.
  159.     // NOTE: This point should never be on a face, always inside a cell, even
  160.     // after refinement.
  161.     insidePoint (-1.05001 0.4511111 0.0001);
  162.  
  163.  
  164.     // Whether any faceZones (as specified in the refinementSurfaces)
  165.     // are only on the boundary of corresponding cellZones or also allow
  166.     // free-standing zone faces. Not used if there are no faceZones.
  167.     allowFreeStandingZoneFaces true;
  168. }
  169.  
  170.  
  171.  
  172. // Settings for the snapping.
  173. snapControls
  174. {
  175.     //- Number of patch smoothing iterations before finding correspondence
  176.     //  to surface
  177.     nSmoothPatch 3;
  178.  
  179.     //- Relative distance for points to be attracted by surface feature point
  180.     //  or edge. True distance is this factor times local
  181.     //  maximum edge length.
  182.     tolerance 2.0;
  183.  
  184.     //- Number of mesh displacement relaxation iterations.
  185.     nSolveIter 20;
  186.  
  187.     //- Maximum number of snapping relaxation iterations. Should stop
  188.     //  before upon reaching a correct mesh.
  189.     nRelaxIter 5;
  190.  
  191.     // Feature snapping
  192.  
  193.         //- Number of feature edge snapping iterations.
  194.         //  Leave out altogether to disable.
  195.         nFeatureSnapIter 10;
  196.  
  197.         //- Detect (geometric only) features by sampling the surface
  198.         //  (default=false).
  199.         implicitFeatureSnap false;
  200.  
  201.         //- Use castellatedMeshControls::features (default = true)
  202.         explicitFeatureSnap true;
  203.  
  204.         //- Detect points on multiple surfaces (only for explicitFeatureSnap)
  205.         multiRegionFeatureSnap false;
  206. }
  207.  
  208.  
  209.  
  210. // Settings for the layer addition.
  211. addLayersControls
  212. {
  213.     // Are the thickness parameters below relative to the undistorted
  214.     // size of the refined cell outside layer (true) or absolute sizes (false).
  215.     relativeSizes true;
  216.  
  217.     // Per final patch (so not geometry!) the layer information
  218.     layers
  219.     {
  220.         "(lowerWall|motorBike).*"
  221.         {
  222.             nSurfaceLayers 1;
  223.         }
  224.     }
  225.  
  226.     // Expansion factor for layer mesh
  227.     expansionRatio 1.0;
  228.  
  229.     // Wanted thickness of final added cell layer. If multiple layers
  230.     // is the thickness of the layer furthest away from the wall.
  231.     // Relative to undistorted size of cell outside layer.
  232.     // See relativeSizes parameter.
  233.     finalLayerThickness 0.3;
  234.  
  235.     // Minimum thickness of cell layer. If for any reason layer
  236.     // cannot be above minThickness do not add layer.
  237.     // Relative to undistorted size of cell outside layer.
  238.     minThickness 0.1;
  239.  
  240.     // If points get not extruded do nGrow layers of connected faces that are
  241.     // also not grown. This helps convergence of the layer addition process
  242.     // close to features.
  243.     // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x)
  244.     nGrow 0;
  245.  
  246.     // Advanced settings
  247.  
  248.     // When not to extrude surface. 0 is flat surface, 90 is when two faces
  249.     // are perpendicular
  250.     featureAngle 60;
  251.  
  252.     // At non-patched sides allow mesh to slip if extrusion direction makes
  253.     // angle larger than slipFeatureAngle.
  254.     slipFeatureAngle 30;
  255.  
  256.     // Maximum number of snapping relaxation iterations. Should stop
  257.     // before upon reaching a correct mesh.
  258.     nRelaxIter 3;
  259.  
  260.     // Number of smoothing iterations of surface normals
  261.     nSmoothSurfaceNormals 1;
  262.  
  263.     // Number of smoothing iterations of interior mesh movement direction
  264.     nSmoothNormals 3;
  265.  
  266.     // Smooth layer thickness over surface patches
  267.     nSmoothThickness 10;
  268.  
  269.     // Stop layer growth on highly warped cells
  270.     maxFaceThicknessRatio 0.5;
  271.  
  272.     // Reduce layer growth where ratio thickness to medial
  273.     // distance is large
  274.     maxThicknessToMedialRatio 0.3;
  275.  
  276.     // Angle used to pick up medial axis points
  277.     // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
  278.     minMedianAxisAngle 90;
  279.  
  280.  
  281.     // Create buffer region for new layer terminations
  282.     nBufferCellsNoExtrude 0;
  283.  
  284.  
  285.     // Overall max number of layer addition iterations. The mesher will exit
  286.     // if it reaches this number of iterations; possibly with an illegal
  287.     // mesh.
  288.     nLayerIter 40;
  289. }
  290.  
  291.  
  292.  
  293. // Generic mesh quality settings. At any undoable phase these determine
  294. // where to undo.
  295. meshQualityControls
  296. {
  297.     #include "meshQualityDict"
  298. }
  299.  
  300.  
  301. // Advanced
  302.  
  303. // Write flags
  304. writeFlags
  305. (
  306.     scalarLevels
  307.     layerSets
  308.     layerFields     // write volScalarField for layer coverage
  309. );
  310.  
  311.  
  312. // Merge tolerance. Is fraction of overall bounding box of initial mesh.
  313. // Note: the write tolerance needs to be higher than this.
  314. mergeTolerance 1e-6;
  315.  
  316.  
  317. // ************************************************************************* //
Advertisement
Add Comment
Please, Sign In to add comment