CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)

 sarah_ron2002 April 10, 2007 00:40

Question about Postprocessing Using UDF(in tutoria

Dear all,

I have a question for the tutorial provided in UDF:

Postprocessing Using User-Defined Scalars (I have included at the end of this post for your reference).

My question is about setting up the equation for the UDS. In the tutorial, it says "In addition to compiling this UDF, as described in Chapter 5, you will need to enable the solution of a user-defined scalar transport equation in FLUENT.". What are the equations for the two UDS ( T4, MAG_GRAD_T4)? How to determine the diffusity,flux and source terms? Any response will be high welcome! Thank you very much for your help! Sincerely, sarah

================================================== =========== Postprocessing Using User-Defined Scalars (http://venus.imp.mx/hilario/SuperCom...ml/node107.htm) Below is an example of a compiled UDF that computes the gradient of temperature to the fourth power, and stores its magnitude in a user-defined scalar. The computed temperature gradient can, for example, be subsequently used to plot contours. Although the practical application of this UDF is questionable, its purpose here is to show the methodology of computing gradients of arbitrary quantities that can be used for postprocessing.

/************************************************** *********************/ /* UDF for computing the magnitude of the gradient of T^4 */ /************************************************** *********************/

#include "udf.h"

/* Define which user-defined scalars to use. */ enum { T4, MAG_GRAD_T4, N_REQUIRED_UDS };

/* Make sure there are enough user-defined scalars. */ if (n_uds < N_REQUIRED_UDS)

Internal_Error("not enough user-defined scalars allocated");

/* Fill first UDS with temperature raised to fourth power. */ thread_loop_c (t,domain)

{

{

begin_c_loop (c,t)

{

real T = C_T(c,t);

C_UDSI(c,t,T4) = pow(T,4.);

}

end_c_loop (c,t)

}

}

{

{

begin_f_loop (f,t)

{

real T = 0.;

T = F_T(f,t);

T = C_T(F_C0(f,t),t->t0);

F_UDSI(f,t,T4) = pow(T,4.);

}

end_f_loop (f,t)

}

}

{

NULL != T_STORAGE_R_NV(t,SV_UDSI_G(T4)))

{

begin_c_loop (c,t)

{

}

end_c_loop (c,t)

}

}

{

NULL != T_STORAGE_R_NV(t->t0,SV_UDSI_G(T4)))

{

begin_f_loop (f,t)

{

}

end_f_loop (f,t)

}

} }

The conditional statement if (NULL != THREAD_STORAGE(t,SV_UDS_I(T4))) is used to check if the storage for the user-defined scalar with index T4 has been allocated, while NULL != T_STORAGE_R_NV(t,SV_UDSI_G(T4)) checks whether the storage of the gradient of the user-defined scalar with index T4 has been allocated.

In addition to compiling this UDF, as described in Chapter 5, you will need to enable the solution of a user-defined scalar transport equation in FLUENT.

Define $\rightarrow$ User-Defined $\rightarrow$ Scalars...

Refer to here in the User's Guide for UDS equation theory and details on how to setup scalar equations.

 sarah_ron April 10, 2007 16:17

Re: Question about Postprocessing Using UDF(in tut

Any suggestion? Thanks!

-Sarah

 All times are GMT -4. The time now is 07:45.