Skip to content

Commit c869cc0

Browse files
committed
Allow setting the viscosity in the creeping flow model (#102)
The creeping flow model takes the dynamic viscosity as a coefficient, coefficientFunctions: { viscosity }, a positive number or a function of (x, y) evaluated at every integration point. It defaults to 1, so existing models give the same results. Tests: check that a viscosity (number and function) leaves the lid-driven cavity velocity unchanged and scales the pressure, and that a varying viscosity gives the same solution through the worker. Examples: set the viscosity in the lid-driven cavity. Closes #102
1 parent 8c73335 commit c869cc0

14 files changed

Lines changed: 79 additions & 17 deletions

File tree

‎dist/feascript-worker.esm.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/feascript-worker.esm.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/feascript.cjs.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/feascript.cjs.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/feascript.esm.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/feascript.esm.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/feascript.umd.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/feascript.umd.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎examples/creepingFlowScript/lidDrivenCavity2DCreepingFlow/lidDrivenCavity2DCreepingFlow.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ console.log("FEAScript Version:", printVersion);
1414

1515
// 1. Create the model and select the physics
1616
const model = new FEAScriptModel();
17-
model.setModelConfig("creepingFlowScript");
17+
model.setModelConfig("creepingFlowScript", {
18+
coefficientFunctions: {
19+
viscosity: 1, // μ
20+
},
21+
});
1822

1923
// 2. Define the mesh
2024
model.setMeshConfig({

‎src/FEAScript.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,11 @@ export class FEAScriptModel {
364364
}
365365
} else if (this.solverConfig === "creepingFlowScript") {
366366
// Use regular linear solver methods for steady creeping flow
367-
const creepingFlowResult = assembleCreepingFlowMatrix(meshData, this.boundaryConditions);
367+
const creepingFlowResult = assembleCreepingFlowMatrix(
368+
meshData,
369+
this.boundaryConditions,
370+
this.coefficientFunctions,
371+
);
368372
jacobianMatrix = creepingFlowResult.jacobianMatrix;
369373
residualVector = creepingFlowResult.residualVector;
370374

0 commit comments

Comments
 (0)