CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

On the UDS flux

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   October 6, 2020, 22:51
Default On the UDS flux
New Member
Join Date: Jul 2020
Posts: 12
Rep Power: 5
Shoh is on a distinguished road
I currently conduct a steady-state simulation for the velocity and (passive) scalar fields.

In calculating scalar field, we should specify flux function in 'user-defined/scalars'.
Here, I don't understand the difference between the 'mass flow rate' flux function (given by fluent) and a 'DEFINE_UDS_FLUX' (provided by udf manual, see below).

I conducted simulations with both flux functions and found that the results are different.

The following is the code of 'DEFINE_UDS_FLUX' in udf manual:

/************************************************** ********************/
/* UDF that implements a simplified advective term in the */
/* scalar transport equation */
/************************************************** ********************/
#include "udf.h"
cell_t c0, c1 = -1;
Thread *t0, *t1 = NULL;
real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;
c0 = F_C0(f,t);
t0 = F_C0_THREAD(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 */
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 */
c1 = F_C1(f,t); /* Get cell on other side of face */
t1 = F_C1_THREAD(f,t);
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;

I think the above code also returns mass flow rate (rho*u*A), and thus I expected that the results should be identical. But I don't understand why the results are different each other.

I really appreciate if you give an answer.
Best regards,
Shoh is offline   Reply With Quote

Old   May 12, 2022, 14:16
Default Same issue
New Member
Pedro Bianchi
Join Date: Jul 2016
Location: Campinas, Brazil
Posts: 1
Rep Power: 0
pedro.bnchi is on a distinguished road
I have had the same issues (in a 2D axisymmetric case). Did you find the solution for it?
pedro.bnchi is offline   Reply With Quote


flux function, mass flow rate, uds

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 07:30
UDS Flux Function Choice Yang Chung FLUENT 1 November 17, 2015 01:14
setting UDS Flux Andrew Garrard FLUENT 9 February 10, 2015 13:26
UDS Flux Function Problem sunbird04 FLUENT 6 April 28, 2014 02:58
Help with UDS FLUX Andrew Garrard FLUENT 2 February 14, 2005 05:47

All times are GMT -4. The time now is 21:35.