找回密码
 注册
查看: 2981|回复: 2

UDF的编译通不过

[复制链接]
发表于 2012-11-19 15:04:18 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
我从UDF的英文帮助中复制粘贴下面的内容成c程序,通过fluent的udf导入编译,(Define->user-defined->functions->interpreted)弹出下面的错误

cpp -I"C:\Fluent.Inc\fluent6.3.26/src" -I"C:\Fluent.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent.Inc\fluent6.3.26/client/src" -I"C:\Fluent.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<udfconfig.h>" "E:\计算\冷凝-重试\condensation-2.c"
Error: E:\\274\306\313\343\\300\344\304\375-\326\330\312\324\condensation-2.c: line 9: structure reference not implemented

我看了fluent的“dpm.h”的头文件,在其中存在这个结构,请问大侠,这个是什么原因造成的,怎样才能解决这个问题。

c程序在附件中也有一份。

/***********************************************************************
UDF for defining the heat and mass transport for
multicomponent particle vaporization
***********************************************************************/
#include "udf.h"

DEFINE_DPM_HEAT_MASS(multivap,p,Cp,hgas,hvap,cvap_surf,dydt,dzdt){
        int ns;
        int nc=TP_N_COMPONENTS(p); /* number of particle components */
        
        //以离散相P确定P所在的单元及线,以及单元,从而找到该单元连续相的信息。
        cell_t c0=RP_CELL(&(p->cCell)); /* cell and thread */
        Thread *t0=RP_THREAD(&(p->cCell)); /* where the particle is in */
        
        //离散相和连续相的材料
        Material *gas_mix=THREAD_MATERIAL(t0); /* gas mixture material */
        Material *cond_mix=p->injection->material;/* particle mixture material */

        cphase_state_t *c=&(p->cphase); /* cell info of particle location */

        //连续相的分子量及平均分子量
        real molwt[MAX_SPE_EQNS]; /* molecular weight of gas species */
        real molwt_bulk=0.0; /* average molecular weight in bulk gas */

        //离散相的信息:温度、质量、粒径,表面积,普朗特数Pr,努赛尔德数Nu,表面对流系数,;
        real Tp=P_T(p); /* particle temperature */
        real mp=P_MASS(p); /* particle mass */
        real Dp=DPM_DIAM_FROM_VOL(mp/P_RHO(p)); /* particle diameter */
        real Ap=DPM_AREA(Dp); /* particle surface */
        real Pr=c->sHeat*c->mu/c->tCond; /* Prandtl number */
        real Nu=2.0+0.6*sqrt(p->Re)*pow(Pr,1.0/3.0); /* Nusselt number 可以从《传热传质基本原理》的P270的公式(7.56)*/
        real h=Nu*c->tCond/Dp; /* Heat transfer coefficient */
        real dh_dt=h*(c->temp-Tp)*Ap; /* heat source term */
        dydt[0]+=dh_dt/(mp*Cp);
        dzdt->energy-=dh_dt;
        
        //求1/平均分子量的值,在解释中为平均分子量,实际计算为其倒数,因此在引用时要注意
        {
                Material *sp;
                mixture_species_loop(gas_mix,sp,ns){
                        molwt[ns]=MATERIAL_PROP(sp,PROP_mwi); /* molecular weight of gas species */
                        molwt_bulk+=C_YI(c0,t0,ns)/molwt[ns]; /* average molecular weight */
                }
        }
        /* prevent division by zero */
        molwt_bulk=MAX(molwt_bulk,DPM_SMALL);

        for(ns=0;ns<nc;ns++){
                /* gas species index of vaporization */
                int gas_index=TP_COMPONENT_INDEX_I(p,ns);
                if(gas_index>=0){
                        /* condensed material */
                        Material *cond_c=MIXTURE_COMPONENT(cond_mix,ns);
                        /* vaporization temperature */
                        real vap_temp=MATERIAL_PROP(cond_c,PROP_vap_temp);
                        /* diffusion coefficient */
                        real D=MATERIAL_PROP_POLYNOMIAL(cond_c,PROP_binary_diffusivity,c->temp);
                        /* Schmidt number */
                        real Sc=c->mu/(c->rho*D);
                        /* mass transfer coefficient */
                        real k=(2.0+0.6*sqrt(p->Re)*pow(Sc,1.0/3.0))*D/Dp;
                        /* bulk gas concentration */
                        real cvap_bulk=c->pressure/UNIVERSAL_GAS_CONSTANT/c->temp*c->yi[gas_index]/molwt_bulk/solver_par.molWeight[gas_index];
                        /* vaporization rate */
                        real vap_rate=k*molwt[gas_index]*Ap*(cvap_surf[ns]-cvap_bulk);
                        /* only condensation below vaporization temperature */
                        if(0.0<vap_rate && Tp<vap_temp)
                                vap_rate=0.0;
                        dydt[1+ns]-=vap_rate;
                        dzdt->species[gas_index]+=vap_rate;
                        /* dT/dt = dh/dt / (m Cp)*/
                        dydt[0]-=hvap[gas_index]*vap_rate/(mp*Cp);
                        /* gas enthalpy source term */
                        dzdt->energy+=hgas[gas_index]*vap_rate;
                }
        }

[ 本帖最后由 llongtan 于 2012-11-19 15:05 编辑 ]

1.zip

1.76 MB, 下载次数: 174

发表于 2012-11-20 08:03:52 | 显示全部楼层
用complies试试,不要用interpreted,很多高级宏都需要complie才能使用
 楼主| 发表于 2012-11-21 08:11:08 | 显示全部楼层

回复 2# aaa-1234 的帖子

谢谢了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表