35. VFUNCTION Namelist
Similar to the FUNCTION namelist, the VFUNCTION namelist is used to define a vector-valued function that can be used in some situations where vector-valued data is needed, such as the specification of the boundary velocity in a flow boundary condition.
These are general vector-valued functions of one or more variables, \(\mathbf{y} = (y_1,\ldots,y_m) = f(x_1,\ldots,x_n)\). The dimension of the value, the number of variables, and the unknowns they represent (i.e., time, position, temperature, etc.) all depend on the context in which the function is used, and that is described in the documentation of those namelists where these functions can be used.
The following function types are available.
Tabular Function. This is a continuous, single-variable function \(y=f(s)\) linearly interpolated from a sequence of data points \((s_i,\mathbf{y}_i), i= 1,\ldots,p\), with \(s_i \lt s_{i+1}\). The variable \(x_d\) that is identified with \(s\) is specified by tabular_dim.
Laser Irradiance Function. This special-use type defines an alias to a laser irradiance function defined by a TOOLHEAD namelist, which can be used by certain thermal boundary condition and source models.
Shared Library Function This is a function from a shared object library having a simple Fortran 77 or C compatible interface. Written in Fortran 77 the function interface must look like
subroutine myfun (v, p, r) bind(c)
double precision v(*), p(*), r(*)
where myfunc can, of course, be any name. The equivalent C interface is
void myfun (double v[], double p[], double r[]);
The vector of variables \(v= (v_1,...,v_m)\) is passed in the argument \(v\) and a vector of parameter values specified by parameters is passed in the argument \(p\). The vector of variables \(r=(r_1,...,r_d)\) of dimension dim is returned. The path to the library is given by library_path and the name of the function (myfun, e.g.) is given by library_symbol. Note that the bind(c) attribute on the function declaration inhibits the Fortran compiler from mangling the function name (by appending an underscore, for example) as it normally would.
Note
- Required/Optional:
Optional
- Single/Multiple Instances:
Multiple
35.1. Namelist Variables
name
A unique name by which this vector function can be referenced by other namelists.
- Type:
case-sensitive string (31 characters max)
- Default:
none
type
The type of function defined by the namelist.
- Type:
case-sensitive string
- Default:
none
- Valid values:
“tabular”, “toolhead-laser”, “library”
tabular_data
The table of p data points \((s_i,\mathbf{y}_i)\) defining a tabular function \(\mathbf{y}=f(s)\). Use tabular_dim to set the independent variable component identified with \(s\).
- Type:
real array
- Default:
none
Note
This 1+m by p array is most easily specified point by point in this manner:
tabular_data(:,1) =
\(s_1, y_{11}, \ldots, y_{m1}\)tabular_data(:,2) =
\(s_2, y_{12}, \ldots, y_{m2}\)…tabular_data(:,p) =
\(s_p, y_{1p}, \ldots, y_{mp}\)
tabular_dim
The dimension in the \(n\)-vector of independent variables that serves as the independent variable for the single-variable tabular function.
- Type:
integer
- Default:
1
toolhead
The name of the TOOLHEAD namelist that defines the laser irradiance function that will be identified with this function. This is a 3-vector valued function that depends on the variables \((t, x, y, z)\).
- Type:
case sensitive string
- Default:
none
library_path
The path to the shared object library that contains the function.
- Type:
A string of up to 128 characters.
- Default:
none
library_symbol
The symbol name of the function within the shared object file.
- Type:
A string of up to 128 characters.
- Default:
none
- Notes:
Unless the Fortran function is declared with the BIND(C) attribute, which is the recommended practice, a Fortran compiler will almost always mangle the name of the function so that the symbol name is not quite the same as the name in the source code. Use the UNIX/Linux command-line utility nm to list the symbol names in the library file to determine the correct name to use here.
parameters
Optional parameter values to pass to the shared library function.
- Type:
real vector of up to 16 values
- Default:
None
dim
Number of components of the return value of the shared library function.
- Type:
integer
- Default:
None