- **FLUENT**
(*https://www.cfd-online.com/Forums/fluent/*)

- - **question on UDF manual example**
(*https://www.cfd-online.com/Forums/fluent/65781-question-udf-manual-example.html*)

question on UDF manual exampleHello everyone,
can anyone explain to me why C_UDSI_G is multiplied by the cell volume in the following UDF example? (in the udf manual, pasted below). Is this necessary if we want to write a scalar in terms of the derivative of another scalar?? i.e. say Ive got a UDS equation solving for some scalar H and another one solving for some scalar I, say a source term appears in the equation for scalar I, which is given by DH/DX...do i need to write this as C_VOLUME*C_UDSI_G(c,t,index of scalar H)? Thanks for your help AK /************************************************** ****************** UDF for defining user-defined scalars and their gradients ************************************************** *******************/ #include "udf.h" DEFINE_ADJUST(adjust_fcn,d) { Thread *t; cell_t c; real K_EL = 1.0; /* Do nothing if gradient isn't allocated yet. */ if (! Data_Valid_P()) return; thread_loop_c(t,d) { if (FLUID_THREAD_P(t)) { begin_c_loop_all(c,t) { C_UDSI(c,t,1) += K_EL*NV_MAG2(C_UDSI_G(c,t,0))*C_VOLUME(c,t); } end_c_loop_all(c,t) } } } |

All times are GMT -4. The time now is 02:01. |