Professional Documents
Culture Documents
We have been given the steady-state convection-diffusion equation in 1D:
…… (1)
Here, the first term on the left-hand side(LHS) is the advective/convective term and that on
the right-hand side(RHS) is the diffusion term. In this type of a problem, the diffusion balances
the convection in a physical sense.
We assume that , u and are constants. These values are given as:
= 1.0
u = 1.0
= 0 at x=0
= 1.0 at x=L
These values won’t be constant in a general scenario as they depend on the temperature and
velocity field in the domain. But for simplicity purposes, we assume them to be constant in
this case.
Also, L = 1 Peclet Number = 50
……. (2)
Now, we approximate the derivatives in the above equations. We apply the central difference
method for the diffusive term and the forward difference method for the advective term. We
get,
Note: Here, we take the partial derivative at the points halfway between and and
points and . This gives us a more elegant and solvable form of the equation.
Since we have a uniform grid, is equal across all the divisions.
Using these in the discretized equation (2), we get:
Here, we have = Length of domain divided by the number of divisions. We can see from the
figure that the . So, we get:
... (3)
Solution Method:
We now apply these equations for various nodes in our domain. For the left boundary
condition, we get:
Similarly, for the right boundary condition,
For intermediate nodes, we get the equations of the form (3) with i = 3,4,5...9.
We get a matrix with three diagonal arrays filled and others as zero. This matrix looks like:
For this type of matrices, we use the Thomas Algorithm. This algorithm is the improved
version of LD decomposition method where we disregard the trivial elements of the matrix
and work only on the non-trivial ones. This helps save memory and ensures faster calculations.
Using this approach in Matlab, we get a solution matrix as follows:
The graph of versus x looks like:
Analytical Solution:
In order to validate the results obtained in the above numerical solution, we formulate the
analytical solution for the above equation.
So, we have the original partial differential equation:
We can write as:
The values of the constants can be found out using the boundary conditions provided in the
Problem Statement. We get:
Substituting the values of and , we get
Plotting the above equation in Matlab, we get the function graph:
This graph is in accordance with the predicted curve. Since the Peclet number is large, the
curve increases gradually and then suddenly to the final values within a very short
distance(from x= 0.9 to x=1.0). This critical area is essential when we test a particular
numerical solution strategy.
Comparing with the numerical solution:
We observe that the numerical solution is nowhere close to the exact solution. This could be
because the delta x is relatively bigger compared to the length of the domain. Also, the
differentiation approximation used is the ones with the least order i.e. least accuracy. This
leads to a large truncation error in the solution.
Central Differencing for both terms
Now, for the differential approximation, we use the central differencing method for both the
diffusion and advection terms. So, we get
And
Substituting these in the discretized equation (1), we get the general form of the equation:
This equation is used for nodes i = 3,4,...9
For the leftmost node, we get
Similarly, for the rightmost node, we get
Combining all the equations in a matrix form, we get
We use the Thomas Algorithm to solve these sets of linear algebraic equations.
We get the functional graph of the solution set as:
Comparing with the analytical solution:
We observe a definite improvement in the solution in comparison with the exact solution.
However, the solution is highly oscillating and is not stable. This is generally the case with
CDS approximation. This causes the values to be exact at some points but highly incorrect in
other cases. These oscillations are caused due to the sudden changes in the gradient values in
the neighbouring points.
Effect of Peclet number on the numerical and exact solution:
We change the Peclet number from 50 to 18. This changes the analytical solution to this:
Plotting this equation in Matlab, we get:
Exact Solution with Pe=18
Here, the red line is the original graph with Peclet number 50 while the blue graph is the one
with Peclet number 18. We see that both the graphs approach infinity when x tends to infinity
but the overall slope of the red graph is much higher. Therefore, the higher the Peclet
number, the faster the function approaches infinity.
Now, redefining the upwinding numerical solution with the new Peclet number we get the
general equation:
This definition is valid for i = 3,4...9
For the leftmost node, we get
Similarly, for the rightmost node, we get
Combining all the above equations in the matrix form,
Solving this matrix form using the Thomas algorithm in Matlab, we get the following graphical
solution:
Comparing this with the exact solution:
We observe that the oscillations increased on decreasing the Peclet number. Also, the
solution is more accurate than the upwinding solution with higher Peclet number.
The CDS approximation leads to decrease of this oscillations and gives a fairly accurate
solution:
Effect of the number of nodes:
We replicate the above procedures for 41 nodes.
The analytical solution remains the same. The generalized discretized equation for the
upwinding approximation changes because of the change in
Also, the number of linear algebraic equations change. We now need to solve 39 equations
instead of 9. The matrix representation is very huge with 39 rows and columns. The final
graphical solution, however, looks like:
Comparing this with the exact solution:
There is a brilliant improvement in the solution. The upwinding solution gives a fairly accurate
measure of except when the solution starts increasing towards infinity. There are still some
oscillations in that particular area (x=0.9 to x =1.0).
The upwinding numerical approximation is over-diffusive i.e. the graph corresponds to the
exact solution with a lower Peclet number.
Now, for the central differencing approximation, the generalized equation changes to:
The graphical solution for the numerical method is:
Comparing this with the exact solution,
Increasing the order of approximation gives us an almost perfect solution.
Now, for the reduced Peclet number, the exact solution is :
And the general discretized equation for the upwind approximation is:
So, graphical representation of the numerical solution:
Comparing with the exact solution:
We see that the overall shape of the numerical solution is close to that of the numerical
solution. However, there is still an error in the sensitive area of x=0.7 to x=1.0.
Note: All the variations of the upwinding approximation can be calculated using the same
code by substituting the appropriate variable values in the number of nodes and Peclet
number. Same goes for the central approximation.
Higher-Order Schemes:
We now examine the effect of the higher-order schemes on the solution. Intuitively, we
understand that higher the order of the approximation for the differentiation, more accurate
the solution. We try to see this in practice.
First, we maintain the central differencing scheme for the diffusive term and increase the
order of accuracy of the advective term from second to third-order accurate. So, we
substitute the following approximations in the governing equation:
We get the generalized discretized form of the equation:
The equation at the leftmost node,
The equation at the rightmost node,
Assembling the 38 equations in matrix form but 39 variables i.e. ... .
So, we add one more equation to the set using a lower order scheme. We use the central
differencing approximation(2nd order accurate) for both the terms. We get the generalized
equation:
Applying for the leftmost node,
Combining these 39 equations into matrix form and solving the system using Gauss
elimination method, we get the graphical solution:
Comparing with the exact solution:
The solution is almost exact other than the area of x=0.9 to x=1.0. However, we get a much
better solution when we use central difference approximation with the same number of
nodes. This shows that applying a higher-order scheme does not always guarantee a better
solution.
Similar strategies could be used to implement other higher-order schemes. The results go on
becoming more and more accurate. Although, the complexity of the equations increases
considerably. Also, the generalized equations become harder to implement at the boundary
nodes. All these factors become important to analyse before increasing the order of accuracy
of the equations mindlessly.
Non-Uniform Grids
All the discussion so far has been with respect to a uniform grid with varying . We now
consider a non-uniform grid, more specifically, a compound interest grid. We assume the
number of nodes to be 11 including the boundaries. The discretized domain looks like the
following:
To find the initial ‘d’, we use the formula for the sum of a finite geometric progression.
... = L = 1.0
...
Here, we take, r = 2
So we get,
Now, for this non-uniform grid, the approximations for differentiations also change. We use
backward difference approximation for convective term and CDS for diffusive term.
Substituting and simplifying, we get:
Assembling all these equations and solving in Matlab using the Thomas algorithm, we get the
following graphical solution:
Here, the red line represents the exact solution.
Although the solution is not very accurate overall, the error in the beginning is low. At the end
where there is a considerable amount of change in function, the divisions are larger. So, the
solution becomes less accurate towards the end.
Now, if we reverse the scheme such that the bigger divisions come towards the beginning
instead of the end. We change r = 2 to r = 0.5. This will ensure smaller divisions towards the
end.
The solution looks like this:
Again, the red line represents the exact solution.We observe that the numerical solution has
come considerably closer to the exact solution. This is because we corrected the error that
came up in the previous case. The overall error in both cases is also due to the use of
backward difference approximations which is not very accurate. We also notice that
non-uniform grids don’t always guarantee a more accurate solution.
This accuracy further increases if we increase the number of nodes and improve the order of
accuracy.
Concluding Remarks:
● The central difference approximation gives a more accurate solution due to the lower
truncation error. It also leads to a higher number of oscillations in the solution.
● The upwind difference approximation leads to an over-diffusive solution, the apparent
diffusion in the obtained solution is more than the exact.
● A reduced Peclet number leads to an increase in the number of oscillations in the
solution. Also, the analytical solution approaches infinity slower.
● Refining the grid leads to a more accurate solution as the CDS oscillations reduce.
● Higher order schemes give a more accurate solution than the upwinding solution with
a lower order scheme due to lesser truncation error.
● A higher order scheme does not necessarily guarantee a more accurate solution.
● A non- uniform grid gives a fair estimation of the solution when configured properly. It
is not really necessary for simple problems with a basic governing equation.