CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   udf & uds (http://www.cfd-online.com/Forums/fluent/29068-udf-uds.html)

joby November 11, 2001 13:19

udf & uds
 
Hi, I am doing some modeling work by Fluent, there is a problem for me to call the result from one subroutine to another for further calculation, could any one kindly tell me how to do it? Thanks. Here is part of my program, I need to call the result of F_UDSI from UDS_FLUX when doing the calculation of source in SOURCE.

DEFINE_UDS_FLUX(a,f,t,i) { face_t f; Thread *t=Look_Thread(domain,ID);

Yo2=F_YI(f,t,0);

Pc=F_P(f,t);

Xo2=Yo2*Pc;

F_UDSI(f,t,0)=Pc*Xo2;

return F_UDSI(f,t,0); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DEFINE_SOURCE(qq_source,c,thread,ds,eqn) {

cell_t c;

face_t f;

Thread *t;

real source,I0,w;

w=F_UDSI(f,t,0);

source=-w*2.5;

ds[eqn]=-2.5;

return source; } thanks

Greg Perkins November 11, 2001 21:38

Re: udf & uds
 
You should note that for each cell there are multiple faces - so generally your source term will require some integration over all these faces - see Gauss divergence theorem in math books, which is the normal way of doing this.

Alternatively, you can use adjacent cell information to interpolate to a face.

You need to remeber that Fluent doesn't necessarily store face data - for many variables only cell data is stored. Look at the macro definitions in .h files and you'll see that the face definitions and cell definitions are often the same!

Greg


All times are GMT -4. The time now is 21:57.