In this section we will show how the convection-diffusion equation is implemented. We do this for the one-dimensional equation. See the users manual for the convection-diffusion (heat) equation:
where we take here for simplicity a prescribed temperature at
and
.
Multiplication with a weighting function (=test function)
and integration over the volume gives:
where is
at
and
but arbitrary otherwise.
Integration by parts of the conductive term, and moving everything to the right
gives for the residue
in the equation:
where the boundary terms resulting from the integration by parts disappear
because is 0 at
and
.
This form of the equilibrium equation is called the 'weak form'.
The weak form above is still perfectly equal to the heat equation.
Now, however, we start approximating with the finite element method.
The temperature field is approximated with finite element interpolation
functions
where
denotes the node number.
In the standard galerkin approach, the same functions for the
weighting field is used, so
is approximated with
.
Remark 1: we use indices
for the weighting function to prevent conflicting
indices of the temperature and weighting functions.
Remark 2:
can now be called a virtual temperature field, since it consists
of the same set of functions as the temperature field itself.
So:
and:
where is the position of node
, and summation convention is used.
For a two-noded linear element this would be:
and:
The weighting functions are substituted in the weak form of the equilibrium equation:
Now demanding that this is true for arbitrary nodal weighting function values gives
for each
:
The time derivative will be approximated with
the Euler backward scheme
.
Integrals are approximated by numerically integrating over a set of integration points.
The temperature
in the last expression is understood to be interpolated
by the finite element interpolation functions, and so depends on the
nodal temperatures
.
Thus the last expression gives a set of equations for the nodal temperatures
.
We now will discuss where the seperate terms in this expression are implemented
in the finite element program.
First we link terms from the expression for with the program source:
mathematical term | program |
![]() |
element_rhside |
![]() |
dens |
![]() |
condif_capacity |
![]() |
condif_flow |
![]() |
condif_conductivity |
![]() |
condif_absorption |
![]() |
element_volume_force |
![]() |
new_dof |
![]() |
old_dof |
![]() |
dtime |
![]() |
inol |
![]() |
h[inol] |
![]() |
new_d |
Different parts of are implemented in different routines.
First, it will be collected in the variable element_rhside.
Later, element_rhside will be used to fill node_rhsidewhich contains the residue
for the nodes.