Skip to content

Commit 8a1144d

Browse files
committed
Stylistic modifications. Move solver, mesh, and boundary conditions for example case to exampleSolidHeatTransfer01 directory
1 parent ca86e00 commit 8a1144d

File tree

10 files changed

+396
-393
lines changed

10 files changed

+396
-393
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
## FEAScript website
1+
## FEAScript Website
22

3-
FEAScript is an open-source JavaScript library to solve differential equations using the finite element method. This is the source code of the FEAScript <a href="https://feascript.com/" target="_blank">website</a>.
3+
FEAScript is an open-source JavaScript library for solving differential equations using the finite element method. This is the source code of the FEAScript <a href="https://feascript.com/" target="_blank">website</a>.
44

55
## Licenses
66

7-
The content of the FEAScript website is licensed under <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank">CC-BY 4.0</a>. Note that FEAScript itself has a software license, <a href="https://opensource.org/license/mit" target="_blank">MIT</a>.
7+
The content of the FEAScript website is licensed under <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank">CC-BY 4.0</a>. Note that FEAScript itself has a software license, the <a href="https://opensource.org/license/mit" target="_blank">MIT license</a>.

corsHttpServer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
import socketserver
1717
import os
1818

19+
# Define the port on which the server will run
1920
PORT = 8000
21+
# Define the directory to serve files from
2022
DIRECTORY = ".."
2123

2224
class CORSRequestHandler(http.server.SimpleHTTPRequestHandler):
@@ -46,6 +48,7 @@ def do_OPTIONS(self):
4648
".js": "application/javascript",
4749
})
4850

51+
# Create and start the server
4952
with socketserver.TCPServer(("", PORT), handler) as httpd:
5053
print("Serving at port", PORT)
5154
httpd.serve_forever()

boundaryConditionsConfig.json renamed to exampleSolidHeatTransfer01/boundaryConditionsConfig.json

File renamed without changes.

exampleHeatTrasnfer.html renamed to exampleSolidHeatTransfer01/exampleSolidHeatTransfer01.html

Lines changed: 317 additions & 315 deletions
Large diffs are not rendered by default.

meshConfig.json renamed to exampleSolidHeatTransfer01/meshConfig.json

File renamed without changes.

solverConfig.json renamed to exampleSolidHeatTransfer01/solverConfig.json

File renamed without changes.

finiteElementMethod.html

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<html>
1414
<head>
15-
<title>FEAScript: Finite element method</title>
15+
<title>FEAScript: Finite Element Method</title>
1616
<link rel="icon" type="image/x-icon" href="./images/favicon.ico" />
1717
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
1818
<meta
@@ -21,8 +21,8 @@
2121
/>
2222
<meta name="viewport" content="width=device-width" />
2323
<link href="FEAScript-website.css" rel="stylesheet" type="text/css" />
24-
<!-- In the following we use browser UMD build that exposes the libraries as global variables -->
25-
<!-- Import the MathJax for writing equations -->
24+
<!-- In the following, we use the browser UMD build that exposes the libraries as global variables -->
25+
<!-- Import MathJax for writing equations -->
2626
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
2727
<script
2828
id="MathJax-script"
@@ -42,13 +42,13 @@ <h1 class="top">
4242
/>
4343
</a>
4444
</h1>
45-
<h1>Finite element method</h1>
45+
<h1>Finite Element Method</h1>
4646

4747
<ul id="menu">
48-
<li><a href="#galerkinresiduals">Galerkin residuals</a></li>
49-
<li><a href="#boundaryconditions">Boundary conditions</a></li>
50-
<li><a href="#isoparametricmapping">Isoparametric mapping</a></li>
51-
<li><a href="#residualscomputation">Residuals computation</a></li>
48+
<li><a href="#galerkinresiduals">Galerkin Residuals</a></li>
49+
<li><a href="#boundaryconditions">Boundary Conditions</a></li>
50+
<li><a href="#isoparametricmapping">Isoparametric Mapping</a></li>
51+
<li><a href="#residualscomputation">Residuals Computation</a></li>
5252
<li><a href="#references">References</a></li>
5353
</ul>
5454

@@ -58,36 +58,35 @@ <h1>Finite element method</h1>
5858
equation. Basic concepts of the finite element method are described below.
5959
</p>
6060
<h2 id="galerkinresiduals">
61-
<a name="Galerkin residuals"></a>Galerkin residuals
61+
<a name="Galerkin Residuals"></a>Galerkin Residuals
6262
</h2>
6363
<p>
6464
Consider a typical formulation of a boundary value problem (BVP):
6565
$$\begin{eqnarray} Lu &= f \quad \text{in} \quad D, \\ Bu &= g \quad
6666
\text{on} \quad \partial D. \end{eqnarray} \tag{1}$$ The solution \(u\) is
67-
a function of the position vector \(\bar{x}\) at the domain \(D\) which is
68-
a subregion of a one-, two- or tree-dimensional Euclidian space. The
67+
a function of the position vector \(\bar{x}\) at the domain \(D\), which
68+
is a subregion of a one-, two- or three-dimensional Euclidean space. The
6969
position vector \(\bar{x}\) is defined as: \( \bar{x} =\sum_{i=1} ^{n} x_i
70-
e_i\), where \(e_i\) are the unit vectors and \(n\) the dimension of the
71-
Euclidian space. \(L\) is the differential operator and \(B\) is a
70+
e_i\), where \(e_i\) are the unit vectors and \(n\) is the dimension of
71+
the Euclidean space. \(L\) is the differential operator and \(B\) is a
7272
boundary operator defined at the boundary \(\partial D\). The solution
7373
\(u\) can be approximated using a linear combination of basis functions
7474
\(\phi^1, \phi^2, \phi^3, \dots, \phi^N\) such that: \( u(x) = \sum_{j=1}
75-
^{N} u_j \phi^j(x)\), where the number of the basis functions equals to
76-
the number of nodes of the computational mesh. The Galerkin method is
77-
seeking a solution that zeroes out every one of the following weighted
78-
residuals: $$ \begin{aligned} R_i &= \int_{D} (Lu - f) \phi^i \, dS \\ &=
79-
\int_{D} \phi^i \left( L\left( \sum_{j=1}^N u_j \phi^j \right) \right) \,
80-
dS - \int_{D} f \phi^i \, dS \\ &\quad \text{for} \quad i = 1, 2, \dots,
81-
N. \end{aligned} \tag{2} $$ These integrals depend solely on the nodal
82-
values \(u_j\), which are the unknowns to be determined. The number of
83-
residuals is equal to the number of basis functions, which in turn is
84-
equal to the number of nodes, \(N\), in the computational mesh. to the
85-
Setting the Galerkin residuals to zero leads to a system of \(N\)
86-
algebraic equations with \(N\) unknowns, which can be solved to obtain the
87-
approximate solution.
75+
^{N} u_j \phi^j(x)\), where the number of basis functions equals the
76+
number of nodes of the computational mesh. The Galerkin method seeks a
77+
solution that zeroes out every one of the following weighted residuals: $$
78+
\begin{aligned} R_i &= \int_{D} (Lu - f) \phi^i \, dS \\ &= \int_{D}
79+
\phi^i \left( L\left( \sum_{j=1}^N u_j \phi^j \right) \right) \, dS -
80+
\int_{D} f \phi^i \, dS \\ &\quad \text{for} \quad i = 1, 2, \dots, N.
81+
\end{aligned} \tag{2} $$ These integrals depend solely on the nodal values
82+
\(u_j\), which are the unknowns to be determined. The number of residuals
83+
is equal to the number of basis functions, which in turn is equal to the
84+
number of nodes, \(N\), in the computational mesh. Setting the Galerkin
85+
residuals to zero leads to a system of \(N\) algebraic equations with
86+
\(N\) unknowns, which can be solved to obtain the approximate solution.
8887
</p>
8988
<h2 id="boundaryconditions">
90-
<a name="Boundary conditions"></a>Boundary conditions
89+
<a name="Boundary Conditions"></a>Boundary Conditions
9190
</h2>
9291
<p>
9392
In general, there are three common types of boundary conditions that can
@@ -130,7 +129,7 @@ <h2 id="boundaryconditions">
130129
</p>
131130

132131
<h2 id="isoparametricmapping">
133-
<a name="Isoparametric mapping"></a>Isoparametric mapping
132+
<a name="Isoparametric Mapping"></a>Isoparametric Mapping
134133
</h2>
135134
<p>
136135
The basis functions are defined on reference elements: on the unit
@@ -160,39 +159,38 @@ <h2 id="isoparametricmapping">
160159
of \(\bar{x}\): \(\bar{\xi} = \bar{\xi}(\bar{x})\). The basis functions
161160
are then expressed in the coordinate system of \(D\) (the \(\bar{x}\)
162161
system) as \(\phi_i(\bar{\xi}(\bar{x}))\), where \(i = 1, 2, \dots, n_k\).
163-
In case where \(D\) is a two-dimensional domain, the Jacobian of the
162+
In the case where \(D\) is a two-dimensional domain, the Jacobian of the
164163
mapping is the matrix: $$ \bar{\bar{J}} = \begin{vmatrix} x_{\xi} &
165164
y_{\xi} \\ x_{\eta} & y_{\eta} \end{vmatrix}, \tag{7}$$ where \( x_{\xi} =
166165
\frac{\partial x}{\partial \xi}\), \( y_{\xi} = \frac{\partial y}{\partial
167166
\xi}\), \( x_{\eta} = \frac{\partial x}{\partial \eta}\), \( y_{\eta} =
168-
\frac{\partial y}{\partial \eta}\).
169-
</p>
170-
<p>
171-
The relation between the \(\bar{x}\)- and \(\bar{\xi}\)-partial
172-
derivatives of the basis function can also be calculated as: $$
173-
\bar{\bar{J}} \begin{vmatrix} \frac{\partial \phi_i}{\partial x} \\
174-
\frac{\partial \phi_i}{\partial y} \end{vmatrix} = \begin{vmatrix}
175-
\frac{\partial \phi_i}{\partial \xi} \\ \frac{\partial \phi_i}{\partial
176-
\eta} \end{vmatrix}. \tag{8} $$ By solving the above equation, we can
177-
calculate the partial derivatives of the basis function with respect to
178-
\(x\) and \(y\): $$ \begin{eqnarray} \frac{\partial \phi_i}{\partial x}
179-
&=& \frac{1}{\text{det}\bar{\bar{J}}} \left( y_{\eta} \frac{\partial
180-
\phi_i}{\partial \xi} - y_{\xi} \frac{\partial \phi_i}{\partial \eta}
181-
\right), \\ \frac{\partial \phi_i}{\partial y} &=&
167+
\frac{\partial y}{\partial \eta}\). The relation between the \(\bar{x}\)-
168+
and \(\bar{\xi}\)-partial derivatives of the basis function can also be
169+
calculated as: $$ \bar{\bar{J}} \begin{vmatrix} \frac{\partial
170+
\phi_i}{\partial x} \\ \frac{\partial \phi_i}{\partial y} \end{vmatrix} =
171+
\begin{vmatrix} \frac{\partial \phi_i}{\partial \xi} \\ \frac{\partial
172+
\phi_i}{\partial \eta} \end{vmatrix}. \tag{8} $$ By solving the above
173+
equation, we can calculate the partial derivatives of the basis function
174+
with respect to \(x\) and \(y\): $$ \begin{eqnarray} \frac{\partial
175+
\phi_i}{\partial x} &=& \frac{1}{\text{det}\bar{\bar{J}}} \left( y_{\eta}
176+
\frac{\partial \phi_i}{\partial \xi} - y_{\xi} \frac{\partial
177+
\phi_i}{\partial \eta} \right), \\ \frac{\partial \phi_i}{\partial y} &=&
182178
\frac{1}{\text{det}\bar{\bar{J}}} \left( x_{\xi} \frac{\partial
183179
\phi_i}{\partial \eta} - x_{\eta} \frac{\partial \phi_i}{\partial \xi}
184-
\right), \end{eqnarray} \tag{9} $$ where \(\text{det}\bar{\bar{J}}\) is
185-
the determinant of the Jacobian: \( \text{det}\bar{\bar{J}} = x_{\xi}
186-
y_{\eta} - x_{\eta} y_{\xi}.\) In the case where \(D\) is a
187-
one-dimensional domain, Eq. (6) is reduced to: \( x = \sum_{i=1}^{n_k} x_i
188-
\phi_i(\xi). \) The Jacobian of the mapping in this case is: \( J =
189-
\frac{dx}{d\xi} = x_{\xi}, \) and the partial derivative of the basis
190-
function is: \( \frac{d\phi_i}{dx} = \frac{d\phi_i}{d\xi} \Big/ x_{\xi}.
191-
\)
180+
\right). \end{eqnarray} \tag{9}$$
181+
</p>
182+
<p>
183+
where \(\text{det}\bar{\bar{J}}\) is the determinant of the Jacobian: \(
184+
\text{det}\bar{\bar{J}} = x_{\xi} y_{\eta} - x_{\eta} y_{\xi}.\) In the
185+
case where \(D\) is a one-dimensional domain, Eq. (6) is reduced to: \( x
186+
= \sum_{i=1}^{n_k} x_i \phi_i(\xi). \) The Jacobian of the mapping in this
187+
case is: \( J = \frac{dx}{d\xi} = x_{\xi}, \) and the partial derivative
188+
of the basis function is: \( \frac{d\phi_i}{dx} = \frac{d\phi_i}{d\xi}
189+
\Big/ x_{\xi}. \)
192190
</p>
193191

194192
<h2 id="residualscomputation">
195-
<a name="Residuals computation"> </a>Residuals computation
193+
<a name="Residuals Computation"> </a>Residuals Computation
196194
</h2>
197195
<p>
198196
A typical representative of the integrals in the Galerkin residuals is the

index.html

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<html>
1414
<head>
1515
<title>
16-
FEAScript: a JavaScript library for solving differential equations
16+
FEAScript: A JavaScript Library for Solving Differential Equations
1717
</title>
1818
<link rel="icon" type="image/x-icon" href="./images/favicon.ico" />
1919
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -42,12 +42,12 @@ <h1 class="top">
4242
</div>
4343

4444
<h1>
45-
A JavaScript library for solving differential equations using the finite
46-
element method
45+
A JavaScript Library for Solving Differential Equations Using the Finite
46+
Element Method
4747
</h1>
4848

4949
<ul id="menu">
50-
<li><a href="#getstarted">Get started</a></li>
50+
<li><a href="#getstarted">Get Started</a></li>
5151
<li><a href="#features">Features</a></li>
5252
<li><a href="#documentation">Documentation</a></li>
5353
<li><a href="#licensing">Licensing</a></li>
@@ -60,19 +60,19 @@ <h1>
6060
physics and engineering problems without the need for additional
6161
installations. FEAScript can be an excellent tool for
6262
<b>hands-on learning of computational mechanics</b> in academic
63-
environments. It can used as a turnkey solution by the educators without
63+
environments. It can be used as a turnkey solution by educators without
6464
requiring any software installations.
6565
</p>
6666

67-
<h2 id="getstarted"><a name="Get started"></a>Get started</h2>
67+
<h2 id="getstarted"><a name="Get Started"></a>Get Started</h2>
6868
<p>
6969
The latest version of FEAScript can be downloaded from our
7070
<a href="https://github.com/FEAScript/FEAScript" target="_blank"
7171
>GitHub repository</a
72-
>. FEAScript is still in early-development stage with continuous addition
73-
of new features and improvements. Whether you are a CFD or JavaScript
74-
enthusiast, we are currently on the lookout for co-developers to
75-
contribute to the project! To get an idea of our short- and long-term
72+
>. FEAScript is still in the early development stage with continuous
73+
addition of new features and improvements. Whether you are a CFD or
74+
JavaScript enthusiast, we are currently on the lookout for co-developers
75+
to contribute to the project! To get an idea of our short- and long-term
7676
goals, please see the
7777
<a
7878
href="https://github.com/FEAScript/FEAScript/wiki/Roadmap"
@@ -120,38 +120,38 @@ <h2 id="features"><a name="Features"></a>Features</h2>
120120
</ul>
121121

122122
<h2 id="documentation"><a name="Documentation"></a>Documentation</h2>
123-
<h3>Theory notes</h3>
123+
<h3>Theory Notes</h3>
124124
<p>
125125
Presentation of the numerical methods that are utilized in FEAScript. In
126-
case you don't have any experience in those methods, we recommend to start
126+
case you don't have any experience in those methods, we recommend starting
127127
with these articles.
128128
</p>
129129
<ul>
130130
<li>
131131
<a href="https://feascript.com/finiteElementMethod.html" target="_blank"
132-
>Finite element method</a
132+
>Finite Element Method</a
133133
>
134134
</li>
135135
</ul>
136-
<h3>Running examples</h3>
136+
<h3>Running Examples</h3>
137137
<p>
138-
Demonstration of example codes which would serve as a step-by-step
139-
introduction to FEAScript.
138+
Demonstration of example codes which serve as a step-by-step introduction
139+
to FEAScript.
140140
</p>
141141
<ul>
142142
<!-- Run examples on the GitHub server -->
143+
<li>Heat conduction in a large plane wall <i>(under development)</i></li>
143144
<li>
144-
Heat conduction in large plane wall <i>(under development)</i>
145-
</li>
146-
<li>
147-
<a href="https://feascript.com/exampleHeatTrasnfer.html" target="_blank"
148-
>Heat conduction in two-dimensional fin</a
145+
<a
146+
href="https://feascript.com/exampleSolidHeatTransfer01/exampleSolidHeatTransfer01.html"
147+
target="_blank"
148+
>Heat conduction in a two-dimensional fin</a
149149
>
150150
</li>
151151
<!-- Run examples on a local server *** Don't forget to change it before commit *** -->
152152
<!--<li>
153-
<a href="./exampleHeatTrasnfer.html" target="_blank"
154-
>Heat conduction in two-dimensional fin</a
153+
<a href="./exampleSolidHeatTransfer01/exampleSolidHeatTransfer01.html" target="_blank"
154+
>Heat conduction in a two-dimensional fin</a
155155
>
156156
</li>-->
157157
</ul>

0 commit comments

Comments
 (0)