Skip to content

Commit 1d346b8

Browse files
committed
Describe the errors and the shared-node rule of 0.4.0
The pages still described behaviour of 0.3 that 0.4.0 changed: - A Jacobi solve, a Newton-Raphson solve and a front propagation step that do not converge throw NOT_CONVERGED; they no longer log an error and return the last iterate. - An unknown plot field, a field for a scalar model, an unknown plot type and a missing plot element throw INVALID_INPUT; an unknown field no longer falls back to the default one. - A 1D or 3D Gmsh mesh, or one that mixes element shapes or orders, throws UNSUPPORTED_MESH. - With boundaries keyed by name, the Dirichlet condition added last sets the value at a node shared by two boundaries, not the larger key. - FEAScriptWorker.getModelInfo() also returns the mesh. Signed-off-by: Nikos Chamakos <nikoscham@gmail.com>
1 parent 988cbed commit 1d346b8

6 files changed

Lines changed: 16 additions & 12 deletions

File tree

‎docs/api/gmsh-import.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ const { solutionVector, nodesCoordinates } = model.solve();
8080

8181
## Limitations
8282

83-
- Only 2D meshes are supported; a 1D or 3D mesh is reported as an error.
84-
- All elements must be of the same shape (quadrilaterals or triangles) and order (linear or quadratic).
83+
- Only 2D meshes are supported; a 1D or 3D mesh throws a `FEAScriptError` with the code `UNSUPPORTED_MESH`.
84+
- All elements must be of the same shape (quadrilaterals or triangles) and order (linear or quadratic); a mixed
85+
mesh throws `UNSUPPORTED_MESH`.
8586
- Only the ASCII variant of the version 4.1 format is read. Export with
8687
`gmsh model.geo -2 -format msh41 -o model.msh`, or with **File → Export** and the "Version 4 ASCII" format in
8788
the Gmsh interface.

‎docs/api/visualization.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ plotSolution(model, result, "contour", "velocityMagnitudeCanvas"); // Default fi
3333
plotSolution(model, result, "contour", "pressureCanvas", { field: "p" });
3434
```
3535

36-
An unknown field name is reported as an error and the default field is plotted. See the
36+
An unknown field name, a `field` for a scalar model, a plot type the function cannot draw, or a plot element
37+
that does not exist throws a `FEAScriptError` with the code `INVALID_INPUT`. See the
3738
[creeping flow](../models/creeping-flow.md#results) and
3839
[Euler–Bernoulli beam](../models/euler-bernoulli-beam.md#results) pages for the fields.
3940

‎docs/api/web-worker.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ model.terminate();
5555
| `addBoundaryCondition(boundaryKey, condition)` | `Promise<boolean>` | Adds a boundary condition |
5656
| `setSolverMethod(solverMethod)` | `Promise<boolean>` | Deprecated: use the `solver` option of `setModelConfig` |
5757
| `solve(options)` | `Promise<object>` | Solves the model in the worker (`maxIterations`, `tolerance`) |
58-
| `getModelInfo()` | `Promise<object>` | `{ solverConfig, geometry, meshConfig, meshDimension, boundaryConditions, solverMethod }` |
58+
| `getModelInfo()` | `Promise<object>` | `{ solverConfig, geometry, meshConfig, mesh, meshDimension, boundaryConditions, solverMethod }` |
5959
| `ping()` | `Promise<boolean>` | Resolves to `true` when the worker is ready |
6060
| `terminate()` | – | Stops the worker |
6161

‎docs/fundamentals/boundary-conditions.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ Following the [Galerkin formulation](./finite-element-method.md#boundary-conditi
8181
When two boundaries share a node, for example at a corner of a rectangle:
8282

8383
- a Dirichlet condition on either boundary takes precedence over a Robin or natural condition on the other;
84-
- if both boundaries have Dirichlet conditions with different values, the boundary with the larger key sets the
85-
value at the shared node (the boundaries are processed in increasing key order);
84+
- if both boundaries have Dirichlet conditions with different values, the condition added last sets the value
85+
at the shared node (the conditions are applied in the order of the `addBoundaryCondition` calls);
8686
- in the [creeping flow](../models/creeping-flow.md) model, a zero velocity (no slip) takes precedence over a
87-
nonzero velocity, whatever the keys. In the lid-driven cavity, both top corners therefore take the velocity
87+
nonzero velocity, whatever the order. In the lid-driven cavity, both top corners therefore take the velocity
8888
of the side walls, zero, so that the moving lid does not push fluid through the side walls at the corners.
8989

9090
## Deprecated forms

‎docs/fundamentals/solvers.mdx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ The size of the change between two iterations is not used: the Jacobi method can
9393
become small while the iterate is still far from the solution.
9494

9595
The Jacobi method converges only for suitable matrices, for example diagonally dominant ones. Linear elements
96-
usually give such matrices; quadratic elements usually do not. If the method does not converge, FEAScript logs
97-
an error and returns the last iterate.
96+
usually give such matrices; quadratic elements usually do not. If the method does not converge within
97+
`maxIterations`, the solve throws a `FEAScriptError` with the code `NOT_CONVERGED`.
9898

9999
| Option | Default | Description |
100100
| --------------- | ------- | ----------------------------------------------- |
@@ -142,7 +142,9 @@ the `1e-8` of `"jacobi"`, and a much smaller tolerance may never be reached.
142142
Nonlinear models are solved with the Newton–Raphson method (see
143143
[Finite element method](./finite-element-method.md#linear-and-nonlinear-systems)). It starts from
144144
$\bar{u} = 0$ and stops when $\lVert \Delta \bar{u} \rVert_2$ is smaller than or equal to the tolerance. If the
145-
norm of an increment exceeds $10^2$, the iterations are stopped and an error is logged.
145+
norm of an increment exceeds $10^2$, the iterations are stopped with a warning. A Newton–Raphson solve that
146+
stops this way, or that reaches `maxIterations` without converging, throws a `FEAScriptError` with the code
147+
`NOT_CONVERGED`.
146148

147149
| Option | Default | Description |
148150
| --------------- | ------- | --------------------------------------------- |

‎docs/models/front-propagation.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ $$
6969
first step starts from $u = 0$).
7070
- At $\lambda = 1$, the remaining viscous term is $\max(10^{-2}, 10^{-1} h_e)$.
7171

72-
If a step does not converge, FEAScript stops at that step and logs an error: the returned solution is not
73-
valid, and a finer mesh may be required. The `maxIterations` and `tolerance` options (see
72+
If a step does not converge, FEAScript stops at that step and throws a `FEAScriptError` with the code
73+
`NOT_CONVERGED`, instead of going on from a wrong solution; a finer mesh may be required. The `maxIterations` and `tolerance` options (see
7474
[Solvers](../fundamentals/solvers.mdx#newtonraphson-method)) apply to the Newton–Raphson iterations of each step.
7575

7676
## Usage

0 commit comments

Comments
 (0)