|
[Sponsors] |
Question about Postprocessing Using UDF(in tutoria |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 10, 2007, 00:40 |
Question about Postprocessing Using UDF(in tutoria
|
#1 |
Guest
Posts: n/a
|
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 }; DEFINE_ADJUST(adjust_fcn, domain) { Thread *t; cell_t c; face_t f; /* 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) { if (NULL != THREAD_STORAGE(t,SV_UDS_I(T4))) { begin_c_loop (c,t) { real T = C_T(c,t); C_UDSI(c,t,T4) = pow(T,4.); } end_c_loop (c,t) } } thread_loop_f (t,domain) { if (NULL != THREAD_STORAGE(t,SV_UDS_I(T4))) { begin_f_loop (f,t) { real T = 0.; if (NULL != THREAD_STORAGE(t,SV_T)) T = F_T(f,t); else if (NULL != THREAD_STORAGE(t->t0,SV_T)) T = C_T(F_C0(f,t),t->t0); F_UDSI(f,t,T4) = pow(T,4.); } end_f_loop (f,t) } } /* Fill second UDS with magnitude of gradient. */ thread_loop_c (t,domain) { if (NULL != THREAD_STORAGE(t,SV_UDS_I(T4)) && NULL != T_STORAGE_R_NV(t,SV_UDSI_G(T4))) { begin_c_loop (c,t) { C_UDSI(c,t,MAG_GRAD_T4) = NV_MAG(C_UDSI_G(c,t,T4)); } end_c_loop (c,t) } } thread_loop_f (t,domain) { if (NULL != THREAD_STORAGE(t,SV_UDS_I(T4)) && NULL != T_STORAGE_R_NV(t->t0,SV_UDSI_G(T4))) { begin_f_loop (f,t) { F_UDSI(f,t,MAG_GRAD_T4)=C_UDSI(F_C0(f,t),t->t0,MAG_GRAD_T4); } 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. |
|
April 10, 2007, 16:17 |
Re: Question about Postprocessing Using UDF(in tut
|
#2 |
Guest
Posts: n/a
|
Any suggestion? Thanks!
-Sarah |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unanswered question | niklas | OpenFOAM | 2 | July 31, 2013 16:03 |
[OpenFOAM] Postprocessing a billion cell CFD case | hjasak | ParaView | 8 | May 28, 2009 14:02 |
Postprocessing Question | Steve | FLUENT | 0 | May 5, 2005 10:15 |
Question about postprocessing | Pratap | FLUENT | 2 | February 7, 2005 03:46 |
question | K.L.Huang | Siemens | 1 | March 29, 2000 04:57 |