# Sample code for solving Lid-Driven cavity test (Re=1000) - Fortran 90

### From CFD-Wiki

Line 49: | Line 49: | ||

----------------------------------------------------------------- | ----------------------------------------------------------------- | ||

[[Image:Grid_annumeration_for_cavity.jpg]] | [[Image:Grid_annumeration_for_cavity.jpg]] | ||

+ | |||

+ | [[Image:Faces_annumeration_01.jpg]] | ||

[[Image:CavityRe1000.jpg]] | [[Image:CavityRe1000.jpg]] |

## Revision as of 18:17, 3 May 2010

*Dear friends*

*It's just a scrap. Later I'll correct it, although it's a complete working code -- Michail*

Sample program for solving Lid-Driven Cavity Test using SIMPLE-algorithm
**Copyright (C) 2010 Michail Kiričkov ,Lithuania, Marijampole**

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

**Short description**

In this program general transport equation for scalar transport is solved.
Because it was primarily developing program for learning, there was implemented an output for all variables in the txt format as well as for TECPLOT format.
Structured orthogonal uniform grid is used (now). All variables are saved in array **F(1:nx,1:ny,10)** which mean that 2D array for 10 variables.

Variables **F(:,:,1)** and **F(:,:,2)** represented U and V velocity components, and **F(:,:,4)**represented pressure.

Arrays **Xc** and **Yc** represents the coordinates of the CV centres, and **X** and **Y** - coordinates of grids nodes

- Main_Cavity.f90 - Main modul
- Common_incld.f90 - include module
- Init_all.f90 - Initiation of arrays
- Grid_rectangular.f90 - Calculation of grid
- Geometry.f90 - Calculation of geometric properties
- Init_all_cavity.f90 - Init data for lid-driven cavity test
- Solve_UV.f90 - Solution of the momentum equations for U and V
- HLPA.f90 - HLPA approximation for convective term
- Solve_Pressure_Correction.f90 - Solution of pressure-correction equation and correction of U,V and P
- TDMA.f90 - Solution of system of linear equations by Thomas method
- Convergence_Criteria.f90 - Calculation of convergence
- Out_array.f90 - Output into the .txt file