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

Compiling udf:header file content?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 8, 2016, 00:35
Default Compiling udf:header file content?
  #1
Member
 
Join Date: Oct 2015
Posts: 34
Rep Power: 10
SAM S is on a distinguished road
I want to compile the udf for mass transfer source. I am not sure what is meant by source and header files separately.What should be the content of these two files, should I split the code into this.

Also I have another query, if source term not specified through udf then how will fluent compute the transfer process
SAM S is offline   Reply With Quote

Old   February 8, 2016, 22:48
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
The UDFs for Fluent are written in ANSI C and include header files at the top of the source files using the compiler directive (#include), for example:

Code:
#include "udf.h" // the header file required for UDFs

DEFINE_SOURCE(a_custom_source,c,t,dS,eqn)
{
    return 0.; // this example returns a zero source term
}
The header file (udf.h) is for Fluent and contains a list of definitions for the DEFINE macros amongst other important code.

The UDF source term is for additional source terms, more information can be found in the relevant section of the UDF manual. Fluent recommends that you should define a momentum source if you've defined a mass source for a cell zone.
`e` is offline   Reply With Quote

Old   February 8, 2016, 23:54
Default
  #3
Member
 
Join Date: Oct 2015
Posts: 34
Rep Power: 10
SAM S is on a distinguished road
Thank you for the help. So I should save only the header i.e. #include "udf.h" in a .c file and load it for header files during compilation.
SAM S is offline   Reply With Quote

Old   February 9, 2016, 00:01
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
No, simply type the following line at the top of your UDF file (as shown in my example above):

Code:
#include "udf.h"
and compile then load your UDF file within Fluent: Define > User-Defined > Functions > Compiled...
`e` 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
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 03:30
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 17:18
[swak4Foam] Swak4FOAM 0.2.3 / OF2.2.x installation error FerdiFuchs OpenFOAM Community Contributions 27 April 16, 2014 15:14
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 03:23
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08


All times are GMT -4. The time now is 16:29.