 ## Fluids

• rmoss06
Subscriber
Hi all,nnI am using the following body force trying to force my particles to accelerate towards the walls of my rectangular electrostatic precipitator which they are flowing through. I compiled and added the body force to my simulation with no errors and the simulation runs, but this force doesn't seem to affect my particles motion at all. Could I have made a mistake in my code?./* UDF for computing the electric force on a charged particle */nn#include udf.hnn#define Q 7.0 /* particle electric charge */n#define E 4 /* electric field magnitude */n#define TSTART 0 /* field applied at t = tstart */ nn/* Calculate electric force on charged particle. */n/* velocity with electric field: Fx= q*bz*Vy, Fy= -q*bz*Vx */nnDEFINE_DPM_BODY_FORCE(electric_force, p, i)n{ntreal bforce = 0;ntif (P_TIME(p) >= TSTART)nt{nttif (i == 0) bforce = Q * E*P_VEL(p);nnttelse if (i == 1) bforce = -Q * E*P_VEL(p);nnt}ntelsenttbforce = 0.0;nt/* an acceleration should be returned */ntreturn (bforce / P_MASS(p));n}Continued from https://forum.ansys.com/discussion/26077/issues-creating-a-udf-to-act-as-a-force-on-particles#latestn
• YasserSelima
Subscriber
nWhat is the injection velocity? If the particle initial velocity is zero, the force will be zeron
• rmoss06
Subscriber
the injection velocity is 5 m/sn
• YasserSelima
Subscriber
in the UDF, before the return line, add this to see the value of the acceleration ... when dividing this by your time step, you should get an approximate value of the velocity change due to the particle.nn#if RP_HOSTn Message(
acceleration = %f, bforce/P_MASS(p));n#endifn
• rmoss06
Subscriber
Adding that line didn't seem to change anything. After some trouble shooting, it appears that when I run my simulation without any body forces enabled, my particles travel through the space between my two plates with no issues. When I go into discreate phases and set my body force to be electric_force my particles hit the inlet of my simulation and do go up or down, never entering the fluid area between the two plates.n
• YasserSelima
Subscriber
Can you show the geometry?n
• rmoss06
Subscriber
• YasserSelima
Subscriber
From where are you injecting the particles? and what is the velocity direction?n
• rmoss06
Subscriber
the inlet is set as the left edge, the outlet as the right edge, the inlet velocity is 5m/s in the x-direction (left to right) and the injection velocity is set as the same. I checked to see that the inlet and outlet are set on the right axis and they are (x-positive is inlet to outlet direction)nn
• YasserSelima
Subscriber
remove the #if RP_HOST and #endif lines ... leave only the message line and check if fluent write any numbers when you are simulatingn 