User:EML5526.S11.Team3.vnarayanan/Homework6

=Problem 6.4(a) Verify the Divergence Theorem=

Problem Statement
Given a vector field $$\;\;q_{x} = -y^2\;;\; q_{y} = -2xy \;\;$$ on the domain shown below. Verify the divergence theorem.



Solution
$$ \vec{q} = q_{x}\vec{i}+ q_{y}\vec{j}$$

$$\therefore\;\; \vec{q} = -y^2\vec{i} - 2xy\vec{j}$$

Divergence of $$\vec{q} = \vec{\triangledown }. \vec{q} = = \frac{\partial q_{x}}{\partial x}+\frac{\partial q_{y}}{\partial y} = = 0 - 2x = -2x$$ The divergence theorem states,

$$\int_{\Omega }\vec{\triangledown}.\vec{q} = \oint_{\Gamma }\vec{q}.\vec{n}$$

$$\oint_{\Gamma }\vec{q}.\vec{n} = \int_{AB}\vec{q}.\vec{n^{1}}\;d\Gamma_{AB}+\int_{BC}\vec{q}.\vec{n^{2}}\;d\Gamma_{BC}+\int_{CD}\vec{q}.\vec{n^{3}}\;d\Gamma_{CD}+\int_{DA}\vec{q}.\vec{n^{4}}\;d\Gamma_{DA}$$

$$\vec{q}.\vec{n^{1}} = 2xy\;;\vec{q}.\vec{n^{2}} = -y^2\;;\vec{q}.\vec{n^{3}} = -2xy\;;\vec{q}.\vec{n^{4}} = y^2$$

$$d\Gamma_{AB} = dx;\;d\Gamma_{BC} = dy;\;d\Gamma_{CD} = -dx;\;d\Gamma_{DA} = -dy$$

From equations (1) & (2), we have

$$\int_{\Omega }\vec{\triangledown}.\vec{q} = \oint_{\Gamma }\vec{q}.\vec{n}$$

Hence, Divergence theorem is verified

=Problem 6.4(b) Verify the Divergence Theorem=

Problem Statement
Given a vector field $$\;\;q_{x} = 3x^2y+y^3\;;\; q_{y} = 3x+y^3 \;\;$$ on the domain shown below. Verify the divergence theorem.The curved boundary of the domain is a parabola.

Solution
$$ \vec{q} = q_{x}\vec{i}+ q_{y}\vec{j}$$

$$\therefore\;\; \vec{q} = (3x^2y+y^3)\vec{i}+(3x+y^3) \vec{j}$$

Divergence of $$\vec{q} = \vec{\triangledown }. \vec{q} = \frac{\partial q_{x}}{\partial x}+\frac{\partial q_{y}}{\partial y} = 6xy+3y^2$$

The divergence theorem states,

$$\int_{\Omega }\vec{\triangledown}.\vec{q} = \oint_{\Gamma }\vec{q}.\vec{n}$$

The equation of the given parabola is $$x^2 = 4-y \;\;\Rightarrow \;\; y = 4-x^2$$

$$\int_{\Omega }\vec{\triangledown}.\vec{q} = \int_{-2}^{2}\left ( \int_{0}^{4-x^2}(6xy+3y^2)\;dy\right )dx = \int_{-2}^{2}\left (  \int_{0}^{4-x^2}(6x(4-x^2)+3(4-x^2)^2)\;dy\right )dx = \int_{-2}^{2}\left ( -(x^2-4)^2(x^2-3x-4)\right )dx$$

$$\oint_{\Gamma }\vec{q}.\vec{n} = \int_{AB}\vec{q}.\vec{n^{1}}\;d\Gamma_{AB}+\int_{BCA}\vec{q}.\vec{n^{2}}\;d\Gamma_{BCA}$$

$$\vec{q}.\vec{n^{1}} = -(3x+y^3)\;;\vec{q}.\vec{n^{2}} = 3x+y^3$$

$$d\Gamma_{AB} = dx;\;d\Gamma_{BCA} = dy$$

Equation of line AB is $$y = 0$$

$$\therefore\;\;\int_{AB}\vec{q}.\vec{n^{1}}\;d\Gamma_{AB} = \int_{-2}^{2}-3xdx = 0$$

$$\int_{BCA}\vec{q}.\vec{n^{2}}\;d\Gamma_{BCA} = \int_{-2}^{2}3x+y^3$$

Equation of parabola is $$y = 4 - x^2$$

, using [| Wolframalpha]

From equations (1) & (2), we have

$$\int_{\Omega }\vec{\triangledown}.\vec{q} = \oint_{\Gamma }\vec{q}.\vec{n}$$

Hence, Divergence theorem is verified

=Problem 6.4(c) Use Divergence Theorem=

Problem Statement
Using the divergence theorem prove

$$\oint_{\Gamma}n\;\;\mathrm{d}\Gamma = 0$$

Solution
Let, $$\vec{q} = \vec{i}+\vec{j}\;\;\; and \;\; \vec{n} = \vec{n_{1}}+\vec{n_{2}}$$

Divergence Theorem states,

$$\int_{\Omega }\vec{\triangledown}.\vec{q}\mathrm{d}\Omega = \oint_{\Gamma }\vec{q}.\vec{n}\mathrm{d}\Gamma$$

$$\oint_{\Gamma }\vec{q}.\vec{n}\;\mathrm{d}\Gamma = \oint_{\Gamma }(n_{1}+n_{2})\;\mathrm{d}\Gamma = \oint_{\Gamma }n\;\mathrm{d}\Gamma$$

$$\therefore\;\;\oint_{\Gamma }n\;\mathrm{d}\Gamma = \int_{\Omega }\vec{\triangledown}.\vec{q}\mathrm{d}\Omega $$

$$\vec{\triangledown}.\vec{q} = \frac{\partial (1)}{\partial x}+\frac{\partial (1)}{\partial y} = 0$$

$$\therefore\; \int_{\Omega }\vec{\triangledown}.\vec{q}\mathrm{d}\Omega = \int_{\Omega }0\;\mathrm{d}\Omega = 0$$

$$\Rightarrow\;\;\oint_{\Gamma}n\;\;\mathrm{d}\Gamma = 0$$

=Problem 6.8.2(a) Gauss Quadrature=

Problem Statement
Use Gauss quadrature to obtain exact values for the following integrals. Verify by analytical integration:

$$(a).\;\int_{0}^{4}(x^2+1)\mathrm{d}x$$

$$(b).\;\int_{-1}^{1}(\xi^4+2\xi^2)\mathrm{d}\xi$$

Solution
(a).

$$I =\int_{0}^{4}(x^2+1)\mathrm{d}x$$

As $$n_{gp} = 2\; (two-point \;\;quadrature),\; p = 2n_{gp} - 1 = 3$$

$$ \begin{bmatrix} 1 &1 \\ \xi_{1}&\xi_{2} \\ \xi_{1}^2&\xi_{2}^2 \\ \xi_{1}^3&\xi_{2}^3 \\ \end{bmatrix} \begin{bmatrix} W_{1}\\ W_{2}\\ \end{bmatrix} = \begin{bmatrix} 2\\ 0\\ \frac{2}{3}\\ 0\\ \end{bmatrix} $$

Solving the above system of 4 equations and 4 unknowns, we get

$$W_{1} = W_{2} = 1\;\; and \; \xi_{1} = \frac{1}{\sqrt3}\;\;\xi_{2} = \frac{-1}{\sqrt3}$$

We have, $$a = 0\;\;;b = 4$$

$$x = \frac{1}{2}(a+b)+\frac{1}{2}\xi(b-a) = 2+2\xi$$

The value of the function $$f(\xi) = (2+2\xi)^2+1$$

$$I = \frac{l}{2}\int_{-1}^{1}((2+2\xi)^2+1)\; \mathrm{d}\xi$$

$$I = \frac{l}{2}\left[W_{1}((2+2\xi_{1})^2+1)\; + \;W_{2}((2+2\xi_{2})^2+1)\right] \;and \; l = b - a = 4 - 0 = 4$$

$$= 2\left[10.953+1.715\right] = 25.334$$

Analytical Method

$$I =\int_{0}^{4}(x^2+1)\mathrm{d}x$$

$$= \left[\frac{x^3}{3}+x\right]_{0}^{4} = \frac{4^3}{3}+4 = 25.333$$

The analytical method also yields exactly the same result as the Gauss Quadrature.

(b). $$I =\int_{-1}^{1}(\xi^4+2\xi^2)\mathrm{d}\xi$$

$$n_{gp} = 4\; (fo-point \;\;quadrature),\; p = 2n_{gp} - 1 = 7$$

$$ \begin{bmatrix} 1 &1 \\ \xi_{1}&\xi_{2} \\ \xi_{1}^2&\xi_{2}^2 \\ \xi_{1}^3&\xi_{2}^3 \\ \xi_{1}^4&\xi_{2}^4 \\ \xi_{1}^5&\xi_{2}^5 \\ \xi_{1}^6&\xi_{2}^6 \\ \xi_{1}^7&\xi_{2}^7 \\ \end{bmatrix} \begin{bmatrix} W_{1}\\ W_{2}\\ W_{3}\\ W_{4}\\ \end{bmatrix} = \begin{bmatrix} 2\\ 0\\ \frac{2}{3}\\ 0\\ \frac{2}{5}\\ 0\\ \frac{2}{7}\\ 0\\ \end{bmatrix} $$

Solving the above system of 8 equations and 8 unknowns, we get

$$W_{1} = W_{3} = 0.348\;W_{2} = W_{4} = 0.652\; and \; \xi_{1} = 0.861\;\;\xi_{2} = 0.339\;\;\xi_{3} = -0.861\;\;\xi_{4} = -0.339$$

We have, $$a = -1\;\;;b = 1$$

$$x = \frac{1}{2}(a+b)+\frac{1}{2}\xi(b-a) = \xi$$

The value of the function $$f(\xi) = (\xi^4+2\xi^2)$$

$$I = \frac{l}{2}\int_{-1}^{1}(\xi^4+2\xi^2)\; \mathrm{d}\xi$$

$$I = \frac{l}{2}\left[W_{1}(\xi_{1}^4+2\xi_{1}^2)\; + \;W_{2}(\xi_{2}^4+2\xi_{2}^2)\;+ (\xi_{3}^4+2\xi_{3}^2)\;+ (\xi_{4}^4+2\xi_{4}^2)\;\right] \;and \; l = b - a = 4 - 0 = 4$$

$$= 1.4144+0.3169 = 1.731$$

Analytical Method

$$I =\int_{-1}^{1}(\xi^4+2\xi^2)\mathrm{d}\xi$$

$$= \left[\frac{\xi^5}{5}+\frac{2\xi^3}{3}\right]_{-1}^{1} = 2\left[\frac{1}{5}+\frac{2}{3}\right] = 1.731$$

The analytical method also yields exactly the same result as the Gauss Quadrature.

=Problem 6.8.2(b)Three-point Gauss quadrature=

Problem Statement
Use three-point Gauss quadrature to evaluate the following integrals. Compare to the analytical integral.

(a).$$ \int_{-1}^{1}\frac{\xi}{\xi^2+1}\;\mathrm{d}x $$

(b). $$\int_{-1}^{1}cos^2\pi\zeta\mathrm{d\xi}$$

Solution
(a).

$$I =\int_{-1}^{1}\frac{\xi}{\xi^2+1}\;\mathrm{d}x $$

As $$n_{gp} = 3\; (three-point \;\;quadrature),\; p = 2n_{gp} - 1 = 5$$

$$ \begin{bmatrix} 1 &1 \\ \xi_{1}&\xi_{2} \\ \xi_{1}^2&\xi_{2}^2 \\ \xi_{1}^3&\xi_{2}^3 \\ \xi_{1}^4&\xi_{2}^4 \\ \xi_{1}^5&\xi_{2}^5 \\ \end{bmatrix} \begin{bmatrix} W_{1}\\ W_{2}\\ W_{3}\\ \end{bmatrix} = \begin{bmatrix} 2\\ 0\\ \frac{2}{3}\\ 0\\ \frac{2}{5}\\ 0\\ \end{bmatrix} $$

Solving the above system of 6 equations and 6 unknowns, we get

$$W_{1} = W_{3} = 0.557\;W_{2} = 0.889\; and \; \xi_{1} = 0.7745\;\;\xi_{2} = 0\;\;\xi_{3} = -0.7745$$

We have, $$a = -1\;\;;b = 1$$

$$x = \frac{1}{2}(a+b)+\frac{1}{2}\xi(b-a) = \xi$$

$$\therefore\;\; \mathrm{dx} = \mathrm{d\xi}$$

The value of the function $$f(\xi) = \frac{\xi}{\xi^2+1}$$

$$I = \frac{l}{2}\int_{-1}^{1}(\frac{\xi}{\xi^2+1})\; \mathrm{d}\xi$$

$$I = \frac{l}{2}\left[W_{1}(\frac{\xi_{1}}{\xi_{1}^2+1})\; + \;W_{2}(\frac{\xi_{2}}{\xi_{2}^2+1})\;+ W_{3}(\frac{\xi_{3}}{\xi_{3}^2+1})\right] \;and \; l = b - a = 1 - (-1) = 2$$

$$= 0.556\left(\frac{0.7745}{0.7745^2+1}\right)+0.556\left(\frac{-0.7745}{0.7745^2+1}\right) = 0$$

Analytical Method

$$I =\int_{-1}^{1}(\frac{\xi}{\xi^2+1})\mathrm{d}\xi = 0,$$, using [Wolframalpha]

The analytical method also yields exactly the same result as the Gauss Quadrature.

(b). $$\int_{-1}^{1}cos^2\pi\zeta\mathrm{d\xi}$$

(b).

$$I =\int_{-1}^{1}cos^2\pi\zeta\mathrm{d\xi} $$

As $$n_{gp} = 3\; (three-point \;\;quadrature),\; p = 2n_{gp} - 1 = 5$$

$$ \begin{bmatrix} 1 &1 \\ \xi_{1}&\xi_{2} \\ \xi_{1}^2&\xi_{2}^2 \\ \xi_{1}^3&\xi_{2}^3 \\ \xi_{1}^4&\xi_{2}^4 \\ \xi_{1}^5&\xi_{2}^5 \\ \end{bmatrix} \begin{bmatrix} W_{1}\\ W_{2}\\ W_{3}\\ \end{bmatrix} = \begin{bmatrix} 2\\ 0\\ \frac{2}{3}\\ 0\\ \frac{2}{5}\\ 0\\ \end{bmatrix} $$

Solving the above system of 6 equations and 6 unknowns, we get

$$W_{1} = W_{3} = 0.557\;W_{2} = 0.889\; and \; \xi_{1} = 0.7745\;\;\xi_{2} = 0\;\;\xi_{3} = -0.7745$$

We have, $$a = -1\;\;;b = 1$$

$$\zeta = \frac{1}{2}(a+b)+\frac{1}{2}\xi(b-a) = \xi$$

The value of the function $$f(\xi) = cos^2\pi\xi$$

$$I = \frac{l}{2}\int_{-1}^{1}cos^2\pi\xi\mathrm{d\xi}$$

$$I = \frac{l}{2}\left[W_{1}(cos^2\pi\xi_{1})\; + \;W_{2}(cos^2\pi\xi_{2})\;+W_{3}(cos^2\pi\xi_{3})\right] \;and \; l = b - a = 1 - (-1) = 2$$

$$I = 0.556(cos^2\pi(0.7745))+0.889(cos^2\pi(0))+0.556(cos^2\pi(0.7745)) = 1.53$$

Analytical Method

$$I =\int_{-1}^{1}cos^2\pi\zeta\mathrm{d\xi} = 1,$$, using [Wolframalpha]

The value from the analytical method is different from the value evaluated from Gauss Quadrature 

=Problem 6.8.2(c) Check for accuracy in Gauss Quadrature=

Problem Statement
The integral $$\int_{-1}^{1}(3\xi^3+2)\;\mathrm{d\xi}$$ can be integrated exactly using two-point Gauss quadrature. How is the accuracy affected if a. one-point quadrature is employed; b. three-point quadrature is employed.

Solution
$$I =\int_{-1}^{1}(3\xi^3+2)\;\mathrm{d\xi}$$

As $$n_{gp} = 2\; (two-point \;\;quadrature),\; p = 2n_{gp} - 1 = 3$$

$$W_{1} = W_{2} = 1\;\; and \; \xi_{1} =0.5774\;\;\xi_{2} = -0.5774$$

$$f(\xi) = (3\xi^3+2)$$

$$I = \frac{l}{2}\int_{-1}^{1}(3\xi_{1}^3+2)\; \mathrm{d}\xi$$

$$I = \frac{l}{2}\left[W_{1}(3\xi_{1}^3+2)\; + \;W_{2}(3\xi_{2}^3+2)\right] \;and \; l = b - a = 1 - (-1) = 2$$

$$= 2+2 = 4$$

(a).One - Point Quadrature: $$W = 2\;\; and \; \xi =0$$

$$f(\xi) = (3\xi^3+2)$$

$$I = \frac{l}{2}\int_{-1}^{1}(3\xi^3+2)\; \mathrm{d}\xi$$

$$I = \frac{l}{2}\left[W(3\xi^3+2)\right]\;and\;\; l = b - a = 1 - (-1) = 2$$

$$= 2(2) = 4$$

(b).Three - Point Quadrature:

$$W_{1} = W_{3} = 0.556\;\; and \; \xi_{1} =0.7745\;\;\xi_{2} = 0\;\;\xi_{3} =-0.7745$$

$$f(\xi) = (3\xi^3+2)$$

$$I = \frac{l}{2}\int_{-1}^{1}(3\xi_{1}^3+2)\; \mathrm{d}\xi$$

$$I = \frac{l}{2}\left[W_{1}(3\xi_{1}^3+2)\; + \;W_{2}(3\xi_{2}^3+2)+\;\;W_{3}(3\xi_{3}^3+2)\right] \;and \; l = b - a = 1 - (-1) = 2$$

$$= 2(0.556)(2)+(0.889)(2) = 4$$

'''The value of the Integral is same when evaluated with 0ne -,Two - and Three- point Quadratures. Hence all the three are accurate.'''

=Problem 6.8 Verify the given table=

Problem Statement
Verify the table of {(wi,xi),i=1,2,..,5} against NIST handbook and also with table on textbook page 89

Solution
The table from Lecture 36-3 is given below:

Nodes and weights for the 5-point Gauss–Legendre formula from | NIST Handbook are given below:

The values of the Nodes and Weights in the given table in Lecture 36-3 are calculated and the values are tabulated:

The table of Nodes and Weights with the calculated values from the text book Introduction to Finite Element Analysis by Fish and Belytschko is as below:

From the above tables, it can be concluded that the values of Nodes and Weights from the table in Lecture 36-3, NIST handbiik and the text book agree with each other.