CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

UDF memory assignment

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 2, 2006, 08:15
Default UDF memory assignment
  #1
Kate
Guest
 
Posts: n/a
Hello,

In Fluent I'm trying to move a wall by saying that the new wall position should be an old wall position plus a deformation. The UDF is below. However, I can't get Fluent to read in the node positions or displacements correctly.

For example for the position of node 86 which is specified by this line in the file "node_original.txt": 86,4.539341e-03,2.096552e-03,1.979483e-01 Fluent tells me the position is: 86,1.098238e-21,2.626260e-24,1.243272e-08

And for a displacement in the file "disp.txt" which should be: 6.980200e-06, 7.436000e-08, -6.986600e-07 Fluent says it is: 3.673734e-44, 4.929700e-60, -2.875845e-52

I think this has something to do with the way the variable type has been declared at the beginning of the function or the way the type has been declared when the files are read in. But I really can't figure out what is wrong.

I'm working in double precision.

Any advice would be much appreciated!

Thanks, Kate

DEFINE_GRID_MOTION(grid_motion,domain,dt,time,dtim e) { int j; int i; int n; FILE *fd;

real dx[1202]; real dy[1202]; real dz[1202]; int a[7147]; real x[7147]; real y[7147]; real z[7147]; face_t f; Thread *thread = DT_THREAD(dt); Node *v;

char filename[20]; memset(filename,21,0);

sprintf(filename,"disp.txt");

fd = fopen(filename, "r");

for (j=1; j<1202; j++)

fscanf(fd,"%e, %e, %e\n", &dx[j], &dy[j], &dz[j]);

fclose(fd);

printf("%e, %e, %e\n", dx[1], dy[1], dz[1]);

fd = fopen("node_original.txt", "r");

for (j=1; j<7147; j++)

fscanf(fd,"%d,%e,%e,%e\n", &a[j], &x[j] ,&y[j], &z[j]);

fclose(fd);

printf("%d,%e,%e,%e\n", a[1], x[1] ,y[1], z[1]);

i = 0;

begin_f_loop (f, thread)

{

f_node_loop (f, thread, n)

{

v = F_NODE (f, thread, n);

i = i+1;

NODE_X(v) = x[i] + dx[a[i]];

NODE_Y(v) = y[i] + dy[a[i]];

NODE_Z(v) = z[i] + dz[a[i]];

}

}

end_f_loop (f, thread)

}

  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
UDF - Derivatives for User Defined Memory Variable Sandilya Garimella FLUENT 0 January 14, 2008 10:39
memory leaks opening/closing cases with udf? Daniele Scatolini FLUENT 1 August 12, 2006 18:43
CFX CPU time & real time Nick Strantzias CFX 8 July 23, 2006 17:50
memory deallocation problem in UDF Hiranya FLUENT 2 May 6, 2002 01:04


All times are GMT -4. The time now is 05:10.