CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   need help- UDF line descrition (http://www.cfd-online.com/Forums/fluent-udf/105837-need-help-udf-line-descrition.html)

laxwendrofzx9r August 10, 2012 08:09

need help- UDF line descrition
 
Hi,
Simple, could somebody who knows C language under Fluent, describes every line and what this script is doing? I need this for clarification and further learning process :)
Many Thanks,

#include "udf.h"
#include <math.h>

static real mass_flow(Thread *t, Domain *d)
{
face_t f;
real mfr = 0.;
begin_f_loop(f,t)
{
mfr += F_FLUX(f,t);
}
end_f_loop(f,t)
return mfr*mfr;
}

DEFINE_ON_DEMAND(objective_function)
{
Thread *t;
face_t f;
real mfr = 0.;
Domain *d = Get_Domain(1);


thread_loop_f(t,d)
{
if((4 == THREAD_ID(t))|| (5 == THREAD_ID(t)))
{
mfr += mass_flow(t,d);
}

}
RP_Set_Real("morpher/objective-function",mfr);
}


All times are GMT -4. The time now is 00:27.