Boundary conditions
Boundary conditions are added with model.addBoundaryCondition(boundaryKey, condition):
model.addBoundaryCondition("0", ["constantTemperature", 200]);
boundaryKeyis a string that identifies the boundary:"0","1", ... (see Mesh for the keys of structured and Gmsh meshes).conditionis an array whose first entry is the condition type, followed by its parameters.
Each boundary holds one condition: calling addBoundaryCondition again with the same key replaces the previous
condition. A boundary without a condition gets the natural (zero Neumann) condition of the model.
The Euler–Bernoulli beam model is the exception: its keys are node numbers and each node takes an array of conditions. See the model page for details.
Condition types by model
| Model | Condition | Kind | Meaning |
|---|---|---|---|
| Heat conduction | ["constantTemperature", T] | Dirichlet | on the boundary |
["convection", h, Tinf] | Robin | ||
["symmetry"] | Neumann (natural) | (insulated or symmetry) | |
| General form PDE | ["constantValue", value] | Dirichlet | on the boundary |
["zeroGradient"] | Neumann (natural) | ||
| Front propagation | ["constantValue", value] | Dirichlet | Arrival time of the front, (0: initial front) |
["zeroGradient"] | Neumann (natural) | ||
| Creeping flow | ["constantVelocity", ux, uy] | Dirichlet | , on the boundary |
["stressFree"] | Neumann (natural) | ||
| Euler–Bernoulli beam | ["fixed"] | Essential | , |
["pinned"], ["deflection", w] | Essential | (default ) | |
["rotationFixed"], ["rotation", θ] | Essential | (default ) | |
["force", F] | Natural | Point force at the node | |
["moment", M] | Natural | Point moment at the node | |
["spring", k, wRef] | Robin | Transverse spring of stiffness (default ) |
Here is the outward unit normal and the derivative along it.
Natural conditions such as "symmetry", "zeroGradient" and "stressFree" add nothing to the discrete
system: they name the condition that a boundary without a Dirichlet or Robin condition already satisfies. They
are still useful to document the setup.
Checks
When solve() runs, FEAScript checks every condition against the condition types of the selected model (the
table above). A type that the model does not recognize, for example a misspelled "convektion", is reported as
an [ERROR] in the console with the list of supported types; that boundary then gets the natural condition of
the model.
A condition without parameters may also be given as a plain string, for example "zeroGradient" instead of
["zeroGradient"]. FEAScript wraps it in an array and logs a warning; use the array form.
How the conditions are imposed
Following the Galerkin formulation:
- Dirichlet conditions replace the residual of every node on the boundary: the row of the Jacobian matrix is cleared, its diagonal entry is set to one, and the residual entry is set to the prescribed value. With the frontal solver, the nodes are flagged as constrained before the elimination.
- Robin conditions (
"convection") add the boundary integral of the condition to the Jacobian matrix and the residual vector. In 2D, this integral is computed with Gauss quadrature along each element side on the boundary, so curved sides of quadratic elements are taken into account. - Natural conditions need no assembly.
When two boundaries share a node, for example at a corner of a rectangle:
- a Dirichlet condition on either boundary takes precedence over a Robin or natural condition on the other;
- if both boundaries have Dirichlet conditions with different values, the boundary with the larger key sets the
value at the shared node (the boundaries are processed in increasing key order). In the lid-driven cavity of
the creeping flow model, for example, the top-right corner takes the velocity of
the right wall (
"3") and the top-left corner the velocity of the lid ("2").
Deprecated names
| Deprecated type | Replacement |
|---|---|
"constantTemp" | "constantTemperature" |
Deprecated names still work and are converted automatically, with a warning in the console. They will be removed in a future version.