TAGGED: concentration, dpm, fluent, particle, udf
-
-
August 29, 2021 at 9:00 am
xsp2020
SubscriberCan any researcher provide the udf for calculating the particle concentration in FLUENT DPM model using "PSI-C" method?
I tried to write this udf, but after using both "DEFINE_DPM_SCALAR_UPDATE( ParticleCon,c,t,initialize,tp)" and "C_UDMI(c,t,0)+=P_FLOW_RATE(tp)*dt/C_VOLUME(c,t)" at the same time, the residence time of particles within a cell is always cumulative over all iteration time steps and is not only the final value. Besides, the concentration is always cumulative over the flow time steps.Any suggestion or comment is welcome!
(the residence time dt= (P_TIME(tp)-P_TIME0(tp)))
August 30, 2021 at 8:46 pmSurya Deb
Ansys EmployeeHello,
You can write a DEFINE_EXECUTE_AT_END UDF and then loop over all the injections and all the particles in those injections. Then you can use something like this within the loop:
c = P_CELL(p);
t = P_CELL_THREAD(p);
C_UDMI(c, t, 0) += P_N(p) * P_MASS(p)/C_VOLUME(c, t);
Check if P_N(p) is fetching the correct # of particles by testing a simple model.
Regards SD
August 31, 2021 at 5:14 amxsp2020
SubscriberHi sdeb
Thanks for you answer. As a new to UDF, I tried the idea of particle loop based on the Fluent Customization Manual's example 2.5.12.3, the udf tested is shown below. Surprisingly, the contour output of UDM results is always 0. Could you please provide more information about your idea?
Then, besed on my tests of comparison between "C_UDMI(c,t,0)+=C_VOLUME(c,t)"and"C_UDMI(c,t,0)=C_VOLUME(c,t)" in the "DEFINE_DPM_SCALAR_UPDATE( ParticleCon,c,t,initialize,tp)", the "C_UDMI(c,t,0)+=..." can successfully tracking the particles in every cell and display the gradient-changing contour,in which the inlet position is highest because more particles passed with the same cell volume. Hovever, it still exists the cumulative issues described in question. Due to the "0" resul of the particle loop method, i still couldn't try more parctices to validate its effectiveness.
Thank you again for your enthusiastic reply.Looking forward to more ideas from you.

August 31, 2021 at 9:50 amAmine Ben Hadj Ali
Ansys EmployeeYour UDF is wrong: tp (tracked particle) is not defined in the EXECUTE_AT_END.
in DEFINE_DPM_SOURCE you can store the Particle residence time and use it for any thing. If you want to get the particle concentration, there is another way to store it as Temp Value or use what Surya suggested.
August 31, 2021 at 11:43 amxsp2020
SubscriberHiDrAmine
I agree with your point that tp (tracked particle) is not defined in the EXECUTE_AT_END. Before, I only suspect but am not sure, Thank you for helping me to improve my knowledge of udf.
Then, the DEFINE_DPM_SOURCE is also tried. but i trapped in the trouble how to link the "source" to UDM that can be shown in contour. Could you provide a udf example or other information helpful to deal with this trouble.
Thank you again for your enthusiastic reply.Looking forward to more ideas from you.
September 1, 2021 at 6:14 amAmine Ben Hadj Ali
Ansys EmployeeExamples are provided in the Customization Manual.
With DEFINE_DPM_SOURCE you can easily calculate Residence time as you have State at Entry and State at Exit from the cell. From that you get the the time and you can do with it whatever you want like averaging, etc. Once you have done that it is time to store into a cell memory and here I recommend that you track particles using MPI and not Hybrid to avoid issues related to competing tasks (One can avoid these issues but that will require some further coding).
September 3, 2021 at 6:46 amSeptember 3, 2021 at 11:34 amAmine Ben Hadj Ali
Ansys EmployeeYour UDF is wrong: C_DPMS_CONCENTRATION is actually the DPM Concentration you want to access which is already available. It is provided by Fluent: so no need to overwrite it.
Viewing 7 reply threads- The topic ‘The udf for “PSI-C” method?’ is closed to new replies.
Innovation SpaceTrending discussionsTop Contributors-
4944
-
1639
-
1386
-
1242
-
1021
Top Rated Tags© 2026 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-
