Skip to content

A library-free and extremely simple two-dimensional incompressible Navier-Stokes solver

License

Notifications You must be signed in to change notification settings

NaokiHori/NS-Sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NS Sandbox

CI License Last Commit

thumbnail

An extremely simple two-dimensional incompressible Navier-Stokes solver designed to test various numerical algorithms.

Concept

The primary goal of this library is simplicity, allowing numerical methods, especially for multi-phase flows, to be easily and quickly implemented and tested without being encumbered by sub-critical tasks. To achieve this, the following approaches are adopted:

  • Euler-forward time-stepping
  • Fully-explicit diffusive treatments
  • No multi-process (e.g., MPI) parallelization

For the sake of transparency (and for fun), in-house Fourier transforms, linear matrix solvers, and matrix transpose routines are used, despite their sub-optimal performance.

Dependencies

Quick Start

  1. Clone the repository:

    git clone https://github.com/NaokiHori/NS-Sandbox
    cd NS-Sandbox
  2. Build the project:

    make all

    If your platform supports OpenMP:

    make ARG_CFLAG="-fopenmp" all

    Alternatively, you can directly modify the Makefile.

  3. Run the solver:

    make output
    ./a.out

    If your platform supports OpenMP:

    make output
    OMP_NUM_THREADS=4 ./a.out

    (This example uses four threads.)

Domain Size

For several reasons, the domain sizes (spatial resolutions and lengths) are defined in Makefile. Modify the corresponding parameter and re-build the entire source.

Multi-thread Parallelization

Even in two-dimensional domains, some level of parallelization is necessary. This project utilizes OpenMP for parallelization for convenience.

Note

For simplicity, all flow fields have NX + 2 by NY + 2 elements, regardless of the type of arrays. Here, NX and NY represent the degrees of freedom in the x and y directions, respectively. This approach simplifies the incorporation of different boundary conditions (wall-bounded, periodic, inflow-outflow).

About

A library-free and extremely simple two-dimensional incompressible Navier-Stokes solver

Topics

Resources

License

Stars

Watchers

Forks

Languages