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

Error in compiling UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By vinerm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 18, 2019, 04:36
Post Error in compiling UDF
  #1
New Member
 
Kirti Verma
Join Date: Jun 2019
Posts: 7
Rep Power: 7
kirti verma is on a distinguished road
Hi all!
I am trying to define the rate of reaction using UDF, i tried to interprete the UDF but it didn't work so I have been trying to compile it.
I have opened fluent through x86 Native Tools Command Prompt for VS 2017, now I changed the working directory to the folder where my case data and udf file has been stored. I then tried to compile, it shows following:

Copied Z:\Desktop\All Simulations\udf reaction try_files\dp0\FFF-1\Fluent/New Text Document.c to libudf\src
udf_names.c and user_nt.udf files in 3ddp_host are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\ANSYSS~1\v193\fluent"\fluent 19.3.0\src\udf\makefile_nt.udf "libudf\win64\3ddp_host\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_host")
udf_names.c and user_nt.udf files in 3ddp_node are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\ANSYSS~1\v193\fluent"\fluent 19.3.0\src\udf\makefile_nt.udf "libudf\win64\3ddp_node\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_node")
Done.


and on Loading it, this error shows:

Error: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).\n\nThe system cannot find the file specified.
\n\nZ:\Desktop\All Simulations\udf reaction try_files\dp0\FFF-1\Fluent\libudf\win64\3ddp_host\libudf.dll
Error Object: #f



I have tried changing from parallel to serial as well, but it doesn't work, Please someone help me I would be very Grateful
kirti verma is offline   Reply With Quote

Old   June 18, 2019, 05:00
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
make any change in source file (press space and delete it)
recompile

best regards
AlexanderZ is offline   Reply With Quote

Old   June 18, 2019, 05:03
Default
  #3
New Member
 
Kirti Verma
Join Date: Jun 2019
Posts: 7
Rep Power: 7
kirti verma is on a distinguished road
Thankyou for the prompt reply, I have checked making changes in source files, I am getting the same result. The problem still persists.

This is my UDF Code:
#include "udf.h"

DEFINE_VR_RATE(vol_reac_rate,c,t,r,wk,yk,rate,rr_t )
{
real ci, prod;
int i;

/* Calculate Arrhenius reaction rate */

prod = 1.;

if (FLUID_THREAD_P(t) && THREAD_VAR(t).fluid.porous)

for(i = 0; i < r->n_reactants; i++)
{
ci = C_R(c,t) * yk[r->reactant[i]] / wk[r->reactant[i]];
prod *= pow(ci, r->exp_reactant[i]);
}
*rate = r->A * exp( - r->E / (UNIVERSAL_GAS_CONSTANT * C_T(c,t))) *
pow(C_T(c,t), r->b) * prod;

else
*rate = 0.;

*rr_t = *rate;

/* No "return..;" value. */
}
kirti verma is offline   Reply With Quote

Old   June 19, 2019, 00:58
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
#include "udf.h"

DEFINE_VR_RATE(vol_reac_rate,c,t,r,wk,yk,rate,rr_t )
{
real ci, prod;
int i;

/* Calculate Arrhenius reaction rate */

prod = 1.;

if (FLUID_THREAD_P(t) && THREAD_VAR(t).fluid.porous)
{
for(i = 0; i < r->n_reactants; i++)
{
ci = C_R(c,t) * yk[r->reactant[i]] / wk[r->reactant[i]];
prod *= pow(ci, r->exp_reactant[i]);
}
*rate = r->A * exp( - r->E / (UNIVERSAL_GAS_CONSTANT * C_T(c,t))) * 
pow(C_T(c,t), r->b) * prod;
}
else
*rate = 0.;

*rr_t = *rate;

/* No "return..;" value. */
}
I've compiled it with no errors

this is output you should get
Code:
Copied path_to_working_folder.	temp_delete.c to temp_delete\src
udf_names.c and user_nt.udf files in 3ddp are upto date.
(system "copy "fluent_path"temp_delete\win64\3ddp\makefile" ")
        1 file(s) copied.
(chdir "temp_delete")(chdir "win64\3ddp")# Generating ud_io1.h
temp_delete.c
# Generating udf_names.c because of makefile temp_delete.obj
udf_names.c
# Linking libudf.dll because of makefile user_nt.udf udf_names.obj temp_delete.obj
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library libudf.lib and object libudf.exp

Done.
AlexanderZ is offline   Reply With Quote

Old   June 19, 2019, 03:39
Default
  #5
New Member
 
Kirti Verma
Join Date: Jun 2019
Posts: 7
Rep Power: 7
kirti verma is on a distinguished road
Can you please answer a few doubts, it will be really helpful for me as i am a beginner, this is what is shows to me:

Copied Z:\Desktop\All Simulations\compilation_files\dp0\FLU\Fluent/New Text Document.c to libudf\src
udf_names.c and user_nt.udf files in 3ddp_host are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\ANSYSS~1\v193\fluent"\fluent 19.3.0\src\udf\makefile_nt.udf "libudf\win64\3ddp_host\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_host")udf_names.c and user_nt.udf files in 3ddp_node are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\ANSYSS~1\v193\fluent"\fluent 19.3.0\src\udf\makefile_nt.udf "libudf\win64\3ddp_node\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_node")



1. Did you open Fluent from VS Prompt or simply from workbench?
2. Did you tried it with some boundary conditions/ geometry or geometry doesn't have any affect of compilation?
3. Did you select Parallel or Serial processing?
4. Can you send a link where the method of compilation that you used is mentioned, I have tried many methods but none worked.

I will be really grateful to you and this platform for this. I have tried all the possible combinations of methods of compilation.
kirti verma is offline   Reply With Quote

Old   June 19, 2019, 04:06
Default
  #6
New Member
 
Kirti Verma
Join Date: Jun 2019
Posts: 7
Rep Power: 7
kirti verma is on a distinguished road
As far as I can conclude, there must be some problem in setting up environment variables. I haven' t done it because I don't have admin access. Will you please let me know the procedure?
kirti verma is offline   Reply With Quote

Old   June 20, 2019, 01:41
Default
  #7
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Quote:
1. Did you open Fluent from VS Prompt or simply from workbench?
2. Did you tried it with some boundary conditions/ geometry or geometry doesn't have any affect of compilation?
3. Did you select Parallel or Serial processing?
4. Can you send a link where the method of compilation that you used is mentioned, I have tried many methods but none worked.
you should run fluent from VS Prompt (or SDK prompt, depending on your software)

it doesn't matter what settings or geometry you have for compiling process. It doesn't matter single or parallel regime you are using (but you should know, if your compile in parallel regime -> you will get UDF for parallel only, same for serial)

as I told you, Fluent consider your source file is up to date. So Fluent doesnt compile it. You should make any change in source file, save it and compile (click BUILD)

if you are not sure about your software, you may use following link https://www.cfd-online.com/Wiki/Flue...ows_7_64bit.3F

best regards
AlexanderZ is offline   Reply With Quote

Old   June 27, 2019, 07:17
Default
  #8
New Member
 
Kirti Verma
Join Date: Jun 2019
Posts: 7
Rep Power: 7
kirti verma is on a distinguished road
Hey! I have tried these solutions, added environment variables from the "Advanced System Settings" too but it didn't work. I am working on the following system.

Fluent Version - ANSYS 2019 R1
Windows 10, 64 bit
Microsoft Visual C++ 2017

I have attached the screenshot of the error I am getting, basically the file "libudf.dll" is not being formed in the folder.

Copied Z:\Desktop\All Simulations\compilation_files\dp0\FFF\Fluent/New Text Document.c to libudf\src
udf_names.c and user_nt.udf files in 3ddp_host are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\ANSYSS~1\v193\fluent"\fluent 19.3.0\src\udf\makefile_nt.udf "libudf\win64\3ddp_host\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_host")'nmake' is not recognized as an internal or external command,
operable program or batch file.
udf_names.c and user_nt.udf files in 3ddp_node are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\ANSYSS~1\v193\fluent"\fluent 19.3.0\src\udf\makefile_nt.udf "libudf\win64\3ddp_node\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_node")'nmake' is not recognized as an internal or external command,
operable program or batch file.

Done.


This is after Build command,
and the screenshot is of after the Load command.

Please let me know if I have to reinstall Visual Studio and make it work with the Fluent or what steps to follow. I would be very grateful.
Thanks
Attached Images
File Type: jpg Untitled.jpg (99.7 KB, 14 views)
kirti verma is offline   Reply With Quote

Old   February 6, 2020, 13:42
Default
  #9
Member
 
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 6
melj is on a distinguished road
Hello Kirti Verma

I am facing the same issue. Could you please let me know the correction if you have figured it out?
melj is offline   Reply With Quote

Old   February 6, 2020, 15:40
Default Command prompt or udf.bat
  #10
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
nmake not recognized means the paths are not set properly. Either you have to ensure that udf.bat is able to execute properly without any error. This is location in Fluent's installation directory. Other solution is to start Fluent from the command prompt of VS or VC++ or MS SDK.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   February 7, 2020, 12:32
Default
  #11
Member
 
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 6
melj is on a distinguished road
Apologies! Kindly ignore this message. I have sent the correct message again.

Last edited by melj; February 7, 2020 at 12:45. Reason: repeated the question
melj is offline   Reply With Quote

Old   February 7, 2020, 12:39
Default
  #12
Member
 
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 6
melj is on a distinguished road
Thank you very much. I have got it corrected.

One question. I loaded a udf for drag model. I chose the respective drag model in the respective dialogue box. I saved the file. When I read the case and data file later, I can see in the console window that the udf is read. However, when I check the drag model dialogue box, it just shows user defined instead of the name of the new drag model.

Is this how it should be?
melj is offline   Reply With Quote

Old   February 9, 2020, 16:02
Default That's alright
  #13
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
If Fluent shows UDF instead of in-built drag models, then UDF is selected. If it is shows blank, it implies that Fluent expectes and UDF but the UDF library is not loaded.
melj likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Reply

Tags
compile a udf


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
UDF compiling error Weiqiang Liu FLUENT 2 November 21, 2018 10:36
UDF Compiling / Parallel mode MV78 Fluent UDF and Scheme Programming 6 May 29, 2018 06:02
ERROR in compiling UDF stefanos Fluent UDF and Scheme Programming 1 April 25, 2012 08:37
udf compiling problem akr FLUENT 3 August 22, 2007 08:14
On Compiling a UDF David Chabot FLUENT 5 May 20, 2005 10:13


All times are GMT -4. The time now is 17:03.