Creating a Field Function for Mesh Refinement

The first step in field function mesh refinement is to create a field function that returns the mesh size with respect to an appropriate solution quantity.

In this example, if the turbulent kinetic energy is greater than 4 J/kg, the mesh size is 0.1 m; otherwise it is 5 m.

Note

It is important to consider your initial mesh resolution when creating a mesh refinement field function. If your initial mesh is coarse, define a field function that ensures you get a smooth variation in cell sizes. A refinement field function that defines an abrupt change in cell sizes results in poor mesh grading and quality.

To create a field function:

  1. Right-click the Automation > Field Function manager and select New > Scalar.

  2. Select the Field Function node and click the ellipsis next to the Definition property.
    • In this example, the field function name is Mesh Size.

    You are recommended to apply the following conditions when creating and using a field function:
    • A field function must be cell-based and return a scalar value
    • To minimize the time taken to iterate a step, consider a cell size based on the initial mesh resolution
    • Specify a field function that does not over refine the mesh
    • To achieve an optimal mesh, run the solution for at least 100 to 200 iterations per step to partially converge it
  3. In the Field Function - Definition dialog, enter a conditional expression that returns the mesh size with respect to a solution characteristic.

  4. Click OK to save the field function definition.
    Note The mesh size units are always meters; regardless of the preferred length unit.
  5. Next, you can assign this field function directly to the mesher or use it to create an internal table for mesh refinement.

There are a number of differences between field function and mesh refinement table. The most notable difference is that field function refinement is a significantly faster method and uses less memory. Using the field function refinement directly is more precise than the mesh refinement table and generates fewer mesh cells. Creating a table from a field function before using the table for mesh refinement does not produce the same mesh as using the field function directly.

In order to achieve an optimal mesh in minimum time, you should carry out multiple refinement and solution iterations.