 ## Fluids

• Diogo Martinho
Subscriber

Hey all,

I am defining my species transport equations through UDS. This is because my scalar is the molar concentration.

So I thought I could divide it by rho.

return F_FLUX(f,t)/rho;

What is the meaning of this? What am I returning and which units?

This is the example from the manual. I dont understand if I need to have this part
NV_DS(psi_vec, =, C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),*,C_R(c0,t0));
NV_DS(psi_vec, +=, C_U(c1,t1),C_V(c1,t1),C_W(c1,t1),*,C_R(c1,t1));
flux = NV_DOT(psi_vec, A)/2.0; /* Average flux through face */

If I use the F_FLUX(f,t).

**********************************************************************/
/* UDF that implements a simplified advective term in the */
/* scalar transport equation */
/**********************************************************************/
#include "udf.h"
DEFINE_UDS_FLUX(my_uds_flux,f,t,i)
{
cell_t c0, c1 = -1;
real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;
c0 = F_C0(f,t);
F_AREA(A, f, t);
/* If face lies at domain boundary, use face values; */
/* If face lies IN the domain, use average of adjacent cells. */
if (BOUNDARY_FACE_THREAD_P(t)) /*Most face values will be available*/
{
real dens;
/* Depending on its BC, density may not be set on face thread*/
dens = F_R(f,t); /* Set dens to face value if available */
else
dens = C_R(c0,t0); /* else, set dens to cell value */
NV_DS(psi_vec, =, F_U(f,t), F_V(f,t), F_W(f,t), *, dens);
flux = NV_DOT(psi_vec, A); /* flux through Face */ }
else
{
c1 = F_C1(f,t); /* Get cell on other side of face */
NV_DS(psi_vec, =, C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),*,C_R(c0,t0));
NV_DS(psi_vec, +=, C_U(c1,t1),C_V(c1,t1),C_W(c1,t1),*,C_R(c1,t1));
flux = NV_DOT(psi_vec, A)/2.0; /* Average flux through face */
}
/* Ansys Fluent will multiply the returned value by phi_f (the scalar’s
value at the face) to get the ‘‘complete’’ advective term. */
return flux;
}

• Rob
Ansys Employee

You might be better off using the species model?

The NV_ macros look to be vectors, and "return" takes the result of your UDF back to wherever it's been hooked up.

• Diogo Martinho
Subscriber

But this is the UDS I would like to define where Ci is the molar concentration of the species i

• Rob
Ansys Employee

Then you may need to mess with the scalar transport equations, or look at the UDMs if the movement of the scalar isn't what you're wanting. We're very limited in the level of support we can offer via the Community, and what you're doing is definitely beyond where we can do much more than point you at the documentation.

• Diogo Martinho
Subscriber

Thank you Rob!! 