This repo contains a few fun examples of computational fluid dynamics and their code written by Jie on MATLAB.

- Isentropic Vortex
- 2D Incompressible Cylinder
- Multidimensional Diffusion
- Lid-Driven Square Cavity Flow

The simulation marches in time in a periodic domain of length Lx = Ly = 20. The Euler Solver makes use of the 2nd central finite difference scheme in space and the 4th Runge-Kutta method in time. The final time is t =20. The Euler set of fluid equation are quasilinear hyperbolic equations, it governs the adiabatic and inviscid flow. The distinction between the Euler set and the infamous Navier-Stokes equations is the neglection of the viscosity within the fluid. This is an important assumptions once one wants to study the drag effect.

The current vortex strength is set to R = 1.5, Mach number is 0.4 and the characteristic radius gamma is 1.4. For more information you can consult here.

The conserved variable are stored as follows:

Once the field has been initialized, we can start marching the solution in time (RK4,4) with a central scheme.

source: [Spiegel, Seth & Huynh, H.T. & DeBonis, James. (2015). A Survey of the Isentropic Euler Vortex Problem using High-Order Methods. 10.2514/6.2015-2444. ]

The solver used is the Python based PyFR, which is a FEM method using the Discontinuous Galerkin Method.

The implementation uses a time-step and pseudo time-step of size 1.25e-2 & 2.5e-3 respectively. For the complete configuration you can visit the folder 2D Incompressible Cylinder. As well as the official website, PyFR.

The repeating pattern of swirling vortices are called vortex shedding and commonly known as von Kármán vortex street. They form downstream of a blunt body and can happen within a certain range of flow velocities. They are responsible for aeroelastic flutter which are of concern for bridges and skyscraper design.

The image above shows the island, which is located a few hundred kilometers off the west coast of Mexico and the southern tip of Baja California, is part of the Revillagigedo Archipelago.

source: [Huynh, H.T.. (2007). A Flux Reconstruction Approach to High-Order Schemes Including Discontinuous Galerkin Methods. AIAA Paper AIAA 20074079. 1-42. ]

The heat distribution in a solid body obeys the heat equation:

Where the beta is the heat diffusivity. The Courant–Friedrichs–Lewy (CFL) used in this simulation is 0.25. The CFL is a stability criterion in order to reach convergence in hyperbolic PDEs.

The square lid-driven cavityis a widely used canonical simulation to validate numerical methods. The simulation works as the following, it has no-slip condition on each wall except the lid. Which has a constant velocity component, as shown on the schematic.

The numerical method did not change but now we need to take into the viscous effect into consideration. In essence, this will result in a intermediate computation for each time step. Furthermore, the Reynolds Number for this simulation has been calibrated to 100.

The inviscid part is the contribution from Euler equations, refer to the Isotropic Vortex section. The viscous effect fluxes are:

The new term are the heat flux and shearing stresses.

Similarly to before, for every derivative we use the central scheme to approximate it. The final result:

To validate, the result have been compared with values from Ghia[2009].

source: [Marchi, Carlos & Suero, Roberta & Araki, Luciano. (2009). The Lid-Driven Square Cavity Flow: Numerical Solution with a 1024 x 1024 Grid. Journal of The Brazilian Society of Mechanical Sciences and Engineering - J BRAZ SOC MECH SCI ENG. 31. 10.1590/S1678-58782009000300004. ]