-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathSolidificationFront2D.js
More file actions
51 lines (41 loc) · 1.73 KB
/
SolidificationFront2D.js
File metadata and controls
51 lines (41 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// ______ ______ _____ _ _ //
// | ____| ____| /\ / ____| (_) | | //
// | |__ | |__ / \ | (___ ___ ____ _ ____ | |_ //
// | __| | __| / /\ \ \___ \ / __| __| | _ \| __| //
// | | | |____ / ____ \ ____) | (__| | | | |_) | | //
// |_| |______/_/ \_\_____/ \___|_| |_| __/| | //
// | | | | //
// |_| | |_ //
// Website: https://feascript.com/ \__| //
// Import Math.js
import * as math from "mathjs";
global.math = math;
// Import FEAScript library
import { FEAScriptModel, printVersion } from "feascript";
console.log("FEAScript Version:", printVersion);
// Create a new FEAScript model
const model = new FEAScriptModel();
// Set solver configuration for front propagation
model.setSolverConfig("frontPropagationScript");
// Define mesh configuration
model.setMeshConfig({
meshDimension: "2D",
elementOrder: "quadratic",
numElementsX: 12,
numElementsY: 8,
maxX: 4,
maxY: 2,
});
// Define boundary conditions
model.addBoundaryCondition("0", ["constantValue", 0]); // Bottom
model.addBoundaryCondition("1", ["constantValue", 0]); // Left
model.addBoundaryCondition("2", ["zeroGradient"]); // Top
model.addBoundaryCondition("3", ["constantValue", 0]); // Right
// Set solver method (optional)
model.setSolverMethod("lusolve");
// Solve the problem and get the solution
const { solutionVector, nodesCoordinates } = model.solve();
// Print results to console
console.log(`Number of nodes in mesh: ${nodesCoordinates.nodesXCoordinates.length}`);
console.log("Node coordinates:", nodesCoordinates);
console.log("Solution vector:", solutionVector);