Skip to content

divyaprakash-iitd/ibmc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IBMC - Immersed Boundary Method for Cilia and Particles Using Lattice Spring Method

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.

animation
Oscillation of a Morphing Particle Above Cilia Bed

Overview

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:

  1. Ciliary structures - Flexible hair-like projections that can generate fluid motion
  2. Elliptical particles - Closed-loop structures with customizable aspect ratios
  3. 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.

Features

  • 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

Code Structure

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

Prerequisites

  • Fortran compiler (gfortran recommended)
  • NVIDIA HPC SDK (for AmgX acceleration, optional)
  • NVIDIA CUDA Toolkit (for AmgX acceleration, optional)

Installation

  1. Clone the repository:
git clone https://github.com/your-username/ibmc.git
cd ibmc
  1. Build the executable:
make

Usage

  1. 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
  1. Run the simulation:
./ibmc
  1. View the results: Output files are generated in the current directory with the following naming conventions:
  • u_[timestep].txt - x-velocity
  • v_[timestep].txt - y-velocity
  • ib_loc_c[timestep].txt - Cilia positions
  • ib_loc_p[timestep].txt - Particle positions The provided matlab script cilia_vis.m can be used for this purpose

Simulation Types

The code supports three simulation modes (controlled by simtype in input_params.dat):

  1. All (simtype=1): Simulates both cilia and particles together
  2. Cilia (simtype=2): Simulates only cilia structures
  3. Particle (simtype=3): Simulates only elliptical particles

Parameter Configuration

Key parameters in input_params.dat:

Domain and Grid

  • Lx, Ly: Domain size in x and y directions
  • Nx, Ny: Number of grid points

Flow Properties

  • nu: Kinematic viscosity
  • rho: Fluid density
  • utop: Top wall velocity (for lid-driven cavity) or inlet velocity
  • tp: Time period for oscillatory flows

Cilia Properties

  • nc: Number of cilia
  • lc: Length of each cilium
  • xoc, yoc: Position of first cilium
  • dc: Distance between adjacent cilia
  • wbl: Width between cilia layers
  • ko, kd: Spring stiffness constants

Particle Properties

  • nparticles: Number of particles
  • radius: Particle radius
  • ar: Aspect ratio
  • npparticles: Number of nodes per particle layer
  • xop, yop: Initial position
  • kop, kod: Spring stiffness constants

Technical Details

Fluid Solver

  • 2D incompressible Navier-Stokes equations
  • Second-order finite difference discretization
  • Projection method for pressure-velocity coupling
  • RK2 time integration

Immersed Boundary Method

  • 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)

Performance Optimizations

  • Cell-based neighbor list for efficient force calculations
  • AmgX acceleration for pressure Poisson equation (optional)
  • NVTX annotations for performance analysis

Acknowledgments

  • The immersed boundary method implementation is inspired by the work of Charles Peskin
  • AmgX integration based on NVIDIA's AmgX library

Contact

For questions or contributions, please contact [[email protected]]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •