***function_declaration
#
Description#
This command allows input of function declarations ahead of other three stars commands. Complex pre-defined functions can thus be learned, and re-used later in the input file.
Syntax#
The syntax is the following:
***function_declaration
\(~\,~\,~\,\) func_name := definition ;
Note that “:=” for assignment and semi-colon at the end are required. The function’s arguments are discovered as they appear in the declaration, and used in that order (see examples below, and page for a general description of functions).
1The-learn
command line switch makes it possible to share
function definitions between different computations, see .Note
The command ***function_declaration
is also allowed in
****mesher
and ****post-processing
, and such definitions are not
shared between ****
-instances 1The -learn
command line switch makes it possible to share
function definitions between different computations, see .. A behavior has access to
functions learned in the ****calcul
, but for convenience and
readability it can also host its own definitions in a **functions
section in the ***behavior
material file.
Example#
The following example is from
Thermal_test/INP/fluconv_analytical.inp
:
****calcul thermal_steady_state
***function_declarations
T := x^2 * exp(y) * cos(z) ;
LT := 2 * exp(y) * cos(z) ;
Q1 := 2 * x * exp(y) * cos(z) ;
Q2 := T(x,y,z) ;
Q3 := x^2 * exp(y) * sin(z) ;
Text:= x^2 * exp(y) * (cos(z) + sin(z)) ;
% ...
***bc
**convection_heat_flux z0
h 1.
Te function Text(x,y,z) ; time
**surface_heat_flux
x0 function -Q1(x,y,z) ; time
x1 function Q1(x,y,z) ; time
% ...
**volumetric_heat
ALL_ELEMENT function -LT(y,z) ; time