CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDM: statistically averaged variabls (https://www.cfd-online.com/Forums/fluent/39119-udm-statistically-averaged-variabls.html)

lcw January 4, 2006 03:13

UDM: statistically averaged variabls
 
How to define a time-averaged variable by UDM during the unsteady computation? In FLUNET, there are some variables such as mean pressure, mean velocity in unsteady statistics menu, what is the UDM code about these? If we want to define another mean variable, how to write a UDM code?

Thank you in advance!

LCW

lcw January 4, 2006 09:28

Re: UDM: statistically averaged variabls
 
I search the solution on the Internet, and give the rough clue as follows. I am not familiar with UDF or UDM. Could you give me a complete solution of this problem? Thanks a lot.

#include "udf.h"

DEFINE_EXECUTE_AT_END(execute_at_end) { Domain *domain; cell_t c; Thread *t; real k_mean; real k_rms; domain = Get_Domain(1); thread_loop_c (t,domain) { begin_c_loop_all (c,t) {

C_UDMI(c,t,0) = C_K(c,t); } end_c_loop_all (c,t) } }

lcw January 7, 2006 22:28

Re: UDM: statistically averaged variabls
 
Plz help me, I need your help indeed. Thanks a lot!


lcw January 8, 2006 02:34

Re: UDM: statistically averaged variabls (draft)
 
I try to write the UDF of this function. Please correct it for me, thank you!

#include "udf.h"

DEFINE_EXECUTE_AT_END(execute_at_end) { Domain *domain; cell_t c; Thread *t; real k_mean;

domain = Get_Domain(1);

thread_loop_c (t,domain) { begin_c_loop_all (c,t) { C_UDMI(c,t,0) = C_K(c,t); } end_c_loop_all (c,t) } int time_step; curr_ts = RP_Get_Integer("time-step") for(i=0;i<curr_ts;i++) k_mean+= C_K(c,t) k_mean = k_mean / curr_ts


lcw January 8, 2006 02:39

Re: UDM: statistically averaged variabls (draft)
 
Sorry, Last post is not completed, post it again.

#include "udf.h"

DEFINE_EXECUTE_AT_END(execute_at_end) { Domain *domain; cell_t c; Thread *t; real k_mean;

domain = Get_Domain(1);

thread_loop_c (t,domain) { begin_c_loop_all (c,t) { C_UDMI(c,t,0) = C_K(c,t); } end_c_loop_all (c,t) } int time_step; curr_ts = RP_Get_Integer("time-step") for(i=0;i<curr_ts;i++) k_mean+= C_K(c,t) k_mean = k_mean / curr_ts }



All times are GMT -4. The time now is 23:40.