Fortran 90 で有限要素コードを書きました。
このコードは、メッシング プロセスを除けば非常に高速です。
2D と 3D のメッシュにはそれぞれ三角形とtetgenを使用したので、もちろんこのプロセスは高速です。
たとえば、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 つの要素 (辺が境界上にある場合は 1 つだけ) の要素番号を知る必要があります。たとえば、次のような構造 (またはファイル) を生成する必要があります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.dat
、struct2.dat
多くのループを伴う力ずくのアプローチを使用したため、私のコードは非常に遅くなります。
これに最適化されたアルゴリズム (紙、またはそれ以上: ダウンロード可能な fortran のサブルーチン) を探していますか? 三角形と tetgen を使い続けたいと思っていますが、他のオプションも喜んで聞いています。