User:Eml5526.s11.team4.yang/hw5

=HW 5.3 problem: Solving G1DM1.0/D1b using LIBF=

Refer to lecture slide [[media:fe1.s11.mtg29.djvu|mtg-29]] for the problem statement.

Given
G1DM1.0/D1 (Image from Charles Cook, HW1.1) $$\Omega=\left\{0,1\right\}$$ $$\Gamma_{g}=\left\{0\right\}, g = 4$$ $$\Gamma _{h}=\left\{1\right\}, h = 12$$ $$a_{2}\left\{x\right\}=2+3x$$ $$f\left\{x,t\right\}=5x$$ $$\frac{\partial^{2} u}{\partial t^{2}}=0$$

Objective
1. Explain how LIBF are used as CBS 2. Plot all LIBF used 3. Use matlab quad, WA, to int. 4. plot $$u_{m}^{h}$$ VS u, $$u_{m}^{h}(0.5)-u(0.5)$$ VS m

solution
1. According the definition of constraint breaking solution(CBS), we can prove the LIBF can satisfy the CBS.


 * $$l_{m}^{i}(x)=\prod\limits_{j=1,j\ne i}^{m}{\frac{(x-{{x}_{j}})}{({{x}_{i}}-{{x}_{j}})}}$$

where,
 * $${{x}_{1}}=0,{{x}_{2}}=1/3,{{x}_{3}}=2/3,{{x}_{4}}=1$$.

At the boundary of $$\beta $$ , it can be solved that: $$\begin{align} & \beta =0, \\ & l_{m}^{1}(x=0)=1; \\ & l_{m}^{2}(x=0)=l_{m}^{3}(x=0)=l_{m}^{4}(x=0)=0 \\ \end{align}$$ So, these four basis function can satisfy the CBS. The procedure is the same for m=6, m=8 here. 2. Plot all the basis used for m=4, m=6, m=8, respectively. m=4 m=6 m=8 3. The exact solution is obtained by following steps. $$\frac{\partial}{\partial x}\left[(2+3x)\frac{\partial u}{\partial x}\right]+5x=0$$ Integrate the above equation, we obtain that: $$\left[(2+3x)\frac{\partial u}{\partial x}\right]+\frac{5x^{2}}{2}+C_1=0$$ Applying the natural boundary condition: $$\Gamma _{h}=\left\{0\right\}, h = 12$$ which means: $${{a}_{2}}(x)\centerdot \frac{\partial u}{\partial x}(x=1)=(2+3x)\centerdot \frac{\partial u}{\partial x}(x=1)=12$$ Then, we obtain that: $$\mathbf{C_1 = -29/2}$$ Then, we get: $$\left[(2+3x)\frac{\partial u}{\partial x}\right]+\frac{5x^{2}}{2}-29/2=0$$ Using WA to solve the equation, and applying the essential boundary condition yields the exact solution: $$u=-5{{x}^{2}}/12+5x/9+241\centerdot log(3x+2)/54-241\centerdot log(2)/54+4;$$ 4. m=4, the exact solution and approximate solution using LIBF are compared in the following figure: The according matlab code is: m=6, the exact solution and approximate solution using LIBF are compared in the following figure: The according matlab code is:

m=8, the exact solution and approximate solution using LIBF are compared in the following figure: The according matlab code is: The error is decreased by increasing the nodes of basis function(LIBF), which can be clearly in the following figure: The according matlab code is:

This problem was solved by shengfeng yang

=HW 5.4 problem: Solving G1DM1.0/D1 using LIBF=

Refer to lecture slide [[media:fe1.s11.mtg29.djvu|mtg-29]] for the problem statement.

Given
G1DM1.0/D1 (Image from Charles Cook, HW1.1) $$\Omega=\left\{0,1\right\}$$ $$\Gamma_{g}=\left\{1\right\}, g = 4$$ $$\Gamma _{h}=\left\{0\right\}, h = 12$$ $$a_{2}\left\{x\right\}=2+3x$$ $$f\left\{x,t\right\}=5x$$ $$\frac{\partial^{2} u}{\partial t^{2}}=0$$

Objective
1. Explain how LIBF are used as CBS 2. Plot all LIBF used 3. Use matlab quad, WA, to int. 4. plot $$u_{m}^{h}$$ VS u, $$u_{m}^{h}(0.5)-u(0.5)$$ VS m

solution
1. According the definition of constraint breaking solution(CBS), we can prove the LIBF can satisfy the CBS.


 * $$l_{m}^{i}(x)=\prod\limits_{j=1,j\ne i}^{m}{\frac{(x-{{x}_{j}})}{({{x}_{i}}-{{x}_{j}})}}$$

where,
 * $${{x}_{1}}=0,{{x}_{2}}=1/3,{{x}_{3}}=2/3,{{x}_{4}}=1$$.

At the boundary of $$\beta $$ , it can be solved that: $$\begin{align} & \beta =0, \\ & l_{m}^{1}(x=0)=1; \\ & l_{m}^{2}(x=0)=l_{m}^{3}(x=0)=l_{m}^{4}(x=0)=0 \\ \end{align}$$ So, these four basis function can satisfy the CBS. The procedure is the same for m=6, m=8 here. 2. Plot all the basis used for m=4, m=6, m=8, respectively. m=4 m=6 m=8 3. The exact solution is obtained by following steps. $$\frac{\partial}{\partial x}\left[(2+3x)\frac{\partial u}{\partial x}\right]+5x=0$$ Integrate the above equation, we obtain that: $$\left[(2+3x)\frac{\partial u}{\partial x}\right]+\frac{5x^{2}}{2}+C_1=0$$ Applying the natural boundary condition: $$\Gamma _{h}=\left\{0\right\}, h = 12$$ Then, we obtain that: $$\mathbf{C_1 = -12}$$ Then, we get: $$\left[(2+3x)\frac{\partial u}{\partial x}\right]+\frac{5x^{2}}{2}-12=0$$ Using WA to solve the equation, and applying the essential boundary condition yields the exact solution:

$$u=(-45{{x}^{2}}+60x-472\centerdot log(3x+2)+60)/108+4+(472\centerdot log(5)-75)/108$$

4. m=4, the exact solution and approximate solution using LIBF are compared in the following figure: The according matlab code is: m=6, the exact solution and approximate solution using LIBF are compared in the following figure: The according matlab code is:

m=8, the exact solution and approximate solution using LIBF are compared in the following figure: The according matlab code is: The error is decreased by increasing the nodes of basis function(LIBF), which can be clearly in the following figure: The according matlab code is:

This problem was solved by shengfeng yang

=Problem 5.7 Linear Lagrangian Element Basis Function with dataset G1DM1.0/D1b=

From the lecture slide Mtg30

Problem Statement
Similar to HW5.1/HW5.3, but using Linear Lagrangian Element Basis Function (LLEBF ) with uniform discretization (equidistant element nodes). The number of element ($$\displaystyle nel$$) is 4,6,8.

Find:
a) Explain how LLEBF are used as CBS, Constraint Breaking Solution

b) Plot all LLEBF used for $$\displaystyle nel=4$$

c) Use matlab to calculate

d) Plot figures showing $$\displaystyle {{u}^{h}}$$ vs $$\displaystyle u$$, $$\displaystyle \left[ u_{nel}^{h}(0.5)-u(0.5) \right]$$ vs number of element

a) Explain how LLEBF are used as CBS
In the dataset G1DM1.0/D1b, $$\displaystyle {{\Gamma }_{g}}=\left\{ \beta \right\}=\left\{ 0 \right\}$$. As to the Constraint Breaking Solution, it’s required that,

The LLEBF has similar property with Lagrangian Interpolation function in,

Hence, the family $$\displaystyle F=\left\{ {{b}_{0}}(.),{{b}_{1}}(.),{{b}_{2}}(.),\cdots \cdots ,{{b}_{n}}(.) \right\}$$ will satisfy the CBS requirement in that,

No need for constant basis function this case

Generally the family of basis function should include constant one. However there’s no need for LLEBF basis, since the summation $$\displaystyle \sum\limits_{0}^{n}{{{b}_{i}}(.)}$$ can form a constant. That’s property of LLEBF, see part b) below.

b) Plot all LLEBF used for the case of 4 elements
See the figures below



We also post the LLEBF used for case of 6 and 8 elements





c) Use matlab to calculate
The MatLab code is included in the collapsible box

Matlab code for the $$\displaystyle nel=4$$ case

Matlab code for the $$\displaystyle nel=6$$ case

Matlab code for the $$\displaystyle nel=8$$ case

The author of the code also invented a "truncate" function to help calculation:

Matlab Code for "truncate" function

d) Plot figures showing comparison between exact and numerical solution, convergence vs number of element
From HW5.1/HW5.3 we have known the exact solution is,

The comparison of $$\displaystyle {{u}^{h}}$$ vs $$\displaystyle u$$:






$$\displaystyle \left[ u_{nel}^{h}(0.5)-u(0.5) \right]$$ vs number of element:


We can see that the convergence becomes better when number of elements increase.

d) Plot figures showing comparison between exact and numerical solution, convergence vs number of element
From HW5.2/HW5.4 we have known the exact solution is,

The comparison of $$\displaystyle {{u}^{h}}$$ vs $$\displaystyle u$$:






$$\displaystyle \left[ u_{nel}^{h}(0.5)-u(0.5) \right]$$ vs number of element:


We can see that the convergence becomes better when number of elements increase.