The unsteady convection equation for a concentration that is convected with velocity is:
For unsteady problems we will use the method of lines. After performing a spatial discretization the resulting set of ODE’s has the form:
where is the column vector that contains the concentrations, , where is the label of the grid cell.
You are asked to implement the one-component convection equation using the method-of-lines described above, using different spatial discretization methods, namely, upwind, central differencing and a total variance diminishing (TVD) scheme. For the time integration use a standard IVP solver.
Suggested approach:
Use NumPy arrays to store the concentrations, , and right hand side, , at different axial positions .
Prefer using NumPy array indexing notation over for loops for element-wise operations. This approach leverages NumPy’s optimized performance and often results in more readable and efficient code.
For each method, plot axial concentration profiles for several times.
Compare your results with an analytical solution of the problem to verify your code.
Play with the number of grid points used in the spatial discretization.
Questions:
Implement upwind discretization, where
Implement central differencing, where
Implement a TVD scheme, e.g. Min-Mod, for the convection. See lecture notes for the scheme.