|
[Sponsors] |
How to include C standard libraries into interpreted UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 11, 2019, 12:58 |
How to include C standard libraries into interpreted UDF
|
#1 |
New Member
Daniel
Join Date: Apr 2018
Posts: 24
Rep Power: 8 |
I'm trying to add the math.h library to my simple UDF:
Code:
#include "udf.h" #include "math.h" DEFINE_PROFILE(squarewave, thread, pos) { face_t f; real A; real tm1= 1; real tm2 = 1; real t = CURRENT_TIME; begin_f_loop(f, thread) { A = fmod(t, tm1+ tm2); A = round(A*10000)/10000; if (A == 0) { F_PROFILE(f, thread, pos) = 100; } if (A == tm1) { F_PROFILE(f, thread, pos) = 0; } } end_f_loop(f, thread) } However, I'm getting the errors: Code:
math.h: No such file or directory line 13: fmod: undeclared variable Thanks |
|
October 21, 2019, 08:42 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
compile your code, not interpret
best regards
__________________
best regards ****************************** press LIKE if this message was helpful |
|
November 11, 2019, 09:53 |
|
#3 |
Member
Abhinand
Join Date: Jun 2016
Posts: 75
Rep Power: 10 |
If, I am not mistaken, the udf.h library has the files to import all the standard libraries a normal c function takes, like I/O or math functions.
So it is best to not add any of the standard files and just stick with udf.h. It will work correctly on both interpretation and compilation -Abhinand |
|
November 12, 2019, 08:07 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Regardless of your issue: compile, don't interpret. Ansys should remove the option to interpret, it is in almost every aspect inferior to compiling.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] difficulties installing swak4foam | newbie29 | OpenFOAM Community Contributions | 120 | October 21, 2022 05:01 |
SimpleFoam cannot open include file | Marija | OpenFOAM Running, Solving & CFD | 1 | October 28, 2020 11:35 |
UDF interpreted Error | ctmagic | Fluent UDF and Scheme Programming | 4 | May 14, 2018 23:26 |
OpenFoam install script Error during paraFoam installation | SePe | OpenFOAM Installation | 10 | June 19, 2010 16:15 |
Problem about interpreted UDF | Earng | FLUENT | 5 | April 8, 2004 12:07 |