CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Please help me ( udf for regulation the mass flow rate at the inlet ) (https://www.cfd-online.com/Forums/fluent-udf/156304-please-help-me-udf-regulation-mass-flow-rate-inlet.html)

swidi July 7, 2015 09:17

Please help me ( udf for regulation the mass flow rate at the inlet )
 
Hello friends I really need your help

I am trying to control the injection of the mass flow rate at a velocity inlet using a UDF. In fact I want to have the same mass flow rate at the inlet and at the outlet-pressour. So I need to put a condition at my velocity-inlet like if the two mass flow rates are not equal it has to stop injecting ( water ) until they ll be equal
I begun by this UDF, it only needs the regulation part

#include "udf.h"
DEFINE_EXECUTE_AT_END(measure_mass_flow)
{
Domain *d;
real flow=0.;
face_t f;
Thread *t;
t= Lookup_Thread(d, 12);
d = Get_Domain(1);

thread_loop_f(t,d)
{
begin_f_loop(f,t)
{
flow+=F_FLUX(f,t);
}
end_f_loop(f,t)
}
printf("MASS Flow Rate: %g\n",flow);
flow=0.;
}


All times are GMT -4. The time now is 20:48.