# Very simple question

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

 August 5, 2014, 08:42 Very simple question #1 New Member   Join Date: Jul 2014 Posts: 6 Rep Power: 3 Hi everybody, I'm trying to validate my code and I discovered that there is a problem in some loops. In particular, I found out that if I make 2 identic loops over cells, I do not obtain the same results. So, in a very simple way, I obtain that the following code gives: number of cells from loop 1 = 1041 number of cells from loop 2 = 847 The problem is that 2 loops are identical and that I have a mesh of 2024 cells. DEFINE_ADJUST(adjust_gradient, d) { Thread *t; cell_t c; int i; i=0; thread_loop_c (t,d) { begin_c_loop (c,t) { i+=1; printf("boucle cell %d \n", i); } end_c_loop (c,t) } } DEFINE_ADJUST(adjust_grad, d) { Thread *t; cell_t c; int k; k=0; thread_loop_c (t,d) { begin_c_loop (c,t) { k+=1; printf("boucle cell2 %d \n", k); } end_c_loop(c,t) } } Can anybody help me? Stefano

 August 5, 2014, 20:49 #2 Senior Member   Join Date: Aug 2011 Posts: 315 Rep Power: 11 You should have got thousands of lines of output. Try to print the result at the end of loop: Code: ```DEFINE_ADJUST(adjust_gradient, d) { Thread *t; cell_t c; int i; i=0; thread_loop_c (t,d) { begin_c_loop (c,t) { i+=1; } end_c_loop (c,t) } printf("boucle cell %d \n", i); }``` Did you run FLUENT in serial or parallel mode?

 August 6, 2014, 02:55 #3 New Member   Join Date: Jul 2014 Posts: 6 Rep Power: 3 Thank you blackman!! Indeed I have thousands of lines but I did intentionally for looking all loops! I run in parallel mode cause I compile it on Windows. I do not really understand how a so simple action could be wrong!!!

 August 20, 2014, 04:21 #4 Member   Join Date: Jul 2013 Posts: 70 Rep Power: 4 In not that simple actually, you have to take into account parallel considerations. Note that you will find very different result according to the number of partitions of your case. DEFINE_ADJUST(adjust_gradient, d) { Thread *t; cell_t c; int i; i=0; thread_loop_c (t,d) { begin_c_loop (c,t) { i+=1; } end_c_loop (c,t) } i=PRF_GISUM1(i); printf("boucle cell %d \n", i); } I think it will work that way, I didn't test it. For further information, read that chapter of your manual.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post seav OpenFOAM Native Meshers: blockMesh 0 May 2, 2014 08:57 m.nichols19 OpenFOAM 3 June 25, 2010 01:44 Atella CFX 3 April 11, 2010 06:44 Atella Main CFD Forum 0 April 9, 2010 10:58 universez Main CFD Forum 0 November 18, 2009 21:12

All times are GMT -4. The time now is 03:25.