An extremely simple two-dimensional incompressible Navier-Stokes solver designed to test various numerical algorithms.
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.
- C Compiler
- GNU Make
- OpenMP (optional)
-
Clone the repository:
git clone https://github.com/NaokiHori/NS-Sandbox cd NS-Sandbox
-
Build the project:
make all
If your platform supports
OpenMP
:make ARG_CFLAG="-fopenmp" all
Alternatively, you can directly modify the
Makefile
. -
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.)
For several reasons, the domain sizes (spatial resolutions and lengths) are defined in Makefile
.
Modify the corresponding parameter and re-build the entire source.
Even in two-dimensional domains, some level of parallelization is necessary.
This project utilizes OpenMP
for parallelization for convenience.
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).