mesh grid
increased resolution
computational methods
location computation
numerical analysis

How to compute locations of mesh points when resolution is increased?

Data Structures & Algorithms practice on Codemia

Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.

Practice algorithms

When it comes to computational modeling and simulations, representing a continuous domain using discrete mesh points is a fundamental aspect, particularly in fields like computational fluid dynamics, structural analysis, and electromagnetics. Increasing the resolution of a mesh, i.e., refining the mesh, involves creating additional mesh points to achieve more precise simulations. In this article, we will delve into the methodology for computing the locations of these additional mesh points when resolution is increased.

The Basics of Meshing

Meshing divides a continuous domain into a finite set of elements, typically triangles or quadrilaterals in 2D, and tetrahedra or hexahedra in 3D. The accuracy of numerical simulations heavily depends on the quality and resolution of the mesh. Increasing the mesh resolution generally reduces the discretization error, leading to more accurate results.

Types of Mesh Refinement

There are primarily two types of mesh refinement:

  1. Uniform Refinement: This involves dividing each element of the mesh into smaller elements of equal size. It is straightforward but can significantly increase the number of elements and computational cost.
  2. Adaptive Refinement: Elements are selectively refined based on specific criteria, such as error estimation or areas of interest in the simulation. This type enables efficient resource use by refining only where necessary.

Methods to Compute New Mesh Points

Uniform Refinement

In uniform mesh refinement, each element is subdivided into smaller, equally sized elements. Here's how you can compute the new mesh points:

  1. 2D Meshes:
    For a triangular element with vertices at coordinates (x1,y1)(x_1, y_1), (x2,y2)(x_2, y_2), and (x3,y3)(x_3, y_3):
    • Midpoints for each edge are computed as follows:
      • Edge 1-2: ((x1+x2)/2,(y1+y2)/2)((x_1 + x_2)/2, (y_1 + y_2)/2)
      • Edge 2-3: ((x2+x3)/2,(y2+y3)/2)((x_2 + x_3)/2, (y_2 + y_3)/2)
      • Edge 3-1: ((x3+x1)/2,(y3+y1)/2)((x_3 + x_1)/2, (y_3 + y_1)/2)
    • Use these midpoints to create four smaller triangles within the original triangle.
  2. 3D Meshes:
    For a tetrahedral element, perform similar midpoint calculations for every edge, thereby subdividing the tetrahedron into smaller tetrahedra.

Adaptive Refinement

Adaptive refinement necessitates criteria for selecting which elements to refine. Often, this involves:

  • Error Estimation: Estimate error in each element and refine those with errors surpassing a threshold.
  • Gradient-Based Refinement: Calculate the gradient of the solution in each element, refining those with the highest gradients.

In adaptive refinement, refining usually involves bisecting edges or faces corresponding to high-error regions. This can create a non-uniform distribution of points which may require additional smoothing techniques to maintain mesh quality.

Algorithm for Mesh Point Location Computation

The algorithm for determining new mesh point locations, especially in adaptive refinement, can be structured as follows:

  1. Identify Elements to Refine: Use an error estimator or gradient threshold to flag elements.
  2. Compute New Points: For flagged elements, compute midpoints and centroids as needed.
  3. Update Mesh Connectivity: Incorporate new nodes and elements into the existing mesh structure, adjusting connectivity to ensure consistency.
  4. Smooth and Optimise: Optional step to enhance mesh quality, involving repositioning nodes to reduce poor-quality element shapes.

Example

Suppose you have a 2D quadrilateral with vertices at (0,0)(0,0), (1,0)(1,0), (1,1)(1,1), and (0,1)(0,1), and you wish to perform a uniform refinement:

  • Compute midpoints for all edges:
    • (0.5,0)(0.5, 0), (1,0.5)(1, 0.5), (0.5,1)(0.5, 1), (0,0.5)(0, 0.5)
  • Compute midpoint of the diagonals or the centroid of the quadrilateral (0.5,0.5)(0.5, 0.5).
  • Subdivide the original quadrilateral into four smaller quadrilaterals using these points.

Summary Table of Key Points

AspectUniform RefinementAdaptive Refinement
ApproachDivide each element uniformlyRefine selected elements based on criteria
CriteriaNone (applies to all elements)Error threshold, gradient magnitude
Edge CalculationMidpoints on all edgesMidpoints on selected edges
New PointsDetermined by subdividing all elementsDetermined by refined selection process
EfficiencyLess efficient, increases all elementsMore efficient, refines high-priority areas

Conclusion

Increasing the mesh resolution by computing new mesh points can significantly enhance the accuracy of computational models. By understanding and employing appropriate refinement methods—be it uniform or adaptive—engineers and scientists can optimize their simulations for both computational efficiency and precision. While uniform refinement is more straightforward, adaptive refinement offers targeted detail where it’s most needed, making it an invaluable tool in simulations requiring high accuracy in specific regions.


Related reading
Course
Intermediate
27 lessons
15 hours
DSA Fundamentals

Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Data Structures & Algorithms practice on Codemia

Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.

Practice algorithms

All Rights Reserved.