TAGGED: eulerian-multiphase, udf
-
-
February 8, 2024 at 9:19 amnicolo varalloSubscriber
Good morning to everyone.
I am simulating the flow field in a cylindrical 3D bubble column using the Eulerian-Eulerian approach.
I need to define a drag coefficient that depends on the distance from the wall. My idea was to use the C_CENTROID macro to calculate the distance from the column centre and consequently define the drag coefficient, but it did not work.
Can anyone help me?
In the following, how I calculate the spatial coordinate to define the dependency of the drag coefficient on the radial coordinate.
begin_c_loop_all(c,t)
  {
    C_CENTROID(xc,c,t);
    r=pow(xc[0]*xc[0]+xc[2]*xc[2],0.5); //distance from the column centre. The coordinate y is the column axis
    CD= a*r // just an example
    }
end_c_loop_all(c,t)Â
Â
-
February 8, 2024 at 9:50 amRobForum Moderator
It's not compiling, giving an error or giving the wrong answer? "Not working" isn't that precise! :)Â
-
February 8, 2024 at 10:00 amnicolo varalloSubscriber
Sorry for that. It gives the wrong answer; the compilation is ok.
I obtain a constant coefficient without any spatial dependency.
Â
-
February 8, 2024 at 12:03 pmRobForum Moderator
Looking at https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v241/en/flu_udf/flu_udf_MultiphaseDEFINE.html%23flu_udf_sec_define_exchange_property I don't know if you need the cell loop.Â
-
February 8, 2024 at 4:58 pmnicolo varalloSubscriber
Thanks for you reply.
I tried without cell loop, but it is the same. I think the problem is related to the calculation of the distance from the wall. I implemented this simple udf to see if the C_CENTROID works as expected. The udf defines a drag coefficient equal to 3 if the axial coordinate is smaller than 2m, 5 otherwise:
#include "udf.h"#include "math.h"DEFINE_EXCHANGE_PROPERTY(WLL,c,t,i,j){Thread *t_a = THREAD_SUB_THREAD(t,j);Thread *t_w = THREAD_SUB_THREAD(t,i);real CD;real xc[ND_ND];real a=2;C_CENTROID(xc,c,t);real y=xc[1];Â Â Â Â if (y < a)Â Â Â Â Â Â {Â Â Â Â Â Â CD=3;Â Â Â Â Â Â }Â Â Â Â Â Â else if (y>a)ÂÂ Â Â Â Â Â {Â Â Â Â Â Â CD=5;Â Â Â Â Â Â }Âbegin_c_loop_int(c,t){C_UDMI(c,t,0)=CD;}end_c_loop_int(c,t)return CD;}ÂThe result obtained is wrong as the figure shows:The withe line corresponds to a distance from the column bottom of 2m.
Â
-
February 8, 2024 at 5:13 pmRobForum Moderator
The white line may be 2m from the column bottom but the UDF is looking at the y-coordinate. What range of y does Fluent show (Scale is a good way to check).Â
-
February 8, 2024 at 5:22 pmnicolo varalloSubscriber
Â
Â
y is the axial coordinate, with y comprised between 0 and 2m, x between -0.12 and 0.12m and z between -0.12 and 0.12m.
The contour represents only the region of interest, not the whole geometry.
The problem is that the udf does not correctly compute the distance from the column’s bottom.
Â
Â
-
February 9, 2024 at 9:36 amRobForum Moderator
You're not computing a distance, xc[1] is the y-coordinate. So if your domain is 0-2m in the y direction.Â
-
February 9, 2024 at 9:52 amnicolo varalloSubscriber
Why not? If the reference frame is (0,0,0) and coincides with the column bottom, the y-coordinate of each cell centre coincides with the distance of the cell centre from the column bottom.Â
-
-
February 9, 2024 at 10:01 amRobForum Moderator
Reference frame isn't necessarily inside the domain. What is the minimum y coordinate in your mesh?Â
-
February 9, 2024 at 10:04 am
-
February 9, 2024 at 10:27 amRobForum Moderator
Thanks - that's what I wanted to check. You're not working with "wall distance" as that's a different macro, and not useful here. Can you replot the contour and overlay the mesh?Â
-
February 9, 2024 at 10:47 am
-
February 9, 2024 at 2:18 pmRobForum Moderator
Get rid of the cell loop around the UDM.Â
-
February 9, 2024 at 2:31 pmnicolo varalloSubscriber
Now it works. Thank you very much!
-
February 9, 2024 at 3:03 pmRobForum Moderator
I had to ask too!Â
-
- The topic ‘UDF for multiphase flow’ is closed to new replies.
- How do I get my hands on Ansys Rocky DEM
- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Script Error
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Facing trouble regarding setting up boundary conditions for SOEC Modeling
- convergence issue for transonic flow
- Running ANSYS Fluent on a HPC Cluster
- Point exception in erosion calculation
-
1932
-
823
-
599
-
591
-
366
© 2025 Copyright ANSYS, Inc. All rights reserved.