Coder Social home page Coder Social logo

snytav / cfdofreactiveflows Goto Github PK

View Code? Open in Web Editor NEW

This project forked from acuoci/cfdofreactiveflows

0.0 0.0 0.0 1.31 MB

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)

License: GNU General Public License v3.0

MATLAB 91.62% C++ 8.38%

cfdofreactiveflows's Introduction

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.

cfdofreactiveflows's People

Contributors

acuoci avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.