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

how to obtain the total number of cells

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 24, 2011, 22:24
Default how to obtain the total number of cells
  #1
New Member
 
Coiby Xu
Join Date: Jan 2011
Posts: 7
Rep Power: 15
coiby is on a distinguished road
I know we can see the number when importing mesh file. But does Fluent provide API? Thanks!

Last edited by coiby; January 28, 2011 at 02:55.
coiby is offline   Reply With Quote

Old   January 24, 2011, 22:50
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by coiby View Post
I know you can see the number when importing mesh file. But does Fluent provide API? Thanks!
You can use UDF to loop all the cells and count the total cell number.
gearboy is offline   Reply With Quote

Old   January 25, 2011, 00:54
Default
  #3
New Member
 
Coiby Xu
Join Date: Jan 2011
Posts: 7
Rep Power: 15
coiby is on a distinguished road
Quote:
Originally Posted by gearboy View Post
You can use UDF to loop all the cells and count the total cell number.
Thank you, gearboy.
If Fluent doesn't provide API, that's the only way. I'll try this through it's a bit of a waste of CPU.
coiby is offline   Reply With Quote

Old   January 26, 2011, 00:47
Default
  #4
vig
New Member
 
anonymous
Join Date: Jan 2011
Posts: 23
Rep Power: 15
vig is on a distinguished road
Could you try thread->nelements, where thread is a cell thread.
In that case, you have to loop over all cell threads using therad_loop_c.

Or

Try domain-> cell_count

It should help.
vig is offline   Reply With Quote

Old   January 27, 2011, 04:46
Default
  #5
New Member
 
Coiby Xu
Join Date: Jan 2011
Posts: 7
Rep Power: 15
coiby is on a distinguished road
Quote:
Originally Posted by vig View Post
Could you try thread->nelements, where thread is a cell thread.
In that case, you have to loop over all cell threads using therad_loop_c.

Or

Try domain-> cell_count

It should help.
Thank you, vig!
I've tried "domain-> cell_count" :

Code:
 
DEFINE_INIT(my_init_function, domain)
{
 cell_t c;
 Thread *t;
 int i; //loop control
 int j; //loop control
 int cnum = domain->cell_count; // the total number of cells
 float *radius[cnum][K];
 j=0;
 thread_loop_c(t,domain)
 {
  for(i=0;i<K;i++)
   *radius[j][i]=gauss();
  j++;
 }
}
When compling it, Fluent gives out the following message:
"error C2039: 'cell_count' : is not a member of 'domain_struct'"?

And I check mem.h, find these lines:
Code:
#if RP_HOST
  int cell_count, face_count;
#endif
For the first method " thread->nelements", nelements doesn't seem to be a member of struct thread i thread.h.
Thanks!
coiby is offline   Reply With Quote

Old   January 27, 2011, 14:07
Default
  #6
vig
New Member
 
anonymous
Join Date: Jan 2011
Posts: 23
Rep Power: 15
vig is on a distinguished road
which version of fluent are you using.
vig is offline   Reply With Quote

Old   January 27, 2011, 20:58
Default
  #7
New Member
 
Coiby Xu
Join Date: Jan 2011
Posts: 7
Rep Power: 15
coiby is on a distinguished road
Hi, vig. I'm using Fluent_v6.3.26, 32bit, Win7.
I first compile it under Linux, but there are extra errors(see http://www.cfd-online.com/Forums/flu...tters-why.html).
coiby is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to obtain average Nusselt number Caner Main CFD Forum 3 March 2, 2012 15:44
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 10:01
Number of cells Johnny B FLUENT 2 March 17, 2010 05:00
total number of cells changes !!!! Zeitistgeld FLUENT 0 October 10, 2005 02:49
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


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