|November 21, 2009, 12:03||
global variable in udf
Join Date: Aug 2009
Posts: 35Rep Power: 7
i am writing a DEFINE_SOURCE, how can i define a global variable in udf whose value doesn't reset by the repetition of the udf for each cell in the zone.
|November 21, 2009, 15:16||
Join Date: Nov 2009
Posts: 122Rep Power: 7
when you need a global variable you have to define that variable OUTSIDE of any single function, so the variable is visible to all functions within a UDF source file .I past to you a text that you can find in UDF guide.
Global variables are variables that are defined outside of any single function and are
visible to all function(s) within a UDF source file. Global variables can also be used
by other functions outside of the source file unless they are declared as static (see
Section A.5.3: Static Variables). Global variables are typically declared at the beginning
of a file, after preprocessor directives as in
real volume; /* real variable named volume is declared globally */
/* code that computes volume of some zone */
volume = ....
Otherwise, If you have a global variable that is declared in one source code file, but a function in another source file needs to use it, then it must be defined in the other source file as an EXTERNAL variable.
|Thread||Thread Starter||Forum||Replies||Last Post|
|How to write k and epsilon before the abnormal end||xiuying||OpenFOAM Running, Solving & CFD||8||August 27, 2013 15:33|
|Convergence moving mesh||lr103476||OpenFOAM Running, Solving & CFD||30||November 19, 2007 15:09|
|IcoFoam parallel woes||msrinath80||OpenFOAM Running, Solving & CFD||9||July 22, 2007 02:58|
|Could anybody help me see this error and give help||liugx212||OpenFOAM Running, Solving & CFD||3||January 4, 2006 19:07|
|Replace periodic by inlet-outlet pair||lego||CFX||3||November 5, 2002 21:09|