CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Boundary condition (https://www.cfd-online.com/Forums/fluent/29703-boundary-condition.html)

 Srinivas May 2, 2002 01:55

Boundary condition

Hello, In order to set the boundary condition at inlet and outlet of porous media, I developed the following UDF's .But when I try to run the program it shows a segmntation violation.Could any body help in this matter. The condensed source code is as follows...

DEFINE_ADJUST(in_outb,domain) { Thread *t;

Thread *t0;

Thread *t1;

real y, dv,area,kf,kt,x[ND_ND],U;

real ff,constt,l,Rep,Pr;

face_t f;

cell_t c,c0,c1;

area = (20.346*(1-zeta)*pow(zeta,2))/Dp;

dv = (4*zeta)/area;

constt = 1.29*pow((dv/Dp),0.5);

kf = zeta*0.0242;

t = Lookup_Thread(domain,3);

begin_f_loop(f, t)

{

real RE,PR;

F_CENTROID(x,f,t);

y=x[1];

l = 1 - (exp((-(y + 0.005))/(1.5*Dp)));

U = sqrt(pow(F_V(f,t),2.)+pow(F_U(f,t),2.));

kt = 0.375*1.225*1006.43*U*Dp*l;

Rep = (U*Dp*1.225)/(1.7894e-05);

Pr = ((1.7894e-05)*1006.43)/0.0242;

if(c0 = F_C0(f,t) && (t0 = t->t0))

C_T_G(c0,t0)[0]= 0;

RE = pow(Rep,0.5);

PR = pow(Pr,0.4);

C_UDSI_G(c0,t0,0)[0] = (constt)*RE*PR*(kf+kt)*(F_UDSI(f,t,0) -300)/(dv*(1-zeta)*TKS);

}

end_f_loop(f, t)

t = Lookup_Thread(domain,2);//outlet

constt = -(0.2776);

begin_f_loop(f, t)

{

real RE,PR;

F_CENTROID(x,f,t);

y=x[1];

l = 1 - (exp((-(y + 0.005))/(1.5*Dp)));

U = sqrt(pow(F_V(f,t),2.)+pow(F_U(f,t),2.));

kt = 0.375*1.225*1006.43*U*Dp*l;

Rep = (U*Dp*1.225)/(1.7894e-05);

Pr = ((1.7894e-05)*1006.43)/0.0242;

RE = pow(Rep,0.5);

PR = pow(Pr,0.4);

if(c0 = F_C0(f,t) && (t0 = t->t0))

C_T_G(c0,t0)[0]= 0;

/*if(c1 = F_C1(f,t) && (t1 = t->t1))

C_T_G(c1,t1)[0] =0;*/

//F_T_G(f,t,0) = 0.0;

C_UDSI_G(c0,t0,0)[0] = constt*(kf+kt)*RE*PR*(F_UDSI(f,t,0)-F_T(f,t))/Dp;

}

end_f_loop(f, t) }

The source code works fine when I comment the gradient term of my UDS and the gradient of the fluid temperature.

 Srinivas May 2, 2002 19:45

Re: Boundary condition

Hello, I couold partially resolve the problem by making two DEFINE_PROFILE functions one for inlet and the other for oultlet, but when I use the UDF for outlet it gives me an segmentation violation. Could any body expound on how to use a UDF for outlet boundary condition. Srinivas

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