各位前辈好!最近在关于喷油器动网格问题上陷入了困境,希望能够得到大家的帮助。
先简单说一下喷油器的工作原理。图一为三维模型的剖面截图。
5eff8661692327fa42f84dfe24b6f95.png
5deae10e01c9e42e75ad3500a12d353.png
cd0e8a4b2e3be20ae6dee2b9c90b6dc.png
上面那个是球阀,下面那个是针阀,球阀、针阀最初均只受到液体力、弹簧力共同作用静止不动,然后给球阀施加一个电磁力,球阀开始运动,进而改变了流场的压力,从而使得下面的针阀也随之运动。研究的内容主要是通过向fluent中导入模拟两个阀门运动的udf文件,如下。球阀udf```
#include "udf.h"
#include "dynamesh_tools.h"
static real v_prev = 0.0;//initial velocity
static real loc_prev = 0.0;//spring deformation
DEFINE_CG_MOTION(ballball_six_three_one_parallel3, dt, vel, omega, time, dtime)
{
real ELECTROMAGNETIC_FORCE_MAGNITUDE = 155.0;
real SPRING_FORCE_MAGNITUDE = 100.0;
real SPRING_STIFFNESS = 20000.0;
real MASS = 0.00184;
real DISPLACEMENT_LIMIT = 0.0001;
real f1 = 0.0;
real f2, f_s, dv;
real NV_VEC(A);
#if !RP_HOST
Thread *t;
face_t f;
NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
if (!Data_Valid_P())return;
t = DT_THREAD(dt);
begin_f_loop(f, t)
{
if (PRINCIPAL_FACE_P(f, t))
{
F_AREA(A, f, t);
f1 = f1 + F_P(f, t) * A[1];
}
}
end_f_loop(f, t)
#endif
#if RP_NODE
f1 = PRF_GRSUM1(f1);
#endif
node_to_host_real_1(f1);
#if !RP_NODE
if (time <= 0.0001)
{
if (loc_prev < DISPLACEMENT_LIMIT)
{
f_s = SPRING_FORCE_MAGNITUDE + SPRING_STIFFNESS * loc_prev;//spring force
f2 = f1 + ELECTROMAGNETIC_FORCE_MAGNITUDE - f_s;
dv = dtime * f2 / MASS;
v_prev = v_prev + dv;
loc_prev = loc_prev + v_prev * dtime;
}
else
{
v_prev = 0.0;
}
}
if (time > 0.0001)
{
if (loc_prev > 0)
{
f_s = SPRING_FORCE_MAGNITUDE + SPRING_STIFFNESS * loc_prev;//spring force
f2 = - f_s;
dv = dtime * f2 / MASS;
v_prev = v_prev + dv;
loc_prev = loc_prev + v_prev * dtime;
}
else
{
v_prev = 0;
}
}
Message("\n\ntime=%f,y_vel=%f,f1=%f,f2=%f,f_s=%f,loc_prev=%f,dv=%f\n", time, v_prev, f1, f2, f_s, loc_prev, dv);
#endif
host_to_node_real_1(v_prev);
vel[1] = v_prev;
}
针阀udf:
#include "udf.h"
#include "dynamesh_tools.h"
static real v_prev = 0.0;//initial velocity
static real loc_prev = 0.0;//spring deformation
DEFINE_CG_MOTION(needle_six_three_one_parallel2, dt, vel, omega, time, dtime)
{
real SPRING_FORCE_MAGNITUDE = 30.0;
real SPRING_STIFFNESS = 20000.0;
real DISPLACEMENT_LIMIT = 0.00018;
real MASS = 0.01;
real f1 = 0.0;
real f2, f_s, dv;
real NV_VEC(A);
#if !RP_HOST
Thread *t;
face_t f;
NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
if (!Data_Valid_P())return;
t = DT_THREAD(dt);
begin_f_loop(f, t)
{
if (PRINCIPAL_FACE_P(f, t))
{
F_AREA(A, f, t);
f1 = f1 + F_P(f, t) * A[1];
}
}
end_f_loop(f, t)
#endif
#if RP_NODE
f1 = PRF_GRSUM1(f1);
#endif
node_to_host_real_1(f1);
#if !RP_NODE
f_s = SPRING_FORCE_MAGNITUDE + SPRING_STIFFNESS * loc_prev;
f2 = f1 - f_s;
dv = dtime * f2 / MASS;
if (f2 <= 0.0)
{
if (loc_prev <= 0.0)
{
v_prev = 0.0;
}
else
{
v_prev = v_prev + dv;
loc_prev = loc_prev + v_prev * dtime;
}
}
else
{
if (loc_prev < DISPLACEMENT_LIMIT)
{
v_prev = v_prev + dv;
loc_prev = loc_prev + v_prev * dtime;
}
else
{
v_prev = 0.0;
}
}
Message("\n\nn_time=%f,n_y_vel=%f,n_f1=%f,n_f2=%f,n_f_s=%f,n_loc_prev=%f,n_dv=%f\n",time,v_prev,f1,f2,f_s,loc_prev,dv);
#endif
host_to_node_real_1(v_prev);
vel[1] = v_prev;
}
但是导入计算后计算到一半fluent总是卡在一半,没有报错,
也没有退出,就是卡在一个界面无法继续算下去,就是上图
的一直卡在0.000077s,就算不下去了,等了快半周了还是在
那个位置,不知道是代码的原因还是什么原因。
希望能够得到前辈们的解答。万分感谢!!!!
![5deae10e01c9e42e75ad3500a12d353.png](/assets/uploads/files/1703672401397-5deae10e01c9e42e75ad3500a12d353.png)
![cd0e8a4b2e3be20ae6dee2b9c90b6dc.png](/assets/uploads/files/1703672414778-cd0e8a4b2e3be20ae6dee2b9c90b6dc.png)