## Fluids

#### Obtaining swirl number from UDF

• jack forster
Subscriber

I am simulating flow into a combustion chamber. I am trying to obtain the swirl number at multiple cross sectional planes. I have compiled the UDF source code with no errors but I do not know how to extract the value at a specific plane. Is this done within report definitions?

This is the UDF code I am using:

# include "udf.h"DEFINE_ON_DEMAND(calculate_swirl_number){    Domain*d;    Thread *t;    cell_t c;    real rho, mu, U_axial, U_radial, U_circumferential, Swirl_Number;    real angular_momentum = 0.0, axial_momentum = 0.0;    d = Get_Domain(1);    /* Get the density and viscosity of the fluid */    rho = RP_Get_Real("operating-density");    mu = RP_Get_Real("operating-viscosity");     /* Loop over all cells in all threads */    thread_loop_c (t, d)    {        begin_c_loop (c, t)        {            /* Get the axial, radial, and circumferential velocities */            U_axial = C_U(c,t);            U_radial = C_V(c,t);            U_circumferential = C_W(c,t);            /* Calculate the angular momentum and axial momentum */            axial_momentum += rho * U_axial * C_VOLUME(c,t);            angular_momentum += rho * (C_UDMI(c,t,0)) * C_VOLUME(c,t);        }        end_c_loop (c, t)    }    /* Calculate the swirl number */    Swirl_Number = 2 * angular_momentum / (axial_momentum * mu);    /* Print the swirl number to the console */    Message("Swirl Number: %g\n", Swirl_Number);}

Any help would be greatly appreciated.

• Rob
Ansys Employee

Have you looked in the Contour plots? Under Velocity you'll find axial & tangential velocity. In Mesh you'll find Axial and Radial positions. These are relative to the local cell zone axis (set in the Cell Zone panel(s)). You may want a Custom Field Function. You can then report these using the surface reports and/or plot the contours.