CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Very simple question

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2014, 09:42
Default Very simple question
  #1
New Member
 
Join Date: Jul 2014
Posts: 6
Rep Power: 12
stef_pasc is on a distinguished road
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
stef_pasc is offline   Reply With Quote

Old   August 5, 2014, 21:49
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
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?
blackmask is offline   Reply With Quote

Old   August 6, 2014, 03:55
Default
  #3
New Member
 
Join Date: Jul 2014
Posts: 6
Rep Power: 12
stef_pasc is on a distinguished road
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!!!
stef_pasc is offline   Reply With Quote

Old   August 20, 2014, 05:21
Default
  #4
Member
 
Join Date: Jul 2013
Posts: 80
Rep Power: 13
upeksa is on a distinguished road
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.
upeksa is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[blockMesh] mergePatchPairs(); simple question seav OpenFOAM Meshing & Mesh Conversion 0 May 2, 2014 09:57
Simple Outlet Question m.nichols19 OpenFOAM 3 June 25, 2010 02:44
Simple Question Regarding Symmetry Planes Atella CFX 3 April 11, 2010 07:44
Simple Question Regarding Symmetry Planes Atella Main CFD Forum 0 April 9, 2010 11:58
Question of Anil Date's SIMPLE method universez Main CFD Forum 0 November 18, 2009 21:12


All times are GMT -4. The time now is 14:04.