0
我使用Fluent 14.5.7,並且在使用我的UDF時出現了一些編程錯誤。 我試圖解決的模擬是在水平固定牀反應器中的脫硫過程。在包含UDF和CaO和SO2之間的反應之前,它可以很好地工作。 我試着改變一些參數,返回一個常量值(用* rr = 60替換* rr = 60 * k * Beta * NSO2)和其他一些東西,但是同樣的錯誤出現了。錯誤:流利.14.5.7 UDF(SEGMENTATION VIOLATION)
這裏是我的C代碼:
/*********************************************************************/
#include "udf.h"
#include "sg_mphase.h"
DEFINE_HET_RXN_RATE(SO2_capture , c, t, hr, mw,yi, rr, rr_t)
{
Thread **pt = THREAD_SUB_THREADS(t);
Thread *tg = pt[0];
Thread *ts = pt[1];
real XCaO = C_YI(c,ts,0); /* Para checkear que hay sorbente*/
real XSO2 = C_YI(c,tg,0); /* Fraccion masica SO2 en la fase gas*/
real mwSO2 = 64.0638;
real DENS_Gas = C_R(c,tg); /* Si hay problemas se puede considerar que es constante*/
real VReac=6333.843; /* Volumen total del reactor en cm³ */
real NSO2 = XSO2/mwSO2 * DENS_Gas * VReac; /* Controla el valor de NSO2 */
real Time_min = CURRENT_TIME/60;
/*valores de constantes a 400ºC */
real EDiff = -49300; /*mejor sacar el negativo de la potencia*/
real aa1 = 2.10e-03;
real aa2 = 12.9e-02;
real aa3 = -0.66; /*mejor sacar el negativo de la potencia*/
real kdiff = aa1 * exp (EDiff/(8.314 * C_T(c,t))) * (1 + aa2 * exp (aa3*Time_min));
real aa4 = 0.82;
real aa5 = -1; /*mejor sacar el negativo de la potencia*/
real Beta = (1 - aa4 * exp (aa5*Time_min));
real k0 = 1.78e-02;
real Ea = -13900; /*mejor sacar el negativo de la potencia*/
real ks = k0 * exp (Ea/(8.314 * C_T(c,t)));
real k = (ks * kdiff)/(ks + kdiff);
if (XCaO != 0)
{
*rr = 60 * k * Beta * NSO2;
}
else
{
*rr = 0;
}
/*return;*/
}
/****************************************************************/
當我跑我的模擬,它apperead以下錯誤:
===============================================================================
Stack backtrace generated for process id 27426 on signal 1 :
1000000: /usr/local/ansys_inc/v154/fluent/fluent14.5.7/lnamd64/2ddp/fluent.14.5.7 [0x166a164]
1000000: /usr/local/ansys_inc/v154/fluent/fluent14.5.7/lnamd64/2ddp/fluent.14.5.7 [0x166a8d3]
1000000: /lib64/libpthread.so.0 [0x3736e0eca0]
1000000: Kin_Sulp_3/lnamd64/2ddp/libudf.so(SO2_capture+0x9b) [0x2afee78f644f]
Check the file fluenterror.log for details.
Please include this information with any bug report you file on this issue!
===============================================================================
Error: fluent.14.5.7 received a fatal signal (SEGMENTATION VIOLATION).
Error Object: #f
的fluenterror.log文件提供了以下信息:
Received signal 1 [time 5/21/14 13:23:5]
1000000: /usr/local/ansys_inc/v145/fluent/fluent14.5.7/lnamd64/2ddp/fluent.14.5.7 [0x166a287]
1000000: /usr/local/ansys_inc/v145/fluent/fluent14.5.7/lnamd64/2ddp/fluent.14.5.7 [0x166a8d3]
1000000: /lib64/libpthread.so.0 [0x3736e0eca0]
1000000: Kin_Sulp_3/lnamd64/2ddp/libudf.so(SO2_capture+0x9b) [0x2afee78f644f]
Error [client] [time 5/21/14 13:23:6] fluent.14.5.7 received a fatal signal (SEGMENTATION VIOLATION).
999999:/usr/local/ansys_inc/v145/fluent/fluent14.5.7/lnamd64/2ddp/fluent.14.5.7(CX_Primitive_Error+0x204) [0x166a704]
999999: /usr/local/ansys_inc/v145/fluent/fluent14.5.7/lnamd64/2ddp/fluent.14.5.7 [0x166a91f]
999999: /lib64/libpthread.so.0 [0x3736e0eca0]
999999: Kin_Sulp_3/lnamd64/2ddp/libudf.so(SO2_capture+0x9b) [0x2afee78f644f]
任何建議將不勝感激,如果你需要更多的信息,我會很樂意給我噸。
謝謝!
我不能告訴,如果上面的代碼是一個解決這個問題,但如果它顯示錯誤,這顯然不是一個問的人一直在尋找。請在發佈之前提高您的回答並進行測試,同時限制您在答案中多次發佈電子郵件地址,它屬於評論部分。 –