-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNumGy_LV12E.qmd
130 lines (96 loc) · 3.61 KB
/
NumGy_LV12E.qmd
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
title: "Numerical Simulation Methods in Geophysics, Exercise 12: I open at the close"
subtitle: "1. MGPY+MGIN"
author: "[email protected]"
title-slide-attributes:
data-background-image: pics/tubaf-logo.png
data-background-size: 20%
data-background-position: 10% 95%
format:
tubaf-revealjs:
html-math-method: mathjax
chalkboard: true
include-in-header:
- text: |
<script>
window.MathJax = {
loader: {
load: ['[tex]/physics']
},
tex: {
packages: {'[+]': ['physics']}
}
};
</script>
slide-number: c/t
transition: slide
transition-speed: fast
menu:
side: left
# jupyter: python3
---
# Recap time-stepping in FD
There have been problems using the simple time-stepping schemes known from FD. We need to have an FE eye onto the problem at hand.
## Explicit
:::: {.columns}
::: {.column}
Start $T^0$ with initial condition
Update field by
$$ T^{n+1} = T^n + a \pdv[2]{T^n}{z} \cdot \Delta t$$
E.g. by using the matrix $\vb A$ using `T[1:] += A.dot(T)[1:]`
Care for upper boundary!
:::
::: {.column}

:::
::::
## Implicit methods
:::: {.columns}
::: {.column}
$$ \pdv{T}{t}^{n+1} \approx \frac{T^{n+1}-T^n}{\Delta t} = a \pdv[2]{T}{z} ^{n+1} $$
$$ \frac{1}{\Delta t} T^{n+1} - a \pdv[2]{T}{z} ^{n+1} = \frac{1}{\Delta t} T^n $$
$$ (\vb M - \vb A) \vb u^{n+1} = \vb M \vb u^n $$
$\vb M$ - mass matrix
:::
::: {.column}

:::
::::
## Mixed - Crank-Nicholson method
$$ \pdv{T}{t}^{n+1/2} \approx \frac{T^{n+1}-T^n}{\Delta t} = \frac12 a \pdv[2]{T}{z} ^n + \frac12 a \pdv[2]{T}{z} ^{n+1} $$
:::: {.columns}
::: {.column width="60%"}
$$ \frac{2}{\Delta t} T^{n+1} - a \pdv[2]{T^{n+1}}{z} =
\frac{2}{\Delta t} T^n + a \pdv[2]{T^n}{z} $$
$$ (\vb M - \vb A/2) \vb u^{n+1} = (\vb M + \vb A/2) \vb u^n $$
<!-- $$ \pdv{T}{t}^n \approx \frac{T^{n+1}-T^n}{\Delta t} = \frac12 a \pdv[2]{T}{z} ^n + \frac12 a \pdv[2]{T}{z} ^{n+1} $$ -->
:::
::: {.column width="40%"}

:::
::::
# Time-stepping in FE
## Variational formulation of Diffusion equation
$$ \pdv{u}{t} - \div a \grad u = f $$
Finite Difference in Time (NOT in space)
$$ \frac{u^{n+1}-u^n}{\Delta t} - \div a \grad u = f $$
## Variational formulation
$$ \frac{u^{n+1}-u^n}{\Delta t} - \div a \grad u = f $$
::: {.fragment}
Multiplication with test function $w$ and integration $\Rightarrow$ weak form
$$ 1/\Delta t (\int_\Omega w u^{n+1}\dd\Omega-\int_\Omega w u^{n}\dd\Omega) - \int_\Omega w \div a \grad u \dd\Omega = \int_\Omega w f \dd\Omega $$
:::
::: {.fragment}
$$ 1/\Delta t (\int_\Omega w u^{n+1}\dd\Omega-\int_\Omega w u^{n}\dd\Omega) - \int_\Omega a \grad w \cdot \grad u \dd\Omega = \int_\Omega w f \dd\Omega $$
:::
## Variational formulation of Diffusion equation
$u$ is constructed of shape functions $\vb v_i$ that are identical to $w$
The integral over the Poisson term $\int_\Omega a \grad w \cdot \grad u \dd\Omega$ is represented using the stiffness matrix $\vb A \vb v$
$$ \vb A_{i,j} = \int_\Omega \sigma \grad v_i \cdot \grad v_j \dd\Omega $$
## Variational formulation of Poisson equation
Weighted integrals over both $u$ are represented by the mass matrix $\vb M \vb v$
$$ \vb M_{i,j} = \int_\Omega v_i \cdot v_j \dd\Omega $$
explicit method: $\vb M \vb u^{n+1} = (\vb M - \vb A)\vb u^n$
implicit method: $(\vb M + \vb A) \vb u^{n+1} = \vb M \vb u^n$
mixed method: $(\vb M + \vb A/2) \vb u^{n+1} = (\vb M - \vb A/2) \vb u^n$
same as in FD but with FE mass matrix