\documentclass{article}
\usepackage{graphicx}
\author{sun xichao}
\title{programming of FEM}
\usepackage[top=1in, bottom=1in, left=1.25in, right=1.25in]{geometry}
\begin{document}
\maketitle
\begin{equation}
\left\{
\begin{array}{cc}
-\Delta u+u^2=f(x,y) & (x,y) \in [0,1]\times[0,1]\\
u=0 & (x,y) \in \partial\Omega
\end{array}
\right.
\end{equation}
After the Galerkin variation,we get the equation:
\begin{equation}
\int_{\Omega} \nabla u\cdot\nabla v d \Omega+\int_{\Omega}u^{2} \cdot v d\Omega=\int_{\Omega}f\cdot v d{\Omega}
\quad where \quad v|_{\partial \Omega}=0
\end{equation}
we sets\\
$$a(u,v)=\int_{\Omega} \nabla u \nabla v d\Omega$$\\
$$b(u,u,v)=\int_{\Omega} u^{2} v d\Omega$$\\
$$(f,v)=\int_{\Omega}f\cdot vd{\Omega}$$
\\and the weak solution of (1) can be converted into:\\
find $u_{h}\in U=V=\{H_{0}^{1},v|_{\partial\Omega}=0\}$\quad st.\\
\begin{equation}
a(u_{h},v_{h})+b(u_{h},u_{h},v_{h})=(f,v_{h}) \qquad where \quad v_{h}\in V
\end{equation}
For solving the equation (3),we subdivide the $\Omega=[0,1]\times[0,1]$ into the chart below.
\begin{figure}
% Requires \usepackage{graphicx}
\centering \includegraphics[width=100pt]{FEM.png}\\
\end{figure}
NE is the node(I) that we know its value,while NF(II) is the opposite;
so $NE=12,NF=4$\\
LEE is the total number of element;$LEE=18$.\\
For reseaching the node named II,we define $S_{be}$\quad as the set of element that reflects the II and $S_{bn}$ \quad as the set of node as $S_{be}$.
\begin{equation}
\left .
\begin{array}{|c|c|c|}
\hline
n_{p} & S_{be} & S_{bn}\\
\hline
6 & 2,3,4,7,8,9 & 2,3,5,6,7,9,10\\
\hline
7 & 4,5,6,9,10,11 & 3,4,6,7,8,10,11\\
\hline
10 & 8,9,10,13,14,15 & 6,7,9,10,11,13,14\\
\hline
11 & 10,11,12,15,16,17 & 7,8,10,11,12,14,15\\
\hline
\end{array}
\right .
\end{equation}
In each element,we encode withershins the node with 1 2 3,starting from right-angle side,and we get the chart below(the relation of local number and global number);
\begin{equation}
\left .
\begin{array}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 \\
\hline
1 & 1 & 6 & 2 &7 & 3& 8 & 5 & 10 & 6 & 11 & 7 & 12 & 9 & 14 & 10 & 15 & 11 & 16\\
\hline
2 & 2 & 5 & 3 & 6 & 4 & 7 & 6 & 9 & 7 & 10 & 8 & 11 & 10 & 13 & 11 & 14 & 12 & 15 \\
\hline
3 & 5 & 2 & 6 & 3& 7 & 4 & 9 & 6 & 10 & 7 & 11 & 8 & 13 & 10 & 14 & 11 & 15 & 12 \\
\hline
\end{array}
\right .
\end{equation}
obviously,the weak equation of (3) can be converted into the form\\
$$F(u_{h})=a(u_{h},v_{h})+b(u_{h},u_{h},v_{h})-(f,v_{h})=0$$
\begin{equation}
F(u_{h})\approx F(u_{h}^{k})+F^{\prime}(u_{h}^{k})(u_{h}-u_{h}^{k})=0
\end{equation}
$$=\lim _{t \to 0}{\frac{F(u_{n}^{k}+tw_{n})-F(u_{n}^{k})}{t}}\qquad (G \quad differential)$$
$$=\lim_{t \to 0}{\frac {a(u_{h}^{k}+tw_{h},v_{h})+b(u_{h}^{k}+tw_{h},u_{h}^{k}+tw_{h},v_{h})-a(u_{h}^{k},v_{h})-b(u_{h}^{k},u_{h}^{k},v_{h}) } {t} }$$
$$=a(w_{h},v_{h})+\lim _{t \to 0}{\frac{b(u_{h}^{k}+tw_{h},u_{h}^{k}+tw_{h},v_{h})-b(u_{h}^{k},u_{h}^{k},v_{h})} {t}}$$
$$=a(w_{h},v_{h})+\lim _{t \to 0}{\frac{b(u_{h}^{k}+tw_{h},u_{h}^{k}+tw_{h},v_{h})-b(u_{h}^{k},u_{h}^{k}+tw_{h},v_{h})+b(u_{h}^{k},u_{h}^{k}+tw_{h},v_{h})-b(u_{h}^{k},u_{h}^{k},v_{h})} {t}}$$
$$=a(w_{h},v_{h})+b(w_{h},u_{h}^{k},v_{h})+b(u_{h}^{k},w_{h},v_{h})$$
obviously,(6) can be converted to \\
$$a(u_{h}^{k},v_{h})+b(u_{h}^{k},u_{h}^{k},v_{h})-(f,v_{h})+a(u_{h}^{k+1}-u_{h}^{k},v_{h})+b(u_{h}^{k+1}-u_{h}^{k},u_{h}^{k},v_{h})+b(u_{h}^{k},u_{h}^{k+1}-u_{h}^{k},v_{h})=0$$
\begin{equation}
a(u_{h}^{k+1},v_{h})+b(u_{h}^{k+1},u_{h}^{k},v_{h})+b(u_{h}^{k},u_{h}^{k+1},v_{h})=b(u_{h}^{k},u_{h}^{k},v_{h})+(f,v_{h})
\end{equation}
According to the equation(7),we get the finite element equation
\begin{equation}
a(u_{h}^{k+1},\Phi_{j})+b(u_{h}^{k+1},u_{h}^{k},\Phi_{j})+b(u_{h}^{k},u_{h}^{k+1},\Phi_{j})=b(u_{h}^{k},u_{h}^{k},\Phi_{j})+(f,\Phi_{j}) \quad j=1,2...16
\end{equation}
because $$u_{h}=\sum _{i=1}^{16}u_{i}\Phi_{j}=u_{6}\Phi_{6}+u_{7}\Phi_{7}+u_{10}\Phi_{10}+u_{11}\Phi_{11}$$
so we get the final form
$$\sum_{i=1}^{16}(u_{j}[a(\Phi_{i},\Phi_{j})+2 \sum_{m=1}^{16}u_{m}^{k}b(\Phi_{i},\Phi_{m},\Phi_{j})])$$
$$=\sum_{m=1}^{16}\sum_{n=1}^{16}u_{m}^{k}u_{n}^{k}b(\Phi_{m},\Phi_{n},\Phi_{j})+(f,\Phi_{j})$$
$$where \quad u_{k}=0 \quad (k\neq 6,7,10,11)$$
in the last equation,$u_{m}^{k}$ and $u_{m}^{k}$ are given before the computation of the $u_{j}$\\
after the $n_{th}$ iteration,we can get the last solution.\\
\\ \\During the process of computation,we can get
$$a(\lambda_{I},\lambda_{I})=1$$
$$a(\lambda_{II},\lambda_{II})=a(\lambda_{III},\lambda_{III})=1/2$$
$$a(\lambda_{I},\lambda_{II})=a(\lambda_{I},\lambda_{III})=-1/2$$
$$a(\lambda_{II},\lambda_{III})=0$$
\\
So we get the chart(9) about a(u,v) in one element
\begin{equation}
\left .\begin{array}{|c|c|c|c|c|c|}
\hline
1 & -1/2 & -1/2 & 1/2 & 1/2 & 0\\
\hline
1 & 1 & 1 & 2 & 3 & 2\\
\hline
1 & 2 & 3 & 2 & 3 & 3\\
\hline
\end{array} \right .
\end{equation}
\\
meanwhile,we can get the chart (10) of b(u,v,w) and (11) of $f_{j}$ in one element
\\
\begin{equation}
\left .\begin{array}{|c|c|c|c|c|c|c|c|c|c|}
\hline
0.00556 & 0.00556 & 0.00185 & 0.00185 & 0.00195 & 0.00195 & 0.00093 & 0.00093 & -0.00185 & 0.01296\\
\hline
1 & 2 & 1 & 2 & 1 & 2 & 3 & 3 & 1 & 3\\
\hline
1 & 2 & 1 & 2 & 1 & 2 & 1 & 2 & 2 & 3\\
\hline
1 & 2 & 2 & 1 & 3 & 3 & 3 & 3 & 3 & 3\\
\hline
\end{array} \right .
\end{equation}
\\ \\
\begin{equation}
\left .\begin{array}{|c|c|c|c|}
\hline
6 & 7 & 10 & 11\\
\hline
h^{2}f(0.33,0.33) & h^{2}f(0.66,0.33) & h^{2}f(0.33,0.66) & h^{2}f(0.66,0.66)\\
\hline
\end{array} \right .
\end{equation}
\end{document}