# Nonlinear finite elements/Axial bar weak form
## Axially loaded bar: Weak Form

Instead of deriving the differential equation using a balance of forces on a differential element, we may arrive at the same problem description via a different route - the principle of virtual work (also called the variational approach).
If we imagine there were forces (virtual forces) inside and outside of the bar, then the virtual work generated by these 'virtual forces' should conserve energy. For the bar, this principle can be stated as
    $\delta W_{\text{int}}=\delta W_{\text{ext}}+\delta W_{\text{body}}\,$
where $\delta W_{\text{int}}\,$ is the virtual work of the internal forces, $\delta W_{\text{ext}}\,$ is the virtual work of the external forces, and $\delta W_{\text{body}}\,$ is the virtual work of the body forces.
The virtual internal work is given by
    $\delta W_{\text{int}}=A\int _{0}^{L}{\boldsymbol {\sigma }}~\delta {\boldsymbol {\varepsilon }}~dx~.$
The virtual work done by the external forces is given by
    $\delta W_{\text{ext}}=\left.\mathbf {R} ~\delta \mathbf {u} \right|_{\mathbf {x} =L}~.$
The virtual work done by the body forces is given by
    $\delta W_{\text{body}}=\int _{0}^{L}\mathbf {q} ~\delta \mathbf {u} ~dx~.$
The principle of virtual work for the bar can then be expressed as
    $A\int _{0}^{L}{\boldsymbol {\sigma }}~\delta {\boldsymbol {\varepsilon }}~dx=\int _{0}^{L}\mathbf {q} ~\delta \mathbf {u} ~dx+\left.\mathbf {R} ~\delta \mathbf {u} \right|_{\mathbf {x} =L}~.$
Now, the stress and the virtual strain expressed in terms of the displacements are
    ${\boldsymbol {\sigma }}=E{\cfrac {d\mathbf {u} }{dx}}\qquad {\text{and}}\qquad \delta {\boldsymbol {\varepsilon }}={\cfrac {d(\delta \mathbf {u} )}{dx}}~.$
Therefore, we have
    $A\int _{0}^{L}E{\cfrac {d\mathbf {u} }{dx}}{\cfrac {d{\delta \mathbf {u} }}{dx}}~dx=\int _{0}^{L}\mathbf {q} ~\delta \mathbf {u} ~dx+\left.\mathbf {R} ~\delta \mathbf {u} \right|_{\mathbf {x} =L}~.$
Note that the virtual displacement $\delta \mathbf {u} \,$ is zero at points on the boundary where displacements are prescribed.
The above equation is called the variational form or weak form of the problem.

### Why is it called a variational form?

Let us start with the weak form. Using the formula for the first variation (from variational calculus)
    $\delta (x^{2})=2~x~\delta x\,$
we have
    $A\int _{0}^{L}E~{\cfrac {d\mathbf {u} }{dx}}~{\cfrac {d\delta \mathbf {u} }{dx}}~dx=A\int _{0}^{L}{\cfrac {E}{2}}~\delta \left({\cfrac {d\mathbf {u} }{dx}}\right)^{2}~dx=\delta \left[A\int _{0}^{L}{\cfrac {E}{2}}\left({\cfrac {d\mathbf {u} }{dx}}\right)^{2}~dx\right]~.$
Therefore, the weak form can be written as
    $\delta \left[\int _{0}^{L}\left({\cfrac {AE}{2}}~\left({\cfrac {d\mathbf {u} }{dx}}\right)^{2}-\mathbf {q} ~\mathbf {u} \right)~dx-\left.\mathbf {R} ~\mathbf {u} \right|_{\mathbf {x} =L}\right]=0~.$
This is equivalent to the following variational statement of the problem
where $\delta \,$ means variation in and $\delta \mathbf {u} \,$ is an arbitrary variation on $\mathbf {u} \,$ subject to the condition that $\delta \mathbf {u} (0)=0\,$.

### Principle of minimum potential energy

Note that the first term of $I$ is the strain energy stored and the next two terms are the potential energy of the external forces ($\mathbf {u} ,\mathbf {R}$ ). The above variational statement can also be interpreted as statement of minimum potential energy: the total potential of the system (elastic body and external forces) attains a stationary value when equilibrium is satisfied. Further more, this stationary value is minimum. This can be reinterpreted as of all the possible displacements, the actual displacement $\mathbf {u}$ minimizes the potential energy of the system.

## Equivalence of the strong and weak forms

The strong and weak statements of the problem are equivalent. Since finite elements uses the weak form of the problem statement, we can either derive the weak form from the strong form or using the principle of virtual work. The preferred approach is chosen on the basis of convenience.
We can derive the weak form from the strong form as follows. We multiply the strong form with an arbitrary virtual displacement (or weighting function) and integrate over the length of the bar. Thus
    ${\text{(5)}}\qquad \int _{0}^{L}\left(AE{\cfrac {d^{2}\mathbf {u} }{dx^{2}}}+\mathbf {q} \right)\delta \mathbf {u} ~dx=0~.$
Next, we integrate the first term of the equation by parts (to get rid of the higher order derivatives of $\mathbf {u}$) and get
    $\int _{0}^{L}AE{\cfrac {d\mathbf {u} }{dx}}{\cfrac {d(\delta \mathbf {u} )}{dx}}~dx=\int _{0}^{L}\mathbf {q} \delta \mathbf {u} ~dx+\left.AE{\cfrac {d\mathbf {u} }{dx}}\delta \mathbf {u} \right|_{0}^{L}~.$
Recall that $\delta \mathbf {u} (0)=0\,$ and $\mathbf {R} =AE{\cfrac {d\mathbf {u} }{dx}}$. Therefore, we have
    $\int _{0}^{L}AE{\cfrac {d\mathbf {u} }{dx}}{\cfrac {d(\delta \mathbf {u} )}{dx}}~dx=\int _{0}^{L}\mathbf {q} \delta \mathbf {u} ~dx+\left.\mathbf {R} ~\delta \mathbf {u} \right|_{x=L}~.$
This is the same as the weak form derived from the principle of virtual work.