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.
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:
- 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.
- 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:
- 2D Meshes:For a triangular element with vertices at coordinates , , and :
- Midpoints for each edge are computed as follows:
- Edge 1-2:
- Edge 2-3:
- Edge 3-1:
- Use these midpoints to create four smaller triangles within the original triangle.
- 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:
- Identify Elements to Refine: Use an error estimator or gradient threshold to flag elements.
- Compute New Points: For flagged elements, compute midpoints and centroids as needed.
- Update Mesh Connectivity: Incorporate new nodes and elements into the existing mesh structure, adjusting connectivity to ensure consistency.
- 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 , , , and , and you wish to perform a uniform refinement:
- Compute midpoints for all edges:
- , , ,
- Compute midpoint of the diagonals or the centroid of the quadrilateral .
- Subdivide the original quadrilateral into four smaller quadrilaterals using these points.
Summary Table of Key Points
| Aspect | Uniform Refinement | Adaptive Refinement |
| Approach | Divide each element uniformly | Refine selected elements based on criteria |
| Criteria | None (applies to all elements) | Error threshold, gradient magnitude |
| Edge Calculation | Midpoints on all edges | Midpoints on selected edges |
| New Points | Determined by subdividing all elements | Determined by refined selection process |
| Efficiency | Less efficient, increases all elements | More 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
- How to compute mean average robustly?
- How to compute shortest unique prefixes of a set of strings?
- How to compute the intersection points of a line and an arbitrary shape?
- How to compute the union polygon of two or more rectangles
- how to convert logits to probability in binary classification in tensorflow?
- How to convert the half-spaces that constitute a convex hull to a set of extreme points?
- How to count each digit in a range of integers?
- How to count integers between large A and B with a certain property?

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 courseTrack 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.