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

Problem in compiling UDF with ANSYS Fluent 17.1 and Visual Studio 14.0

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 27, 2016, 06:03
Default Problem in compiling UDF with ANSYS Fluent 17.1 and Visual Studio 14.0
  #1
New Member
 
Join Date: Oct 2016
Posts: 13
Rep Power: 9
Spiker54321 is on a distinguished road
Hi guys,

I have a problem compiling my UDF file with the above mentioned software. The function contains a math header that needs to be used. Here the simple code:

Code:
#include "udf.h"
#include <math.h>

#define F = 100;
#define w = 0.85;
#define x_wheel = 0;
#define y_wheel = 0.4;

DEFINE_SOURCE(xmom_source,c,t,ds,eqn)
{
real theta, source;
real x_diff;
real y_diff;
real x[ND_ND];

C_CENTROID(x,c,t);
x_diff = x[0]-x_wheel;
y_diff = x[1]-y_wheel;
theta = atan (x_diff/y_diff);
source = F*(sqrt (x_diff*x_diff+y_diff*y_diff)*w)*(sqrt (x_diff*x_diff+y_diff*y_diff)*w)*cos (theta);
ds[eqn] = 2*F*(sqrt (x_diff*x_diff+y_diff*y_diff)*w)*cos (theta);
return source;
}
It should mimic the force of a paddle wheel on an open water flow as it is depicted in principle here:



And this is the error message:

Quote:
..\..\src\PaddleWheel.c(17): error C2059: syntax error: '='
..\..\src\PaddleWheel.c(18): error C2059: syntax error: '='
..\..\src\PaddleWheel.c(20): error C2059: syntax error: '='
..\..\src\PaddleWheel.c(20): error C2143: syntax error: missing ';' before ')'
..\..\src\PaddleWheel.c(21): error C2059: syntax error: '='
..\..\src\PaddleWheel.c(21): error C2143: syntax error: missing ';' before ')'
I guess it has something to do with the math header that is not handled correctly. I already tried to follow the suggestions from the other threads but it didn't help. The big difference here is that the include files of Visual Studio 14 are distributed in another way than the previous versions. As far is I understood it right they are outsourced in a "Windows Kit" folder. How can I tell this to Fluent? I also tried already to copy the files to the VC\include directory of Visual Studio but that didn't help neither.

Unfortunately, I can't go back to an older Visual Studio Version as I need the current version for another program.

Please help me!
Spiker54321 is offline   Reply With Quote

Old   October 27, 2016, 06:33
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Remove the equals signs and semicolons from your preprocessor directives because these are currently included in the compiler.

Code:
#define F 100
#define w 0.85
#define x_wheel 0
#define y_wheel 0.4
`e` is offline   Reply With Quote

Old   October 27, 2016, 10:09
Default
  #3
New Member
 
Join Date: Oct 2016
Posts: 13
Rep Power: 9
Spiker54321 is on a distinguished road
Shame on me.
Problem solved!

Thanks!
Spiker54321 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
problem with compiling udf through visual studio chem engineer Fluent UDF and Scheme Programming 2 August 17, 2015 11:46
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 01:53
CFX11 + Fortran compiler ? Mohan CFX 20 March 30, 2011 19:56
How to install CGNS under windows xp? lzgwhy Main CFD Forum 1 January 11, 2011 19:44
CGNS lib and Fortran compiler manaliac Main CFD Forum 2 November 29, 2010 07:25


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