NasCar
|
This numerical code solves fluide-structure interactions problems based on the incompressible Navier-Stokes equations
This code, witten in C and based on PetsC, is devoted to solve 3D-flows in around moving and deformable bodies. The incompressible Navier-Stokes equations are discretized in space on Cartsesain grids using Finite Differences and Finites Volumes, and the bodies are taken into account thanks to penalization and/or immersed boundary methods. The interface between the fluid and the bodies is tracked with a level set function or in a Lagrangian way. The numerical code is fully second order (time and space). The temporal resolution of the incompressible Navier-Stokes equations is based on projection schemes of Chorin-Temam's type.
Installation (https://petsc.org/release/) and compilation
brew install petsc (all necessary librairies like MPI are aslo installed with petsc).
xcode-select –install (Possibly, you have also to install some necessary xcode command line tools)
make clean (or make mrproper) -> clean the working directory
make ns3d -> compilation to create execution file ns3d
make run -> execution of code (if more than 1 million of degrees of freedom are used, you may have to consider using a scheduler and a batch file)
make doc -> this documentation is generated by doxygen
The input parameters defining the flow configuration are read in the *.DAT files, depending on the test case read in TEST_CASES.DAT
The results are written in some directories
- Results: the temporal evolutions of some quantities like drag, lift, energy, ...
- Solution: snapshots of some flow fields like velocity, pressure, vorticity, ...
- Body: body mesh geometry with surface pressure, drag, lift, ...
Eaxmples of numerical simulations:
General structure of the code
The main program is main.c
the struc.h defines the necessary variables
The files TEST_CASE.DAT, INPUT.DAT (or TEST1.DAT, TEST2.DAT, TEST3.DAT or TEST4.DAT, depending of the choice made in TEST_CASE.DAT) are read in initialisations.c
the arrays defined in struct.h are allocated with dimensions read in INPUT.DAT in Alloc.c
the petsc vectors are created in Vectors.c
Some other Petsc creations (the grid) are in main.c
Initial conditions (for velocity, pressure, etc) are defined in initialisations.c
Different body geomeries can be used (choice in INPUT.DAT), like fish (Body_Fish.c), rings or torus (Body_Anneau.c, Body_Tore.c)
(1) Resolution of the incompressible Navier-Stokes equations with Chorin-Temam [13] [23] factional step methodAll the next steps are iterativeley computed in a temporal loop, where the time step is comptuted in dedicated function in Prediction.c
The momentum equation is solve using a pressure guess in Prediction.c, where the stress tensor is computed in Stress.c: The stress tensor can be fluid or elastic (Navier model with Mooney Rivlin [17]). The numerical schemes for convective and diffusive terms can be chosen in INPUT.DAT (upwind, centered, WENO5, explicit or iplicit). The bi-fluid interface is defined using the CSF method [11]
The Poisson equation is solved in Poisson.c
(2) Computation of the body motion: imposed or passive deformation + rigid motionThe pressure and velocity fields are corrected in Correction.c to have a solenoidal velocity field (mass conservation)
Compute the aerodynamic forces and torques [18] in CoefAero.c
Compute the body deformation (with procrustes analysis [3]) and motion in Body_***.c files, for instance Body_Dolphin2.c for the dolphin test case
Compute the Level Set function [19] [21] from Body Lagrangian markers in LevelSet.c
Penalisation [1] or IPC [7] step to impose to take into account the body in the Navier-Stokes equations in Penalisation.c
(3) Time to time, export the field solutionsTransport the bi-fuid or fluid-elastic structure intefaces in Transport.c, togheter with some reinitialisation steps [16]. For fluid-elastic structure problems, extrapolation [2] of the backward characteristics is performed in Extrapol.c
The fields solutions are exported in directory 'Solution' using Export.c
The body geometry, with surface informations (normals, stress, pressure, etc) are written in the 'Body' directory using Export.c
The temporal evolutions of some quatities of interest (drag, lift, power, etc) are written in the 'Results' directory by main.c
When the temporal loop is over, delete/deallocate all variables using functions in Alloc.c and Vectors.c