fluent中新建一个材料,滑油。滑油的物性参数是随温度变化的。用udf写了相关函数。
经过Define》User-Defined》Functions》Compiled,在弹出的窗口中Source Files找到了四个物性参数的源文件。
点击build,代码窗口显示Done后,点击Load,代码窗口再次显示Done。
![fluent中Set_Material_Property: null user-defined-function name]()
![fluent中Set_Material_Property: null user-defined-function name-1]()
然后在Materials中新建材料huayou,就出问题了。
![fluent中Set_Material_Property: null user-defined-function name-2]()
![fluent中Set_Material_Property: null user-defined-function name-3]()
立刻出现以下错误:
old-name (air . #f) new-name (huayou . #f)
Error: No user-defined functions have been loaded.
Error Object: #f
Primitive Error at Node 0: Set_Material_Property: null user-defined-function name
Primitive Error at Node 5: Set_Material_Property: null user-defined-function name
Primitive Error at Node 1: Set_Material_Property: null user-defined-function name
Primitive Error at Node 2: Set_Material_Property: null user-defined-function name
以下是四个udf代码:
文件名:huayou4106_cp.c
#include "udf.h"
#include "math.h"
DEFINE_PROPERTY(huayou4106_cp,c,t)
{
real cp;
real temp = C_T(c,t);
cp=(2.161443+2.555131*0.001*(temp-144)+9.535232*pow(10,-6)*pow(temp-144,2)+1.171208*pow(10,-7)*pow(temp-144,3))*1000;
return cp;
}
文件名:huayou4106_pho.c
#include "udf.h"
#include "math.h"
DEFINE_PROPERTY(huayou4106_pho,c,t)
{
real pho;
real a;
real temp = C_T(c,t);
pho=959.7/(1+60.4*pow(10,-5)*(temp-20));
return pho;
}
文件名:huayou4106_tc.c
#include "udf.h"
#include "math.h"
DEFINE_PROPERTY(huayou4106_tc,c,t)
{
real tc;
real temp = C_T(c,t);
tc=0.167*(1-0.0011976*temp);
return tc;
}
文件名:huayou4106_cviscosity.c
#include "udf.h"
#include "math.h"
DEFINE_PROPERTY(huayou4106_viscosity,c,t)
{
real mu_lam;
real a;
real temp = C_T(c,t);
a=pow(10.0,10.1295)*pow((459.7+32+temp*1.8),-3.6312f);
mu_lam=(pow(10,a)-0.6)*pow(10,-6);
return mu_lam;
}
刚学这些东西,刚开始时环境变量没设置好,折腾了半天终于能载入了,载入之后又陷入现在的困境。
有没有人知道这是什么原因啊?是操作的问题?代码的问题?还是? |