Skip to content

Commit aec298d

Browse files
committed
Add Heat Conduction Through a Wall example with HTML and README documentation
1 parent 1dc81ff commit aec298d

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<!DOCTYPE html>
2+
3+
<!-- ______ ______ _____ _ _ -->
4+
<!-- | ____| ____| /\ / ____| (_) | | -->
5+
<!-- | |__ | |__ / \ | (___ ___ ____ _ ____ | |_ -->
6+
<!-- | __| | __| / /\ \ \___ \ / __| __| | _ \| __| -->
7+
<!-- | | | |____ / ____ \ ____) | (__| | | | |_) | | -->
8+
<!-- |_| |______/_/ \_\_____/ \___|_| |_| __/| | -->
9+
<!-- | | | | -->
10+
<!-- |_| | |_ -->
11+
<!-- Website: https://feascript.com/ \__| -->
12+
13+
<html lang="en">
14+
<head>
15+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
16+
<meta name="viewport" content="width=device-width" />
17+
<title>FEAScript: Heat Conduction Through a Wall Example</title>
18+
19+
<!-- Math.js and Plotly.js libraries -->
20+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/5.0.0/math.min.js"></script>
21+
<script src="https://cdnjs.cloudflare.com/ajax/libs/plotly.js/2.27.0/plotly.min.js"></script>
22+
23+
<!-- Link to the CSS files -->
24+
<link href="https://feascript.com/FEAScript-website.css" rel="stylesheet" type="text/css" />
25+
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet" />
26+
</head>
27+
28+
<body>
29+
<h1>Heat Conduction Through a Wall Example</h1>
30+
<div id="solutionPlot"></div>
31+
32+
<p>
33+
This example demonstrates heat conduction through a wall using a one-dimensional model. The mesh
34+
configuration and boundary conditions are defined directly within the JavaScript code. Please refresh
35+
the page to update the results. Detailed instructions for this example can be found in the corresponding
36+
<a href="https://feascript.com/tutorials/HeatConduction1DWall.html" target="_blank"
37+
>FEAScript tutorial</a
38+
>. If you need further assistance, you can visit the
39+
<a href="https://feascript.com/" target="_blank">FEAScript website</a>.
40+
</p>
41+
42+
<p>&#169; 2023-<span id="currentYear"></span> FEAScript</p>
43+
<script>
44+
document.getElementById("currentYear").innerHTML = new Date().getFullYear();
45+
</script>
46+
47+
<!-- Import FEAScript library -->
48+
<script type="module">
49+
import { FEAScriptModel, plotSolution, printVersion } from "https://core.feascript.com/src/index.js";
50+
51+
window.addEventListener("DOMContentLoaded", () => {
52+
// Print FEAScript version in the console
53+
printVersion();
54+
55+
// Create a new FEAScript model
56+
const model = new FEAScriptModel();
57+
58+
// Set solver configuration
59+
model.setSolverConfig("solidHeatTransferScript");
60+
61+
// Define mesh configuration
62+
model.setMeshConfig({
63+
meshDimension: "1D",
64+
elementOrder: "linear",
65+
numElementsX: 10,
66+
maxX: 0.15,
67+
});
68+
69+
// Define boundary conditions
70+
model.addBoundaryCondition("0", ["convection", 1, 25]);
71+
model.addBoundaryCondition("1", ["constantTemp", 5]);
72+
73+
// Set solver method (optional) - 'lusolve' uses LU decomposition
74+
model.setSolverMethod("lusolve");
75+
76+
// Solve the problem and get the solution
77+
const { solutionVector, nodesCoordinates } = model.solve();
78+
79+
// Plot the solution as a 1D line plot
80+
plotSolution(
81+
solutionVector,
82+
nodesCoordinates,
83+
model.solverConfig,
84+
model.meshConfig.meshDimension,
85+
"line",
86+
"solutionPlot"
87+
);
88+
});
89+
</script>
90+
</body>
91+
</html>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<img src="https://feascript.github.io/FEAScript-website/assets/FEAScriptHeatTransfer.png" width="80" alt="FEAScript Logo">
2+
3+
## Heat Conduction Through a Wall
4+
5+
This example demonstrates solving a steady-state heat transfer problem in a 1D domain using the FEAScript library. The problem represents heat flow through a building wall, where heat conduction is modeled to determine temperature profiles under specific boundary conditions.
6+
7+
All examples are intentionally kept simple and modular to facilitate easy integration with web applications. The clean, minimal structure makes it straightforward to incorporate these simulations into existing websites or web-based tools.
8+
9+
### Available Versions
10+
11+
1. **Standard Version** (`HeatConduction1DWall.html`)
12+
13+
### Instructions
14+
15+
The mesh configuration and boundary conditions are defined directly in the JavaScript section of the HTML file. For a step-by-step guide and additional details, refer to the corresponding [tutorial](https://feascript.com/tutorials/HeatConduction1DWall.html).

0 commit comments

Comments
 (0)