RefineMesh

From OpenFOAMWiki

1 Name

refineMesh - Utility to refine cells in multiple directions .

Valid versions: OF Version 21.png

2 Synopsis

refineMesh [OPTIONS]

3 Description

Refine the all cells of the mesh by cutting them in 8 for a 3D mesh, respectively 4 for a 2D mesh. If you don't want to refine all the mesh or in all directions, you must write a dictionary system/refineMeshDict.

If the option -dict is specified, the refinement is applied on a cellSet according to the parameters specified in system/refineMeshDict. The example shipped with the source code (in $FOAM_TUTORIALS/combustion/fireFoam/les/oppositeBurningPanels/system/refineMeshDict) is reproduced below.

-dict

Refine the mesh according the parameters written in system/refineMeshDict

-overwrite

Overwrite the existing mesh files

-parallel

Run the utility in parallel

-roots "(DIR1 [...DIRN])"

Directories through which the data are distributed

-region NAME

Specify a mesh region by its NAME

-case DIR

Execute the command on the case directory DIR. If not provided, use the current directory

-noFunctionObjects

Skip the execution of the functionObjects

-help

Display the help and exit

This utility is used in the following tutorials:

  • combustion/fireFoam/les/oppositeBurningPanels
  • multiphase/cavitatingFoam/les/throttle
  • multiphase/cavitatingFoam/les/throttle3D
  • multiphase/cavitatingFoam/ras/throttle
  • multiphase/interFoam/les/nozzleFlow2D

4 refineMeshDict description

FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      refineMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Cells to refine; name of 'cellSet'
set             c0; 

// Type of coordinate system:
// - global : coordinate system same for every cell. Usually aligned with
//   x,y,z axis. Specify in globalCoeffs section below.
// - patchLocal : coordinate system different for every cell. Specify in
//   patchLocalCoeffs section below.
coordinateSystem global;

// Specifies 2 directions by a name and a vector. The normal direction is
// calculated as tan1^tan2
globalCoeffs
{
    tan1            ( 1 0 0 );
    tan2            ( 0 1 0 );
}

patchLocalCoeffs
{
    // Normal direction is face normal of zero'th face of patch
    patch           outside;
    tan1            ( 1 0 0 );
    tan2            ( 0 0 1 );
}

// Specifies the direction to be refined by the name used above
// To refine in the third direction, use the keyword 'normal'
directions      
(
    tan1
    normal
);

// Whether to use hex topology. This will
// - if patchLocal: all cells on selected patch should be hex
// - split all hexes in 2x2x2 through the middle of edges.
useHexTopology  yes; 

// Cut purely geometric (will cut hexes through vertices) or take
// topology into account. Incompatible with 'useHexTopology'
geometricCut    no;

// Write meshes from intermediate steps
writeMesh       no;