CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Fluent UDF: POSTPROCESSING (http://www.cfd-online.com/Forums/fluent-udf/104972-fluent-udf-postprocessing.html)

mila_oliv July 19, 2012 15:40

Fluent UDF: POSTPROCESSING
 
Hi,

i recently started learning udf. My objective is to implement heat flux lines in a square cavity with natural convection. It's supposed to be just like fluent shows us stream lines on "graphics and animations".

To do so, i started programing stream lines to be able to compare my results with fluent's results.

I'm having basic problems like what DEFINE should i use?
And after de code for calculation is done, do i use "return(name)"????

And when its finally compiled, isn't it diferent to calculate some number (like velocity inlet) and show a graphic???


Here's what i've already written:

Quote:

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


DEFINE_EXECUTE_AT_EXIT(funcaocorrente)
{

real psi[320][320]; /* função corrente que se deseja determinar*/
real NV_VEC(u); /* vetor velocidade em x*/
int i, j, deltax, m, n;
cell_t c;
Thread *t, *tc;

i=1;
j=1;


/*condições de contorno*/
psi[i][1]=0;
psi[i][n]=0;
psi[1][j]=0;
psi[n][j]=0;
/*condições de contorno*/


n=C_NNODES(c,t); /*number of nodes on the mesh*/
m=(n^0.5)-1; /* divisions on the mesh: m X m */
deltax=1/m; /* distance between nodes */

NV_D(u,=,C_U(c,t)); /* u is Vx in a cell */
NV_S(u,*=,deltax) /* (u*deltax) */

begin_c_loop(c,tc)
{
for(i=1;i<320;i++)
{
for(j=1;j<320;j++)
{
psi[i][j+1]=psi[i][j]+NV_VEC(u)); /*integral -> stream function definition*/
}
}
}end_c_loop(c,tc)

return psi;
}



am I on the right way?

mila_oliv July 19, 2012 17:24

I cant even compile this udf :(


All times are GMT -4. The time now is 16:03.