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/)
-   -   User defined viscosity - error in load (https://www.cfd-online.com/Forums/fluent-udf/158110-user-defined-viscosity-error-load.html)

Far August 15, 2015 13:20

User defined viscosity - error in load
 
1 Attachment(s)
Here is my udf for defining the viscosity as function of temperature and pressure:

Code:

#include "udf.h"

DEFINE_PROPERTY(viscosity,c,t)
{
real mu_laminar, temp, pr;

temp = C_T(c,t);

pr = C_T(c,t);

mu_laminar = 0.0127*exp(0.000000213345*(pr-
101345))*exp(0.029*(temp-293));

return mu_laminar;

}

After compilation i get following message, which i am sure is OK!


D:\a\libudf\win64\3ddp\libudf.dll
Copied D:\a/D:\a\viscosity .c to libudf\src
udf_names.c and user_nt.udf files in 3ddp are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\v160\fluent"\fluent16.0.0\sr c\udf\makefile_nt.udf "libudf\win64\3ddp\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp")
Done.


Then I click on load option to make it available to solver, but then I get this error message :

http://www.cfd-online.com/Forums/att...1&d=1439659112

Any suggestion?

Far August 16, 2015 01:26

3 Attachment(s)
Today morning, just started the procedure again without any changes to system configuration or Fluent settings and surprisingly every thing is working fine.


Though you can see that I have made few changes to UDF but that is not more than adding comments etc...

Here is the message I received now (perfectly working udf )


http://www.cfd-online.com/Forums/att...1&d=1439702414

And UDF (also attached)

http://www.cfd-online.com/Forums/att...1&d=1439702177

PS: I am using Visual studio Express 12.0. For editing of udf files ( c files in fact), I am using notepad++.

`e` August 18, 2015 06:38

I generally find it safest to first unload the compiled library before building and loading a new library (instructions). Restarting Fluent would have a similar effect which could explain why the compilation worked next day.

Far August 18, 2015 19:39

Just wondering, what is the purpose of return command?

`e` August 18, 2015 20:00

Fluent UDF macros are implemented with the usual C function definitions which may return a value. Article on C Functions. In this particular case, the DEFINE_PROPERTY macro is called for each cell and returns the viscosity value. This process occurs when the properties are updated (near the end of each iteration before the convergence check).


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