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

Very simple question

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 5, 2014, 08:42
Default Very simple question
  #1
New Member
 
Join Date: Jul 2014
Posts: 6
Rep Power: 3
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, 20:49
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 11
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, 02:55
Default
  #3
New Member
 
Join Date: Jul 2014
Posts: 6
Rep Power: 3
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, 04:21
Default
  #4
Member
 
Join Date: Jul 2013
Posts: 70
Rep Power: 4
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

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
mergePatchPairs(); simple question seav OpenFOAM Native Meshers: blockMesh 0 May 2, 2014 08:57
Simple Outlet Question m.nichols19 OpenFOAM 3 June 25, 2010 01:44
Simple Question Regarding Symmetry Planes Atella CFX 3 April 11, 2010 06:44
Simple Question Regarding Symmetry Planes Atella Main CFD Forum 0 April 9, 2010 10: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 03:25.