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/)
-   -   Error in UDF for sinusoidal wave propagation at channel wall (https://www.cfd-online.com/Forums/fluent-udf/158308-error-udf-sinusoidal-wave-propagation-channel-wall.html)

engrmansoor2534 August 21, 2015 04:18

Error in UDF for sinusoidal wave propagation at channel wall
 
I have the following UDF for sinusoidal wave propagation at channel wall. this UDF is intended to deform the channel wall thus causing the fluid motion inside the channel.

#include "udf.h"
#include<stdlib.h>
#include<math.h>

#define AH 0.1 // Average Height of Channel
#define XL 1.0 // Length
#define WA 0.01 // Wave Amplitude
#define PI 3.1415925
#define C 0.05 //Wave Speed
#define Lambda 3.0 // wavelength

#define XStep 0.001
#define XSize XL/XStep

#define HStep 0.0001
#define HSize AH/HStep

DEFINE_GRID_MOTION(peristaltic, domain, dt, time, dtime)
{
Thread *tf= DT_THREAD(dt);
face_t f;

float curr_time = CURRENT_TIME;

//float xVec[XSize]; //based on XStep you can pre compute how much should be the vector dimension (number of elements in xVec, say 1000 (replace it here
float xVec[1000];
xVec[0] = 0;

int counter = 1;
for (counter = 1; counter < XSize; counter++)
xVec[counter] = xVec[counter - 1] + XStep;

float hVec[1000]; //same as the case of xVec, compute the number and put the number here

int i=1;
begin_f_loop(f,tf)
{
curr_time = CURRENT_TIME;
float sint = sin (2 * PI/Lambda * xVec[i] - C * curr_time);
hVec[i] = AH * WA * sint;
i = i + 1;
}
}

After building the library the following errors in console appear.

Build Time: Oct 12 2010 17:12:32 Build Id: 10703
Loading "c:\PROGRA~1\ANSYSI~1\v130\fluent\fluent13.0.0 \lib \fl_s1119.dmp"
Done.



> Deleted old libudf\ntx86\2d\libudf.dll
1 file(s) copied.
(system "copy "c:\PROGRA~1\ANSYSI~1\v130\fluent"\fluent13.0. 0\sr c\makefile_nt.udf "libudf\ntx86\2d\makefile" ")
1 file(s) copied.
(chdir "libudf")()
(chdir "ntx86\2d")()
# Generating ud_io1.h
PeistalticUDFNEW.C
..\..\src\PeistalticUDFNEW.C(29) : error C2143: syntax error : missing ';' before 'type'
..\..\src\PeistalticUDFNEW.C(30) : error C2065: 'counter' : undeclared identifier
..\..\src\PeistalticUDFNEW.C(30) : error C2065: 'counter' : undeclared identifier
..\..\src\PeistalticUDFNEW.C(30) : error C2065: 'counter' : undeclared identifier
..\..\src\PeistalticUDFNEW.C(31) : error C2065: 'counter' : undeclared identifier
..\..\src\PeistalticUDFNEW.C(31) : error C2065: 'counter' : undeclared identifier
..\..\src\PeistalticUDFNEW.C(33) : error C2143: syntax error : missing ';' before 'type'
..\..\src\PeistalticUDFNEW.C(35) : error C2143: syntax error : missing ';' before 'type'
..\..\src\PeistalticUDFNEW.C(39) : error C2143: syntax error : missing ';' before 'type'
..\..\src\PeistalticUDFNEW.C(40) : error C2065: 'hVec' : undeclared identifier
..\..\src\PeistalticUDFNEW.C(40) : error C2065: 'i' : undeclared identifier
..\..\src\PeistalticUDFNEW.C(40) : error C2109: subscript requires array or pointer type
..\..\src\PeistalticUDFNEW.C(40) : error C2065: 'sint' : undeclared identifier
..\..\src\PeistalticUDFNEW.C(41) : error C2065: 'i' : undeclared identifier
..\..\src\PeistalticUDFNEW.C(41) : error C2065: 'i' : undeclared identifier
..\..\src\PeistalticUDFNEW.C(43) : fatal error C1075: end of file found before the left brace '{' at '..\..\src\PeistalticUDFNEW.C(36)' was matched

Done.
Please I need some useful suggestion to get rid of these errors. I am a beginner in ANSYS Fluent and my brother wrote this UDF for me whose is a computer engineer. I think the errors are due to syntex difference??


All times are GMT -4. The time now is 13:04.