We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

[UDF] [PARTICLE] Raycast or find distance to walls in multiple directions?

    • adrian.sieradzki
      Subscriber

      Hello,

      I am studying behaviour of particles in procedurally generated devices.
      To that end I need to know approximate distance (relative X, Y) of my particle to the walls of the device. Is there anything at all in Ansys UDF api to help with that?
      For my use case an omnidirectional raycast would be nice but I dont see anything similar in the documentation.

      Is there a way to do this in Ansys? Or any other suggestions on how to get my relative distance from walls inside volume mesh? 

    • Ahmed Hussien
      Ansys Employee

      You can use the DEFINE_DPM_BC macro, which provides access to the particle properties at boundary interactions. Within this macro, you can use TP_POS(tp) to obtain the particle's position.

      For more details, refer to the Fluent documentation on DPM macros—you’ll find several examples illustrating how DEFINE_DPM_BC is used. 2.5. Discrete Phase Model (DPM) DEFINE Macros

      If you're trying to calculate the particle's distance from the wall, one approach is to loop through all wall boundary zones and compute the distance between the particle position and each wall face (or face centroid). The shortest distance among them can then be taken as the approximate particle-to-wall distance.

       

Viewing 1 reply thread
  • You must be logged in to reply to this topic.