Parameters, variables and functions
Parameters
Global Definitions › Parameters 1 () is a table of named values that you can use everywhere: in geometry dimensions, materials, physics settings, mesh sizes, study settings and result expressions.
| Name | Expression | Value | Description |
|---|---|---|---|
|
|
10 cm |
Length |
|
|
0.002 |
Area (SI: m²) |
|
|
20 °C |
Reference temperature |
|
|
1500 rpm |
Rotation speed |
-
A parameter can use earlier and later parameters, built-in constants and functions. The order doesn’t matter, but circular definitions are an error.
-
Values are stored in SI. The Value column shows the value in the unit the expression ends with, or in SI when there is none.
-
A parameter that can’t be evaluated shows
(error)in red. -
The buttons under the table move, delete and clear rows, and Load or Save the table as a text file.
-
A Parametric Sweep changes parameters from run to run (Studies › Parametric Sweep). Geometry, mesh and physics that use them follow.
The full syntax (operators, functions, constants and units) is in Expressions and units.
Units are checked
Elmer Studio works out the unit of every expression from the units in brackets, the parameters, the variables, the dependent variables (T is in K, V in V) and the coordinates. It warns, as COMSOL does, when:
-
two terms of a sum or a comparison have different units:
1[m]+1[s]; -
a function such as
sinorexpgets a quantity with a unit:sin(2[m]); -
a setting gets a quantity of another unit than its own, for example
2930[K]for a density in kg/m³.
The value is still used, as its SI number (as in COMSOL). The field shows the message in orange under it, with the unit it deduced and the one it expected, and the node gets an orange triangle in the Model Builder. A plain number has no unit and is taken in the setting’s unit. A unit belongs to the number or name in front of it: x/2[mm] is x divided by 2 mm.
Variables
Component 1 › Definitions › Variables () defines named expressions that may depend on space, time and the solution. For example:
| Name | Expression | Description |
|---|---|---|
|
|
Distance from the z axis |
|
|
Temperature-dependent conductivity |
|
|
Deformed diameter (with integration couplings) |
Use a variable in material properties and physics settings, where it is expanded into the expression Elmer evaluates, and in any result expression.
Functions
Add functions under Global Definitions with or .
- Analytic
-
A Function name, its Arguments (comma-separated) and an Expression, for example
ramp(t) = min(t/10[s], 1). Call it asramp(t)in any setting. - Interpolation
-
A table of points (t, f(t)) under a Function name. Use it for measured data, for example a polarization curve
i_meas(eta)or a property tablek_tab(T). Elmer interpolates linearly between the points. Interpolation functions work inside any expression in physics settings, for example2*k_tab(T).
Coupling operators
Coupling operators ( or right-click Definitions) turn a field into a number, over a selection:
| Operator | Default name | Returns |
|---|---|---|
Average |
|
The average of an expression over the selected domains, boundaries or points. |
Integration |
|
The integral. On a single point, the value at that point. |
Maximum |
|
The maximum. |
Minimum |
|
The minimum. |
Select the Geometric entity level (domain, boundary or point) and the entities, then use the operator in result expressions: aveop1(T) in a Global Evaluation or a Global plot over a parametric sweep, or intop1(u) - intop2(u) in a Definitions variable. The Busbar and Postprocessing tutorials use them.
| In Elmer Studio, coupling operators are evaluated on the solution, in results. They are not available inside physics settings, where COMSOL would make them nonlocal couplings of the equations. |