|
|
[求助]
DEFINE_MASS_TRANSFER这个宏不能编译型???
今天使用了一个宏DEFINE_MASS_TRANSFER
发现一个问题:这个宏只能采用解释型的UDF,不能作为编译型的UDF导入。
但是从help帮助中,是这么写的:
After the UDF that you have defined using DEFINE_MASS_TRANSFER is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument (e.g., liq_gas_source) will become visible and selectable under Mass Transfer when you select the Mass tab option in the Phase Interaction dialog box and specify the Number of Mass Transfer Functions.
就是说支持编译型的UDF。
我的udf内容如下:
#include "udf.h"
DEFINE_PROPERTY(cell_vis,cell,thread) /*定义材料粘度*/
{real ga_visy;
real temp=C_T(cell,thread);
if(temp<=1773)
ga_visy=2;
else if(temp<=1853)
ga_visy=1e-3*(119.003-0.061*temp);
else if(temp<=1873)
ga_visy=1e-3*(10.603-0.0025*temp);
else if(temp<=1973)
ga_visy=1e-3*(36.263-0.0162*temp);
else
ga_visy=3e-3;
return ga_visy;
}
DEFINE_MASS_TRANSFER(liq_gas_source,cell,thread,from_index,from_species_index,to_index,to_species_index)
{
real m_lg;
real T_frost=1773;
Thread *liq = THREAD_SUB_THREAD(thread, from_index);
Thread *soild = THREAD_SUB_THREAD(thread, to_index);
m_lg = 0.;
if (C_T(cell, soild) >= T_frost)
{
m_lg = -0.1*C_VOF(cell,soild)*C_R(cell,soild)*fabs(C_T(cell,soild)-T_frost)/T_frost;
}
if ((m_lg == 0. ) && (C_T(cell, liq) <= T_frost))
{
m_lg = 0.1*C_VOF(cell,liq)*C_R(cell,liq)*fabs(T_frost-C_T(cell,liq))/T_frost;
}
return (m_lg);
}
一个定义了材料属性,一个定义那个质量传输。代码没有问题。编译结果如下:
Done.
已复制 1 个文件。
Copied F:\rongdi\seconddimension/F:\rongdi\seconddimension est.c to libudf\src
已复制 1 个文件。
Copied F:\rongdi\seconddimension/F:\rongdi\seconddimension\udf.h to libudf\src
(system "copy "E:\softwear\special\ansys14\ANSYSI~1\v140\fluent"\fluent14.0.0\src\makefile_nt.udf "libudf\ntx86\2ddp\makefile" "
已复制 1 个文件。
(chdir "libudf" ()
(chdir "ntx86\2ddp" ()
# Generating ud_io1.h
test.c
# Generating udf_names.c because of makefile test.obj
udf_names.c
# Linking libudf.dll because of makefile user_nt.udf udf_names.obj test.obj
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
正在创建库 libudf.lib 和对象 libudf.exp
Done.
Opening library "F:\rongdi\seconddimension\libudf"...
Library "F:\rongdi\seconddimension\libudf\ntx86\2ddp\libudf.dll" opened
cell_vis
liq_gas_source
Done.
就是说我成功load了这两个udf。
定义粘度材料属性时是成功的。如图1:
但是定义那个两相间传递,情况如图2:
如果我的那个质量传递宏采用解释型的udf,此时又可以成功。如图3:
这个真是奇怪了。
![]()
![]()
![]() |
|