Fluent-UDF造波源程序集(共7页).doc
《Fluent-UDF造波源程序集(共7页).doc》由会员分享,可在线阅读,更多相关《Fluent-UDF造波源程序集(共7页).doc(7页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、精选优质文档-倾情为你奉上法一:边界造波法程序一:inlet.c#include udf.h /* #include (输入输出)*/ #include#include#define HH 0.5 /*waver hight*/ /*不同波形需要修改的波形参数*/#define LL 0.95 /*波长*/#define g 9.81#define pi 3.#define d 0.5 /*water deepth */DEFINE_PROFILE(x_velocity,thread,index) real kk = 2.0*pi/LL; real c = sqrt(g*tanh(kk*d)/
2、kk); /*参见一般性公式的推导*/ real TT = LL/c; real xND_ND; /* this will hold the position vector */ real y = 0; real s = 0; real ct = 0; /*相位角*/ face_t f; real t = CURRENT_TIME; real u = 0; t=RP_Get_Real(flow-time); begin_f_loop(f,thread) /* loops over all faces in the thread passed in the DEFINE macro argume
3、nt */ F_CENTROID(x,f,thread); y = x1; s = y+d; ct = kk*(x0-c*t); /*参见一般性公式的推导*/ if(y 0.5*HH*sin(ct) /*水面以下,其中,0.5*HH*sin(ct)为波面方程*/ u = pi*HH*cosh(kk*s)*sin(ct)/(TT*sinh(kk*d); /*x方向速度分量公式,参见一般性公式的推导*/ else u = 0.0; /*水面以上流体单位速度矢量的x方向分量*/ F_PROFILE(f,thread,index) = u; end_f_loop(f,thread)DEFINE_PRO
4、FILE(y_velocity,thread,index) real kk = 2.0*pi/LL; real c = sqrt(g*tanh(kk*d)/kk); real TT = LL/c; real xND_ND; /* this will hold the position vector */ real y = 0; real s = 0; real ct = 0; face_t f; real t = CURRENT_TIME; real v = 0; t=RP_Get_Real(flow-time); begin_f_loop(f,thread) F_CENTROID(x,f,t
5、hread); y = x1; s = y+d; ct = kk*(x0-c*t); if(y 0.5*HH*sin(ct) v = pi*HH*sinh(kk*s)*cos(ct)/(TT*sinh(kk*d); else v = 0.0; F_PROFILE(f,thread,index) = v; end_f_loop(f,thread)DEFINE_PROFILE(voffactor,thread,index)real kk = 2.0*pi/LL; real c = sqrt(g*tanh(kk*d)/kk);real TT = LL/c; real xND_ND; /* this
6、will hold the position vector */ real y = 0; real s = 0; real ct = 0; face_t f; real t = CURRENT_TIME; t=RP_Get_Real(flow-time); begin_f_loop(f,thread) F_CENTROID(x,f,thread); y = x1;s = y+d; ct = kk*(x0-c*t); if(y 0.5*HH*sin(ct) F_PROFILE(f,thread,index) = 1.0; else F_PROFILE(f,thread,index) = 0.0;
7、 end_f_loop(f,thread)程序二:wave.c (此程序同程序一大致相同)#include udf.h /* must be at the beginning of every UDF you write new9 case */real AA=0.5; /*waver amplitude*/real LL=0.95; /*不同波形需要修改的波形参数*/real TT=0.78;real pi=3.real kk=2.0*pi/TT;real ww=2.0*pi/LL;real h=0.5; /*water deepth */real ux=1.0; /*此为何变量?*/DEF
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Fluent UDF 波源 程序
限制150内