用于生成和元素(tetgen-triangle)

时间:2015-10-30 00:42:11

标签: fortran fortran90 finite-element-analysis

我在fortran 90中写了一个有限元素代码。

除了网格化过程之外,这段代码非常快。

我分别使用triangletetgen进行2D和3D网格划分,所以这个过程当然很快。

例如,对于2D中的单位平方[0,1] x [0,1],我有一个带有节点坐标的文件(例如,一个有5个节点的网格):

1   0.0 0.0  # coordinates of node 1
2   1.0 0.0  # coordinates of node 2
3   1.0 1.0  # coordinates of node 3
4   0.0 1.0  # coordinates of node 4
5   0.5 0.5  # coordinates of node 5

名为coordinate.dat,它有4个元素(三角形),节点名为element.dat

1   1 5 4  # vertices of triangle 1
2   1 2 5  # vertices of triangle 2
3   2 3 5  # vertices of triangle 3
4   5 2 4  # vertices of triangle 4

我还有一个文件,其中每一行i是其最初节点的编号,称为edge.dat

1   1 2  # initial and final node of edge 1
2   2 3  # initial and final node of edge 2
3   3 4  # initial and final node of edge 3
4   4 1  # initial and final node of edge 4
5   1 5  # initial and final node of edge 5
6   5 2  # initial and final node of edge 6
7   2 5  # initial and final node of edge 7
8   5 4  # initial and final node of edge 8

使用这些文件,我需要生成以下信息:

(1)给定一个元素(三角形或四面体),我需要知道它的边数(分别是边和面)。例如,我需要生成以下结构或文件,称为struct1.dat

1   5 8 4  # triangle 1 has the edges number 5, 8 and 4
2   1 6 5  # triangle 2 has the edges number 1, 6 and 5
3   6 2 7  # triangle 2 has the edges number 6, 2 and 7
4   7 3 8  # triangle 4 has the edges number 7, 3 and 8

(2)此外,给定一个边(边或面)我需要知道该边共享的2个元素的元素编号(或者如果边在边界上,则只有一个元素编号)。例如,我需要生成以下名为struct2.dat的结构(或文件):

1   2 0  # edge number 1 is only on element 2
2   3 0  # edge number 2 is only on element 3
3   4 0  # edge number 3 is only on element 4
4   1 0  # edge number 4 is only on element 1
5   1 2  # edge number 5 is sharing by elements 1 and 2
6   3 2  # edge number 6 is sharing by elements 3 and 2
7   4 3  # edge number 7 is sharing by elements 4 and 3
8   1 4  # edge number 8 is sharing by elements 1 and 4

对于这两种结构struct1.datstruct2.dat,我的代码非常慢,因为我使用了一个带有大量循环的强力方法..

我正在寻找一种针对此优化的算法(一篇论文,或更好的:fortran中可供下载的子程序)?我想继续使用triangle和tetgen,但我愿意听其他选择。

0 个答案:

没有答案