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

Interepreted Vs. Compiled UDFs

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 4 Post By suvash

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 31, 2006, 16:34
Default Interepreted Vs. Compiled UDFs
  #1
Antonis
Guest
 
Posts: n/a
Hi all.

I have created a UDF using a DEFINE_ADJUST routine, and I don't know if it's supposed to be an interpreted or a compiled one.

Is there a general rule for how to tell when a UDF is compiled or interpreted?

Thanks in advance for your answers!
  Reply With Quote

Old   August 31, 2006, 18:26
Default Re: Interepreted Vs. Compiled UDFs
  #2
Reginaldo Cotto
Guest
 
Posts: n/a
Interpreting a UDF source file (example.c)

The UDF source file (example.c) must be in the same directory that contains your case (e.g., example.msh). After start FLUENT and read your case file (example.msh): Define â€" User-Defined â€" Functions â€" Interpreted In the Interpreted UDFs panel select the UDF source file (example.c) The next step is to set the Use Contributed CPP and click Interpret.

Fluent diplay a message of the interpreted UDF source file.

Close the Interpreted UDFs panel when the interpreter has finished

The proceder to Interpreted UDF is the same in the Windows and LINUX, but to compile in the Windows system it is necessary the C+ sotfware and service pack 2.

In FLUENT user guide chapter 8.2 you can see the steps TO compile UDF source file. In my opinion Interpreted UDF it is easier than Compiled UDF, however the Compiled UDF runs faster.

  Reply With Quote

Old   August 31, 2006, 20:46
Default Re: Interepreted Vs. Compiled UDFs
  #3
Antonis
Guest
 
Posts: n/a
Thanks for your reply!

I'm a bit confused though, because in the udf manual i read an example for DEFINE_ADJUST that can be used as interpreted OR compiled, and another example again for DEFINE_ADJUST that can be ONLY used as compiled?

I was wondering if there is a rule to know this difference
  Reply With Quote

Old   September 1, 2006, 06:19
Default Re: Interepreted Vs. Compiled UDFs
  #4
Mark Russell
Guest
 
Posts: n/a
for more advice take a look at

http://www.fluentusers.com/fluent/do...etedVSCompiled

I suspect it is not the 'name' or 'type' of the macro that creates the intepret or compile issue but rather the code that is contained 'within' the macro / UDF.

Compare the UDF's you are referring to and you will probably find the line(s) that the interprter cannot handle hence the need to compile.

Hope this helps

  Reply With Quote

Old   September 1, 2006, 10:28
Default Re: Interepreted Vs. Compiled UDFs
  #5
Antonis
Guest
 
Posts: n/a
Thanks for your reply.

Unfortunately I don't have acces to the fluent support website as I am a student...

Is it possible to give an example?
  Reply With Quote

Old   September 1, 2006, 13:35
Default Re: Interepreted Vs. Compiled UDFs
  #6
Mark Russell
Guest
 
Posts: n/a
Which examples were you initially referring to that prompted this question?

  Reply With Quote

Old   September 1, 2006, 14:11
Default Re: Interepreted Vs. Compiled UDFs
  #7
Antonis
Guest
 
Posts: n/a
I was going through the UDF manual, and for the DEFINE_ADJUST there are two examples. For the first one it's mentioned that is used as an interpreted, and the second one only as compiled (the second one uses UDS, maybe that's why)

I want to define a von Neumann condition with a DEFINE_ADJUST function.
  Reply With Quote

Old   September 6, 2006, 05:18
Default Re: Interepreted Vs. Compiled UDFs
  #8
suvash
Guest
 
Posts: n/a
Differences Between Interpreted and Compiled UDFs

The major difference between interpreted and compiled UDFs is that interpreted UDFs cannot access FLUENT solver data using direct structure references; they can only indirectly access data through the use of Fluent-supplied macros. This can be significant if, for example, you want to introduce new data structures in your UDF.

A summary of the differences between interpreted and compiled UDFs is presented below. See Chapters 7 and 8 for details on interpreting and compiling UDFs, respectively, in FLUENT.

* Interpreted UDFs

o are portable to other platforms.

o can all be run as compiled UDFs.

o do not require a C compiler.

o are slower than compiled UDFs.

o are restricted in the use of the C programming language.

o cannot be linked to compiled system or user libraries.

o can access data stored in a FLUENT structure only using a predefined macro (see Chapters 5 and 6).

* Compiled UDFs

o execute faster than interpreted UDFs.

o are not restricted in the use of the C programming language.

o can call functions written in other languages (specifics are system- and compiler-dependent).

o cannot necessarily be run as interpreted UDFs if they contain certain elements of the C language that the interpreter cannot handle.

In summary, when deciding which type of UDF to use for your FLUENT model

* use interpreted UDFs for small, straightforward functions.

* use compiled UDFs for complex functions that

o have a significant CPU requirement (e.g., a property UDF that is called on a per-cell basis every iteration).

o require access to a shared library.

  Reply With Quote

Old   September 6, 2006, 06:50
Default Re: Interepreted Vs. Compiled UDFs
  #9
Antonis
Guest
 
Posts: n/a
Thanks!

That cleared things a lot!

Antonis
  Reply With Quote

Old   October 18, 2012, 01:08
Default von neumann
  #10
New Member
 
nadesan
Join Date: Oct 2012
Posts: 11
Rep Power: 14
nadesan is on a distinguished road
Hi antonis, could you please let me know that the von neumann boundary condition i created is correct. The boundary condition is created for a 2D serial fluent code on the top wall.

#include "udf.h"
DEFINE_ADJUST(von_neumann,d)
{
face_t f;
cell_t c;
Thread *t;
begin_f_loop(f,t)
{
c0=F_C0(f,t);
t0=THREAD_T0(t);
F_U(f,t)=C_U(c0,t0);
}
end_f_loop(f,t)
}


When i am trying to hook the udf to the wall, it is asking for the shear stress, how should i define the boundary in order to hook the udf. Your help is much appreciated.

Thank you
Rgds
nadesan
nadesan is offline   Reply With Quote

Old   March 22, 2018, 12:15
Default
  #11
New Member
 
David
Join Date: Nov 2017
Posts: 14
Rep Power: 9
uconcorde is on a distinguished road
Quote:
Originally Posted by nadesan View Post
Hi antonis, could you please let me know that the von neumann boundary condition i created is correct. The boundary condition is created for a 2D serial fluent code on the top wall.

#include "udf.h"
DEFINE_ADJUST(von_neumann,d)
{
face_t f;
cell_t c;
Thread *t;
begin_f_loop(f,t)
{
c0=F_C0(f,t);
t0=THREAD_T0(t);
F_U(f,t)=C_U(c0,t0);
}
end_f_loop(f,t)
}


When i am trying to hook the udf to the wall, it is asking for the shear stress, how should i define the boundary in order to hook the udf. Your help is much appreciated.

Thank you
Rgds
nadesan
Hi Nadesan,

I am tryting to define a neumann boundary for y-velocity at a top symmetry boundary with UDF. I am wondering whether you have solved your problem. Any insights would be appreciated.

Thanks
Dv
uconcorde is offline   Reply With Quote

Reply


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
Compiled UDFs - questions Antonis FLUENT 6 December 26, 2012 07:12
Using compiled UDF:s in different Fluent versions S H FLUENT 1 September 12, 2007 04:40
accessing udf_library for compiled udf's Asghari FLUENT 0 August 9, 2006 05:41
compiled UDFs Jianli FLUENT 5 December 14, 2004 04:20
Compiled UDFs Devin FLUENT 4 October 28, 2003 21:47


All times are GMT -4. The time now is 23:46.