CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Compiling UDF (https://www.cfd-online.com/Forums/fluent-udf/68153-compiling-udf.html)

hosna September 8, 2009 13:55

Compiling UDF
 
Hi everyone;
I have got kind of error when compiling a UDF file to fluent and the error when I try to built is:
C:\Program Files\microsoft visual studio\vc98\include\eh.h(32) : fatal error C1189: #error : "eh.h is only for C++!"
I also get error of the type:
Opening library "libudf"...
Error: open_udf_library: The system cannot find the file specified.

Error: open_udf_library: The system cannot find the file specified.
Error Object: #f
when I try to load the file. My UDF file is suppose to read some flow data (a text file has time, and volume rate data in matrix format and as you see I have to somehow define the matrix for C) and produce a fully developed velocity profile. you can see the file below. I will appreciate if anyone of you can help we where I have been working on this problem for some times.

#include "udf.h"
#include "iostream"
#include "fstream"
#include "string"
DEFINE_PROFILE(velocity_inlet, thread, index)
using namespace std;
int main()
{
face_t f;
real z[ND_ND];
real y;
real x;
real VOL;
real t = RP_Get_Real("flow-time");
#define row 40
#define col 10
FILE *p;
int i, j, loop = 0;
char buffer[10], ch;
float matrx [row][col];
for (i=0; i<row; i++)
for (j=0; j<col; j++)
matrx[i][j] = 0;

p = fopen("num.txt", "r");
if (p) {
ch = fgetc( p );
/* skip to start of record */
while( ((ch == '\n') || (ch == ' ')) && (ch != EOF) )
ch = fgetc( p );
if( ch == EOF ) return 0;
for(i=0; i<row; i++)
{
for(j=0; j<col; j++)
{

loop = 0;
/* read character */
while( (ch != '\n') && (ch != ' ') && (ch != EOF)) {
buffer[loop++] = ch;
ch = fgetc( p );
}

buffer[loop] = 0;
matrx[i][j] = atof( buffer );

if( ch == EOF ) break;
/* skip to start of next field */
while( ((ch == '\n') || (ch == ' ')) && (ch != EOF) )
ch = fgetc( p );
if( ch == EOF ) break;
}
if( ch == EOF ) break;
}

} else {
printf("File does not exist.\n");
}
fclose(p);
for (i=0; i<row; i++)
for (j=0; j<col; j++)
printf("%f\n", matrx[i][j]);
// system("PAUSE");
// return EXIT_SUCCESS;
return 0;
for (i=0; i<40; i++)
{
Ļif (fd[i][1]<=t && t=<fd[i+1][1]
{
VOL = fd[i][8]/fd[i][1];
}
}
begin_f_loop(f, thread)
{
F_CENTROID(z,f,thread);
y = z[0];
x = z[1];
F_PROFILE(f, thread, index) = VOL - VOL*((x*x)+(y*y))/(0.025*0.025)
}
end_f_loop(f, thread)
}


All times are GMT -4. The time now is 05:46.