You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added reference to fe_intro for derivation and discretisation.
Changed notation of trial functions to be consistent with previous tutorials (v -> δu).
Modified doassembly functions into one function for K, M and f. (If there is a reason why they were in two different function, please let me know since I am new to this library).
Copy file name to clipboardExpand all lines: docs/src/literate-tutorials/transient_heat_equation.jl
+25-50Lines changed: 25 additions & 50 deletions
Original file line number
Diff line number
Diff line change
@@ -35,22 +35,28 @@
35
35
# ```
36
36
# The semidiscrete weak form is given by
37
37
# ```math
38
-
# \int_{\Omega}v \frac{\partial u}{\partial t} \ \mathrm{d}\Omega + \int_{\Omega} k \nabla v \cdot \nabla u \ \mathrm{d}\Omega = \int_{\Omega} f v \ \mathrm{d}\Omega,
38
+
# \int_{\Omega}\delta u \frac{\partial u}{\partial t} \ \mathrm{d}\Omega + \int_{\Omega} k \nabla \delta u \cdot \nabla u \ \mathrm{d}\Omega = \int_{\Omega} f \delta u \ \mathrm{d}\Omega,
39
39
# ```
40
-
# where $v$ is a suitable test function. Now, we still need to discretize the time derivative. An implicit Euler scheme is applied,
40
+
# where $\delta u$ is a suitable test function. Now, we still need to discretize the time derivative. An implicit Euler scheme is applied,
41
41
# which yields:
42
42
# ```math
43
-
# \int_{\Omega} v\, u_{n+1}\ \mathrm{d}\Omega + \Delta t\int_{\Omega} k \nabla v \cdot \nabla u_{n+1} \ \mathrm{d}\Omega = \Delta t\int_{\Omega} f v \ \mathrm{d}\Omega + \int_{\Omega} v \, u_{n} \ \mathrm{d}\Omega.
43
+
# \int_{\Omega} \delta u\, u_{n+1}\ \mathrm{d}\Omega + \Delta t\int_{\Omega} k \nabla \delta u \cdot \nabla u_{n+1} \ \mathrm{d}\Omega = \Delta t\int_{\Omega} f \delta u \ \mathrm{d}\Omega + \int_{\Omega} \delta u \, u_{n} \ \mathrm{d}\Omega.
44
44
# ```
45
45
# If we assemble the discrete operators, we get the following algebraic system:
# where $u_j$ and $\delta u_i$ are the shape functions of the trial and test functions, respectively.
49
54
# In this example we apply the boundary conditions to the assembled discrete operators (mass matrix $\mathbf{M}$ and stiffnes matrix $\mathbf{K}$)
50
55
# only once. We utilize the fact that in finite element computations Dirichlet conditions can be applied by
51
56
# zero out rows and columns that correspond
52
57
# to a prescribed dof in the system matrix ($\mathbf{A} = Δt \mathbf{K} + \mathbf{M}$) and setting the value of the right-hand side vector to the value
53
-
# of the Dirichlet condition. Thus, we only need to apply in every time step the Dirichlet condition to the right-hand side of the problem.
58
+
# of the Dirichlet condition. Thus, we only need to apply in every time step the Dirichlet condition to the right-hand side of the problem. For more details
59
+
# on the derivation and discretisation, see the [Introduction to FEM](@ref fe-intro).
54
60
#-
55
61
# ## Commented program
56
62
#
@@ -75,11 +81,6 @@ add!(dh, :u, ip)
75
81
close!(dh);
76
82
77
83
# By means of the `DofHandler` we can allocate the needed `SparseMatrixCSC`.
78
-
# `M` refers here to the so called mass matrix, which always occurs in time related terms, i.e.
# As in the [heat equation example](@ref heat_equation.jl) we define a `doassemble!` function that assembles the diffusion and diffusive parts of the equation:
0 commit comments