CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Calculate net species/ UDS flux (

PK57 July 13, 2004 15:18

Calculate net species/ UDS flux
I am new to Fluent. I am using the software to model electrochemical analyses with advective effects. I have found in Fluent the capability to solve for the net flux of energy through a surface which has a specified temperature. Is there an easily available analogous capability for calculating the net flux of an electroactive species to a solid surface? Or the surface integral of normal gradient of the species concentration at a surface? Thanks!

Peter Kottke July 21, 2004 09:58

Re: Calculate net species/ UDS flux
Figured it out - a UDF to do this is based on Fluent 6.1 UDF Guide section 5.2.2 Connectivity Variables. Here's the UDF for UDS-0 : note that because Execute_at_end does not have threads available to be passed, the zone ID and index must be hard coded. Also, prior to linking to a case file, type "solve/set/expert" and then answer "yes" to the question "keep temporary solver memory from being freed? Finally, use as a compliled not interpreted UDF.


#include "udf.h"

#include "sg.h"



Domain *dom= Get_Domain(1);

int ID=5;

int index=0;

Thread *f_thread = Lookup_Thread(dom,ID);

Thread *tc0;

face_t f;

cell_t c0;

real grad[ND_ND];

real A[ND_ND];

real es[ND_ND];

real dr0[ND_ND];

real A_by_es;

real ds;

real flux;

real scalar_c;

real scalar_f;

real grad_p;

real grad_x;

real D;/* scalar diffusion coefficient*/

real rho;/* mixture density*/

flux = 0.0;

begin_f_loop(f, f_thread);


c0 = F_C0(f,f_thread);

tc0 = THREAD_T0(f_thread); BOUNDARY_FACE_GEOMETRY(f,f_thread,A,ds,es,A_by_es, dr0)





rho = C_R(c0,tc0);

D=C_UDSI_DIFF(c0,tc0,index)/rho; /* for my applications expect D to be constant therefore OK, also, my D is FLUENTs gamma/rho*/





end_f_loop(f, f_thread);

flux=flux*2.*M_PI; /* for 2-D axisymetric calculation */

Message("Surface integral of boundary flux of normal gradient of scalar: %g\n", flux);

Petere Kottke August 2, 2004 08:16

Re: Calculate net species/ UDS flux
Slight correction to the above - for general 2 or 3 - D problem replace lines such as "grad[0]=C_UDSI_G(c0,tc0,index)[0];" with ND_SET commands

Sandeep August 4, 2004 09:59

How can I calculate the Flux of Vof species at the cell face. Please let me know

All times are GMT -4. The time now is 17:34.