Looking for simple to use 2D meshing library in Fortran or software

Hello people. I am looking for either:

  • A simple to use Fortran library that produces 2D meshes given a description of a geometry.

  • Software that does something similar. I would also accept softwares that are harder to use but are ubiquitous in numerical computing.

For context, I am studying Fortran and FEM. I am currently learning FEM through Bengzon and Larson’s book while implementing the material in Fortran. I am familiar with static libraries but not so much with dynamic libraries.

2 Likes

Welcome @hohoho. I don’t work in this area, but the Mesh Generation section of Fortran Codes on GitHub has some entries. Maybe LaGriT or MPI-AMRVAC? There is also a Finite Elements section.

2 Likes

This is not a Fortran library, however you may want to have a look at the Triangle code by Jonathan Shewchuk (if triangular meshes are acceptable for your application).

https://www.cs.cmu.edu/~quake/triangle.html

I believe the code is quite robust and the resulting meshes of good quality; a previous colleague used this successfully for inviscid CFD.

1 Like

Some grid generation texts have companion software you can download
(if you can find the current website). The software is usually in Fortran or C.

Here are a couple.

Knupp&Steinberg, Fundamentals of Grid Generation
Zip file with Fortran 77 code is at

Farrashkhalvat & Miles, Basic Structured Grid Generation (with intro to unstructured grid generation). Used to be a Butterworth-Heinemannm book but I think its Elsevier now. Unfortunately the companion web site for the source code given on the back cover appears to be no longer valid. I have the code somewhere but am not sure if its legal to redistrubute it. You can contact Elsevier to see if they can point you to the code

I think the book by Liseiken, Grid Generation Methods, Springer-Verlag also has companion software but I can’t find a link to it on the Springer Web site.

Also, about 12 years or so ago I wrote some Fortran C-Interop interfaces to Shewchuk’s Triangle code. I’ll upload it to github if enough folks are interested.

Edit:

You would probably be better off using a full blown FEM mesh generator like GMSH (https://gmsh.info). I think it supports 2D as well as 3D meshes (triangles, quads etc) and
also supports higher-order versions of these elements. Most of the open-source CFD and FEM codes written in Fortran (and other languages) have a GMSH reader (for at least the version 2 file format). For the V2 file format, programming you own reader is fairly straightforward.

1 Like

Thank you for your replies. What I ended up doing at the time was indeed go down the GMSH route and program my own reader. It was a good learning experience.

Thank you for the references and have a nice Sunday.

Thanks. Just tried LaGriT. I can call it now, but still need to figure out how to define an area and let LaGrit to mesh it.