Hot answers tagged

9 votes

What is a common file/data format for a mesh (for FEM)?

The short answer is no, there is not a standard format. But there are some common ones, like Gmsh for input/output and VTK for output. Before making a decision you need to find out what do you want ...
nicoguaro's user avatar
  • 8,490
9 votes
Accepted

Algorithm to find boundary faces of mesh

First, create a list of faces in the mesh. From there you should be able to create a map from faces to tets, as each face must belong to either one or two tets. The faces that belong to only one tet ...
coolguy1000000's user avatar
8 votes

Mesh ordering algorithms used by COMSOL Multiphysics

The idea of "ordering the nodes" in a finite element mesh to improve the computational time of the sparse solver originated in the large structural analysis FE codes of the 70's. Those codes typically ...
Bill Greene's user avatar
  • 5,984
7 votes
Accepted

3D contour mesh computation

I think you could use the "marching cubes" algorithm. If memory serves, it requires a grid of samples as input, so at the very least you should be able to sample your function and run the algorithm as-...
rchilton1980's user avatar
  • 4,862
7 votes
Accepted

Is mesh orthogonality important for FEM?

Yes. The constants that appear in the interpolation estimates upon which finite element error estimates are based contain minimum and maximum angles of triangles/tetrahedra (or similar geometric ...
Wolfgang Bangerth's user avatar
6 votes

How to "smoothen" (not just refine) a 2D/3D polygonal mesh

To complement the two answers from Daniel Shapero and Nicoguaro: Basically, there are two ways of smoothing a mesh, subdivision (generate new vertices) and smoothing (move the points in such a way ...
BrunoLevy's user avatar
  • 2,305
6 votes

Solving PDEs in parallel

Domain decomposition was developed in the late 1990s and early 2000s because it allowed the re-use of sequential PDE solvers: You only have to write a wrapper around it that sends the computed ...
Wolfgang Bangerth's user avatar
6 votes
Accepted

Unreasonably large deviation in calculations of mean curvature in different algorithms

First of all remember that curvatures, being 2nd order values, can be really sensitive to even very small variations. Moreover, we are speaking about computing differential values in a discrete ...
ALoopingIcon's user avatar
5 votes

Commonly-used metrics to quantify the irregularity of a triangular mesh

I do not think that there exists an answer to this question in general, because it all depends on the intended use for the mesh. For instance, if you are doing computational fluid dynamics, you may ...
BrunoLevy's user avatar
  • 2,305
5 votes
Accepted

Commonly-used metrics to quantify the irregularity of a triangular mesh

As @Nicoguaro and @Paul have said in the comments to the question post, there are a great many ways to do this kind of thing, and I'm not sure if there is a single "best" approach. From a review ...
Darren Engwirda's user avatar
5 votes
Accepted

Common nodes in two FEM grids

Hashing floating-point numbers can indeed lead to weird results, especially if the node positions can be perturbed by some small amount or if there are denormalized values. You included the Python ...
Daniel Shapero's user avatar
5 votes
Accepted

what is the meaning of mesh smoothing steps in Gmsh?

Meshing algorithms can place the vertices of triangles and tetrahedra in a wide variety of ways, but they are us usually essentially constructive (i.e new vertices are introduced, existing vertices ...
origimbo's user avatar
  • 2,239
5 votes

How to "smoothen" (not just refine) a 2D/3D polygonal mesh

As mentioned in the answer by @DanielShapero, you can follow an approach based on local approximations of the curvature for your nodes. In the post he suggest, there is an article by Desbrun. I would ...
nicoguaro's user avatar
  • 8,490
5 votes

Barycentric interpolation equivalent for irregular hexahedra

A hexahedron with straight edges is the image of the unit cube under a trilinear mapping. So, if you have values on the eight vertices of a hexahedron, and you are asking to interpolate between them ...
Wolfgang Bangerth's user avatar
5 votes
Accepted

Convergence rate Jacobi/Gauss-Seidel with mesh resolution

The convergence rate that is mentioned here is in the sense that the error in iteration $k$ and $k-1$ are related by $$ \| x^{(k)} - x^\ast\| \le r \| x^{(k-1)} - x^\ast\|, $$ which implies that $$ ...
Wolfgang Bangerth's user avatar
5 votes

3D contour mesh computation

In addition to the voxel-based approach that rchilton suggests, you could also look at Delaunay-type algorithms. For example, the Computational Geometry Algorithms Library (CGAL) has some built-in ...
Daniel Shapero's user avatar
4 votes

How to "smoothen" (not just refine) a 2D/3D polygonal mesh

For just mesh smoothing, you can start by looking at Laplacian smoothing and some of the references therein. The idea is to update the position of every vertex in the interior of the mesh by replacing ...
Daniel Shapero's user avatar
4 votes
Accepted

Determinant of jacobian matrix

The determinant of the Jacobian, as a determinant changes its sign when odd permutations of columns (or rows) are applied. Imagine, for simplicity a two dimensional case in which the reference ...
HBR's user avatar
  • 1,628
4 votes
Accepted

Combined translational and rotational meshing in gmsh

I cannot visualize your geometry properly using Gmsh, or export it. I generated something similar using FreeCAD. Maybe you can modify this script for your purposes. ...
nicoguaro's user avatar
  • 8,490
4 votes

How can I coarsen a mesh in Gmsh when 'Mesh options' include 'Refine by splitting' but nothing about coarsening?

To create a coarser mesh, you can set the characteristic length globally to a larger value, e.g., ...
H. Rittich's user avatar
4 votes

Creating 3D Mesh from stl files with gmsh

I am not entirely sure what is going wrong in your version of the command-line approach. However, I think it works on my test STL file (with gmsh 4.0.7) with the following line: ...
Anton Menshov's user avatar
  • 8,652
4 votes
Accepted

Sorting Triangle vertices based on indices for alpha blending (back to front) C++, OpenGL

You can use a stable sorting algorithm. Take the array $[1,\ldots,3n]$, and sort it according to a rule like $$ \text{sorts-before}(i, j) = \text{in-front-of}\big(\text{triangle}(\lfloor\tfrac{i}{3}\...
Kirill's user avatar
  • 11.4k
4 votes

Effect of mesh size on solution curves for a 1D problem

What you're looking for is an a-posteriori error estimate for your mesh study. Normally, these quantitative measures are line/area/volume- and/or time- averaged nodal or element quantities (e.g. avg. ...
Ken Grimes's user avatar
4 votes

What are the best ways to interpolate a vector field inside (convex) polygons?

Let me try and break the problem down into two steps. Step 1: You have a polygon (one cell of your mesh) and you have scalar data $d_i$ associated with each vertex $\mathbf x_i$ of that polygon. You ...
Wolfgang Bangerth's user avatar
4 votes

Elements on a triangle (FEM)

You can rather easily write Lagrange bases over any dimension simplices. Define a $k$-simplex as the convex combinations of $k+1$ points, e.g. a triangle is a $2$-simplex. Definition As a triangle $K$ ...
Sardine's user avatar
  • 368
3 votes

Getting adjacent cells map for an unstructured polyhedral mesh

Using a hash map adds a log(n) complexity to all accesses (then traversing the whole mesh will cost n log(n) in general), so clearly it is not the best solution. Now your question is how you can ...
BrunoLevy's user avatar
  • 2,305
3 votes

How to "smoothen" (not just refine) a 2D/3D polygonal mesh

Surprisingly, Lloyd smoothing hasn't come up here yet. Check out Du, Qiang; Faber, Vance; Gunzburger, Max (1999), "Centroidal Voronoi tessellations: applications and algorithms", SIAM Review, 41 (4):...
Nico Schlömer's user avatar
3 votes

What is a common file/data format for a mesh (for FEM)?

You might try either Gmsh's MSH file format or GAMBIT neutral file format.
Wes's user avatar
  • 270
3 votes

What is a common file/data format for a mesh (for FEM)?

The number of file formats for FEM is ridiculous, partly due to the fact that every software package implemented its own format in the past. (From xkcd.) I've created meshio to alleviate the pain of ...
Nico Schlömer's user avatar
3 votes

What is a common file/data format for a mesh (for FEM)?

There is actually a standard for this: ISO/TS 10303 (start with parts 1380 to 1386). Prior to being hijacked by ISO, this initiative, which began back in the 1980s, was known as PDES/STEP. See https:...
alephzero's user avatar
  • 311

Only top scored, non community-wiki answers of a minimum length are eligible