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

Loop over the faces of a cell in UDF

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 15, 2001, 11:57
Default Loop over the faces of a cell in UDF
  #1
Anthony Wachs
Guest
 
Posts: n/a
Hi everybody,

Does someone know how to do a loop over the faces of a cell in an UDF ? or what is the macro to name the face of a given cell ?

I have found the instruction "C_FACE(cell,thread,i)" where I suppose that "i" corresponds to face number i of the cell. Therefore, I tried a thing like :

for (i=0;i less C_NFACES(cell,thread);i++)

{

f0=C_FACE(cell,thread,i);

...

}

(I write "less" otherwise errors occurs in the text, but in the C source, I obviously used the sign, thus don't mind about that, the problem is not here!!)

but it doesn't seem to work.

Any help would be really appreciated.

Thanks in advance

Anthony
  Reply With Quote

Old   October 15, 2001, 15:06
Default Re: Loop over the faces of a cell in UDF
  #2
ravi
Guest
 
Posts: n/a
The integer variables C_NNODES and C_NFACES return the number of nodes or faces, respectively, for a given cell. The integer variable F_NNODES returns the number of nodes associated with a face.

So this is not the appropriate macro for looping over faces in a cell.

Use : begin_f_loop(f,t) end_f_loop(f,t) ---> which loops over faces in a face thread.
  Reply With Quote

Old   October 16, 2001, 03:04
Default Re: Loop over the faces of a cell in UDF
  #3
Anthony Wachs
Guest
 
Posts: n/a
Hi Ravi,

Thank you for your contribution.

Unfortunetaly, your answer does not correspond to what I would like to do. I know very well the command : begin_f_loop(f,t) end_f_loop(f,t), which as you mentioned as well, is useful for a loop over faces in a FACE THREAD. But I am concerned with loop over faces of a CELL, not of a thread : this is completely different.

I have been using "begin_f_loop(f,t) end_f_loop(f,t)" efficiently for a long time in simpler situations, when I would like to do a loop over faces of a face thread.

If you have any other suggestion concerning how to write a "LOOP OVER FACES OF A CELL", thank you in advance

Anthony
  Reply With Quote

Old   October 16, 2001, 05:58
Default Re: Loop over the faces of a cell in UDF
  #4
Greg Perkins
Guest
 
Posts: n/a
Ok here's how to do it:

int numbf; cell_t cf; Thread *tf,*f_thread; face_t face;

/* cf,tf is cell & cell thread */

c_face_loop(cf,tf,numbf) {

face = C_FACE(cf,tf,numbf);

f_thread = C_FACE_THREAD(cf,tf,numbf);

/* do what you like with face numbf with

face & f_thread */

/* -- eg temp = F_T(face,thread); */ }

Greg

  Reply With Quote

Old   October 16, 2001, 10:55
Default Re: Loop over the faces of a cell in UDF
  #5
Anthony Wachs
Guest
 
Posts: n/a
Thanks Greg !!

Anthony
  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
udf problem jane Fluent UDF and Scheme Programming 11 December 4, 2012 04:09
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 09:01
external flow with snappyHexMesh chelvistero OpenFOAM 11 January 15, 2010 20:43
accessing upstream cell - UDF bohis FLUENT 0 April 7, 2008 05:12
Metrics of Transformation at the cell faces? Mohammad Kermani Main CFD Forum 0 February 23, 2000 15:04


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