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/)
-   -   multiphase udf (https://www.cfd-online.com/Forums/fluent-udf/102948-multiphase-udf.html)

ak2009 June 7, 2012 00:15

multiphase udf
 
Hi....

I am writing udf for multiphase flow to access the phase level data (primary phase).

I tried two ways to define the problem. Giving below both the udfs


I'st udf

#include "udf.h"
DEFINE_EXECUTE_AT_END (calculate_water_flow_rate)
{
int phase_domain_index = 0;
Domain *subdomain;
real total_flow_rate=0;
face_t f;
subdomain = Get_Domain(2);
int ID = 6;
Thread *thread = Lookup_Thread(subdomain,ID);

thread_loop_f(thread,subdomain)
{
begin_f_loop_all(f,thread)
{
total_flow_rate += F_FLUX(f,thread);
}
end_f_loop_all(f,thread)
}
printf("flow rate of water at outlet: %g/n", total_flow_rate);
}

In here, I have to access the phase level info (for primary phase, water) at outlet (ID - 6). So used the lookup_thread utility to find the approrpiate phase level thread.

Then I intend to estimate total flow rate of water going out from outlet faces. So looped over all the faces in the outlet thread.

The udf compiles . It gives some value which does not match with that calculated by fluent in the outlet boundary.

Is there any method by which I can read the outlet flowrate directly.


2nd UDF is....

#include "udf.h"


DEFINE_EXECUTE_AT_END (calculate_water_flow_rate)

{
int phase_domain_index = 0;
Domain *mixture_domain;
Domain *subdomain;
real total_flow_rate=0;
face_t f;
mixture_domain = Get_Domain(1);
subdomain = Get_Domain(2);
int ID = 6;
Thread *mixture_thread = Lookup_Thread(mixture_domain,ID);
Thread *subthread =

THREAD_SUB_THREAD(mixture_thread,phase_domain_inde x);

thread_loop_f(subthread,subdomain)

{

begin_f_loop_all(f,subthread)

{

total_flow_rate += F_FLUX(f,subthread);

}

end_f_loop_all(f,subthread)

}

printf("flow rate of water at outlet: %g/n", total_flow_rate);

}


In here, tried to dig the same info using THREAD_SUB_THREAD loop. First used the lookup thread utility to find out the mixture thread at outlet (ID - 6). Then using thread sub thread loop, accessed the phase level thread for primary pahse.

In both cases, I get some value of otlet water flow. I am not sure if either of the approaches is adequate for the case.


Need inputs about udfs....


Thanks


All times are GMT -4. The time now is 22:33.