|
[Sponsors] |
March 28, 2009, 02:28 |
C_volume sum
|
#1 |
Member
Tiago Macarios
Join Date: Mar 2009
Posts: 35
Rep Power: 17 |
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); } |
|
March 30, 2009, 10:14 |
|
#2 |
Senior Member
Max
Join Date: Mar 2009
Posts: 133
Rep Power: 17 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Transient simulation not converging | skabilan | OpenFOAM Running, Solving & CFD | 14 | December 17, 2019 00:12 |
How to write k and epsilon before the abnormal end | xiuying | OpenFOAM Running, Solving & CFD | 8 | August 27, 2013 16:33 |
Convergence moving mesh | lr103476 | OpenFOAM Running, Solving & CFD | 30 | November 19, 2007 15:09 |
IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 03:58 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 19:07 |