24小时热门版块排行榜    

查看: 4134  |  回复: 4

nba24

新虫 (小有名气)

[求助] 质量源项、动量源项

source = -mass/C_VOLUME(cell_gas,thread_gas)/CURRENT_TIMESTEP;           /* 传质源项,单位 kg/m3-s */            
   mass具体是如何定义的?相减符号如何?
  还有,谁有动量源项,我已经在UDF里面写好质量源项,怎样加动量源项?在UDF里面
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

天津大学化学工程
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

kylafree

至尊木虫 (知名作家)

【答案】应助回帖

★ ★
感谢参与,应助指数 +1
xiegangmai: 金币+2, 谢谢应助 2012-06-22 00:12:29
查看 UDF HELP 中 DEFINE_SOURCE宏,有详细说明
2楼2012-06-21 22:35:29
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

hihaoer

新虫 (小有名气)

【答案】应助回帖

★ ★
xiegangmai: 金币+2, 谢谢应助! 2012-06-27 21:14:08
source = -mass/C_VOLUME(cell_gas,thread_gas)/CURRENT_TIMESTEP

你没有写出全部,根据你写的来看mass除以单元体积和时间步。根据源项的定义单位是kg/m3,所以mass单位是kg。负号我的理解应该表示消失源项,至于动量源fluent udf help里面的例子就是动量源,你可以看看。
3楼2012-06-27 09:50:57
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

nba24

新虫 (小有名气)

引用回帖:
3楼: Originally posted by hihaoer at 2012-06-27 09:50:57
source = -mass/C_VOLUME(cell_gas,thread_gas)/CURRENT_TIMESTEP

你没有写出全部,根据你写的来看mass除以单元体积和时间步。根据源项的定义单位是kg/m3,所以mass单位是kg。负号我的理解应该表示消失源项,至于 ...

DEFINE_SOURCE(gas_source, cell_gas, thread_gas, dS, eqn)        /* gas相o2组分的传质源项 */
{
real source;
Domain *domain_liquid = Get_Domain(3);        /* liquid相domain指针 */
Thread *thread_mix = THREAD_SUPER_THREAD(thread_gas);        /* mixture的fluid-air区域指针 */
Thread *thread_liquid = Lookup_Thread(domain_liquid, 2);        /* liquid相的fluid-water区域指针 */
cell_t cell_liquid;
real m0_gas, m0_liquid, m1_gas, m1_liquid;

if(C_UDMI(cell_gas, thread_mix, 0 ) == -1)        /* 非相界面cell */
        {
        source = 0.0;        /* 传质源项为0 */
        }
else        /* 相界面cell */
        {
        cell_liquid = C_UDMI(cell_gas, thread_mix, 0);        /* 获取相界面另一侧的cell编号 */
        /* 下面就可通过thread_mix, cell_gas, thread_gas, cell_liquid, thread_liquid五个变量获取需要的数据计算传质源项 */
        m0_gas = C_YI(cell_gas, thread_gas, 0)*C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas);        /* 气相中o2组分质量,单位 kg */
        m0_liquid = C_YI(cell_liquid, thread_liquid, 0)*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid);        /* 液相中o2组分质量,单位 kg */
        m1_liquid = (m0_gas+m0_liquid)*kc*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)/(kc*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)+C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas));/* 分配后液相中o2组分质量,单位 kg */
        m1_gas = m1_liquid*C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas)/(C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)*kc);        /* 分配后气相中o2组分质量,单位 kg */
        source = (m1_gas-m0_gas)/C_VOLUME(cell_gas, thread_gas)/(CURRENT_TIMESTEP+0.023);        /* 传质源项,单位 kg/m3-s */
        }

dS[eqn] = 0.0;
return source;
}

DEFINE_SOURCE(liquid_source, cell_liquid, thread_liquid, dS, eqn)        /* liquid相o2组分的传质源项 */
{
real source;
Domain *domain_gas = Get_Domain(2);        /* gas相domain指针 */
Thread *thread_mix = THREAD_SUPER_THREAD(thread_liquid);        /* mixture的fluid-water区域指针 */
Thread *thread_gas = Lookup_Thread(domain_gas, 3);        /* gas相的fluid-air区域指针 */
cell_t cell_gas;
real m0_gas, m0_liquid, m1_gas, m1_liquid;

if(C_UDMI(cell_liquid, thread_mix, 0 ) == -1)        /* 非相界面cell */
        {
        source = 0.0;        /* 传质源项为0 */
        }
else /* 相界面cell */
        {
        cell_gas = C_UDMI(cell_liquid, thread_mix, 0);        /* 获取相界面另一侧的cell编号 */
        /* 下面就可通过thread_mix, cell_gas, thread_gas, cell_liquid, thread_liquid五个变量获取需要的数据计算传质源项 */
        m0_gas = C_YI(cell_gas, thread_gas, 0)*C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas);        /* 气相中o2组分质量,单位 kg */
        m0_liquid = C_YI(cell_liquid, thread_liquid, 0)*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid);        /* 液相中o2组分质量,单位 kg */
        m1_liquid = (m0_gas+m0_liquid)*kc*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)/(kc*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)+C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas));/* 分配后液相中o2组分质量,单位 kg */
        m1_gas = m1_liquid*C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas)/(C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)*kc);        /* 分配后气相中o2组分质量,单位 kg */
        source = (m1_liquid-m0_liquid)/C_VOLUME(cell_liquid, thread_liquid)/(CURRENT_TIMESTEP+0.023);        /* 传质源项,单位 kg/m3-s */
        }

dS[eqn] = 0.0;
return source;
}

DEFINE_SOURCE(gas_source1, cell_gas, thread_gas, dS, eqn)        /* gas相o2组分的传质源项 */
{
real source;
Domain *domain_liquid = Get_Domain(3);        /* liquid相domain指针 */
Thread *thread_mix = THREAD_SUPER_THREAD(thread_gas);        /* mixture的fluid-air区域指针 */
Thread *thread_liquid = Lookup_Thread(domain_liquid, 2);        /* liquid相的fluid-water区域指针 */
cell_t cell_liquid;
real m0_gas, m0_liquid, m1_gas, m1_liquid;

if(C_UDMI(cell_gas, thread_mix, 1 ) == -1)        /* 非相界面cell */
        {
        source = 0.0;        /* 传质源项为0 */
        }
else /* 相界面cell */
        {
        cell_liquid = C_UDMI(cell_gas, thread_mix, 1);        /* 获取相界面另一侧的cell编号 */
        /* 下面就可通过thread_mix, cell_gas, thread_gas, cell_liquid, thread_liquid五个变量获取需要的数据计算传质源项 */
        m0_gas = C_YI(cell_gas, thread_gas, 0)*C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas);        /* 气相中o2组分质量,单位 kg */
        m0_liquid = C_YI(cell_liquid, thread_liquid, 0)*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid);        /* 液相中o2组分质量,单位 kg */
        m1_liquid = (m0_gas+m0_liquid)*kc*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)/(kc*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)+C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas));/* 分配后液相中o2组分质量,单位 kg */
        m1_gas = m1_liquid*C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas)/(C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)*kc);        /* 分配后气相中o2组分质量,单位 kg */
        source = (m1_gas-m0_gas)/C_VOLUME(cell_gas, thread_gas)/CURRENT_TIMESTEP;        /* 传质源项,单位 kg/m3-s */
        }

dS[eqn] = 0.0;
return source;
}


这是我写的源项  -----但是我觉得我的周期性浓度变化没有写进来----求助啊
天津大学化学工程
4楼2012-07-08 22:13:12
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

nba24

新虫 (小有名气)


xiegangmai: 金币+1, 鼓励讨论交流! 2012-07-08 22:35:08
引用回帖:
3楼: Originally posted by hihaoer at 2012-06-27 09:50:57
source = -mass/C_VOLUME(cell_gas,thread_gas)/CURRENT_TIMESTEP

你没有写出全部,根据你写的来看mass除以单元体积和时间步。根据源项的定义单位是kg/m3,所以mass单位是kg。负号我的理解应该表示消失源项,至于 ...

DEFINE_SOURCE(gas_source, cell_gas, thread_gas, dS, eqn)        /* gas相o2组分的传质源项 */
{
real source;
Domain *domain_liquid = Get_Domain(3);        /* liquid相domain指针 */
Thread *thread_mix = THREAD_SUPER_THREAD(thread_gas);        /* mixture的fluid-air区域指针 */
Thread *thread_liquid = Lookup_Thread(domain_liquid, 2);        /* liquid相的fluid-water区域指针 */
cell_t cell_liquid;
real m0_gas, m0_liquid, m1_gas, m1_liquid;

if(C_UDMI(cell_gas, thread_mix, 0 ) == -1)        /* 非相界面cell */
        {
        source = 0.0;        /* 传质源项为0 */
        }
else        /* 相界面cell */
        {
        cell_liquid = C_UDMI(cell_gas, thread_mix, 0);        /* 获取相界面另一侧的cell编号 */
        /* 下面就可通过thread_mix, cell_gas, thread_gas, cell_liquid, thread_liquid五个变量获取需要的数据计算传质源项 */
        m0_gas = C_YI(cell_gas, thread_gas, 0)*C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas);        /* 气相中o2组分质量,单位 kg */
        m0_liquid = C_YI(cell_liquid, thread_liquid, 0)*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid);        /* 液相中o2组分质量,单位 kg */
        m1_liquid = (m0_gas+m0_liquid)*kc*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)/(kc*C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)+C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas));/* 分配后液相中o2组分质量,单位 kg */
        m1_gas = m1_liquid*C_R(cell_gas, thread_gas)*C_VOLUME(cell_gas, thread_gas)/(C_R(cell_liquid, thread_liquid)*C_VOLUME(cell_liquid, thread_liquid)*kc);        /* 分配后气相中o2组分质量,单位 kg */
        source = (m1_gas-m0_gas)/C_VOLUME(cell_gas, thread_gas)/(CURRENT_TIMESTEP+0.023);        /* 传质源项,单位 kg/m3-s */
        }

dS[eqn] = 0.0;
return source;
}


我这个因为是周期型传质---两边都传---然后右边的传质实际上是下一个长度周期的呀---所以我不知道怎样弄啊---我的udf  关于质量分数哪儿写的不对啊
天津大学化学工程
5楼2012-07-08 22:28:44
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 nba24 的主题更新
信息提示
请填处理意见