Skip to content

Commit 37ec53e

Browse files
committed
Set the viscosity in the creeping flow tutorials
Show the viscosity coefficient (μ = 1) in the creeping flow tutorials (main thread and worker).
1 parent d541ee2 commit 37ec53e

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

‎tutorials/lid-driven-cavity-2d-creeping-flow-worker.html‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ <h1>
225225
// 1. Create the model in a web worker and select the physics
226226
const model = new FEAScriptWorker();
227227
await model.ping(); // Wait until the worker is ready
228-
await model.setModelConfig("creepingFlowScript");
228+
await model.setModelConfig("creepingFlowScript", {
229+
coefficientFunctions: {
230+
viscosity: 1, // μ
231+
},
232+
});
229233

230234
// 2. Define the mesh (creeping flow needs quadratic elements)
231235
await model.setMeshConfig({
@@ -325,7 +329,11 @@ <h1>
325329
await model.ping();
326330

327331
// Set solver configuration
328-
await model.setModelConfig("creepingFlowScript");
332+
await model.setModelConfig("creepingFlowScript", {
333+
coefficientFunctions: {
334+
viscosity: 1, // μ
335+
},
336+
});
329337

330338
// Define mesh configuration
331339
const numElementsX = 12;

‎tutorials/lid-driven-cavity-2d-creeping-flow.html‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ <h1>Creeping Flow in a <span class="accent">2D Lid-Driven Cavity Tutorial</span>
207207
\(\nabla \cdot \mathbf{u} = 0\) and \(-\mu \nabla^{2} \mathbf{u} + \nabla p = \mathbf{0}\),
208208
where \(\mathbf{u} = (u,v)\) is the velocity vector, \(p\) is the pressure and \(\mu\) is the
209209
dynamic viscosity. In the FEAScript implementation below, we set the viscosity coefficient to
210-
\(\mu = 1.0\).
210+
\(\mu = 1.0\) with the <code>viscosity</code> coefficient of the model (a number, or a function of
211+
\(x\) and \(y\) for a varying viscosity).
211212
</p>
212213

213214
<div class="center-image">
@@ -260,7 +261,11 @@ <h1>Creeping Flow in a <span class="accent">2D Lid-Driven Cavity Tutorial</span>
260261

261262
// 1. Create the model and select the physics
262263
const model = new FEAScriptModel();
263-
model.setModelConfig("creepingFlowScript");
264+
model.setModelConfig("creepingFlowScript", {
265+
coefficientFunctions: {
266+
viscosity: 1, // μ
267+
},
268+
});
264269

265270
// 2. Define the mesh (creeping flow needs quadratic elements)
266271
model.setMeshConfig({
@@ -368,7 +373,11 @@ <h1>Creeping Flow in a <span class="accent">2D Lid-Driven Cavity Tutorial</span>
368373
const model = new FEAScriptModel();
369374

370375
// Set model configuration
371-
model.setModelConfig("creepingFlowScript");
376+
model.setModelConfig("creepingFlowScript", {
377+
coefficientFunctions: {
378+
viscosity: 1, // μ
379+
},
380+
});
372381

373382
// Define mesh configuration
374383
model.setMeshConfig({

0 commit comments

Comments
 (0)