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/)
-   -   Access inlet mass flow value (target mass flow rate) (https://www.cfd-online.com/Forums/fluent-udf/200378-access-inlet-mass-flow-value-target-mass-flow-rate.html)

YCarv March 31, 2018 14:30

Access inlet mass flow value (target mass flow rate)
 
Hello everyone,
I need to specify the mass flow rate percentage through multiple outlets, just as in outflow boundary condition, but using pressure-outlet boundary condition instead, and target mass flow rate option.

The inlet mass flow varies with time. How can I retrieve this value ?
I've created the UDFs, but the results are weird. I think I am not retrieving the correct inlet mass flow.


---------------------------------------------------------------------------
Here is the code I've created:

DEFINE_PROFILE(target_massflow_left1,outlet_thread ,massflow)
{
face_t f;
face_t inlet;
Domain *domain;
real percentage = 0.24;
int inlet_zone_id = 61;
real inlet_massflow;

domain = Get_Domain(1); //fluid domain
Thread *inlet_thread = Lookup_Thread(domain,inlet_zone_id); //thread containing inlet

begin_f_loop(inlet,inlet_thread)
{
if(BOUNDARY_FACE_THREAD_P(inlet_thread)) //found inlet
{
inlet_massflow = -F_FLUX(inlet,inlet_thread);

}
}
end_f_loop(inlet, inlet_thread);


//loop over every face on the thread
begin_f_loop(f,outlet_thread)
{
F_PROFILE(f,outlet_thread,massflow) = percentage * inlet_massflow ;

}
end_f_loop(f, outlet_thread);
}
----------------------------------------------------------------------------------

Thanks in advance,
YCarv

pakk April 1, 2018 06:27

To get the total inflow, you need to sum the inflow overall faces in the inlet.

Code:

real inlet_massflow=0;
[...]
inlet_massflow -= F_FLUX(inlet,inlet_thread);


YCarv April 1, 2018 08:09

oh, of course !
Thank you very much pakk, I will try this now !


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