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

math.h: no such file or directory SOS!SOS!

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By yanghai
  • 2 Post By AlexanderZ
  • 1 Post By nepomnyi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 25, 2018, 07:17
Default math.h: no such file or directory SOS!SOS!
  #1
New Member
 
yanghai
Join Date: Mar 2018
Posts: 16
Rep Power: 8
yanghai is on a distinguished road
Dear all:

when i load the udf, there will be occur:math.h :no such file or directory. the fluent is fluent 16.0.and visual studio is belong to 2010.
i have install and uninstall the fluent and visual studio many times, but it doesn't work. anyone know it ? It's been bothering me for a long time.
nepomnyi likes this.
yanghai is offline   Reply With Quote

Old   December 22, 2019, 18:48
Default The same problem!
  #2
Member
 
Ivan Nepomnyashchikh
Join Date: Sep 2019
Location: USA
Posts: 30
Blog Entries: 1
Rep Power: 6
nepomnyi is on a distinguished road
I have the same problem. I use ANSYS 2019R2 on Windows10. I've written a simple UDF, I included math.h. I launched the interpreter. It says the following: "math.h: No such file or directory".


So, I join the question of the author of this post: if anybody knows how to solve it, please, share the solution.


Thank you very much in advance.


Ivan

Last edited by nepomnyi; December 23, 2019 at 16:40.
nepomnyi is offline   Reply With Quote

Old   December 22, 2019, 23:00
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
ВАНЯ, compile your code
pakk and nepomnyi like this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   December 23, 2019, 17:24
Default
  #4
Member
 
Ivan Nepomnyashchikh
Join Date: Sep 2019
Location: USA
Posts: 30
Blog Entries: 1
Rep Power: 6
nepomnyi is on a distinguished road
Thank you very much Alexander. With your hint, I've managed to launch my UDF (though, not the way you suggested).


For those experiencing the problem with math.h file, I'd like to describe my problem and show how I solved it.


1) Description of my simulation.
I'm simulating a 3-D water-air flow in a vertical round pipe. I am using ANSYS FLUENT 2019R2 on Windows 10. I am not using visual studio. Any manipulations with UDFs (loading/unloading, compiling and so on) I am doing using FLUENT window (in workbench: Setup -> User-Defined -> Functions).
My pipe has a constant velocity water inlet at the bottom, constant pressure outlet at the top, time dependent air velocity inlet at the side (i.e., gas is being supplied through a horizontal pipe adjacent to the main vertical pipe near the bottom of the vertical pipe).


2) Description of my UDF with which I experienced problems.

For a time dependent gas velocity inlet I've written a UDF. I wanted my time dependent gas velocity obey a sin law. That is why I had to introduce a sin function to my code. I read in the Internet that if I have a sin function in the code, I must include math.h header file. I did that. I also used PI constant which is specified in the code as M_PI. Here's my code with math.h:


#include "udf.h"
#include "math.h"


DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;

begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) = -0.15 * ( 1 + sin(t+3*M_PI/2.00) );
}
end_f_loop(f, thread)
}


3) Description of the problem.
First I tried to interpret my UDF. That didn't work. ANSYS showed me an error that it can't find math.h file.
I don't know what "interpret a UDF" means in ANSYS because C is not an interpreted language, it is a compiled language.



4) Solution of the problem.
It appears to be that if I include "udf.h" header file, I can freely use sin function and I don't need to include "math.h" header file. I did not check if the same is true for the PI constant M_PI - instead I just changed the M_PI constant to "3.14" because it was not crucial for me.
It appears to be that if I have "udf.h" header file only and I don't have other header files such as "math.h", I can interpret my UDF. Otherwise, I have to compile it as AlexanderZ suggested.
So, I tried to compile my UDF with both "math.h" and "M_PI" in it. I failed. I got an error. But apparently, I couldn't compile it because of my computer. Namely, I used my university network. But if one wants to compile a UDF he should do it on his computer's hard drive. Also, I have some other computer problems which I didn't try to understand.
My solution. 1) I changed "M_PI" to "3.14". 2) I deleted "math.h" because "udf.h" can easily handle sin function. 3) I interpreted my UDF. 4) Just for a case I place my UDF to the case and data folder <your project name>_files --> dp0 --> FFF --> Fluent. My resultant working code is:


#include "udf.h"

DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;

begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) = -0.15 * ( 1 + sin(t+3*3.14/2.00) );
}
end_f_loop(f, thread)
}


5) Conclusions.
- If you have problems with math.h try to delete it and go just with udf.h. Interpret your UDF - don't compile it. It worked in my case.
- If you still have to use math.h, then you need to compile your code. Compiling can be a challenge (I failed to compile my UDF eventually). Some things you need to do to compile a UDF. 1) Bring your project to your local hard drive - it shouldn't be stored on a cloud or on your enterprise network. 2) Put your UDF code into <your project name>_files --> dp0 --> FFF --> Fluent - this is a directory where your case and data files are stored.


Ivan
AlexanderZ likes this.
nepomnyi is offline   Reply With Quote

Old   December 24, 2019, 00:34
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
the only way to solve problem with math.h is to compile UDF
of course, no math.h - no problem
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ 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
[waves2Foam] Waves2Foam Related Topics ngj OpenFOAM Community Contributions 660 August 20, 2018 12:39
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 09:07
[foam-extend.org] problem when installing foam-extend-1.6 Thomas pan OpenFOAM Installation 7 September 9, 2015 21:53
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43
Trouble compiling utilities using source-built OpenFOAM Artur OpenFOAM Programming & Development 14 October 29, 2013 10:59


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