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

UDF error concerning math.h

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

Like Tree13Likes
  • 5 Post By trollreign
  • 1 Post By jipaz
  • 1 Post By wayuu1981
  • 1 Post By piprus
  • 5 Post By Ratel

Reply
 
LinkBack Thread Tools Display Modes
Old   October 25, 2013, 05:44
Unhappy UDF error concerning math.h
  #1
New Member
 
Marie
Join Date: Oct 2013
Location: Knk
Posts: 24
Rep Power: 3
KITetima is on a distinguished road
Hi,

I compiled my UDF on fluent v145 and I have got this error concerning math.h

However in my header I donīt add math.h (I have tried with and I have no changes). I have also download a new math.h file and remplace it in my ansys\v145\....\src\math.h file.

Copied C:\Users\urdfa\Desktop\UDF essai\25_10_files\dp0\FFF\MECH/C:\Users\urdfa\Desktop\UDF essai\25_10_files\dp0\FFF\MECH\vitesse.c to libudf\src
Copied C:\Program Files\ANSYS Inc\v145\fluent\fluent14.5.0\src\udf.h to libudf\src
************************************************** ************************
** NOTE: user_nt.udf file is outdated. So, recreating the file for 2d ...
************************************************** ***********************
(system "copy "C:\PROGRA~1\ANSYSI~1\v145\fluent"\fluent14.5.0\sr c\makefile_nt.udf "libudf\win64\2d\makefile" ")
1 Datei(en) kopiert.
(chdir "libudf")()
(chdir "win64\2d")()
# Generating ud_io1.h
vitesse.c
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: Syntaxfehler: ','
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2143: Syntaxfehler: Es fehlt ')' vor 'Konstante'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2143: Syntaxfehler: Es fehlt '{' vor 'Konstante'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: Syntaxfehler: 'Konstante'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: Syntaxfehler: ')'


I also add my UDF Perharps the error comes from my UDF, but I have found no error with Visual Studio)


/************************************************** *********************
vprofile.c
UDF for specifying steady-state velocity profile boundary condition
************************************************** **********************/
#include "udf.h"

DEFINE_PROFILE(x_velocity,thread,position)
{
real x[ND_ND]; /* this will hold the position vector */
real y;
face_t f;

begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
y = x[1];
F_PROFILE(f, thread, position) = 5;
}
end_f_loop(f, thread)
}


Thank you in advance for any idea concerning my issue.
KITetima is offline   Reply With Quote

Old   October 27, 2013, 10:30
Default
  #2
New Member
 
Laszlo A.
Join Date: Oct 2013
Location: Bristol, UK
Posts: 4
Blog Entries: 1
Rep Power: 3
trollreign is on a distinguished road
I am trying the exact same thing and I am getting the same error.

My UDF is pretty similar to yours, I am trying to implement a user-defined velocity profile on my boundary using an UDF. When I try to compile it, it gives the same errors with the math.h file located in Visual Studio 12.

Done.
Deleted old libudf\win64\2d\libudf.dll
1 file(s) copied.
Copied J:\CFD\004_vertflow\velocity_profile.c to libudf\src
(system "copy "C:\PROGRA~1\ANSYSI~1\v140\fluent"\fluent14.0.0\sr c\makefile_nt.udf "libudf\win64\2d\makefile" ")
1 file(s) copied.
(chdir "libudf")()
(chdir "win64\2d")()
# Generating ud_io1.h
velocity_profile.c
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: syntax error : ','
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2143: syntax error : missing ')' before 'constant'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2143: syntax error : missing '{' before 'constant'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: syntax error : 'constant'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(482) : error C2059: syntax error : ')'

Done.



Further information for those trying to help.
1. I also tried to get a math.h file from the internet and load it as a header file on the right of the screen. This way it also gave the same errors from the math.h file located in the Visual Studio 12 folder's VC library, AND in addition some errors from the other math.h header file I attached. In any case, it looks for the math.h file of VS12, whether you attached it or not.

2. Visual Studio 12 is actually the Microsoft Visual Studio 2013 Express that Microsoft released recently. Is it possible that their math.h file is simply wrong? Or that it is not compatible with Fluent 14.0 for some reason?

3. If I try to load the profile after building it with errors, I get the following error message:

The UDF library you are trying to load (libudf) is not compiled for 2d on the curent platform (win64).
The system cannot find the file specified.

J:\CFD\004_vertflow\libudf\win64\2d\libudf.dll



So it seems that the .dll file was not created. Somehow the dll should be linked but it isn't.
In a video on YouTube I saw that the right message Fluent should give would be: http://www.youtube.com/watch?v=rT3a-Lu7LI4
trollreign is offline   Reply With Quote

Old   October 27, 2013, 15:56
Default Have to replace math.h
  #3
New Member
 
Laszlo A.
Join Date: Oct 2013
Location: Bristol, UK
Posts: 4
Blog Entries: 1
Rep Power: 3
trollreign is on a distinguished road
After several hours I found a solution to the problem.

So my setup is:
- Windows 8.1 x64
- ANSYS v140 x64
- Microsoft Visual Studio 2013 Express (which is the same as Microsoft Visual Studio 12)
- Microsoft Windows Software Development Kit (SDK) 8.1
- Microsoft .NET Framework 4.5.1

The environmental variables were set, I ran Fluent from the command prompt properly with x64, the compiler was specified. The above problem occurred (see KITetima' post) at compilation.

Solution:
1. In addition to above mentioned software, install Microsoft Visual C++ Express 2010.
2. Copy the math.h file from
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
to
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include
(this is with standard installation folders)
3. Start Fluent from the VS2013 x64 Cross Tools Command Prompt. If you go to the Start screen (windows key on the keyboard) and type "Visual Studio Tools" you will find this command prompt in that folder.

Note that starting fluent from the command prompt of Visual Studio 2010 will not work, you need a 64 bit environment (x64)

Hope this helps.
trollreign is offline   Reply With Quote

Old   October 28, 2013, 05:20
Default
  #4
New Member
 
Marie
Join Date: Oct 2013
Location: Knk
Posts: 24
Rep Power: 3
KITetima is on a distinguished road
Thank you. You have solved my problem with this math.h error !
KITetima is offline   Reply With Quote

Old   November 19, 2013, 17:31
Default
  #5
New Member
 
Join Date: Aug 2012
Posts: 20
Rep Power: 4
jipaz is on a distinguished road
Lazlo and Marie, its seems Ansys Fluent is not compatible with last version of MSVS. I'm using Ansys Fluent 12.1 and I solved the same problem just copying math.h from:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
to
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include

and now Fluent in compiling my UDF properly. Regards.
Rui_27 likes this.
jipaz is offline   Reply With Quote

Old   December 2, 2013, 11:04
Default It worked !!!
  #6
New Member
 
J.G.E.
Join Date: Oct 2013
Posts: 2
Rep Power: 0
wayuu1981 is on a distinguished road
Man, God Bless you !! I had this problem for a long time with no solution, I tried all version of Visual Studio and nothing worked, but now you saved my life !!!

Thanks again ...
jipaz likes this.
wayuu1981 is offline   Reply With Quote

Old   December 2, 2013, 11:27
Default
  #7
New Member
 
Join Date: Aug 2012
Posts: 20
Rep Power: 4
jipaz is on a distinguished road
Because of I'm using Ansys Fluent 12.1, I had to edit the udf.bat file to indicate to Fluent has to use MSVS 12, maybe if you're using a later Fluent release, you don't have to do this.

Regards.
jipaz is offline   Reply With Quote

Old   January 23, 2014, 07:42
Default
  #8
Member
 
Piotr Prusinski
Join Date: Oct 2009
Location: Warsaw, Poland
Posts: 53
Rep Power: 7
piprus is on a distinguished road
Can I ask anyone of you to share with me just a math.h file from VS2010?
lleite likes this.
piprus is offline   Reply With Quote

Old   May 30, 2014, 22:59
Default
  #9
New Member
 
Junphy Liues
Join Date: Apr 2014
Posts: 9
Rep Power: 3
Junphy is on a distinguished road
Quote:
Originally Posted by piprus View Post
Can I ask anyone of you to share with me just a math.h file from VS2010?
This can also work well, I just tried it
Junphy is offline   Reply With Quote

Old   June 17, 2014, 06:39
Default
  #10
New Member
 
Dawie Marais
Join Date: Jan 2014
Posts: 6
Rep Power: 3
Ratel is on a distinguished road
Hi guys,

Would it be possible to please share a math.h file from VS2010 on this thread? I also have the same problem but I am having trouble installing VS2010 due to proxy issues.

Thanks!
Ratel is offline   Reply With Quote

Old   June 18, 2014, 02:11
Default
  #11
New Member
 
Dawie Marais
Join Date: Jan 2014
Posts: 6
Rep Power: 3
Ratel is on a distinguished road
Attached is the math.h file from VS2010 should anyone need it- it works very well indeed!
Attached Files
File Type: h math.h (23.2 KB, 119 views)
p36288, moghimi64, lleite and 2 others like this.
Ratel is offline   Reply With Quote

Old   July 29, 2014, 12:30
Default udf math.h error on visual studio 2013
  #12
New Member
 
WangLei
Join Date: Mar 2011
Posts: 2
Rep Power: 0
p36288 is on a distinguished road
In Visual Studio 2013, I found Line 482 in the math.h:
Code:
_CRTIMP double __cdecl cbrt(_In_ double _X);
makes the math.h error happen.
delete it or wrap with /**/, the error C2059 and C2143 would disappear, then you need not copy another math.h file.
I have no idea what's wrong with this code.
p36288 is offline   Reply With Quote

Old   February 21, 2015, 20:50
Default
  #13
New Member
 
Ugur Goktolga
Join Date: Jul 2013
Posts: 2
Rep Power: 0
mugurg is on a distinguished road
Thank you trollreign, thank you very much!
mugurg is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
Dynamic Mesh UDF Qureshi FLUENT 1 December 2, 2009 01:27
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


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