#include "udf.h"
#include "math.h"
#include "sg_udms.h"
#define debye 0.001
#define rhomax 0.0008
#define phimax 5000
#define sigma 0.003
#define rholoc 0.5
enum {
phi,
rho
};
enum {
Ex,
Ey,
Fx,
Fy,
Fm
};
%%%%% CALCULATION OF ELECTRIC FIELD STRENGTH %%%%%%%%%%%%%
DEFINE_ADJUST(udf_adjust, domain)
{
Thread *t;
cell_t c;
thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,Ex)=-C_UDSI_G(c,t,phi)[0];
C_UDMI(c,t,Ey)=-C_UDSI_G(c,t,phi)[1];
}
end_c_loop(c,t)
}
}
%%%%% DEFINITION OF SOURCE OF HELMHOLTZ EQUATION %%%%%%%
DEFINE_SOURCE(rho_source, c, t, dS, eqn)
{
real source;
source=-pow(debye,-2)*C_UDSI(c,t,rho);
dS[eqn]=-pow(debye,-2);
return source;
}
%%%%%%%%%%%%%% DEFINITION OF X-MOMENTUM SOURCE TERM %%%%%%%%
DEFINE_SOURCE(X_Source, c, t, dS, eqn)
{
real Sourcex;
Sourcex=-rhomaxphimaxC_UDSI(c,t,rho)C_UDSI_G(c,t,phi)[0];
dS[eqn]=-rhomaxphimax;
C_UDMI(c,t,Fx)=Sourcex;
return Sourcex;
}
%%%%%%%%%%%%%%%% DEFINITION OF Y-MOMENTUM SOURCE TERM %%%%%%%%
DEFINE_SOURCE(Y_Source, c, t, dS, eqn)
{
real Sourcey;
Sourcey=-rhomaxphimaxC_UDSI(c,t,rho)C_UDSI_G(c,t,phi)[1];
dS[eqn]=-rhomaxphimax;
C_UDMI(c,t,Fy)=Sourcey;
C_UDMI(c,t,Fm)=sqrt(C_UDMI(c,t,Fx)*C_UDMI(c,t,Fx)+C_UDMI(c,t,Fy)*C_UDMI(c,t,Fy));
return Sourcey;
}
%%%%%%%%%%%%%%%%%%%%% DISTRIBUTION FUNCTION ON WALL %%%%%%%%%%%%%%%%%%%%
DEFINE_PROFILE(rho_profile,thread,i)
{
float r[3];
float x;
real xloc;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(r,f,thread);
xloc = r[0];
F_PROFILE(f,thread,i)=exp(-pow((xloc-rholoc),2)/(2*pow(sigma,2)));
}
end_f_loop(f,thread)
}
这是国外毕业论文里的UDF( Master of Science Thesis : Master of Science ThesisModeling of Dielectric-Barrier Discharge ActuatorImplementation, validation and generalization of an electrostatic model),模拟一对电极的等离子体,如下图
现在遇到的问题是,不确定在fluent中定义的x和y的动量source term是否正确。
(1)加载UDF后,定义UDM和UDS的数量,5和2.
(2)定义x、y动量源项
y动量源项一样的操作
(3)定义 User Scalar 0 和 1?这个步骤我不太确定
所以在UDF中, rho_source和rho_profile在fluent中应该如何使用呢?请教下各位前辈,谢谢!