Skip to content

This repository contains a Fortran implementation of a 2D flow using the projection method, with Finite Volume Method (FVM) approach. The code solves Navier Stokes equations in a 2D lid driven cavity, with computation of the rotational as well.

Notifications You must be signed in to change notification settings

DavidCico/Development-of-Navier-Stokes-code-by-projection-method

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Development-of-Navier-Stokes-code-by-projection-method

This code is a Fortran implementation of a 2D flow using projection method with FVM. Navier Stokes equations are solved for velocity and pressure fields. The rotational of velocity is also calculated, and the output data can be visualized with Ensight or Paraview.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

The code being implemented in Fortran 90, and Fortran being a compiled language, it requires a compiler such as GFortran.

In Ubuntu, Mint and Debian you can install GFortran like this:

sudo apt-get install gfortran

Alongside the GFortran compiler, the open-source platform for data analysis and visualization, ParaView, is also required and installed through the commands:

sudo apt-get update
sudo apt-get install paraview

Paraview is preferred compared to Ensight as it is free and open-source, so that everybody can use it.

For other Linux flavors, OS X and Windows, packages are available at:

https://gcc.gnu.org/wiki/GFortranBinaries for GFortran
https://www.paraview.org/download/ for ParaView

File descriptions

  • '*.f90' files in which the main code, as well as the different subroutines are programmed.
  • 'Makefile' to compile the code.
  • In the directory 'Documents', there are 3 files in PDF format:
    • 2 papers 'cavityflow.pdf' and 'ghia82.pdf', which treat of the lid driven cavity problem for incompressible flows.
    • 'Program_presentation.pdf' which describes all the steps followed in the code implementation.

Running the program

  1. Input numerical values for the mesh size and viscosity, in the file 'variables module.f90'.
! Parameters for reading data to be modified
integer ,parameter :: nx=11,ny=11,nz=1 ! nx and ny correpond to the number of cells in x and y direction
real*8 ,parameter :: nu = 1e-02, dt2 = 1e-04 ! nu is the fluid viscosity and dt2 is the initial timestep. 
  1. Simulation parameters to be defined in the main program 'main.f90'.
!!! Parameters for the simulation
  zeta=1.e-8       ! zeta and itmax for solving pressure matrix in ICCG2 subroutines
  itmax=300
  time = 0.        ! initialize time of simulation
  nstep = 20000    ! number of timesteps for the simulation
  isto = 200       ! data stored every 'isto' steps
  1. Use the Makefile to compile all the files and create the executable (run the command 'make' while being in the main directory of the program).

  2. Launch the executable NS_lid_driven_cavity, which will create the mesh and run the discretised calculation on the latter.

  3. Observe the different fields (u, v, p and omega) on the domain using Paraview. Ensight6 and Ensight Gold formats are  normally supported by Paraview.

  4. Remove the created files thanks to the commands 'make clean' and 'make cleanall'.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

About

This repository contains a Fortran implementation of a 2D flow using the projection method, with Finite Volume Method (FVM) approach. The code solves Navier Stokes equations in a 2D lid driven cavity, with computation of the rotational as well.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published