CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   problem with c_face_loop (https://www.cfd-online.com/Forums/fluent/43746-problem-c_face_loop.html)

Phanindra February 14, 2007 03:42

problem with c_face_loop
 
I have a problem working with c_face_loop macro. can any body help me in this regard.. I'm sending my udf

#include "udf.h" #include "mem.h"

/*source term for w=5rpm*/ DEFINE_SOURCE(imp_in,c,t,dS,eqn) {

real source; real x[ND_ND]; real NV_VEC(omega); real NV_VEC(vel);

Thread *thread; face_t f; int i; real A[ND_ND]; real sum=0.0; real sum1=0.0;

/*setting value of the omega*/ NV_S(omega,=,0.0);

omega[0]=5.0;/*The value of the given rpm*/

/*cross product of the w and r*/ /*r is given by x vector*/

sum=0.0; NV_S(vel,=,0.0);

c_face_loop(c, t, i) {

f=C_FACE(c,t,i); thread=C_FACE_THREAD(c,t,i);

F_CENTROID(x,f,thread);

NV_CROSS(vel,omega,x);

F_AREA(A,f,thread);

sum+=NV_DOT(A,vel);

}

dS[eqn]=0.0;

source=-1*C_R(c,t)*sum;

return source;

}


Bogdan February 14, 2007 08:18

Re: problem with c_face_loop
 
Could you tell us what was the problem? I don't see any mistake.

Rizwan February 14, 2007 10:47

Re: problem with c_face_loop
 
Can u please explain wat u exactly want to do? coz source terms are calculated on cell basis. i feel u unnecessarily complicated the problem by looping over faces on cell. rather u can directly add source term to a single cell.

Phanindra February 18, 2007 01:48

Re: problem with c_face_loop
 
Thanks fr u'r concern.I'm pleasured to let know my problem.

The problem is with the loop c_face_loop.When i run my udf it shows me an error and this error is abot the face index number i.e.,n in the loop macro.I dont no what it exactly mean and how to specify it. I need to loop over all the faces of a cell and it is required for my project.

Thanks in advance

Phanindra.

Rizwan February 18, 2007 03:08

Re: problem with c_face_loop
 
well, this is what i said. c_face_loop is a macro to loop over faces within a cell. i agree to that. but u r implementing c_face_loop to define a source, which i feel may not be compatible as source terms are defined on cell basis. like u have to define source term at the centroid of the cell ratehr than the individual face centroids of the particular cell. in your case the udf will become much simple with a source term specified at the cell centroid. this is my understanding of the udf help file on source terms. Regards Razwan.

Phanindra February 19, 2007 02:26

Re: problem with c_face_loop
 
Thank u Rizwan .I will try with a new approach as u have suggested.

Phanindra

Rizwan February 19, 2007 02:34

Re: problem with c_face_loop
 
U r welcome. All the best.


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