osinco3d
November 13, 2025 · View on GitHub
| This project is a Fortran90 Computational Fluid Dynamics (CFD) code designed to solve the 3D Navier-Stokes equations for incompressible flow using a high-order finite difference method. |
|
Table of Contents
Summary
- Prediction-correction method: Utilizes the Chorin method.
- Time integration schemes: Euler, Adams-Bashforth 2nd order (AB2), or Adams-Bashforth 3rd order (AB3).
- Spatial discretization schemes: Finite differences.
- First derivatives: 6th order.
- Second derivatives: 4th order.
- Poisson equation solver: Successive Over-Relaxation (SOR) method with a 2nd order finite differences scheme.
- Boundary conditions: Periodic or free-slip conditions in all directions and Dirichlet conditions in the x-direction only.
- Large Eddy Simulation: Standard Smagorinsky model
- Visualization:
- 2D: Using Gnuplot.
- 3D: Using ParaView (XDMF format).
- Programming language: Fortran90.
- Configuration: Single parameter file
parameters.o3d. - Executable: The executable file is named
osinco3d.app.
Installation
Clone the repository:
git clone git@github.com:jojoledemago/osinco3d.git
cd src/
make
Use make clean to clean compilation directory
Usage
Got to the bin directory:
cd bin
Edit the paramters file: parameters.o3d
./osinco3d.app
Contributing
I am looking to parallelize the code using the MPI library and to implement a non-reflective outflow condition at . If you're interested in contributing, please feel free to help with these tasks.
Parameters
The parameters.o3d file contains various parameters that control the simulation. Here's a description of each parameter group:
FlowParam
typesim: type of simulation- 0: read data from
fields.binfile - 1: Convected vortex
- 2: Taylor-Green vortex
- 3: Planar Jet
- 4: Co-planar Jet
- 5: Mixing Layer
- 6: Vortex Merge
- 0: read data from
l0: characteristic size of the flow fieldu0: characteristic velocity of the flow fieldre: Reynolds number of the flow, defined as ( is the kinematic viscosity)ratio: ratio between the maximum and minimum velocity in the domain. This parameter depends on the simulation typetypesim
Domain
nx,ny,nz: number of discretisation points in each direction (, , )xlx,yly,zlz: sizes of the computational domain in each directionx0,y0,z0: origin of the computational domain in each direction
BoundaryConditions
nbcx1,nbcxn: BC for x-direction at faces 1 and nxnbcy1,nbcyn: BC for y-direction at faces 1 and nynbcz1,nbczn: BC for z-direction at faces 1 and nz- 0: Periodic
- 1: Free Slip
- 2: Dirichlet, only for x-direction
sim2d: Set 1 to execute a 2D simulation
AdvanceTime
itscheme: time integration scheme- 1: Euler
- 2: second-order Adams-Bashforth
- 3: third-order Adams-Bashforth
cfl: Courant-Friedrichs-Lewy (CFL) number, a criterion for numerical stability, defined asirestart- 1: restart simulation from
fields.binfile (only valid fortypesim = 0) - 0: start a new simulation
- 1: restart simulation from
itstart: Index of the first time stepitstop: Index of the last time step
PoissonEq
omega: relaxation coefficient for the Successive Over-Relaxation (SOR) method. The theoretical optimum is:idyn: If 1, the relaxation coefficient is calculated dynamically at each iteration.eps: convergence criterion for the iterative solverkmax: maximum number of iterations allowed for the solver
Scalar (optional)
nscr: flag to enable scalar equation resolution (set to 1)sc: Schmidt number, defined as (D is the scalar diffusivity)
VisuParameters
nfre: frequency of saving data for visualization (XDMF format)nsve: frequency of saving data for post-processinginitstat: time after which statistics are collectedxpro,ypro,zpro: coordinates of the cut plane for 2D visualization (Gnuplot format)
InitInflow
iin: inlet boundary condition type (0: classical, 1: turbulent)inflow_noise: turbulence intensity at the inlet boundary (0 to 1), representing a fraction of the characteristic velocityu0ici: initial condition type (0: classical, 1: oscillation, 2: noise, 3: both)init_noise: turbulence intensity for the initial condition (0 to 1), representing a fraction of the characteristic velocityu0
LES
iles: If 1, Large Eddy Simulation is enabledcs: Samgorinsky constant to evaluate