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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 7, 2011, 15:43
Exclamation Error in compiling UDF
  #1
akm
New Member
 
Join Date: Jan 2010
Location: Netherlands
Posts: 28
Rep Power: 16
akm is on a distinguished road
Hello.

Im using some functions in my udf that can only be compiled and not interpreted. But i cannot compile my udf..
Im working on Win7 (32bit), Fluent 6.3.26. I have already installed Microsoft Visual Studio on my machine.
I have the source file (.c file) in the same directory as the the case and data files.

First, in the 'Compiled UDFs' panel, do i need to add 'udf.h' under 'Header files' tab ??

On hitting the 'Build' button, i am getting the following message on the console window:


Deleted old libudf\ntx86\2d\libudf.dll
The system cannot find the file specified.
(system "copy C:\Fluent.Inc\fluent6.3.26\src\makefile_nt.udf libudf\ntx86\2d\makefile")
1 file(s) copied.
(chdir "libudf")()
(chdir "ntx86\2d")()

Done.


Can anyone pls help me and tell me what i need to do to compile a UDF..
Thanks.
akm is offline   Reply With Quote

Old   March 7, 2011, 16:12
Default
  #2
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
Hi,
you didn't link Visual C++ with FLUENT.
headers can include automatically and you shouldn't care about.
Amir is offline   Reply With Quote

Old   March 7, 2011, 16:13
Default
  #3
akm
New Member
 
Join Date: Jan 2010
Location: Netherlands
Posts: 28
Rep Power: 16
akm is on a distinguished road
Quote:
Originally Posted by Amir View Post
Hi,
you didn't link Visual C++ with FLUENT.
headers can include automatically and you shouldn't care about.
and how can i do link them ??
akm is offline   Reply With Quote

Old   March 7, 2011, 17:10
Default
  #4
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
Quote:
Originally Posted by akm View Post
and how can i do link them ??
first you should include FLUENT to your environment by using this:

"~\Program Files\Fluent\ntbin\ntx86\setenv.exe"

for some versions of VC, libraries of VC were included to your environment while installing for these cases the above step is enough.
if your problem didn't resolved, you should also include VC libraries to your path and for this purpose you have 2 choices:
1) launch FLUENT from VC command prompt
2) refer to my blog in this forum to manually include VC libraries.

Regards,

Amir
Amir is offline   Reply With Quote

Old   March 8, 2011, 04:34
Default
  #5
akm
New Member
 
Join Date: Jan 2010
Location: Netherlands
Posts: 28
Rep Power: 16
akm is on a distinguished road
thanks Amir..
that problem was dealt with.

now there is a new one :
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

i see a lot of people hav this problem, but none of the solutions worked for me..
kindly help me out again.
thanks
akm is offline   Reply With Quote

Old   March 8, 2011, 11:06
Default
  #6
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
if you explain more, where and when you face that, I may help you.
Amir is offline   Reply With Quote

Old   April 19, 2011, 05:56
Exclamation Define_adjust
  #7
akm
New Member
 
Join Date: Jan 2010
Location: Netherlands
Posts: 28
Rep Power: 16
akm is on a distinguished road
hey amir.. thanks for resolving my previous problem. i am afraid m facing a new one.

as i understand define_adjust can be "used to adjust or modify FLUENT
variables that are not passed as arguments".
in my 3phase eularian simulation i am required to modify the volume fractions of the two secondary phases, keeping the volume of primary phase same.

i have done the calculation as required in define_execute_at_end, to compute how much do the volume fractions change and hence correctly computed the value of global variables 'vf1' and 'vfpr'.

my adjust macro:

Code:
DEFINE_ADJUST(mt,d)
{
  Thread *t;
  cell_t c;
  real volf1, volf2, volf3;
  real xc[ND_ND];

  if (counter == 1)
  {
    thread_loop_c(t,d)
    {
      begin_c_loop(c,t)
      {
         Thread *fr = THREAD_SUB_THREAD(t,1);  //1st secondary phase
	 Thread *to = THREAD_SUB_THREAD(t,2); //2nd secondary phase
	  volf1 = C_VOF(c,fr);
	  volf2 = C_VOF(c,to);
	  volf3 = 1-(volf1+volf2);  //primary phase volume frac.

	  if(volf1 > 0.01)
	  {
	    C_VOF(c,fr) = volf1 * vf1/vfpr;  //modifying the vol.fr. of 1st sec. phase
	    volf1 = C_VOF(c,fr);
	    C_VOF(c,to) = 1-(volf1+volf3);  //adjusting the vol. fr. of 2nd sec. phase, keeping the sum of volume fractions unity.
	    volf1 = C_VOF(c,fr);
	    volf2 = C_VOF(c,to);

	    C_CENTROID(xc,c,t);
	    Message("%g\t%g",xc[0],xc[1]);
	    Message("\t%g   %g\n",volf1,volf2);
	  }
      }
      end_c_loop(c,t)
    }	
  }

}

When the variables are printed from the udf, they do seem to get modified as required by the problem. But returning to solver at the end of iteration/timestep, the variables show no change when viewed as contours or even when accessed by define_execute_at_end macro.

What might be the problem in modifying the variables ??
Is there anything wrong in what i am trying to do? Please suggest an alternative.

Can you please help me..

Regards.
akm is offline   Reply With Quote

Old   April 19, 2011, 09:20
Default
  #8
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
Hi,
if you want to do your desired modifications once, at the end of your calculation, I propose you to use another macro, DEFINE_ON_DEMAND, that may help you to implement your modifications when ever you want by executing this macro.
Amir is offline   Reply With Quote

Reply

Tags
fluent compile udf error


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
About UDF compiling issues: 'nmake' Haoyin Shan Fluent UDF and Scheme Programming 15 November 4, 2019 19:05
compiling udf at window Nt(64BIT) noa FLUENT 3 July 30, 2014 00:01
UDF compiling problem in Flient 6.3 jeevan kumar FLUENT 2 February 25, 2009 01:43
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 02:32.