# 弱形式方程的离散化

2015年 2月 9日

### 简单示例

(1)

\int_1^5 \partial_x T(x) \partial_x \tilde{T}(x) \,dx = -2 \tilde{T}_1 -\lambda_2 \tilde{T}_2 -\tilde{\lambda}_2 (T_2-9)

### 基础函数

(2)

\begin{equation*}
\psi_{1L}(x) %26=%26 \left\{ \begin{array}{ll}
2-x \mbox{ for } 1 \le x \le 2,\\
0 \mbox{ elsewhere}
\end{array} \right \mbox{ (solid red line)}
\begin{equation*}
\psi_{1R}(x) %26=%26 \left\{ \begin{array}{ll}
x-1 \mbox{ for } 1 \le x \le 2, \\
0 \mbox{ elsewhere}
\end{array} \right \mbox{ (dashed red line)}

(3)

u(x) \approx a_{1L} \psi_{1L}(x) + a_{1R} \psi_{1R}(x) + a_{2L} \psi_{2L}(x) + a_{2R} \psi_{2R}(x) + \cdots

\begin{equation*}
\begin{align}
a_1 %26\equiv a_{1L}\\
a_2 %26\equiv a_{1R} = a_{2L}\\
a_3 %26\equiv a_{2R} = a_{3L}\\
a_4 %26\equiv a_{3R} = a_{4L}\\
a_5 %26\equiv a_{4R}
\end{align}
\end{equation*}

(4)

\begin{equation*}
\begin{align}
\phi_1(x) \equiv \psi_{1L}(x) %26= \left\{ \begin{array}{ll}
2-x \mbox{ for } 1\:$\leq$\:\textit{x}\:$\leq$\:2,\\
0 \mbox{ elsewhere}
\end{array} \right
\\
\phi_2(x) \equiv \psi_{1R}(x) + \psi_{2L}(x) %26= \left\{ \begin{array}{lll}
x-1 \mbox{ for } 1\:$\leq$\:\textit{x}\:$\leq$\:2, \\
3-x \mbox{ for } 2\:\textless\:x\:$\leq$\:3, \\
0 \mbox{ elsewhere}
\end{array} \right
\\
\phi_3(x) \equiv \psi_{2R}(x) + \psi_{3L}(x) %26= \left\{ \begin{array}{lll}
x-2 \mbox{ for } 2\:$\leq$\:\textit{x}\:$\leq$\:3, \\
4-x \mbox{ for } 3\:\textless\:x\:$\leq$\:4, \\
0 \mbox{ elsewhere}
\end{array} \right
\\
\\ \cdot
\\ \cdot
\\ \cdot
\end{equation*}

(5)

u(x) \approx a_1 \phi_1(x) + a_2 \phi_2(x) + \cdots + a_5 \phi_5(x)

### 两步离散弱形式方程

(6)

T(x) = a_1 \phi_1(x) + a_2 \phi_2(x) + \cdots + a_5 \phi_5(x)

T(x) 的表达式 (6) 代入弱形式方程 (1) 可得到：

(7)

\begin{array}{ll}
a_1 \int_1^5 \partial_x \phi_1(x) \partial_x \tilde{T}(x) \,dx + a_2 \int_1^5 \partial_x \phi_2(x) \partial_x \tilde{T}(x) \,dx + \cdots + a_5 \int_1^5 \partial_x \phi_5(x) \partial_x \tilde{T}(x) \,dx
\\
= -2 \tilde{T}_1 -\lambda_2 \tilde{T}_2 -\tilde{\lambda}_2 (a_5 -9)
\end{array}

\tilde{T}(x) \tilde{\lambda}_2
\phi_1(x) 0
\phi_2(x) 0
\phi_3(x) 0
\phi_4(x) 0
\phi_5(x) 0
0 1

\begin{array}{ll}
a_1 \int_1^5 \partial_x \phi_1(x) \partial_x \phi_1(x) \,dx + a_2 \int_1^5 \partial_x \phi_2(x) \partial_x \phi_1(x) \,dx + \cdots + a_5 \int_1^5 \partial_x \phi_5(x) \partial_x \phi_1(x) \,dx
\\
= -2 \phi_1(x=1) -\lambda_2 \phi_1(x=5) -0 (a_5 -9)
\end{array}

(8)

a_1 -a_2 = -2

\begin{equation*}
\begin{align}
\int_1^5 \partial_x \phi_1(x) \partial_x \phi_1(x) \,dx %26= 1\\
\int_1^5 \partial_x \phi_2(x) \partial_x \phi_1(x) \,dx %26= -1\\
\end{align}
\end{equation*}

(9)

\begin{equation*}
\begin{align}
-a_1 + 2 a_2 -a_3 %26= 0\\
-a_2 + 2 a_3 -a_4 %26= 0\\
-a_3 + 2 a_4 -a_5 %26= 0\\
-a_4 + a_5 %26= -\lambda_2\\
0 %26= -(a_5 -9)\\
\end{align}
\end{equation*}

\begin{equation*}
\begin{align}
T(x=5) %26= a_1 \phi_1(x=5) + a_2 \phi_2(x=5) + \cdots + a_5 \phi_5(x=5)\\
%26= a_1 \cdot 0 + a_2 \cdot 0 + \cdots + a_5 \cdot 1\\
%26= 9\\
\begin{align}
\end{equation*}

### 矩阵表示

(10)

\left(
\begin{array}{cccccc}
1 & -1 & 0 & 0 & 0 & 0 \\
-1 & 2 & -1 & 0 & 0 & 0 \\
0 & -1 & 2 & -1 & 0 & 0 \\
0 & 0 & -1 & 2 & -1 & 0 \\
0 & 0 & 0 & -1 & 1 & 1 \\
0 & 0 & 0 & 0 & 1 & 0
\end{array}
\right)
\left(
\begin{array}{c} a_1 \\ a_2 \\ a_3 \\ a_4 \\ a_5 \\ \lambda_2 \end{array}
\right)
= \left(
\begin{array}{c} -2 \\ 0 \\ 0 \\ 0 \\ 0 \\ 9 \end{array}
\right)

### 总结和弱形式系列的下一主题

1. 以它们为基准来近似真实解
2. 逐个将它们代入弱形式方程得到离散方程组系统

#### 评论 (6)

2021-04-01

##### hao huang
2021-04-02 COMSOL 员工

##### Kai Li
2021-04-02

{结果符合右边界温度为 9 的固定边界条件。样可以轻松发现正是与试函数 相关的项推出了方程 ()，与预期一致。}

##### hao huang
2021-04-02 COMSOL 员工

2023-06-13

##### Kaixi Tang
2023-06-25 COMSOL 员工