Skip to content

Commit 3a9c44d

Browse files
committed
Document the creeping flow viscosity
Replace the "μ is fixed to 1" notes with the viscosity coefficient (number or function of position), in the creeping flow page, the FEAScriptModel options table and llms.txt.
1 parent f91441b commit 3a9c44d

3 files changed

Lines changed: 35 additions & 15 deletions

File tree

‎docs/api/feascript-model.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ Selects the physical model and sets its options.
4444
| `"creepingFlowScript"` | [Creeping flow](../models/creeping-flow.md) | 2D |
4545
| `"eulerBernoulliBeamScript"` | [Euler–Bernoulli beam](../models/euler-bernoulli-beam.md) | 1D |
4646

47-
| Option | Type | Used by | Description |
48-
| ---------------------- | --------- | ------------------------------------------------------- | ------------------------------------------------------ |
49-
| `coefficientFunctions` | `object` | Heat conduction, general form PDE, Euler–Bernoulli beam | Coefficients of the equation; see each model page |
50-
| `nonlinear` | `boolean` | General form PDE | Solve with the Newton–Raphson method (default `false`) |
51-
| `maxIterations` | `number` | All | Maximum iterations of the iterative method in use |
52-
| `tolerance` | `number` | All | Convergence tolerance of the iterative method in use |
47+
| Option | Type | Used by | Description |
48+
| ---------------------- | --------- | ---------------------------------------------------------------------- | ------------------------------------------------------ |
49+
| `coefficientFunctions` | `object` | Heat conduction, general form PDE, creeping flow, Euler–Bernoulli beam | Coefficients of the equation; see each model page |
50+
| `nonlinear` | `boolean` | General form PDE | Solve with the Newton–Raphson method (default `false`) |
51+
| `maxIterations` | `number` | All | Maximum iterations of the iterative method in use |
52+
| `tolerance` | `number` | All | Convergence tolerance of the iterative method in use |
5353

5454
`maxIterations` and `tolerance` apply to the Jacobi solvers in linear models and to the Newton–Raphson method in
5555
nonlinear models; see [Solvers](../fundamentals/solvers.md) for their defaults.

‎docs/models/creeping-flow.md‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ where $\bar{u} = (u, v)$ is the velocity, $p$ the pressure and $\mu$ the dynamic
2121
forces are neglected, which is valid when the Reynolds number is much smaller than one.
2222

2323
:::note
24-
The viscosity is fixed to $\mu = 1$ and cannot be changed yet. For a Newtonian fluid with a different viscosity
25-
and velocity boundary conditions only, the velocity field is the same and the pressure scales linearly with
26-
$\mu$.
24+
With velocity boundary conditions only, a constant viscosity does not change the velocity field: the pressure
25+
scales linearly with $\mu$.
2726
:::
2827

2928
## Taylor–Hood elements
@@ -74,7 +73,11 @@ import { FEAScriptModel } from "feascript";
7473

7574
// 1. Create the model and select the physics
7675
const model = new FEAScriptModel();
77-
model.setModelConfig("creepingFlowScript");
76+
model.setModelConfig("creepingFlowScript", {
77+
coefficientFunctions: {
78+
viscosity: 1, // μ
79+
},
80+
});
7881

7982
// 2. Define the mesh
8083
model.setMeshConfig({
@@ -97,7 +100,24 @@ model.setSolverMethod("lusolve");
97100
const { solutionVector, nodesCoordinates, fields } = model.solve();
98101
```
99102

100-
The model takes no coefficient functions.
103+
### Coefficient functions
104+
105+
| Property | Symbol | Default | Type |
106+
| ----------- | ------ | ------- | -------------------------------- |
107+
| `viscosity` | $\mu$ | `1` | `number` or function of position |
108+
109+
The dynamic viscosity can be a positive constant or a function of the physical coordinates `(x, y) => ...`,
110+
evaluated at every integration point, so regions of different viscosity are supported. `coefficientFunctions`
111+
can be omitted entirely to use $\mu = 1$.
112+
113+
```javascript
114+
model.setModelConfig("creepingFlowScript", {
115+
coefficientFunctions: {
116+
// A ten times more viscous fluid in the right half of the cavity
117+
viscosity: (x, y) => (x < 2 ? 1 : 10),
118+
},
119+
});
120+
```
101121

102122
### Boundary conditions
103123

‎static/llms.txt‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const { solutionVector, nodesCoordinates } = model.solve();
6161
| `"heatConductionScript"` | −∇·(k ∇T) = Q | 1D or 2D, linear or quadratic |
6262
| `"generalFormPDEScript"` | d/dx(A du/dx) + B du/dx + C u = D | 1D only |
6363
| `"frontPropagationScript"` | Eikonal equation \|∇u\| = 1 (vanishing viscosity) | 1D or 2D |
64-
| `"creepingFlowScript"` | Stokes flow: −μ∇²u + ∇p = 0, ∇·u = 0, with μ = 1 (fixed) | 2D, quadratic only |
64+
| `"creepingFlowScript"` | Stokes flow: −μ∇²u + ∇p = 0, ∇·u = 0 | 2D, quadratic only |
6565
| `"eulerBernoulliBeamScript"` | d²/dx²(EI d²w/dx²) + c0 w = q | 1D, `elementOrder: "linear"` only |
6666

6767
### heatConductionScript
@@ -109,7 +109,7 @@ const result = model.solve({ maxIterations: 100, tolerance: 1e-5 });
109109

110110
### creepingFlowScript (2D, quadratic only)
111111

112-
- No options. The viscosity μ is fixed to 1.
112+
- Options: `coefficientFunctions: { viscosity }`, the dynamic viscosity μ, a positive number or a function `(x, y) => ...`. Default `viscosity = 1`; `coefficientFunctions` can be omitted. With velocity boundary conditions only, a constant μ leaves the velocity unchanged and scales the pressure by μ.
113113
- Mesh: `meshDimension: "2D"` and `elementOrder: "quadratic"` (Taylor–Hood Q2–Q1 on quadrilaterals, P2–P1 on triangles from Gmsh).
114114
- Boundary conditions: `["constantVelocity", u, v]` (Dirichlet), `["stressFree"]` (natural outflow). If no boundary is `"stressFree"`, the pressure is set to 0 at the first pressure node.
115115
- Solvers: `"lusolve"` only.
@@ -237,8 +237,8 @@ worker.terminate();
237237
- 3D meshes, and 1D or 3D Gmsh meshes
238238
- 2D general form PDE
239239
- Transient (time-dependent) problems
240-
- Setting the viscosity in creeping flow, or Navier–Stokes (inertia)
241-
- Coefficient functions for front propagation or creeping flow
240+
- Navier–Stokes (inertia) in creeping flow
241+
- Coefficient functions for front propagation
242242
- Mixed element shapes or orders in one mesh
243243
- Heat flux (Neumann) conditions with a non-zero value
244244
- `"frontal"` for creeping flow, the beam, or the nonlinear general form

0 commit comments

Comments
 (0)