|
[Sponsors] |
UDF that can get the number of particles passing through a certain interior region |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 6, 2024, 08:56 |
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 |
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, 0z0.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. |
|
March 11, 2024, 15:18 |
Help
|
#2 |
New Member
Mohammed
Join Date: Sep 2018
Posts: 15
Rep Power: 8 |
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; } |
|
|
|
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 03:08 |
[Other] Equal decomposition of cylindrical fluid domain | Sean95 | OpenFOAM Meshing & Mesh Conversion | 3 | February 12, 2019 04:34 |
SigFpe when running ANY application in parallel | Pj. | OpenFOAM Running, Solving & CFD | 3 | April 23, 2015 15:53 |
Cluster ID's not contiguous in compute-nodes domain. ??? | Shogan | FLUENT | 1 | May 28, 2014 16:03 |