A Fortran-based computational fluid dynamics (CFD) framework implementing the Immersed Boundary Method (IBM) to simulate the interaction between fluids and immersed structures such as cilia and elliptical particles.
Oscillation of a Morphing Particle Above Cilia Bed
IBMC simulates fluid-structure interactions using a fixed Eulerian grid for the fluid and a Lagrangian representation for immersed boundaries. The code is specifically designed to model:
- Ciliary structures - Flexible hair-like projections that can generate fluid motion
- Elliptical particles - Closed-loop structures with customizable aspect ratios
- Fluid-structure interactions - Two-way coupling between fluid flow and immersed structures
The solver implements a 2D incompressible Navier-Stokes solution coupled with immersed boundary forces using a projection method on a staggered grid.
- 2D incompressible flow solver
- Staggered grid arrangement
- RK2 time integration scheme
- Pressure-Poisson equation solver with AMGX acceleration
- Immersed boundary method with:
- Spring-connected ciliary structures
- Deformable elliptical particles
- Force coupling between structure
- Dynamic Resting Length: Features a novel implementation that allows for time-varying resting length of springs, enabling active cilia/particle motion
- Cell-based neighbor list for efficient particle-particle interactions
- NVTX instrumentation for NVIDIA profiling
The codebase is organized into the following modules:
| Module | Description |
|---|---|
mod_mesh |
Defines computational mesh and grid management |
mod_time |
Time advancement and Navier-Stokes solution methods |
mod_pressure |
Pressure Poisson solver and sparse matrix generation |
mod_amgx |
NVIDIA AmgX-based pressure solver acceleration |
mod_boundary |
Boundary condition implementations |
mod_particle |
Particle data structure for immersed boundary points |
mod_ib |
Immersed boundary representation |
mod_cilia |
Ciliary structure implementation |
mod_cilia_array |
Management of multiple cilia |
mod_closed_cilia |
Closed-loop (elliptical) particle implementation |
mod_ibm |
Core immersed boundary method functions |
mod_io |
Input/output routines |
mod_inter_particle_force |
Particle interaction forces |
mod_cell |
Cell data structure for neighbor lists |
mod_dims |
Dimension tracking utility |
ftn_c |
Fortran to C interface for AmgX |
nvtx |
NVIDIA Tools Extension for performance profiling |
- Fortran compiler (gfortran recommended)
- NVIDIA HPC SDK (for AmgX acceleration, optional)
- NVIDIA CUDA Toolkit (for AmgX acceleration, optional)
- Clone the repository:
git clone https://github.com/your-username/ibmc.git
cd ibmc- Build the executable:
make- Configure your simulation by editing
input_params.dat:
# Example configuration
&stype
simtype = 2/ # Simulation type (1=all, 2=cilia, 3=particle)
&time
dt = 0.0001, # Time step
it_save = 100, # Save interval
tsim = 28.0/ # Simulation duration
# ... other parameters
- Run the simulation:
./ibmc- View the results: Output files are generated in the current directory with the following naming conventions:
u_[timestep].txt- x-velocityv_[timestep].txt- y-velocityib_loc_c[timestep].txt- Cilia positionsib_loc_p[timestep].txt- Particle positions The provided matlab scriptcilia_vis.mcan be used for this purpose
The code supports three simulation modes (controlled by simtype in input_params.dat):
- All (simtype=1): Simulates both cilia and particles together
- Cilia (simtype=2): Simulates only cilia structures
- Particle (simtype=3): Simulates only elliptical particles
Key parameters in input_params.dat:
Lx,Ly: Domain size in x and y directionsNx,Ny: Number of grid points
nu: Kinematic viscosityrho: Fluid densityutop: Top wall velocity (for lid-driven cavity) or inlet velocitytp: Time period for oscillatory flows
nc: Number of cilialc: Length of each ciliumxoc,yoc: Position of first ciliumdc: Distance between adjacent ciliawbl: Width between cilia layersko,kd: Spring stiffness constants
nparticles: Number of particlesradius: Particle radiusar: Aspect rationpparticles: Number of nodes per particle layerxop,yop: Initial positionkop,kod: Spring stiffness constants
- 2D incompressible Navier-Stokes equations
- Second-order finite difference discretization
- Projection method for pressure-velocity coupling
- RK2 time integration
- Discrete delta function for force spreading and velocity interpolation
- Spring-based force calculations between connected nodes
- Two-way coupling between fluid and structures
- Support for different boundary types (open cilia, closed particles)
- Cell-based neighbor list for efficient force calculations
- AmgX acceleration for pressure Poisson equation (optional)
- NVTX annotations for performance analysis
- The immersed boundary method implementation is inspired by the work of Charles Peskin
- AmgX integration based on NVIDIA's AmgX library
For questions or contributions, please contact [[email protected]]