24小时热门版块排行榜    

查看: 998  |  回复: 7

ZBY右婪

新虫 (初入文坛)

[求助] udf文件哪里错了 已有1人参与

#include "udf.h"
#include "mem.h"
#include "sg_mphase.h"
#include "sg.h"
#include "flow.h"
#include "math.h"
#include "surf.h"
#include "stdio.h"
/**************************************************/
/***** D * E * F * I * N * E *** A * D * J * U * S * T *****/
/*************************************************/

DEFINE_ADJUST(adjust_1,domain)
{
Thread *t;
cell_t c;
real Temp,Visc,str;
real dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz;
real conversion_visc; /*conversion efficiency of viscous dissipation*/
conversion_visc=0.9;       
thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
Temp=C_T(c,t);                       
Visc=0.1*C_UDMI(c,t,0);          /*modified viscocity   */
dudx=C_DUDX(c,t);
dudy=C_DUDY(c,t);
dudz=C_DUDZ(c,t);
dvdx=C_DVDX(c,t);
dvdy=C_DVDY(c,t);
dvdz=C_DVDZ(c,t);
dwdx=C_DWDX(c,t);
dwdy=C_DWDY(c,t);
dwdz=C_DWDZ(c,t);                       
str=C_STRAIN_RATE_MAG(c,t);
if(str>1&&str<400)       
C_UDMI(c,t,1)=conversion_visc*Visc*fabs(2*dudx*dudx+2*dvdy*dvdy+2*dwdz*dwdz+(dvdx+dudy)*(dvdx+dudy)+(dvdz+dwdy)*(dvdz+dwdy)+(dwdx+dudz)*(dwdx+dudz));
else       
C_UDMI(c,t,1)=0;
                                                               
C_UDMI(c,t,4)=2*dudx*dudx+2*dvdy*dvdy+2*dwdz*dwdz+(dvdx+dudy)*(dvdx+dudy)+(dvdz+dwdy)*(dvdz+dwdy)+(dwdx+dudz)*(dwdx+dudz);
}
end_c_loop(c,t)
}       
}



/****************************************************************/
/***** M * A * T * E * R * I * A * L *** P * R * O * P * E * R * T * Y *****/
/**************************************************************/
DEFINE_PROPERTY(U_Visc,c,t)
{
real Temp,Visc,str,A,alfa,n,Q,Z,stress,stress_modify,R,asinh_input,asinh_output,Visc_limit_up,Visc_limit_down;
/*
real dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz;
  dudx=C_DUDX(c,t);
        dudy=C_DUDY(c,t);
        dudz=C_DUDZ(c,t);
        dvdx=C_DVDX(c,t);
        dvdy=C_DVDY(c,t);
        dvdz=C_DVDZ(c,t);
        dwdx=C_DWDX(c,t);
        dwdy=C_DWDY(c,t);
        dwdz=C_DWDZ(c,t);
str=sqrt(0.6667*(dudx*dudx+dvdy*dvdy+dwdz*dwdz+0.5*(dudy+dvdx)*(dudy+dvdx)+0.5*(dudz+dwdx)*(dudz+dwdx)+0.5*(dvdz+dwdy)*(dvdz+dwdy)));
*/
str=C_STRAIN_RATE_MAG(c,t);
Temp=C_T(c,t);
A=240000000;
alfa=0.000000045;
n=3.55;
Q=145000;
R=8.314; /* Specific gas constant */
Visc_limit_up=10000000;
if(str<0.1)
{
str=0.1;
Z=str*exp(Q/(R*Temp));
asinh_input=pow(Z/A,1/n);
asinh_output=log(asinh_input + sqrt(asinh_input *asinh_input + 1));
stress=(1/alfa)*asinh_output;
}
else if(str>1000)
{
str=1000;
Z=str*exp(Q/(R*Temp));
asinh_input=pow(Z/A,1/n);
asinh_output=log(asinh_input + sqrt(asinh_input *asinh_input + 1));
stress=(1/alfa)*asinh_output;
}
else
{
Z=str*exp(Q/(R*Temp));
asinh_input=pow(Z/A,1/n);
asinh_output=log(asinh_input + sqrt(asinh_input *asinh_input + 1));
stress=(1/alfa)*asinh_output;
}
stress_modify=stress;
Visc=stress_modify/(3*str);
if((Visc>Visc_limit_up)|| (str == 0))       
{
Visc=Visc_limit_up;
}
C_UDMI(c,t,2)=stress_modify;
C_UDMI(c,t,0)=Visc;
return Visc;
}


/*material density */
DEFINE_PROPERTY(material_density,c,t)
{
real density;                                       
density=2770.0;
return density;
}

/*material heat capacity */
DEFINE_SPECIFIC_HEAT(cell_specific_heat,T,Tref,h,yi)
{
real cp;
cp=39.3608+4.9426*T-0.0088404*T*T+0.0000055778*T*T*T;
*h=cp*(T-Tref);
return cp;
}


/*material thermal conductivity */
DEFINE_PROPERTY(material_thermal_conductivity,c,t)
{
real k;           
real temp=C_T(c,t);                                 
k=54.7398+0.3543*temp-0.00041846*temp*temp+0.0000002392*temp*temp*temp;
return k;
}

/*************************************************************************************************/
/***** H * E * A * T *** F * L * U * X *** F * R * O * M *** T * H * E *** I * N * T * E * R * F * A * C * E *****/
/************************************************************************************************/

/*heat flux from the shoulder*/
DEFINE_PROFILE(shoulder_heat,t,i)
{
face_t f;
real b[ND_ND];
real x,y,r;
real sin_theta;
real Beta2;         
real Delta;         
real Mu;            
real rad;               
real U;      
real p0;         
real k_w,k_t,Cp_w,Cp_t,Rho_w,Rho_t;
real e_w,e_t;
real fact_w;       /*the heat trans betweent the interface of workpiece and tool*/
real T;
real stress;
cell_t c0;
Thread *t0;
Beta2=1;           /*conversion efficiency of the tool-workpiece interface*/
Delta=0.3;         /*Slip rate between the tool and the workpiece*/
Mu=0.4;              /*Frictional coefficient between the tool and the workpiece*/
rad=60;          /*rotation speed   rad s-1*/
U=0.001;            /*welding speed   m s-1*/
p0=12000000;   /*normal stress*/
begin_f_loop(f,t)
{
F_CENTROID(b,f,t);
x=b[0];
y=b[1];
r=sqrt(x*x+y*y);
sin_theta=y/r;               
c0=F_C0(f,t);                        /* Adjacent Cell Index Macros Defined in mem.h*/
t0=THREAD_T0(t);      /*THREAD_T0(t) Adjacent Cell Thread */
T=F_T(f,t);                        /*face temperature*/
k_w=120.0;                       /*thermal conductivity of workpiece*/
k_t=42.0;                           /*thermal conductivity of tool*/
Cp_w=1172.0;                  /*heat capacity of workpiece*/
Cp_t=440.0;                      /*heat capacity of tool*/
Rho_w=2770.0;                /*density of workpiece*/
Rho_t=7800.0;                  /*density of tool*/
e_w=sqrt(k_w*Cp_w*Rho_w);                   /*thermal effusivity of workpiece*/
e_t=sqrt(k_t*Cp_t*Rho_t);                          /*thermal effusivity of tool*/
fact_w=e_w/(e_w+e_t);               
stress=C_UDMI(c0,t0,2);       
F_PROFILE(f,t,i)=fact_w*Beta2*(Delta*stress+(1-Delta)*Mu*p0)*fabs(rad*r-U*sin_theta);               
}
end_f_loop(f,t)
}


/*heat flux from the pin_side_acr*/
DEFINE_PROFILE(pin_side,t,i)
{
face_t f;
real b[ND_ND];
real x,y,r;
real sin_theta;
real Beta2;         
real Delta;         
real Mu;            
real rad;               
real U;      
real p0;         
real k_w,k_t,Cp_w,Cp_t,Rho_w,Rho_t;
real e_w,e_t;
real fact_w;       /*the heat trans betweent the interface of workpiece and tool*/
real T;
real stress;
real sin_cone;
cell_t c0;
Thread *t0;
Beta2=1;           /*conversion efficiency of the tool-workpiece interface*/
Delta=0.5;         /*Slip rate between the tool and the workpiece*/
Mu=0.4;              /*Frictional coefficient between the tool and the workpiece*/
rad=60;          /*rotation speed   rad s-1*/
U=0.001;            /*welding speed   m s-1*/
p0=12000000;   /*normal stress*/
sin_cone=0.196;            /*sin Cone angle of the pin*/
begin_f_loop(f,t)
{
F_CENTROID(b,f,t);
x=b[0];
y=b[1];
r=sqrt(x*x+y*y);
sin_theta=y/r;               
c0=F_C0(f,t);                        /* Adjacent Cell Index Macros Defined in mem.h*/
t0=THREAD_T0(t);      /*THREAD_T0(t) Adjacent Cell Thread */
T=F_T(f,t);                        /*face temperature*/
k_w=120.0;                       /*thermal conductivity of workpiece*/
k_t=42.0;                           /*thermal conductivity of tool*/
Cp_w=1172.0;                  /*heat capacity of workpiece*/
Cp_t=440.0;                      /*heat capacity of tool*/
Rho_w=2770.0;                /*density of workpiece*/
Rho_t=7800.0;                  /*density of tool*/
e_w=sqrt(k_w*Cp_w*Rho_w);                   /*thermal effusivity of workpiece*/
e_t=sqrt(k_t*Cp_t*Rho_t);                          /*thermal effusivity of tool*/
fact_w=e_w/(e_w+e_t);               
stress=C_UDMI(c0,t0,2);               
F_PROFILE(f,t,i)=fact_w*Beta2*(Delta*stress+(1-Delta)*Mu*p0*sin_cone)*fabs(rad*r-U*sin_theta);               
}
end_f_loop(f,t)
}



/*heat flux from the pin*/
DEFINE_PROFILE(pin_bottom_heat,t,i)
{
face_t f;
real b[ND_ND];
real x,y,r;
real sin_theta;
real Beta2;         
real Delta;         
real Mu;            
real rad;               
real U;      
real p0;         
real k_w,k_t,Cp_w,Cp_t,Rho_w,Rho_t;
real e_w,e_t;
real fact_w;       /*the heat trans betweent the interface of workpiece and tool*/
real T;
real stress;
cell_t c0;
Thread *t0;
Beta2=1;           /*conversion efficiency of the tool-workpiece interface*/
Delta=0.35;         /*Slip rate between the tool and the workpiece*/
Mu=0.4;              /*Frictional coefficient between the tool and the workpiece*/
rad=60;          /*rotation speed   rad s-1*/
U=0.001;            /*welding speed   m s-1*/
p0=12000000;   /*normal stress*/
begin_f_loop(f,t)
{
F_CENTROID(b,f,t);
x=b[0];
y=b[1];
r=sqrt(x*x+y*y);
sin_theta=y/r;               
c0=F_C0(f,t);                        /* Adjacent Cell Index Macros Defined in mem.h*/
t0=THREAD_T0(t);      /*THREAD_T0(t) Adjacent Cell Thread */
T=F_T(f,t);                        /*face temperature*/
k_w=120.0;                       /*thermal conductivity of workpiece*/
k_t=42.0;                           /*thermal conductivity of tool*/
Cp_w=1172.0;                  /*heat capacity of workpiece*/
Cp_t=440.0;                      /*heat capacity of tool*/
Rho_w=2770.0;                /*density of workpiece*/
Rho_t=7800.0;                  /*density of tool*/
e_w=sqrt(k_w*Cp_w*Rho_w);                   /*thermal effusivity of workpiece*/
e_t=sqrt(k_t*Cp_t*Rho_t);                          /*thermal effusivity of tool*/
fact_w=e_w/(e_w+e_t);               
stress=C_UDMI(c0,t0,2);       
F_PROFILE(f,t,i)=fact_w*Beta2*(Delta*stress+(1-Delta)*Mu*p0)*fabs(rad*r-U*sin_theta);               
}
end_f_loop(f,t)
}


/*********************************************************/
/***** S * O * U * R * C * E *** O * F *** F * L * U * I * D *****/
/*******************************************************/
/*source of energy equation (viscous dissipation)*/

DEFINE_SOURCE(heat_source_vd,c,t,dS,eqn)
{
real source;
source=C_UDMI(c,t,1);
dS[eqn]=0;
return source;
}



/***************************************************************************************/
/***** V * E * L * O * C * I * T * Y *** O * F *** T * H * E *** I * N * T * E * R * F * A * C * E *****/
/**************************************************************************************/
DEFINE_PROFILE(shoulder_u,t,i)
{
real x[ND_ND];
real omega;
face_t f;
real theta,r, u_delta, x1, y1,u_weld;
real Delta;
Delta=0.3;
u_weld=0.001;
omega=60;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t); /*Get the centroid positions into x */
x1=x[0] ;
y1=x[1] ;
r=pow(x1*x1+y1*y1,0.5);
theta=atan2(y1,x1) ;
u_delta=omega*r*Delta*sin(theta)-u_weld;
F_PROFILE(f,t,i)= u_delta;
}
end_f_loop(f,t)
}


DEFINE_PROFILE(shoulder_v,t,i)
{
real x[ND_ND];
real omega;
face_t f;
real theta,r, v_delta, x1, y1,u_weld;
real Delta;
Delta=0.3;
u_weld=0.001;
omega=60; /*rad per sec */
begin_f_loop(f,t)
{
F_CENTROID(x,f,t); /*Get the centroid positions into x */
x1=x[0] ;
y1=x[1] ;
r=pow(x1*x1+y1*y1,0.5);
theta=atan2(y1,x1) ;
v_delta=-omega*r*Delta*cos(theta);
F_PROFILE(f,t,i)= v_delta;
}
end_f_loop(f,t)
}




DEFINE_PROFILE(pin_side_u,t,i)
{
real x[ND_ND];
real omega;
face_t f;
real theta,r, u_delta, x1, y1,u_weld;
real Delta;
Delta=0.5;
u_weld=0.001;
omega=60;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t); /*Get the centroid positions into x */
x1=x[0] ;
y1=x[1] ;
r=pow(x1*x1+y1*y1,0.5);
theta=atan2(y1,x1) ;
u_delta=omega*r*Delta*sin(theta)-u_weld;
F_PROFILE(f,t,i)= u_delta;
}
end_f_loop(f,t)
}


DEFINE_PROFILE(pin_side_v,t,i)
{
real x[ND_ND];
real omega;
face_t f;
real theta,r, v_delta, x1, y1,u_weld;
real Delta;
Delta=0.5;
u_weld=0.001;
omega=60; /*rad per sec */
begin_f_loop(f,t)
{
F_CENTROID(x,f,t); /*Get the centroid positions into x */
x1=x[0] ;
y1=x[1] ;
r=pow(x1*x1+y1*y1,0.5);
theta=atan2(y1,x1) ;
v_delta=-omega*r*Delta*cos(theta);
F_PROFILE(f,t,i)= v_delta;
}
end_f_loop(f,t)
}



DEFINE_PROFILE(pin_bottom_u,t,i)
{
real x[ND_ND];
real omega;
face_t f;
real theta,r, u_delta, x1, y1,u_weld;
real Delta;
Delta=0.35;
u_weld=0.001;
omega=60;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t); /*Get the centroid positions into x */
x1=x[0] ;
y1=x[1] ;
r=pow(x1*x1+y1*y1,0.5);
theta=atan2(y1,x1) ;
u_delta=omega*r*Delta*sin(theta)-u_weld;
F_PROFILE(f,t,i)= u_delta;
}
end_f_loop(f,t)
}


DEFINE_PROFILE(pin_bottom_v,t,i)
{
real x[ND_ND];
real omega;
face_t f;
real theta,r, v_delta, x1, y1,u_weld;
real Delta;
Delta=0.35;
u_weld=0.001;
omega=60; /*rad per sec */
begin_f_loop(f,t)
{
F_CENTROID(x,f,t); /*Get the centroid positions into x */
x1=x[0] ;
y1=x[1] ;
r=pow(x1*x1+y1*y1,0.5);
theta=atan2(y1,x1) ;
v_delta=-omega*r*Delta*cos(theta);
F_PROFILE(f,t,i)= v_delta;
}
end_f_loop(f,t)
}

发自小木虫Android客户端
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ZBY右婪

新虫 (初入文坛)

2楼2017-09-24 21:10:39
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ZBY右婪

新虫 (初入文坛)

3楼2017-09-24 21:11:02
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ZBY右婪

新虫 (初入文坛)

Error:received a fatal signal (segmentation fault)

发自小木虫Android客户端
4楼2017-09-24 21:12:02
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

tumu_tu

金虫 (小有名气)

引用回帖:
4楼: Originally posted by ZBY右婪 at 2017-09-24 21:12:02
Error:received a fatal signal (segmentation fault)

是不是没开UDM啊

发自小木虫Android客户端
5楼2017-09-25 01:46:55
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ZBY右婪

新虫 (初入文坛)

udm,应该开了吧,我使用教程的时候在workbench里点开solution后加载udf能够用,但是在steup里面自己按照教程设置加载的udf初始化后就报错

发自小木虫Android客户端
6楼2017-09-25 10:01:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

fluid00

禁虫 (小有名气)

感谢参与,应助指数 +1
本帖内容被屏蔽

7楼2017-09-25 10:14:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ZBY右婪

新虫 (初入文坛)

8楼2017-09-27 13:23:21
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 ZBY右婪 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 为什么资助数各大高校都创新高,自己申请怎么就这么难 +15 Kittylucky 2026-08-27 17/850 2026-09-03 10:24 by Kittylucky
[基金申请] 国社科又开始会评了,不知道这次命运如何 +9 雨打竹帘 2026-08-30 13/650 2026-09-03 08:16 by kudofaye
[基金申请] 麻烦专家们看看评委们的意见(F口面上) +8 gdd2018 2026-08-28 13/650 2026-09-03 06:22 by 羽毛枫f
[公派出国] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +3 ero8OE6tv9cu 2026-09-02 4/200 2026-09-03 03:14 by rM1TE0WVDIIY
[博后之家] 售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急 +3 ero8OE6tv9cu 2026-09-02 6/300 2026-09-02 23:59 by rM1TE0WVDIIY
[基金申请] 科研人应该花精力去思考如何解决问题,而不是去凝练问题 +7 瞬息宇宙 2026-09-01 14/700 2026-09-02 17:33 by ma0526
[基金申请] 要骂人了,新模版改版就是要淡化问题凝练这种虚的东西,结果有个评委还在说凝练得不够 +9 瞬息宇宙 2026-08-31 17/850 2026-09-02 14:04 by anjeeshine
[基金申请] 基金系统什么内容也没有 30+4 winsaint 2026-08-27 10/500 2026-09-02 11:35 by 大不刘6
[基金申请] 学科评审组评审是指会评吗? +5 瞬息宇宙 2026-08-31 5/250 2026-09-02 10:13 by 雨冰共舞
[基金申请] 面上函评意见出来了,像什么等级? 20+4 Tsingking1 2026-08-27 17/850 2026-09-01 19:51 by 超级无敌华子
[论文投稿] 小白求助 投论文要求的highlights应该如何写 5+3 l1963982152 2026-08-29 4/200 2026-09-01 09:04 by 北京莱茵编辑
[基金申请] 基金未中,这种答复是模板吗? +6 zhaosm1982 2026-08-27 7/350 2026-08-31 21:18 by qdxxmc
[基金申请] 面上意见出来了 +12 黄鸟于飞Chao 2026-08-29 23/1150 2026-08-31 18:57 by 黄鸟于飞Chao
[基金申请] 能否申诉? +7 echo8914667 2026-08-30 8/400 2026-08-31 17:00 by yihongxu
[基金申请] 中青基了要发朋友圈吗? +7 349506619 2026-08-28 7/350 2026-08-31 13:39 by 冼亮淀粉酶
[基金申请] 29号明天会评吗 +4 笨笨唐 2026-08-28 4/200 2026-08-31 09:30 by huixian257
[基金申请] 为什么到现在没收到通知? +5 tannykie 2026-08-29 5/250 2026-08-30 21:05 by purplejack
[考博] 找导师 +6 yuanjiabao 2026-08-29 7/350 2026-08-30 14:40 by 生科新手
[基金申请] 我就是申请一个面上项目而已,这评审意见是按照杰青的条件评的吧? +6 gouxfjh 2026-08-28 11/550 2026-08-30 07:57 by gouxfjh
[基金申请] 国自然评审意见 +13 wangmingqi 2026-08-28 19/950 2026-08-29 10:22 by Poppy1104
信息提示
请填处理意见