Hot answers tagged

11

Making a mesh watertight There are several efficient algorithms to make a mesh watertight, historically, in Stanford, the pionneers of 3D Scanning developed the Zipper algorithm: https://graphics.stanford.edu/papers/zipper/ Then many algorithms were developed, you may refer for instance to the following website maintained by friends of mine: http://www....


10

No. As the mesh size $h\rightarrow 0$, the solution on a given mesh converges to the solution of the differential equation (assuming a well-posed PDE and a suitable discretization). Consequently, if your discrete solution on M2 is closer to experimental results than that on M3 or M4, then there are only two possibilities: The differential equation does not ...


10

I would recommend gmsh. I have just started working with this program actually only a few days ago. But it is straight-forward to use. You can create various 2D and even 3D-geometries and it offers a ton of information, boundary nodes, etc.. Here is a link to the website: http://geuz.org/gmsh/ They have many useful references, there is a manual of course ...


9

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 are your boundary faces.


8

deal.II keeps the entire coarse mesh on every processor, but of course we cannot do that with the actual mesh after many refinement steps. It is true that this somewhat limits the size of problems we can solve to maybe a few hundred thousand coarse mesh cells on typically-sized cluster nodes. However, this is plenty for most realistic cases for a reasonable ...


8

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 to do. If you want to have your (small) program for a while, then you can pick the format that best suit to your taste and needs. If you are planning to change ...


7

If you are not using AMR and do not want to scale beyond 1K-4K cores then simply do this. Rank 0 reads the entire mesh and partitions it using METIS/Scotch etc. (Note: This is a serial operation). Rank 0 broadcasts the element/node partitioning info to all other ranks and frees the memory (used to store the mesh) All ranks read the nodes/elements they own (...


7

I claim that the independent mesh is the best one. Say the actual solution is $U$ and your solver delivers an $u_h$ depending on a mesh parameter $h$. Then you can do the estimate for the distance of $u_h$ to the actual solution $$\|U-u_h \| \leq \|U-u_m \| + \|u_m - u_h\|,$$ where $u_m$ is the solution of the model used to describe the problem ...


7

Use dolfin-convert from a terminal window.


7

One of the authors of fenics, A. Logg, have written a very good paper on datastructures of storing meshes. The paper is A. Logg (2009). Efficient Representation of Computational Meshes http://arxiv.org/abs/1205.3081 In fact it's always a tradeoff between storing all the topological informations (nodes around nodes, faces around nodes, etc...) OR having to ...


7

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 used banded or variable-band storage schemes for the sparse matrices so reducing the bandwidth was the main criterion. That is the origin of the old Cuthill-...


7

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-is. You also might be able to modify the algorithm to callback to f directly. There's a popular implementation at http://paulbourke.net/geometry/polygonise/ ...


6

Adaptive mesh refinement is a very useful technique for improving accuracy around shocks, since any method will be at most first order accurate near solution discontinuities. The downside of implementing AMR is that it will add substantial complexity to your code and thus require significant additional development and maintenance time. I would only do the ...


6

In deal.II, we basically only use vectors. Maps are too slow and scatter data all around memory, so we typically don't use them if the keys are integers and within a given range. For example, for the connectivity between cells, you can do arrays (STL vectors) in which you store neighbor indices and so that neighbor indices $4i\ldots 4i+3$ correspond to cell $...


6

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 that the obtained shape is smoother). Subdivision To grasp the intuition, imagine you want to "smoothen" a 2D square. The 2D square is not smooth because it has ...


5

There is no continuous mapping from a domain with a hole (the tube with the cylinder in it) to a rectangle as in Even for much simpler domains (without holes), like unions of rectangles, one typically would not try and map the domain to a rectangle to then employ a finite-difference approach. This only moves the complication from finding a proper grid to ...


5

gmsh is a viable way to generate quadrilateral meshes in 2d. It's also open source.


5

Permit me to clarify - you ask about "structured mesh" that's "quadrilateral." By definition, a structured mesh (or grid) consists of quads (2D) and hexes (3D). So I want to clarify that you're inquiring about automatic structured quad/hex grid generation. If so, you're seeking the holy grail. While there are many software tools for generating structured ...


5

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 tag, so I assume that's what you're using and that you have scipy. A quick and dirty solution would be to construct a kd-tree of the fine grid points, then for ...


5

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 suggest to check another article by him: Anisotropic Polygonal Remeshing [1]. Another option that comes to my mind is to use Catmull-Clark subdivision ...


5

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 $$ \| x^{(k)} - x^\ast\| \le r^k \| x^{(0)} - x^\ast\|. $$ For this to converge at all, we need that $r<1$, which the statement you quote provides. But for ...


5

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 functionality for surface mesh generation with examples here. You could also try distmesh, the essential idea of which has been ported to a number of other ...


4

This depends on the equations in case. If your equations are first-order hyperbolic equations such as the Euler equations of gas dynamics, then the equations allow solutions that have truly discontinuous shocks -- in that case, there is no amount of mesh refinement that can resolve the shock. On the other hand, if your equations are transport dominated but ...


4

In your problem description, note that $80\text{mm} \neq 0.008 \text{m}$. That said, every quantity in a computer program is just a number. It's up to you to interpret it. So of course you can run a simulation where the domain has an edge length of 80 or 0.08 -- they refer to the same domain, after all. But depending on what you use as your base unit, you ...


4

I've used examples from: INRIA: huge number of meshes in many file formats Large Geometric Models archive: handful of very big meshes in .ply format Stellar: a program for improving tetrahedral meshes; has a few examples on its website Purely a matter of preference, but I like Tetgen for 3D tetrahedral mesh generation more than gmsh. While gmsh has more ...


4

If you have access to MATLAB, you might consider using PDE Toolbox to generate your geometry and mesh: http://www.mathworks.com/help/pde/index.html It is very easy to generate simple geometries like the ones you describe by doing boolean operations on primitive shapes. The output mesh is described by three MATLAB arrays: node locations, element ...


4

If you want the simplest possible numerical scheme working for Burger's equation that has your suggested form then you should prefer the so called Lax-Friedrichs method. If you have the book of LeVeque on Finite Volume Methods for Hyperbolic Problems, look for a very simple formula 4.20 (or a little bit more complex 4.21, but in your suggested form). With ...


4

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 it with the average of its neighbors. There are loads of more sophisticated ways of doing this by using different operators. If you're doing both surface mesh ...


4

I cannot visualize your geometry properly using gmsh, or export it, for that matters. I generated something similar using FreeCAD. Maybe you can modify this script for your purposes. from __future__ import division, print_function import FreeCAD as FC import Draft from numpy import sin, cos, pi nturns = 1 nslices = 20 length = 10 width = 20 height = 60 dz =...


4

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 study of Jonathan Richard Shewchuck at Berkley, an answer is: Please refer to the original document (version 31/12/2002) for symbology, terminology, special ...


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