CFDofReactiveFlows Save

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)

Project README

CFDofReactiveFlows

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)

1. Advection-diffusion equation in 1D with the Finite Difference (FD) method

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.

2. Advection-diffusion equation in 2D with the Finite Difference (FD) method

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.

3. Poisson equation in 2D

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

4. Navier-Stokes equations in 2D: vorticity-streamline formulation

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.

5. Advection-diffusion equations in 1D with the Finite Volume (FV) method

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.

  • Diffusion equation with explicit (forward) Euler method and centered differencing scheme. Matlab script: diffusion_1d.m
  • Diffusion equation with implicit (backward) Euler method and centered differencing scheme. Matlab script: diffusion_1d_implicit.m
  • Steady-state advection-diffusion equation with implicit (backward) Euler method and several discretization schemes for the advective contribution (centered, upwind, hybrid, power-law). Matlab script: steady_advection_diffusion_1d_implicit.m
  • Steady-state advection-diffusion equation with implicit (backward) Euler method and QUICK scheme for the discretization of the advective contribution. Matlab script: steady_advection_diffusion_1d_implicit_quick.m

6. Navier-Stokes equations in 2D: staggered grid and projection algorithm

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.

Extensions/Modifications

7. Navier-Stokes equations in 2D: examples

Taylor-Green vortex in 2D

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.

A. Utilities

Collection of utility functions for linear algebra, pre- and post-processing, analysis of data, etc.

  • TDMA (TriDiagonal Matrix Algorithm) for solving tridiagonal linear systems of equations. Matlab script: tridiagonal.m

B. Homework

Homework 1

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.

Homework 3

Numerical solution of Poisson and advection-diffusion equation in 2D using the the finite-differencing scheme. Comparison with analytical solutions.

Homework 4

Numerical solution of Navier-Stokes equations via the vorticity-streamline function method. Application to the driven cavity test case.

Open Source Agenda is not affiliated with "CFDofReactiveFlows" Project. README Source: acuoci/CFDofReactiveFlows
Stars
67
Open Issues
1
Last Commit
2 years ago
License

Open Source Agenda Badge

Open Source Agenda Rating