How To Refine Mesh In OpenFOAM
Mesh refinement region | created with blockMeshdict | by virengos.com

How To Refine Mesh In OpenFOAM

TASK DESCRIPTION

OpenFOAM CFD Case. In order to investigate the mesh independence: some extra refinement region are required for the mesh which has been created with the blockMeshDict.

SOLUTION

  • Firstly, define the required refinement geometries in the system/topoSetDict file
  • Secondly, add all the refinement sets -geometries for refinement- to the system/refineMeshDict file
  • create the mesh by using the blockMesh command
  • run the command refineMesh
  • Last but not least, check the results with ParaView

The picture below only shows the basic approach, how to refine mesh in OpenFOAM. However, some additional tuning will be required to gain better results.

Rectangular mesh refinement region | created with blockMeshdict in OpenFOAM
Mesh refinement region | created with blockMeshdict | by virengos.com
How to create a box source in ParaView software from Kitware | animated GIF
How to find out object dimensions in ParaView | virengos.com

topoSetDict (Example)

/*——————————–*- C++ -*———————————-*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*—————————————————————————*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
{
name ref_sphere;
type cellSet;
action new;
source sphereToCell;
sourceInfo
{
centre (0.02 0 0);
radius 0.01;
}
}

// // Cells with cell centre within box
{
name ref_box;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (0.01 -0.005 0) (0.03 0.005 0.02);
}
}

);

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

refineMeshDict (Example)

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

// Cells to refine; name of ‘cellSet’
set ref_box;

// 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 0 1 );
}

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;

DOCUMENTATION

To summarize, the exact configuration of the setting files depends on your case. For more documentation please check either the official OpenFOAM documentation:

As well as that, a bunch of additional examples can be found on the Internet:

In case, you are looking for some additional engineering tools:for example, to streamline your simulation work-flows, check our list

Disclaimer:
This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software via www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® trade marks.

Please follow and like us: