2D unstructured mesher in F90
Posted August 9, 2012 at 08:23 by truffaldino
Tags 2d mesher, fortran, unstructured
This is 2D unstructured mesher.
tri_mesh.f90 is a mesher and the rest are input files
Example 1: Cavity flow driven by upper cavity wall
file: cavity_bc.txt
Example 2: flow past NACA 0012 airfoil
files: NACA0012_bc.txt  airfoil
wt_bc.txt  wind tunnel
wake_bc.txt wake
Description of the program is placed in the header of tri_mesh.f90
tri_mesh.f90 is a mesher and the rest are input files
Example 1: Cavity flow driven by upper cavity wall
file: cavity_bc.txt
Example 2: flow past NACA 0012 airfoil
files: NACA0012_bc.txt  airfoil
wt_bc.txt  wind tunnel
wake_bc.txt wake
Description of the program is placed in the header of tri_mesh.f90
Total Comments 3
Comments

thx for your nice work truffaldino! the code help me a lot :)
can you please tell me some detail information about the algorithm in subroutine get_tree_and_table, i know you used quadtree to split the area（im not sure about the details， this part confused me too），but what really puzzles me is how to use quadtree to distinguish the area inside or outside the domain which need meshing， Can you give me some details about these， or give me some references. thx alotPosted August 23, 2014 at 13:39 by fireflies
Updated August 23, 2014 at 14:12 by fireflies (need more details) 
Hello fireflies,
I have written this program several years ago and can barely remember what is inside. Let us try to recall...
The main idea of the algorithm was to initially distribute points according to desired density inside domain. Then do the domain triangulation on these points with help of Delaunay algorithm and then deform the mesh according to this article ("DistMesh" algorithm)
http://persson.berkeley.edu/pub/persson04mesh_col.pdf
The quadtree is needed only on initial stage of point distribution. The distances to the domain boundary are computed with the help of subroutines dist get_distances etc just by computing distances from the point to all segments of the boundary and computing the total angle spanned by boundary with the center at a given point: If the angle is 0 then the point is outside the domain: if it is 2*Pi it is inside the domain. Total angle is computed by summing up the contribution from each segment of the bounday.
About tree and table: I should refresh all details in memory, but as far as I can remember the table is something like the inverse tree. It seems I was trying to pack the tree in 1D array and then inverse tree restored the tree point from its number in this array.
I should take look at this program once more to restore details in memory
TruffaldinoPosted August 24, 2014 at 11:00 by truffaldino
Updated August 24, 2014 at 16:28 by truffaldino 
I got it! you are such a nice man! many many thanks for your patience to answer, great help for me :）
Posted August 25, 2014 at 13:05 by fireflies