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

'execute on demand' shut down fluent automatically

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 26, 2013, 11:14
Default 'execute on demand' shut down fluent automatically
  #1
Member
 
Rexxar
Join Date: May 2012
Location: Bethlehem, PA
Posts: 36
Rep Power: 14
czhao86 is on a distinguished road
Code:
#include "udf.h"

extern float plasma[4];

DEFINE_ON_DEMAND(read_data)
{
int i;
FILE *rfile; /* declare a FILE pointer */

rfile = fopen("try.txt", "r"); /* open file for reading */
Message("file opened\n");

/* loop to read file */
i=0; /* initialize before to loop */
for (i=0;i<4;i++)
{
fscanf (rfile, "%f", &plasma[i]); /* that supposes one value per line */
}

fclose(rfile);
Message("file closed\n");
}
I am trying to import data from a text file named 'try.txt'. After compiling the UDF, and Fluent will close when I click 'execute' under 'execute on demand'. I put try.txt in the same folder as the UDF. Anyone have some idea? Thanks.
__________________
Best,

Rexxar
czhao86 is offline   Reply With Quote

Old   September 26, 2013, 16:43
Default
  #2
Member
 
Rexxar
Join Date: May 2012
Location: Bethlehem, PA
Posts: 36
Rep Power: 14
czhao86 is on a distinguished road
It turns out that I need to interpret a UDF before do the execute. I don't know why, but it is working now.
__________________
Best,

Rexxar
czhao86 is offline   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
Two questions on Fluent UDF Steven Fluent UDF and Scheme Programming 7 March 23, 2018 04:22
How to open Icem mesh in Ansys Fluent? emmkell FLUENT 27 February 6, 2018 04:34
Error in reading Fluent 13 case file in fluent 12 apurv FLUENT 2 July 12, 2013 08:46
fluent parallel problem in win7 x64 system dunga82 FLUENT 8 April 19, 2012 21:23
Fluent 6.3 32bit vs Fluent 12.0 64bit ibex7 FLUENT 7 April 18, 2011 03:44


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