CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF that can get the number of particles passing through a certain interior region

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 6, 2024, 07:56
Default UDF that can get the number of particles passing through a certain interior region
  #1
New Member
 
S.J
Join Date: Mar 2024
Posts: 1
Rep Power: 0
SunDongYul is on a distinguished road
Hello. I am doing a cyclone DPM simulation with ANSYS FLUENT.

I want to know the number of particles passing through a certain interior surface, but it is a interior surface so I can't set it as a trap.

The equation for the surface is [x]^{2}+[y]^{2}[/math][/math] = 0.0025, 0\leqz\leq0.1.
(Side of a cylinder with radius 0.05, height 0.1)

I wrote code to exclude particles when they enter a certain area.
The UDF code is as follows.
The condition is transient, Steady particle tracking.

#include "udf.h"
#include "math.h"
#include "dpm.h"

DEFINE_DPM_SCALAR_UPDATE(trapp, c, t, initialize, p)
{
real x[ND_ND]; // Array to store particle positions
real t_r = 0.05; // Radius of reference circle
real h_min = 0; // Minimum height
real h_max = 0.1; // Maximum height
real d_from_center; // Distance between particle and the center of the circle

C_CENTROID(x, c, t); // Get the current particle position

d_from_center = sqrt(x[0] * x[0] + x[1] * x[1]);

if (d_from_center <= t_r && x[2] >= h_min && x[2] <= h_max)
{
return PATH_ABORT; // Remove particles when they come within range
}
}

An error occurs when building udf in FLUENT, but I don't know what the error is.

I also tried using another macro, P_POS(p), to express the position of the particle, but an error still occurred.

Please let me know how I can implement the code.
Other different methods with my code are also okay. Please give me some advice.

Thank you.
SunDongYul is offline   Reply With Quote

Old   March 11, 2024, 14:18
Default Help
  #2
New Member
 
Mohammed
Join Date: Sep 2018
Posts: 15
Rep Power: 7
mohkh is on a distinguished road
is my code right
#include "udf.h"
#define Beta 60. /*Exit angle of swirler*/
#define PI 3.14159265359
#define WEIGHT 1.e20
DEFINE SOURCE(user swirl, cell, thread, dS, eqn)
{
real swirl_vel, x[3], y, source;
/*float swirl_vel, x[3], y, source;*/
C_CENTROID(x, cell, thread);
y=x[1];
/* y-coord, radius */
swirl_vel=(C_U(cell, thread))*(tan(Beta*PI/180)); /*swirl vel in cell*/
/* returning the linearized source (see below) */ source=WEIGHT*(swirl vel-C_ SWIRL(cell, thread)); dS[eqn]=-WEIGHT;
return source; }
mohkh is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
use the message in macro DEFINE_PROFILE with parallel processor alireza_T Fluent UDF and Scheme Programming 3 May 11, 2022 02:08
[Other] Equal decomposition of cylindrical fluid domain Sean95 OpenFOAM Meshing & Mesh Conversion 3 February 12, 2019 03:34
SigFpe when running ANY application in parallel Pj. OpenFOAM Running, Solving & CFD 3 April 23, 2015 14:53
Cluster ID's not contiguous in compute-nodes domain. ??? Shogan FLUENT 1 May 28, 2014 15:03


All times are GMT -4. The time now is 19:13.