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

flux around one specific cell

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 7, 2010, 18:25
Default flux around one specific cell
  #1
Member
 
CJ
Join Date: Jun 2009
Posts: 34
Rep Power: 17
solefire is on a distinguished road
Dear,

I have a question, probably it is very easy for u, if I have got a cell ID , source[0], I want to get the flux of faces of this cell, "just for this cell" , it is structured grid, could u help check what is wrong with my code, Thanks a lot!!


DEFINE_ON_DEMAND(get_mf)
{
Domain *d; /*pointer to the collection of all cells' threads (stored information) */
/* declare domain pointer since it is not passed as an argument to the DEFINE macro */
cell_t c; /* cell identifier */
Thread *t; /* pointer to a thread */
d = Get_Domain(1); /*domain is already available to your function (via define_adjust argument). */
mf=0.0;
int i=0.0;

/************try to get neighbouring faces of the cell********************************************** ***/

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



c_face_loop(c, t, i)

{
face_t f;
Thread *tf;
f = C_FACE(c,t,i);
tf = C_FACE_THREAD(c,t,i);
c0 = F_C0(f,tf);
c1 = F_C1(f,tf);
t0 = THREAD_T0(tf);
t1 = THREAD_T1(tf);
real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;
F_AREA(A, f, t);


if (!BOUNDARY_FACE_THREAD_P(tf))
{
/* c0 is current cell*/
if (c0 == source[0])
{

NV_DS(psi_vec, =, C_U(c,t),C_V(c,t),C_W(c,t),*,1.0);
NV_DS(psi_vec, +=, C_U(c1,t1),C_V(c1,t1),C_W(c1,t1),*,1.0);
flux = NV_DOT(psi_vec, A)/2.0; /* Average flux through face */

}
else
{

NV_DS(psi_vec, =, C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),*,1.0);
NV_DS(psi_vec, +=, C_U(c,t),C_V(c,t),C_W(c,t),*,1.0);
flux = NV_DOT(psi_vec, A)/2.0; /* Average flux through face */

}
}
}


}

hereby density is 1.0;
solefire 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
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 06:21
Constant velocity of the material Sas CFX 15 July 13, 2010 09:56
Cells with t below lower limit Purushothama Siemens 2 May 31, 2010 22:58
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15
Warning 097- AB Siemens 6 November 15, 2004 05:41


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