# UDF mass flow rate

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 16, 2007, 10:27 UDF mass flow rate #1 Juan Guest   Posts: n/a Hi, I'm new in fluent and i have a big project to make for university. I need to make a UDF in fluent which gives me the mass flow rate of a fluid that travels through a plane. I know you can do this with "report" and then surface integrals. But there are several flows passing through the plane. One major flow, and some secondary flows (which are in the opposite directions). So i have a criteria on which i can base which flows i want. But how do you turn this into an UDF. I've been reading through the manual, but up untill now, haven't found anything that would suit this problem. I think it's a very basic UDF, but for a newbie it's quite difficult . Any help would be welcome!

 December 18, 2007, 08:13 Re: UDF mass flow rate #2 Greg Guest   Posts: n/a Hi, you could iterate through all the faces of the plane and add the products of face_velocity*density*face_area only of those faces where the face_velocity is positive (or negative, depends on your problem). You can get the face_area with BOUNDARY_FACE_GEOMETRY macro. You will find help in UDF manual how to get values at faces and how to iterate through faces. Regards, Greg

 December 22, 2007, 10:29 Re: UDF mass flow rate #3 Juan Guest   Posts: n/a Thanks for this reply. I've been trying to write the UDF with the help of the manual, but there isn't much explanation in the manual about the basic functions. Could somebody have a look at my code and give some suggestions or tell me where i can find a list of the basic functions used with some explanation. This is my code so far #include "udf.h" DEFINE_ON_DEMAND(massflow_hor) { Thread *t; cell_t c; face_t f; real sum_massflow=0., A; begin_f_loop(f,t) if(C_U(c,t)>0){ sum_massflow += C_U(c,t) * C_R(c,t) * F_AREA(A,f,t); } end_f_loop(f,t) printf("the massflow is: %g",sum_massflow); } Could somebody give me some suggestions, how i can compute the massflow through a plane that i want. E.G. that i can give an input which plane i want this function to work in. Also the AREA function gives an error, the A is defined wrongly. thanks for your help.