CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Uds udf issue (https://www.cfd-online.com/Forums/fluent/80468-uds-udf-issue.html)

solefire September 27, 2010 10:52

Uds udf issue
 
Currently I have some trouble in implementing UDF.

It is about adding a scalar equation :UDS:…. Which is almost like mass fraction equation re writing myself , I didn’t get right result. Could u help me take a look! I am so grateful ! . There are no grammar mistakes, and I can compile as well! But I feel some where there is mistake! And I don’t know how to save data from UDSI to UDMI.



/*to define scalar source*/

#define SV_YN SV_UDS_I(YN)

#define SV_OTHER SV_UDM_I

#define C_YN(c,t) C_UDSI(c,t,YN)
#define F_YM(f,t) F_UDMI(f,t,YM)



/*User-Defined-Scalars-Pollutant-mass-fraction-Normalization by well-mixed concentration*/

enum

{YN,

N_REQUIRED_UDS

};

/*Initialize parameters in the domain*/

DEFINE_INIT(init_parameter,domain)
{
Domain *d;
Thread *t;
cell_t c;
face_t f;
int i;

if(n_uds<N_REQUIRED_UDS)
{
Error("Not enough user defined scalars!\n");
}
d = Get_Domain(1);
thread_loop_c(t,d)
{
if(NNULLP(THREAD_STORAGE(t,SV_YN)))
{
begin_c_loop(c,t)
{
for(i=0;i<N_REQUIRED_UDS;i++)
C_UDSI(c,t,i)=0.0;
}
end_c_loop(c,t);
}
}

thread_loop_f (t,domain)
{

if(BOUNDARY_FACE_THREAD_P(t)&NNULLP(THREAD_STORAGE (t,SV_YN)))
{
begin_f_loop(f,t)
{
for(i=0;i<N_REQUIRED_UDS;i++)
F_UDSI(f,t,i)=0.0;
}
end_f_loop(f,t);
}

}

}


DEFINE_DIFFUSIVITY(diffusivity, c, t, i)

{

(information….correct)



}





DEFINE_SOURCE(scalar_source,c,t,dS,eqn)

{

(information….correct)

}


All times are GMT -4. The time now is 13:11.