CFD Online Logo CFD Online URL
Home > Forums

2D unstructured mesher in F90

Register Blogs Members List Search Today's Posts Mark Forums Read

Rate this Entry

2D unstructured mesher in F90

Posted August 9, 2012 at 08:23 by truffaldino

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
Attached Files
File Type: f tri_mesh.f (100.5 KB, 354 views)
File Type: txt cavity_bc.txt (65 Bytes, 221 views)
File Type: txt NACA0012_bc.txt (16.6 KB, 320 views)
File Type: txt wt_bc.txt (184 Bytes, 234 views)
File Type: txt wake_bc.txt (5.5 KB, 336 views)
Posted in Uncategorized
Views 1654 Comments 3 Edit Tags Email Blog Entry
« Prev     Main     Next »
Total Comments 3


  1. Old Comment
    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 quad-tree to split the area(im not sure about the details, this part confused me too),but what really puzzles me is how to use quad-tree 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 alot
    Posted August 23, 2014 at 13:39 by fireflies fireflies is offline
    Updated August 23, 2014 at 14:12 by fireflies (need more details)
  2. Old Comment
    truffaldino's Avatar
    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)

    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

    Posted August 24, 2014 at 11:00 by truffaldino truffaldino is offline
    Updated August 24, 2014 at 16:28 by truffaldino
  3. Old Comment
    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 fireflies is offline

All times are GMT -4. The time now is 05:21.