-
-
June 20, 2019 at 2:38 pm
ehkh
SubscriberHi,
I am facing errors while trying to do interpretation or compilation for a UDF in fluent.
I am simulating a 2D rectangular cavity with the following boundary conditions: adiabatic top layer, periodic side walls and rigid bottom with thermal heat flux and small random perturbations following this equation: dT/dy= -exp(-h)+ epsilon*[rand(x)-0.5] , where rand is a one dimensional array of random numbers uniformly distributed in the range of [0,1].
I used a UDF to assign the heat flux and perturbation to the bottom layer. When I used interpretation of UDF, I get an error notifying that: srand: undeclared variable.
When trying to compile it, I get an error notifying that: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).nnThe system cannot find the file specified. however, the UDF source files are in the directory that contains my case and data files.
Following the UDF I am using to set up the boundary condition at the bottom layer:
#include "udf.h"
#include "stdlib.h" /* srand and rand */
#include "time.h"
#include "random.h"
#define RAND_MAX 32767
DEFINE_PROFILE(Temp_rand_pertubation_bottom,thread,index)
{
real x[ND_ND]; /* this will hold the position vector */
face_t f;
real time= CURRENT_TIME;
float h,E,r;
srand((unsigned)time(NULL)); /* this to specify a different random number at each cell */
k=0.6 /* thermal conductivity */
T=300 /* Temp in Kelvin */
h = 0.5; /* cavity height */
E= 0.01; /* epsilon constant value */
begin_f_loop_all(f,thread)
{
r= rand()/float(RAND_MAX); /* r is a 1D array of random numbers uniformly distributed in the range of [0,1] */
F_CENTROID (x,f,thread);
F_PROFILE(f,thread,index) = k*T*(- exp(-h)+E*(r-0.5))/h; /* apply random perturbation */
}
end_f_loop_all(f,thread);
void srand(unsighned int seed);
}
To avoid these errors, please advice me whether my UDF need to be corrected or modified, or its something to do with fluent itself.
Many thanks
Esra'a
-
June 20, 2019 at 4:28 pm
Rob
Ansys EmployeeCheck on the compiled error: is there something about "nmake" not being recognised?
-
June 21, 2019 at 3:42 am
ehkh
SubscriberCan you please give me more clarification what you meant by "nmake"?
If I understood you, I get nothing about "nmake", the error that I get is as follows:
The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).nnThe system cannot find the file specified.
However, even I am getting this error, I found a libudt file in the directory but the UDF does not come out in the drop down menu in heat flux boundary condition dialog box.
-
June 21, 2019 at 8:18 am
DrAmine
Ansys EmployeeDo you have compiler installed? Can you check with a dummy Hello World dummy DEFINE_ON_DEMAND UDF.?
-
June 21, 2019 at 9:14 am
Rob
Ansys EmployeeUDFs can fail to compile due to coding errors and/or lack of a compiler. The former usually gives a string of errors, the latter complains about nmake not being present/recognised. As there is then no libudf to load you get the error you're seeing.
-
June 24, 2019 at 3:23 am
ehkh
SubscriberHi,
Thanks for your reply.
In order to solve the problem, I have installed the latest version of visual studio, restarted the machine, set up the Path in the environment variable correctly as below:
C:Program Files (x86)Microsoft Visual Studio2019CommunityCommon7Tools;
C:Program Files (x86)Microsoft Visual Studio2019CommunityVC;
C:Program FilesANSYS Incv192fluent;
BUT still facing the same problem !
Could you please guide me how to get this error solved.
Thanks
-
June 24, 2019 at 10:01 am
Rob
Ansys EmployeeWhich means it's not compiling. Are you getting the "nmake" not recognised or a list of errors on the code? Check in the Installation section for the former (I think we're still using Visual Studio 2017).
-
June 24, 2019 at 11:11 am
ehkh
SubscriberThanks for your reply.
I don't get anything related to "nmake" or error in the code. the only error error I get exactly copied from the TUI:
Error: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).nnThe system cannot find the file specified.
nnF:esraworked simulations2Drayleigh benard convectionRectCavityHeatfluxPatterson2015RecyCavityHeatflux_filesdp0FFFMECHlibudfwin642ddp_hostlibudf.dll
Error Object: #f
Regarding Visual studio, I have installed v2019, do I need to install v2017 to be compatible with Fluent 19.2 ??
-
June 24, 2019 at 3:19 pm
Rob
Ansys EmployeeWhich just means the UDF isn't compiled. I'll move to installation, but please review the various threads on compilers as I suspect that'll resolve this problem.
-
June 24, 2019 at 9:26 pm
tsiriaks
Ansys EmployeePlease use Visual Studio 2017, the current ANSYS versions won't work with 2019 without certain modifications in the script.
Try VS 2017 and make sure that you don't have space anywhere in path, folder names, case and data files (I see you have plenty of them)
-
June 26, 2019 at 2:50 am
ehkh
SubscriberThanks for your reply.
Do you recommend to use ANSYS 19.2 or 18.2 to be compatible with VS 2017 ??
Thanks
-
June 26, 2019 at 3:39 pm
tsiriaks
Ansys EmployeeANSYS 2019 R# is ok, no need for older versions.
Thanks,
Win
-
July 2, 2019 at 1:44 pm
ehkh
SubscriberIt works!! Thanks.
-
July 2, 2019 at 4:56 pm
tsiriaks
Ansys EmployeePerfect ! Thank you for the update.
Win
-
July 3, 2019 at 6:57 am
ehkh
SubscriberHi,
When using the UDF at the bottom layer, I supposed to see plumes or rolls on the temperature contour profile.
BUT I didn't, what I get is a simple diffusion problem.
I wrote the UDF so that each cell on the bottom layer has different random number of heat flux, I used the srand function.
Here is my UDF:
#include "udf.h"
#include "stdlib.h"
/* srand and rand */
#include "random.h"
#include "time.h"
/*#define RAND_MAX 32767*/
#define k 0.6
/* thermal conductivity */
#define T 300
/* Temp in Kelvin */
DEFINE_PROFILE(Temp_rand_pertubation_bottom,thread,index)
{
real x[ND_ND];
/* this will hold the position vector */
face_t f;
real time = CURRENT_TIME;
float h = 0.5;
float E = 0.01;
srand((unsigned int) time);
/*this to specify a different random number at each cell*/
begin_f_loop_all(f,thread)
{
float r = (rand() / RAND_MAX);
/* r is a 1D array of random numbers uniformly distributed in the range of [0,1] */
F_CENTROID (x,f,thread);
F_PROFILE(f,thread,index) = k*T*(- exp(-h)+E*(r-0.5))/h;
/* apply random perturbation */
}
end_f_loop_all(f,thread);
void srand(unsigned int seed);
}
please advice me whether I need to modify the code.
Many thanks for your valuable help.
Esra'a
-
July 3, 2019 at 2:52 pm
Rob
Ansys EmployeeWhat is the material density?
-
July 4, 2019 at 12:21 am
ehkh
SubscriberI am using water as a fluid at 300K , so the density is 997 Kg/m3.
please not that I am using a laminar unsteady model.
Thanks
-
July 16, 2019 at 6:00 am
ehkh
Subscriber
Hi
I am still struggling with this...
I modified My UDF so that each face on the bottom layer has different random number of heat flux, using the uniform_random() function and included this in the profile equation. Compiled successfully and hooked as a thermal boundary condition for heat flux. My UDF returns the correct value I am looking for.
BUT still not getting plumes or rolls on the temperature contour profile, as I am using a laminar transient simulation with Rayleigh number equals to 10^9. I am expecting to see something similar to previous work done using SNS code. Please refer to Figure 6 in the Journal article (Hattori et. at, 2015)
https://doi.org/10.1016/j.ijheatmasstransfer.2015.03.060
could you please advice me what is the correct setup for heat flux boundary condition. I went through the boundary conditions section in the manual but could not figure out an answer to my question.
Thanks
Esra'a -
July 16, 2019 at 5:56 pm
tsiriaks
Ansys EmployeeYou may have to create a new thread in Physics Simulation -> Fluid Dynamics section , then include the url of this thread for reference. You should get more responses in that section.
Thanks,
Win
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Error with workbench SceneGraphChart
- How can I renew ANSYS student version license?
- License Error
- Workbench error
- Workbench not opening
- Sizing on Ansys Workbench 19.2
- Error: Exception of type ‘Ansys.Fluent.Cortex.Cortex not availableException’ was thrown
- Ansys2021R2 ansys212 seg faults immediately on RHEL8.2
- Licensing error while opening ANSYS Mechanical
- An error occurred when the post processor attempted to load a specific result.
-
3744
-
2573
-
1795
-
1236
-
594
© 2023 Copyright ANSYS, Inc. All rights reserved.