# Nonlinear finite elements/Quiz 1/Solutions
## Quiz 1: Given

Heat conduction in an isotropic material with a constant thermal conductivity and no internal heat sources is described by Laplace's equation
    $\nabla ^{2}T=0~\qquad ~{\text{or,}}\qquad {\frac {\partial ^{2}T}{\partial x^{2}}}+{\frac {\partial ^{2}T}{\partial y^{2}}}+{\frac {\partial ^{2}T}{\partial z^{2}}}=0~.$

## Solution
### Part 1

Derive a symmetric weak form for the Laplace equation in 1-D (an insulated rod).
The 1-D version of Laplace's equation is
    ${\frac {\partial ^{2}T}{\partial x^{2}}}=0~.$
To derive the symmetric weak form we multiply the equation by a weighting function ($w$) and integrate by parts. Thus,
    $\int _{\Omega }w~{\frac {\partial ^{2}T}{\partial x^{2}}}~dx=0$
or
    ${\int _{\Omega }{\frac {\partial w}{\partial x}}~{\frac {\partial T}{\partial x}}~dx=\left.w~\left({\frac {\partial T}{\partial x}}\right)\right|_{\Gamma }~\qquad \leftarrow \qquad {\text{Symmetric Weak Form}}~.}$

### Part 2

What are the expressions for the components of the finite element stiffness matrix ($K_{ij}$) and the load vector ($f_{i}$) for this 1-D problem?
The stiffness matrix terms are
    ${K_{ij}^{e}=\int _{\Omega ^{e}}{\frac {\partial N_{i}^{e}}{\partial x}}{\frac {\partial N_{j}^{e}}{\partial x}}~dx}$
The load vector terms are
    ${f_{i}^{e}=\left.N_{i}^{e}\left({\frac {\partial T}{\partial x}}\right)\right|_{\Gamma ^{e}}~}$

### Part 3

Assume that the one of ends of the rod is maintained at a temperature of $T_{1}$ (which is nonzero) and the other end has a prescribed heat flux of $Q_{2}$. If we discretize the rod into two elements, what does the reduced finite element system of equations look like?You do not have to work out the terms of the stiffness matrix - just use generic labels.
The finite element system of equations for a two element mesh (with linear shape functions) is
    ${\begin{bmatrix}K_{11}&K_{12}&0\\K_{12}&K_{22}&K_{23}\\0&K_{23}&K_{33}\end{bmatrix}}{\begin{bmatrix}T_{1}\\T_{2}\\T_{3}\end{bmatrix}}={\begin{bmatrix}f_{1}\\0\\Q_{2}\end{bmatrix}}$
If $T_{1}$ is not zero, the reduced system of equations will be
    ${{\begin{bmatrix}K_{22}&K_{23}\\K_{23}&K_{33}\end{bmatrix}}{\begin{bmatrix}T_{2}\\T_{3}\end{bmatrix}}={\begin{bmatrix}-K_{12}T_{1}\\Q_{2}\end{bmatrix}}~.}$

### Part 4

Now, assume that the thermal conductivity of the material varies with temperature. What form does the governing equation take? (We will call this the modified problem.)
If the thermal conductivity ($\kappa$) is a function of temperature, the governing equation takes the form
    ${\frac {\partial }{\partial x}}\left(\kappa (T){\frac {\partial T}{\partial x}}\right)=0~.$
Since $\kappa$ is a function only of temperature, we can take it outside the derivative to get
    $\kappa (T){\frac {\partial ^{2}T}{\partial x^{2}}}=0\qquad \implies \qquad {{\frac {\partial ^{2}T}{\partial x^{2}}}=0~.}$
The equation does not change!

### Part 5

List the steps needed to solve the modified problem using finite elements.
The standard steps for a linear ODE are applicable.
* Derive the symmetric weak form.
* Substitute the approximate solution into the weak form and find the symmetric element stiffness matrix and element load vector.
* Assemble global stiffness matrix and load vector.
* Apply boundary conditions.
* Solve.