CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   PLS help me find the error in the code. (https://www.cfd-online.com/Forums/fluent/43983-pls-help-me-find-error-code.html)

arwang March 3, 2007 04:21

PLS help me find the error in the code.
 
Dear freind:

The following code is used to compute the sum pressure on two walls which will be applied on the other outlet. when I compile it,prompting the warning in console window like that:

-------------------------------------------------

..\..\src\wallpre.c(10) : warning C4700: local variable 'd' used without having been initialized

------------------------------------------------

Could you have a good ideal to solute the problem.I don't know whether the code can realize my thought to apply the sum pressure.

Code following:

---------------------------------------

#include "udf.h" real calc_pressure() {

real pressure;

face_t f;

int w_id0=6;

int w_id1=7;

real totalpressure;

Domain *d;

Thread *t1 = Lookup_Thread(d,w_id0);

Thread *t2 = Lookup_Thread(d,w_id1);

real sum0_a,sum0_f,sum0_p,sum1_a,sum1_f,sum1_p,force;

sum0_a=sum0_f=sum0_p=0;

sum1_a=sum1_f=sum1_p=0;

begin_f_loop(f,t1)

{

real aa[1],area;

F_AREA(aa,f,t1);

area=NV_MAG(aa);

sum0_a+=area;

force=F_P(f,t1)*aa[1];

sum0_f+=force;

sum0_p+=sum0_f/sum0_a;

}

end_f_loop(f,t1)

begin_f_loop(f,t2)

{

real aa[1],area;

F_AREA(aa,f,t2);

area=NV_MAG(aa);

force=F_P(f,t2)*aa[1];

sum1_a+=area;

sum1_f+=force;

sum1_p+=sum1_f/sum1_a;

}

end_f_loop(f,t2)

totalpressure=sum0_p+sum1_p;

return totalpressure; } DEFINE_ON_DEMAND(get) {

Domain *d;

d = Get_Domain(1); } DEFINE_PROFILE(outpressure,thread,position) {

real pressure;

face_t f;

pressure = calc_pressure();

begin_f_loop(f,thread)

{

F_PROFILE(f,thread,position) = pressure;

}

end_f_loop(f,thread) }


arwang March 3, 2007 04:26

Re: PLS help me find the error in the code.
 
Pwall1+Pwall2-->Poutlet wall1 id = 6 wall2 id = 7

how to set the Domain initial value.


All times are GMT -4. The time now is 15:29.