Collection of codes in Matlab(R) and C++ for solving basic problems presented and discussed in the "Computational Fluid Dynamics of Reactive Flows" course (Politecnico di Milano)
Collection of codes in Matlab(R) and C++ for solving basic problems presented and discussed in the "Computational Fluid Dynamics of Reactive Flows" course (Politecnico di Milano)
The advection-diffusion equation is solved on a 1D domain using the finite-difference method. Constant, uniform velocity and diffusion coefficients are assumed. The forward (or explicit) Euler method is adopted for the time discretization, while spatial derivatives are discretized using 2nd-order, centered schemes.
The advection-diffusion equation is solved on a 2D rectangular domain using the finite-difference method. Constant, uniform velocity components and diffusion coefficients are assumed. The forward (or explicit) Euler method is adopted for the time discretization, while spatial derivatives are discretized using 2nd-order, centered schemes.
The Poisson equation is solved on a 2D rectangular domain using the finite-difference method. A constant source term is initially adopted. Spatial derivatives are discretized using 2nd-order, centered schemes. Different methods are adopted for solving the equation: the Jacobi method, the Gauss-Siedler method, and the Successive Over-Relaxation (SOR) method
The same Poisson equation is solved by explicitly assembling the sparse matrix corresponding to the linear system arising after the spatial discretization
The Navier-Stokes equations for an incompressible fluid are solved on a 2D rectangular domain according to the vorticity-streamline formulation. The vorticity advection-diffusion equation is solved using the forward Euler method and 2nd order, centered spatial discretizations. The streamline function Poisson equation is solved using the Successive Over-Relaxation method and 2nd order, centered discretization for the spatial derivatives.
The advection-diffusion equations are solved on a 1D domain using the finite volume method. Both explicit (forward) and implicit (backward) Euler methods are considered. Different discretization schemes for the advective term are implemented: centered, upwind, hybrid, power-law and QUICK.
The Navier-Stokes equations for an incompressible fluid are solved on a 2D rectangular domain meshed with a staggered grid. The momentum equations are solved using the forward Euler method and 2nd order, centered spatial discretizations. The projection algorithm is adopted for managing the coupling between pressure and velocity. In particular, the corresponding Poisson equation for pressure is solved using the Successive Over-Relaxation method and 2nd order, centered discretization for the spatial derivatives.
ode45
or ode15s
). Matlab script (square domain, uniform grid): driven_cavity_2d_staggered_2ndorder_reaction_operator_splitting.m
The Taylor-Green vortex is an exact closed form solution of 2D, incompressible Navier-Stokes equations. This 2D decaying vortex defined in the square domain, 0-2pi, serves as a benchmark problem for testing and validation of incompressible Navier-Stokes codes. The implementation here proposed is based on the Finite Volume Method (FV) applied on a staggered mesh and coupled with the Porjection Algorithm. Matlab script (square domain, uniform grid, FV): taylor_green_vortex_2d.m.
Collection of utility functions for linear algebra, pre- and post-processing, analysis of data, etc.
Numerical solution of advection-diffusion equation in 1D using the Forward Euler method and the centered 2nd order finite-differencing scheme. Comparison with analytical solutions.
Numerical solution of Poisson and advection-diffusion equation in 2D using the the finite-differencing scheme. Comparison with analytical solutions.
Numerical solution of Navier-Stokes equations via the vorticity-streamline function method. Application to the driven cavity test case.