Git Product home page Git Product logo

mesh2d's Introduction

MESH2D: Delaunay-based mesh generation in MATLAB

MESH2D is a MATLAB / OCTAVE-based unstructured mesh-generator for two-dimensional polygonal geometries, providing a range of relatively simple, yet effective two-dimensional meshing algorithms. MESH2D includes variations on the "classical" Delaunay refinement technique, a new "Frontal"-Delaunay refinement scheme, a non-linear mesh optimisation method, and auxiliary mesh and geometry pre- and post-processing facilities.

       

Algorithms implemented in MESH2D are "provably-good" - ensuring convergence, geometrical and topological correctness, and providing guarantees on algorithm termination and worst-case element quality bounds. Support for user-defined "mesh-spacing" functions and "multi-part" geometry definitions is also provided, allowing MESH2D to handle a wide range of complex domain types and user-defined constraints. MESH2D typically generates very high-quality output, appropriate for a variety of finite-volume/element type applications.

MESH2D is a simplified version of my JIGSAW mesh-generation algorithm (a C++ code). MESH2D aims to provide a straightforward MATLAB / OCTAVE implementation of these Delaunay-based triangulation and mesh optimisation techniques.

Code Structure

MESH2D is a pure MATLAB / OCATVE package, consisting of a core library + associated utilities:

MESH2D::
├── MAIN-DIR. -- core MESH2D library functions. See REFINE2, SMOOTH2, TRIDEMO, etc.
├── aabb-tree -- support for fast spatial indexing, via tree-based data-structures.
├── geom-util -- geometry processing, repair, etc.
├── hfun-util -- mesh-spacing definitions, limiters, etc.
├── hjac-util -- solver for Hamilton-Jacobi eqn's.
├── mesh-ball -- circumscribing balls, orthogonal balls etc.
├── mesh-cost -- mesh cost/quality functions, etc.
├── mesh-file -- mesh i/o via ASCII serialisation.
├── mesh-util -- meshing/triangulation utility functions.
├── poly-data -- polygon definitions for demo problems, etc.
└── poly-test -- fast inclusion test for polygons.

Quickstart

After downloading and unzipping the current repository, navigate to the installation directory within MATLAB / OCTAVE and run the set of examples contained in tridemo.m:

tridemo( 0); % a very simple example to get everything started.
tridemo( 1); % investigate the impact of the "radius-edge" threshold.
tridemo( 2); % Frontal-Delaunay vs. Delaunay-refinement refinement.
tridemo( 3); % explore impact of user-defined mesh-size constraints.
tridemo( 4); % explore impact of "hill-climbing" mesh optimisations.
tridemo( 5); % assemble triangulations for "multi-part" geometries.
tridemo( 6); % assemble triangulations with "internal" constraints.
tridemo( 7); % investigate the use of "quadtree"-type refinement.
tridemo( 8); % explore use of custom, user-defined mesh-size functions.
tridemo( 9); % larger-scale problem, mesh refinement + optimisation. 
tridemo(10); % medium-scale problem, mesh refinement + optimisation. 

Note that a call to initmsh() should be included in MESH2D scripts to ensure the MATLAB / OCTAVE path variable includes all MESH2D sub-directories.

For OCTAVE users, performance can be improved by compiling elements of the MESH2D library. See mkoctfile for additional information (note: requires a -dev installation of OCTAVE).

License

This program may be freely redistributed under the condition that the copyright notices (including this entire header) are not removed, and no compensation is received through use of the software. Private, research, and institutional use is free. You may distribute modified versions of this code UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution of this code as part of a commercial system is permissible ONLY BY DIRECT ARRANGEMENT WITH THE AUTHOR. (If you are not directly supplying this code to a customer, and you are instead telling them how they can obtain it for free, then you are not required to make any arrangement with me.)

DISCLAIMER: Neither I nor the University of Sydney warrant this code in any way whatsoever. This code is provided "as-is" to be used at your own risk.

References

If you make use of MESH2D please include a reference to the following! MESH2D is designed to provide a simple and easy-to-understand implementation of Delaunay-based mesh-generation techniques. For a much more advanced, and fully three-dimensional mesh-generation library, see the JIGSAW package. MESH2D makes use of the AABBTREE and FINDTRIA packages to compute efficient spatial queries and intersection tests.

[1] - Darren Engwirda, Locally-optimal Delaunay-refinement and optimisation-based mesh generation, Ph.D. Thesis, School of Mathematics and Statistics, The University of Sydney, September 2014.

[2] - Darren Engwirda, Unstructured mesh methods for the Navier-Stokes equations, Honours Thesis, School of Aerospace, Mechanical and Mechatronic Engineering, The University of Sydney, November 2005.

mesh2d's People

Contributors

dengwirda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mesh2d's Issues

Edge nodes introduced even when preservation is requested

It seems that when a region has a very high aspect ratio (e.g. a triangle with a very small angle), nodes are inserted into the border even when I have ref1 set to preserve. Is this the expected behavior? Is there anything I can do to be more strict about preserving edge nodes?

refine2 without introducing additional border nodes

I am wondering if it is possible to use the refine2() function to generate a mesh in which no new nodes are added on the border of the polygonal geometry. I have experimented with the various refine2 options (RHO1, SIZ1, SIZ2, etc.) and have been unable to achieve this, though my understanding of the effect of some of the options is limited. In my case, I care more about the no-new-border-nodes requirement than the final mesh quality. Is there any way to achieve this, either directly or indirectly?

Download of mesh2d

Hi, I'm trying to download mesh2d from the github repository. But when I ran some sample code in matlab, it's still saying that the function is not found. Could you suggest the correct way of downloading the function? Thank you!

Creating poly-data suitable for use

Hey,
I was wondering how you would suggest creating a file like the airfoil.msh or lake.msh from a histological section like this: histological slice. I would want to define the layers as edges so I can refine the mesh at each transition. They might be more complicated than just a straight lines, otherwise I would define them like in tridemo(0)
Cheers!

mesh with specified nodes

Hi Professor Darren Engwirda,

I have a narrow region and I hope to get the mesh as that in the picture.
My way in other mesher might be specifying the mesh nodes on the edge and the mesh size for that region. I understand the quality in the region is not very good, but that's just I hope to have.
is it possible/what is the good way to do this with mesh2d?

sorry it is not an issue, but I don't know where to ask.

Thanks!
George.
mesh2d_ask

acute triangulation

Hi, this is not an issue per say. I was wondering how to make a constrained delaunay where all triangles are acute ?

long meshing times with heavy duty constraints

Hey Darren,

I have a meshing problem where I'd like to constrain the red lines in the blue polygon region below. There's a lot of constraints and what I find is that passing some configurations of constraints lead to non-convergence.

Are there any geometry pre-processing/clean up that I can do with the constraints that I can do to perhaps avoid this?

question1

question2

Thanks!

How can I extract the boundary of the mesh?

Excellent work! I found this program very helpful. I'm wondering how can I extract the boundary nodes/edges of the triangular mesh?I'm using the mesh to set up a finite element model

Error in deltri2 (during refine2) when meshing multi-part geometry

I am running into a strange error when meshing a 3-part geometry. The traceback is as follows:

Index in position 1 exceeds array bounds (must not exceed 269).
Error in deltri2 (line 138)
    tmid = vert(tria(:,1),:) ...
Error in refine2>cdtbal0 (line 311)
        tria,tnum] = deltri2(vert,conn, ...
Error in refine2 (line 260)
        cdtbal0(vert,conn,tria,tnum, ...

The index in question exists in the tria variable and has a value of 270 (vert only goes up to 269). Oddly, when I mesh the three parts separately, or even in sets of two parts at a time--i.e. parts 1 and 2, parts 2 and 3, etc.--then I do not encounter this error.

Do you expect that this may be indicative of some kind of input error? Any suggestions of things to try? Let me know if this is simply too difficult to diagnose without some kind of example geometry and I'll see what I can do...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.