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

problem with reading data from txt file

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 8, 2024, 09:25
Default problem with reading data from txt file
  #1
New Member
 
amina
Join Date: Feb 2020
Posts: 9
Rep Power: 6
aminalaouti is on a distinguished road
hi everyone,
i try to read a file named data.txt that contains the absorption coefficient of gas .
for that i wrote 2 UDFs :
the 1st : DEFINE_ON_DEMAND for reading a variable 'coef'
the 2nd: DEFINE_GRAY_BAND_ABS_COEFF to allocate the coef variable readed previously (from data.txt file) to the absorption coefficient .


//////////////////////////****///////////////////////////
DEFINE_ON_DEMAND(lire)
{
FILE* fp;
float coef[5];
int i, j;
fp = fopen("C:\\Codes\\ALBDF\\Tables\\data.txt", "r");
for (i = 0; i < 5; i++)
{
fscanf(fp, "%f", &coef[i]);
}
fclose(fp);
}
*********/////*********************
DEFINE_GRAY_BAND_ABS_COEFF(abs3, c, t, nb)
{
float coef[5];
switch (nb)
{
case 0: abs_coeff = coef[0]; break;
case 1: abs_coeff = coef[1]; break;
case 2: abs_coeff = coef[2]; break;
case 3: abs_coeff = coef[3]; break;
case 4: abs_coeff = coef[4];
}
return abs_coeff;
}
/////*************////////

The problem is when i hook the 1st udf(DEFINE_ON_DEMAND) the fluent-window disaper ( fluent window closes spontaneously) i dont found the probleme were is ????
aminalaouti 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
Custom Thermophysical Properties wsmith02 OpenFOAM 4 June 1, 2023 15:30
Postprocess: sampleDict works but creates no output folder shock77 OpenFOAM Post-Processing 14 November 15, 2021 09:27
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 07:42
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23


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