CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

cell_t c0, c1 = -1 what does -1 mean, see codes inside

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

LinkBack Thread Tools Display Modes
Old   June 6, 2011, 07:00
Default cell_t c0, c1 = -1 what does -1 mean, see codes inside
New Member
Join Date: May 2011
Location: uk
Posts: 9
Rep Power: 8
zhaolinchen is on a distinguished road
cell_t c0, c1 = -1;/*what does the -1 mean?*/
Thread *t0, *t1 = NULL;/*what does the NULL mean?*/

real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;

c0 = F_C0(f,t);
t0 = F_C0_THREAD(f,t);
F_AREA(A, f, t);

/* If face lies at domain boundary, use face values; */
/* If face lies IN the domain, use average of adjacent cells. */

if (BOUNDARY_FACE_THREAD_P(t)) /*Most face values will be available*/
real dens;

/* Depending on its BC, density may not be set on face thread*/
dens = F_R(f,t); /* Set dens to face value if available */
dens = C_R(c0,t0); /* else, set dens to cell value */

NV_DS(psi_vec, =, F_U(f,t), F_V(f,t), F_W(f,t), *, dens);

flux = NV_DOT(psi_vec, A); /* flux through Face */
c1 = F_C1(f,t); /* Get cell on other side of face */
t1 = F_C1_THREAD(f,t);

NV_DS(psi_vec, =, C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),*,C_R(c0,t0));
NV_DS(psi_vec, +=, C_U(c1,t1),C_V(c1,t1),C_W(c1,t1),*,C_R(c1,t1));

flux = NV_DOT(psi_vec, A)/2.0; /* Average flux through face */

/* ANSYS FLUENT will multiply the returned value by phi_f (the scalar's
value at the face) to get the "complete'' advective term. */

return flux;
************************************************** ******
see the picture, am I right?
zhaolinchen is offline   Reply With Quote

Old   June 10, 2011, 08:08
New Member
Kristian Etienne Einarsrud
Join Date: Oct 2010
Location: Trondheim
Posts: 29
Rep Power: 9
KristianEtienne is on a distinguished road

For this particular example the intialization of the neighbour cell and thread pointers does not have any significance as they are set to their correct values later in the code (i.e. c1 = F_C1(f,t); and t1 = F_C1_THREAD(f,t); ). I guess they are initialized to these values in order to handle any exceptions arising, although these should not occur for this case.

Note that the cell pointers refer to the cells adjacent to the face in question. So, in your figure, if the (face) thread pointer f is on a boundary (which is checked by BOUNDARY_FACE_THREAD_P(t) ), only one cell is available, namely C0. If you are in the interior, C0 and C1 will be the cells neighboring to the face thread in question. See section in the R13 UDF guide for further information.

KristianEtienne is offline   Reply With Quote


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
Is it worth it? Jason Bardis Main CFD Forum 47 July 27, 2011 04:52
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08
how to extend FSI 2D codes to 3D, need advises abouziar Main CFD Forum 1 May 30, 2008 04:08
Modelling the Heat flow inside the curing oven Marios Vlad CFX 1 February 6, 2008 08:11
meshing F1 front wing Steve FLUENT 0 April 17, 2003 12:37

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