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

[Help Please], Trouble Using UDF to Import Velocity Data -- But All Zeros :(

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 11, 2009, 17:14
Unhappy [Help Please], Trouble Using UDF to Import Velocity Data -- But All Zeros :(
  #1
New Member
 
明月出天山
Join Date: Jun 2009
Posts: 6
Rep Power: 8
rockymountai is on a distinguished road
Hello, Friends

I know that I bothered you guys so much but really need help from you guys. I am using Fluent UDF to import velocity from local data files. But the output are always zero, I tested the C program by local c compiler, it works great as what I expected. Please, please take a look at my UDF and let me know what you believe are wrong, thanks a lot!

#include "udf.h"
#include "mem.h"
#include <stdio.h>

int Nz = 512;
int ts, n;
char buffer[50];
real u, v, w;

DEFINE_PROFILE(x_velocity, t, i){
FILE *fid;
face_t f;
/************************* Construct file names here **************************/
ts = N_TIME;
n = sprintf(buffer, "Uf_%i.dat", ts % Nz);
Message("Importing x-velocity from %s...", buffer);
fid = fopen(buffer, "r");
begin_f_loop(f, t){
fscanf(fid, "%f %f %f\n", &u, &v, &w);<=== u, v, w read from here are always zeros
/* printf("u = %f, u = %f, u = %f\n", u, v, w);*/
F_PROFILE(f,t,i) = u;
}
end_f_loop(f,t)
fclose(fid);
Message("Done\n");
}

The data files look like this below

7.241065 -8.430264 85.50916
-9.164535 -1.508738 82.77167
10.84698 -2.585959 90.85329
-3.974935 -2.802197 92.33000
... ...
rockymountai is offline   Reply With Quote

Old   November 11, 2009, 17:30
Default
  #2
Member
 
Ivan
Join Date: May 2009
Posts: 85
Rep Power: 8
ivanbuz is on a distinguished road
I also want to know how to read a big data file and assigne velocity to the boundary.

for example, save the unsteady outflow boudary velocity data, and use it as inlet velocity in another simulation.
ivanbuz is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read data into my UDF??? Harshit Gupta FLUENT 3 June 15, 2006 02:34
Profile Data Velocity Boundary Condition Changes?? Maria Angelica CFX 9 June 14, 2006 02:44
Variables Definition in CFX Solver 5.6 R P CFX 2 October 26, 2004 02:13
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11
UDF component in Cyliderical Velocity? Hongchan Kim FLUENT 3 April 24, 2001 12:20


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