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

UDF to read data from a file for VOF model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 23, 2008, 07:02
Default UDF to read data from a file for VOF model
  #1
Pablo
Guest
 
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]);

u=m[cell][2];

v=m[cell][3];

p=m[cell][4];

vof=m[cell][5];

C_CENTROID(xc,cell,cell_thread);

C_VOF(cell,cell_thread)=vof;

C_U(cell,cell_thread)=u;

C_V(cell,cell_thread)=v;

C_P(cell,cell_thread)=p*/;

}

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

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
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 20:27


All times are GMT -4. The time now is 18:35.