ユーザー定義関数(UDF)は、プログラムが可能で、CFDソフトウェアFluent Solverとともに動的にロードして、標準機能を拡張できる関数です。UDFはCプログラミング言語で書かれています。
以下は私のUDFのセクションです。
/*Memory Allocation only at first call to the subroutine*/
if(CellAroundNodeFirstCallflag==0)
{
CellAroundNodeFirstCallflag=1;
Avg_CellAroundNode =(cell_t**)calloc((Nnum+1),sizeof(cell_t));
for(i=0;i<Nnum;i++)
{
Avg_CellAroundNode[i] =(cell_t*)calloc((NCellANode+1),sizeof(cell_t));
}
}
if (Avg_CellAroundNode!=NULL)
{
Message("Check: Not Null.... \n");
}
Message("CHECK Enter... \n.");
Message("Check:Array size %d %d \n",Nnum,NCellANode);
/*Initializing the matrix*/
for(i=0;i<Nnum;i++)
{
for(j=0;j<NCellANode;j++)
{
Message("Check:Initalizing cell: %d %d \n",i,j);
Avg_CellAroundNode[i][j]=-1;
}
}
Message("CHECK Exit....");
Windows32ビットでVC++を使用してコンパイルする上記のコードに問題はありません。しかし、Windows64ビットおよびLinux32/64ビット(GCCを使用)では、次のエラーが発生します。
==============================================================================
Stack backtrace generated for process id 10801 on signal 1 :
Please include this information with any bug report you file on this issue!
==============================================================================
Data.In is read...
Check: Not Null....
CHECK Enter...
Check:Array size 10 20
Check:Initalizing cell: 0 0
Check:Initalizing cell: 0 1
Check:Initalizing cell: 0 2
.
.
Check:Initalizing cell: 7 18
Check:Initalizing cell: 7 19
Check:Initalizing cell: 8 0
/opt/Fluent.Inc/fluent6.3.26/lnamd64/2ddp/fluent.6.3.26[0xcc0e0b]
/opt/Fluent.Inc/fluent6.3.26/lnamd64/2ddp/fluent.6.3.26[0xcc0d61]
/lib64/libpthread.so.0[0x355aa0de70]
BubUDF/lnamd64/2ddp/libudf.so(NodeAvg+0x104)[0x2ba2089bc1bd]
Error: fluent.6.3.26 received a fatal signal (SEGMENTATION VIOLATION).
この問題を解決するのを手伝ってくれる人はいますか?