-
-
March 23, 2021 at 3:30 pm
rmoss06
SubscriberHi, nI am trying to simulate a Electrostatic Precipitator in Fluent. I have my PM10 injection flowing through my mesh, and my last step is to create a UDF which simulates an electric force acting on the particles. I modified the magnetic force code from the Ansys UDF manual as follows, below, then I place the c file in the folder with my project files, interpret the UDF, select it from the dropdown under UDF in my PM injection, initialize and calculate. During the iteration, I get the following error: chip-exec: electric_force: wrong return type: void udf function expectednumber tracked = 19, escaped = 19nI'm very new to using UDFs so I was wondering if anyone my be able to point me in the right direction as to where I went wrong.nnThanksn/* UDF for computing the electric force on a charged particle */nn#include udf.hnn#define Q 7.0 /* particle electric charge */n#define E 3.0 /* 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[ND_ND] = 0;ntif (P_TIME(p) >= TSTART)nt{nttif (i == 0) bforce[i] = Q * E*P_VEL(p)[0];nnttelse if (i == 1) bforce[i] = -Q * E*P_VEL(p)[1];nnt}ntelsenttbforce[i] = 0.0;nt/* an acceleration should be returned */ntreturn (bforce[i] / P_MASS(p));n} -
March 23, 2021 at 4:18 pm
YasserSelima
Subscribertry this .. n#include udf.h#define Q 7.0 /* particle electric charge */nn#define E 3.0 /* electric field magnitude */nn#define TSTART 0 /* field applied at t = tstart */ nDEFINE_DPM_BODY_FORCE(electric_force, p, i)n{n real bforce = 0;n if (P_TIME(p) >= TSTART)n {n if (i == 0) {n bforce = Q * E*P_VEL(p)[0];n } else if (i == 1) {n bforce = -Q * E*P_VEL(p)[1];n } else {n bforce = 0.0;n }n }n/* an acceleration should be returned */n return (bforce / P_MASS(p));nnnLet me know if you are still getting the same errorn -
March 23, 2021 at 4:35 pm
rmoss06
SubscriberThanks Yasser, that?s seemed to work. I can compile it now and apply it as a body force, the body force doesn?t seem to be affecting my particle motion at all, but at least this is a big step forwards, appreciate it!n -
March 23, 2021 at 4:52 pm
Rob
Ansys EmployeeContinues here to work out why the particles aren't doing anything! nhttps://forum.ansys.com/discussion/26079/body-force-not-affecting-particle-motion#latestnn
-
- The topic ‘Issues Creating a UDF to act as a force on particles’ is closed to new replies.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
-
3716
-
2564
-
1771
-
1236
-
592
© 2023 Copyright ANSYS, Inc. All rights reserved.