TAGGED: dpm, dpm-tracking, dpm-udfs
-
-
September 19, 2024 at 7:46 am
dseong
SubscriberHi all,
I am working on creating a UDF to track particles hitting the outlet boundary. The setup involved in an air purifier in a small chamber, and I aim to set the purifier's efficiency at 95%. (95% of the particles that reach the outlet will escape, while 5% will be reinjected from a reinjection point)
From my understanding:
return PATH_ENDÂ is used for considering particles escaped from the domain and
return PATH_ACTIVEÂ is for continuously tracking particles
I would like to set up the system so that 5% of particles are reinjected from the reinjection point and continue being tracked. While PATH_END seems to work as expected, PATH_ACTIVE does not. In the console, particles are being aborted.
I have revised my code several times and attempted different solutions, but I am currently out of ideas.
Would anyone be able to help me solve this issue or suggest any possible approaches? I would greatly appreciate your insights.
Thank you in advance!
Best regards,
Dahae
--------------------------------------------------------------
Here is my code FYI:
#include "udf.h"
#include "dpm.h"
#define REINJECT_POSITION_X 2.0 // Set the x-coordinate of the reinjection point
#define REINJECT_POSITION_Y 0.425 // Set the y-coordinate of the reinjection point
#define REINJECT_POSITION_Z 0.18 // Set the z-coordinate of the reinjection point
/* Global variables */
int particle_count = 0;
int escaped_count = 0;
int reinjected_count = 0;
DEFINE_DPM_BC(udf_outlet, tp, t, f, f_normal, dim)
{
particle_count++;
if (particle_count <= 95)
{
/* Mark as escaped */
escaped_count++;
return PATH_END;
}
if (particle_count > 95)
{
/* Mark as reinjected */
reinjected_count++;
/* Move particle to specific point */
P_POS(tp)[0] = REINJECT_POSITION_X; // Specific X position
P_POS(tp)[1] = REINJECT_POSITION_Y; // Specific Y position
P_POS(tp)[2] = REINJECT_POSITION_Z; // Specific Z position
return PATH_ACTIVE;
}
/* Reset the counter after 100 particles */
if (particle_count > 100)
{
particle_count = 0;
escaped_count = 0;
reinjected_count = 0;
}
return PATH_ACTIVE;
} -
September 19, 2024 at 10:53 am
Rob
Forum ModeratorAre you applying the UDF to the outlet boundary? What fate did you set on the boundary?Â
-
September 20, 2024 at 12:31 am
-
-
September 20, 2024 at 10:30 am
Rob
Forum ModeratorHow far into the domain is the injection?
-
September 23, 2024 at 12:28 am
dseong
SubscriberÂ
I injected around 10,000 particles uniformly all around the domain (the size of the domain is 3 m by 4 m by 2.5 m). And I wanted to set the 5% of particles passing the pressure outlet to be reinjected from the inlet. So, I specified the reinjection point in front of the inlet.Â
Â
-
-
September 23, 2024 at 10:21 am
Rob
Forum ModeratorBut you're not sending 5% back you're sending count-95 back. Or would be if it worked.Â
-
September 24, 2024 at 1:08 am
dseong
SubscriberFrom my understanding, 'return PATH_END' means that particles escaped from the domain. So, I thought my code said that the particle count of less than 95 escaped. Could you please correct my code?Â
if (particle_count <= 95)
{
/* Mark as escaped */
escaped_count++;
return PATH_END;
}
if (particle_count > 95)
{
/* Mark as reinjected */
reinjected_count++;
/* Move particle to specific point */
P_POS(tp)[0] = REINJECT_POSITION_X; // Specific X position
P_POS(tp)[1] = REINJECT_POSITION_Y; // Specific Y position
P_POS(tp)[2] = REINJECT_POSITION_Z; // Specific Z position
return PATH_ACTIVE;
}
-
-
September 24, 2024 at 9:00 am
Rob
Forum ModeratorI'm not debugging, the problem is if (particle_count > 95) I think.Â
-
September 25, 2024 at 1:29 am
dseong
SubscriberThanks for your reply, Rob
I am sorry but I am having trouble understanding the issue. If the problem lies with particle_count>95, how should I relocate particles from 96th to 100th that are hitting the outlet? I would greatly appreciate your answer.Â
-
-
September 25, 2024 at 8:48 am
Rob
Forum ModeratorIf you have 100 parcels you'll have the last 5 be reinjected. But... with 1000 particles you'll have 905 reinjected. So a random number function may be better.Â
Now, for the actual return part. If a parcel hits the outlet does it leave the domain before the UDF triggers? If you put a surface at a few cells into the domain (porous jump are really useful for this) does behaviour change?
-
- You must be logged in to reply to this topic.
- How do I get my hands on Ansys Rocky DEM
- Script Error
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- convergence issue for transonic flow
- Facing trouble regarding setting up boundary conditions for SOEC Modeling
- Point exception in erosion calculation
- Errors with multi-connected bodies using AQWA
- Script Error Ansys
-
2397
-
930
-
599
-
591
-
559
© 2025 Copyright ANSYS, Inc. All rights reserved.