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/)
-   -   C_volume sum (http://www.cfd-online.com/Forums/fluent-udf/63090-c_volume-sum.html)

los March 28, 2009 02:28

C_volume sum
 
I am using the following code to try to sum the volume of a specific domain, but it returns me the sum of all domains. What is wrong with it? Thanks for you help =D

void volume (int ID)
{
Domain *domain = Get_Domain(1);
Thread *t = Lookup_Thread(domain,ID);
cell_t c;
double VOLMOTC=0.0;

thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
VOLMOTC +=C_VOLUME(c,t);
}
end_c_loop(c,t)
}

Message0("Volume integral: %f\n", VOLMOTC);

}

coglione March 30, 2009 09:14

Hello los

as it name implies thread_loop_c(t,domain) loops over all cell threads in your domain and thus neglects the previous specification with ID. Omitting the outer loop will do what you want.

cheers


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