CFD Online Logo CFD Online URL
Home > Forums > FLUENT

UDF to read data from a file for VOF model

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

LinkBack Thread Tools Display Modes
Old   October 23, 2008, 07:02
Default UDF to read data from a file for VOF model
Posts: n/a
Hi, I'm trying to build an UDF thats read the flow field variables in a VOF problem. The UDF should read the flow field stored in a file and then assign the values of the velocity, pressure and volume fraction to each cell centroid. I've tried with this one, and as it is being compiled without errors, Fluent returns a Segmentation violation message: Any help will be very welcome!!. Thanks!.

#include "udf.h" FILE *fout;

/* domain pointer that is passed by INIT function is mixture domain */ DEFINE_INIT(read_flow_field, mixture_domain) { int phase_domain_index; cell_t cell; Thread *cell_thread; Domain *subdomain; real xc[ND_ND]; real vof; real x,p,u,v; real m[41600][6];

fout= fopen("data2d.dat","r");

/* loop over all subdomains (phases) in the superdomain (mixture) */ sub_domain_loop(subdomain, mixture_domain, phase_domain_index) {

/* loop if secondary phase */

if (DOMAIN_ID(subdomain) == 3)

/* loop over all cell threads in the secondary phase domain */

thread_loop_c (cell_thread,subdomain)


/* loop over all cells in secondary phase cell threads */

begin_c_loop_all (cell,cell_thread)


fscanf(fout,"%g %g %g %g %g %g",&m[cell][0],&m[cell][1],&m[cell][2],&m[cell][3],&m[cell][4],&m[cell][5]);











end_c_loop_all (cell,cell_thread)


} fclose(fout); }

I've also tried use a counter to index the variables in the loop, unsuccessfully.

  Reply With Quote


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 a file with inlet velocity data? dorin CFX 13 July 20, 2007 02:16
read data file sandra FLUENT 5 August 24, 2006 05:42
read data files and export to avs file Santhosh FLUENT 0 June 15, 2006 06:46
Read data file R.B.M FLUENT 0 July 10, 2002 23:16
Tecplot can't read data file from Fluent. stephen FLUENT 8 November 21, 2001 21:27

All times are GMT -4. The time now is 06:34.