CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF programing (https://www.cfd-online.com/Forums/fluent-udf/175148-udf-programing.html)

mostafa.n.229@gmail.com July 24, 2016 23:47

UDF programing
 
Hello
I want to write a udf in fluent.
How can i save the coordinate of zone's cells in a part of a domain in a (((.txt)))file?
Thanks a lot.

mostafa.n.229@gmail.com July 25, 2016 01:03

Hello
How can save all for example a varriable which is acted in some cells in a thread ?
for eample i want to save all variation in cells for source term in this code?
how can i do?
thanks

#include "udf.h"
#include "stdio.h"
#define RO 1.222
#define k 4
#define V 10
#define R 60
#define q 2.83
#define cl 0.5
#define cd 0.6
DEFINE_SOURCE(momentom_x_source,c,t,dS,eqn)
{FILE *pf;

real source;
cell_t c;
face_t f;
Thread *c_thread;
real position[ND_ND];

//real phi[25];
real x,y,U,i;
begin_c_loop(c,t)
{
C_CENTROID(position,c,t);
x=position[0];
y=position[1];
for(i=1;i=25;i++)
C_UDMI(c,t,i)=y;
end

source=C_U(c,t)*y;
dS[eqn]=y;
}
end_c_loop(c,thread)

if(NULL == (pf = fopen("ffff.txt","a")))
Error("Could not open file for append!\n");
fprintf(pf,"%f\n",source);
fclose(pf);
return source;
}


All times are GMT -4. The time now is 14:42.