To find the finite element solution, we can either start with the
strong form and derive the weak form, or we can start with a weak form
derived from a variational principle.
Let us assume that the approximate solution is
and plug
it into the ODE. We get
![{\displaystyle AE{\cfrac {d^{2}\mathbf {u} _{h}}{dx^{2}}}+a\mathbf {x} =R_{h}(\mathbf {x} )}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f952683cc656aed6bc62331dca40a3654a414474)
where
is the residual. We now try to minimize the residual in a weighted average sense
![{\displaystyle \int _{0}^{L}R_{h}(\mathbf {x} )\mathbf {w} (\mathbf {x} )~dx=0}](https://wikimedia.org/api/rest_v1/media/math/render/svg/7fc4696da41684882218d779e3be75feaa239c68)
where
is a weighting function. Notice that this equation is similar to equation (5) (see 'Weak form: integral equation') with
in place of the variation
. For the two equations to be equivalent, the weighting function must also be such that
.
Therefore the approximate weak form can be written as
![{\displaystyle {\int _{0}^{L}AE{\cfrac {d\mathbf {u} _{h}}{dx}}{\cfrac {d\mathbf {w} }{dx}}~dx=\int _{0}^{L}\mathbf {q} \mathbf {w} ~dx+\left.{\boldsymbol {R}}~\mathbf {w} \right|_{x=L}~.}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/17417f96b1a0c904acbcefcdfa024d678007a76f)
In Galerkin's method we assume that the approximate solution can
be expressed as
![{\displaystyle \mathbf {u} _{h}(\mathbf {x} )=a_{1}\varphi _{1}(\mathbf {x} )+a_{2}\varphi _{2}(\mathbf {x} )+\dots +a_{n}\varphi _{n}(\mathbf {x} )=\sum _{i=1}^{n}a_{i}\varphi _{i}(\mathbf {x} )~.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/806f8acf0c9066733fa1c4c35b879eac66c267b1)
In the Bubnov-Galerkin method, the weighting function is chosen to be of the same form as the approximate solution (but with arbitrary coefficients),
![{\displaystyle \mathbf {w} (\mathbf {x} )=b_{1}\varphi _{1}(\mathbf {x} )+b_{2}\varphi _{2}(\mathbf {x} )+\dots +b_{n}\varphi _{n}(\mathbf {x} )=\sum _{j=1}^{n}b_{j}\varphi _{j}(\mathbf {x} )~.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f8f506b3646ca20d8b115491ab70ae17b6d6bdba)
If we plug the approximate solution and the weighting functions into
the approximate weak form, we get
![{\displaystyle \int _{0}^{L}AE\left(\sum _{i=1}^{n}a_{i}{\cfrac {d\varphi _{i}}{dx}}\right)\left(\sum _{j=1}^{n}b_{j}{\cfrac {d\varphi _{j}}{dx}}\right)~dx=\int _{0}^{L}\mathbf {q} \left(\sum _{j=1}^{n}b_{j}\varphi _{j}\right)~dx+\left.{\boldsymbol {R}}~\left(\sum _{j=1}^{n}b_{j}\varphi _{j}\right)\right|_{x=L}~.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/1cd540f886debecbcfd725597029578070818308)
This equation can be rewritten as
![{\displaystyle \sum _{j=1}^{n}b_{j}\left[\int _{0}^{L}AE\left(\sum _{i=1}^{n}a_{i}{\cfrac {d\varphi _{i}}{dx}}{\cfrac {d\varphi _{j}}{dx}}\right)~dx\right]=\sum _{j=1}^{n}b_{j}\left[\int _{0}^{L}\mathbf {q} \varphi _{j}~dx+\left.\left({\boldsymbol {R}}~\varphi _{j}\right)\right|_{x=L}\right]~.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/08eb686776c56bd4516969ddbf1bf2d5056f4f42)
From the above, since
is arbitrary, we have
![{\displaystyle \int _{0}^{L}AE\left(\sum _{i=1}^{n}a_{i}{\cfrac {d\varphi _{i}}{dx}}{\cfrac {d\varphi _{j}}{dx}}\right)~dx=\int _{0}^{L}\mathbf {q} \varphi _{j}~dx+\left.{\boldsymbol {R}}~\varphi _{j}\right|_{x=L}~,~j=1\dots n.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/5b9b3a98fae865b14cc7e89b0c1ecacc99e884f0)
After reorganizing, we get
![{\displaystyle \sum _{i=1}^{n}\left[\int _{0}^{L}{\cfrac {d\varphi _{j}}{dx}}AE{\cfrac {d\varphi _{i}}{dx}}~dx\right]a_{i}=\int _{0}^{L}\varphi _{j}\mathbf {q} ~dx+\left.\varphi _{j}{\boldsymbol {R}}\right|_{x=L}~,~j=1\dots n}](https://wikimedia.org/api/rest_v1/media/math/render/svg/52e2732f97d7b1db49e5bb7d99fbea509f424821)
which is a system of
equations that can be solved for the unknown coefficients
. Once we know the
s, we can use them to compute approximate solution. The above equation can be written in matrix form as
![{\displaystyle \mathbf {K} \mathbf {a} =\mathbf {f} \qquad \leftrightarrow \qquad K_{ji}a_{i}=f_{j}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/478de54d431afc46ef49d890861df138cf2f868a)
where
![{\displaystyle \mathbf {K} =\int _{0}^{L}\mathbf {B} ^{T}\mathbf {D} \mathbf {B} ~dx\qquad \leftrightarrow \qquad K_{ji}=\int _{0}^{L}{\cfrac {d\varphi _{j}}{dx}}AE{\cfrac {d\varphi _{i}}{dx}}~dx}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ac0dfa6a47be99ca4fe126bdf01fcc25188efe14)
and
![{\displaystyle f_{j}=\int _{0}^{L}\varphi _{j}\mathbf {q} ~dx+\left.\varphi _{j}{\boldsymbol {R}}\right|_{x=L}~.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/d303583a3ddeeb0daad3227c85da93ee72cece1f)
The problem with the general form of the Galerkin method is that the
functions
are difficult to determine for complex domains.