CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   flux around one specific cell (https://www.cfd-online.com/Forums/fluent/80826-flux-around-one-specific-cell.html)

 solefire October 7, 2010 17:25

flux around one specific cell

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 */
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;
f = C_FACE(c,t,i);
c0 = F_C0(f,tf);
c1 = F_C1(f,tf);
real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;
F_AREA(A, f, t);

{
/* 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;

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