Jumping drops Basilisk simulation with a two-phase workflow:
initialization (STL geometry -> dumpInit) and a main MPI-compatible run.
- Basilisk (
qcconPATH) - MPI (optional, for parallel main phase)
- macOS or Linux
First-time install (or reinstall):
curl -sL https://raw.githubusercontent.com/comphy-lab/basilisk-C/main/reset_install_basilisk-ref-locked.sh | bash -s -- --ref=v2026-01-29 --hardSubsequent runs (reuses existing basilisk/ if same ref):
curl -sL https://raw.githubusercontent.com/comphy-lab/basilisk-C/main/reset_install_basilisk-ref-locked.sh | bash -s -- --ref=v2026-01-29Load the environment before running the scripts:
source .project_configNote: Replace
v2026-01-29with the latest release tag from https://github.com/comphy-lab/basilisk-C/releases.
# Full workflow (init + main)
./runSimulation.sh default.params
# Init only (STL -> dumpInit)
./runSimulation.sh --init-only default.params
# Main only (MPI)
./runSimulation.sh --main-only --mpi --cores 8 default.params
# Parameter sweep
./runParameterSweep.sh sweep.paramsThis codebase has been refactored from two monolithic files into a modular workflow with a clean separation between initialization and the MPI-compatible main simulation.
simulationCases/JumpingDrops_legacy.c- local initialization with STLsimulationCases/JumpingDrops_Snellius_legacy.c- HPC version (missing gravity bug)
src-local/jumpingDrops_common.h- shared definitions, tolerances, boundary conditions, and helper functions (refRegion(),adapt(),writingFiles(),logWriting()), with MPI-aware logging viaMPI_MODEsimulationCases/jumpingDrops_init.c- init phase (serial only; usesdistance.handreduced.h) that writesdumpInitsimulationCases/jumpingDrops_main.c- main simulation (MPI-ready; nodistance.h) that restores fromdump/dumpInitsrc-local/parse_params.sh- parameter file parsing helpers
| File | Purpose | MPI | Input | Output |
|---|---|---|---|---|
simulationCases/jumpingDrops_init.c |
Create initial condition | No (serial only) | STL file | dumpInit |
simulationCases/jumpingDrops_main.c |
Run simulation | Yes | dump/dumpInit |
snapshots, log |
- Parameter files are
key=valuelines. - Required keys:
CaseNo,Oh,Bo,MAXlevel,tmax. - Sweep files define
BASE_CONFIG,CASE_START,CASE_END, andSWEEP_*values.
CaseNo=1000 # 4-digit case number (1000-9999)
Oh=0.001 # Ohnesorge number
Bo=0.001 # Bond number
MAXlevel=10 # Maximum refinement level
tmax=10.0 # Maximum simulation time (main phase only)# Jumping Drops Simulation Parameters
CaseNo=1000
Oh=0.001
Bo=0.001
MAXlevel=10
tmax=10.0--init-only # Init phase only
--main-only # Main phase only
--mpi # Enable MPI
--cores N # Number of MPI cores (default: 4)
--compile-only # Compile but don't run
--debug # Debug mode (-g -DTRASH=1)
--verbose # Verbose output--skip-init # Skip init for all cases
--dry-run # Show combinations, don't run
--mpi # Enable MPI for all cases
--cores N # MPI cores per case
--compile-only # Compile but don't run
--verbose # Verbose output# First time
./runSimulation.sh case.params
# Subsequent runs (skip init)
./runSimulation.sh --main-only case.params# First sweep (auto-runs init if needed)
./runParameterSweep.sh sweep.params
# Re-run after changes (skip init)
./runParameterSweep.sh --skip-init sweep.paramsStep 1: Local - create initial conditions
for case in 1000 1001 1002; do
./runSimulation.sh --init-only "simulationCases/${case}/case.params"
doneStep 2: Local - transfer to HPC
for case in 1000 1001 1002; do
scp "simulationCases/${case}/dumpInit" \
"hpc:Drop-Impact/simulationCases/${case}/"
doneOr transfer all at once:
rsync -av --include='**/dumpInit' --include='*/' --exclude='*' \
simulationCases/ hpc:Drop-Impact/simulationCases/Step 3: HPC - run sweep
sbatch runSweepSnellius.sbatchMinimum files per case directory:
simulationCases/<CaseNo>/
├── dumpInit # From local init phase
└── case.params # Generated by sweep
Auto-created by the sbatch script:
simulationCases/<CaseNo>/
├── jumpingDrops_main.c # Copied by script
├── jumpingDrops_main # Compiled executable
└── intermediate/ # Created if needed
Shared header used during compilation:
src-local/jumpingDrops_common.h
| Error | Cause | Fix |
|---|---|---|
| "dump file not found" | No initial condition | Run --init-only first |
| "Cannot restore dump" | Corrupted dump | Re-run init phase |
| "Source file not found" | Missing files on HPC | Transfer all new .c/.h files |
| Init phase too slow | High MAXlevel | Expected - only run once |
- Missing gravity: both init and main now set
G.y = -Bo - Error tolerances consistent:
fErr=1e-3,KErr=1e-4,VelErr=1e-2 - Gas viscosity consistent:
mu2 = Mu21*Oh = 1e-3*Oh - MPI-aware logging with
pid()checks insidelogWriting() - Shared common header for consistent behavior across phases
- Compiler:
qcc(serial only) - Include:
distance.h,reduced.h - Flags:
-O2 -Wall -disable-dimensions - MPI: not supported
- Compiler:
qcc(serial) ormpicc + qcc(parallel) - Include: no
distance.h - Flags:
-O2 -Wall -disable-dimensions [-D_MPI=1] - MPI: supported
├── src-local/
│ ├── jumpingDrops_common.h # Shared definitions
│ └── parse_params.sh # Parameter parsing helpers
├── simulationCases/
│ ├── jumpingDrops_init.c # Initialization
│ ├── jumpingDrops_main.c # Main simulation
│ ├── JumpingDrops_legacy.c # Deprecated
│ ├── JumpingDrops_Snellius_legacy.c # Deprecated
│ └── <CaseNo>/ # Case directories
│ ├── case.params # Parameter file
│ ├── InitialCondition.stl # STL geometry (for init)
│ ├── dumpInit # Initial condition (from init)
│ ├── dump # Current state
│ ├── restart # Restart file (if exists)
│ ├── log # Simulation log
│ └── intermediate/ # Snapshot files
│ └── snapshot-*.dump
├── runSimulation.sh # Single case runner
├── runParameterSweep.sh # Parameter sweep
├── runSweepSnellius.sbatch # HPC sweep
├── default.params # Example single-case parameters
├── sweep.params # Example sweep configuration
└── .project_config.example # Basilisk environment template
- Clean separation: initialization vs main simulation
- MPI compatibility: no
distance.hin parallel code - Flexibility: reuse
dumpInitfor multiple runs - Consistency: single source of truth for common code
- Development speed: skip init during main-phase testing
From old local code (JumpingDrops_legacy.c):
# Before
./JumpingDrops Oh Bo MAXlevel
# After
./jumpingDrops_init Oh Bo MAXlevel
./jumpingDrops_main tmax Oh Bo MAXlevelFrom old HPC code (JumpingDrops_Snellius_legacy.c):
# Before (missing gravity)
mpirun -np 48 ./JumpingDrops_Snellius_legacy case.params
# After
./runSimulation.sh --init-only case.params
scp dumpInit hpc:case/
srun -n 48 ./jumpingDrops_main tmax Oh Bo MAXlevel| File | Size | Transfer? |
|---|---|---|
InitialCondition.stl |
~1-10 MB | No (local only) |
dumpInit |
~10-100 MB | Yes (to HPC) |
| snapshot files | ~10-100 MB each | No (keep on HPC) |
- Runtime: ~1-2 minutes (depends on MAXlevel and STL complexity)
- Memory: moderate (STL loading + distance field)
- Parallelization: serial only (distance.h limitation)
- Frequency: once per geometry
- Runtime: hours to days (depends on tmax, MAXlevel)
- Memory: varies with refinement
- Parallelization: strong MPI scaling
- Frequency: multiple runs with same initial condition
- Run init locally (STL loading not MPI-compatible)
- Transfer
dumpInitto HPC (smaller than STL files) - Use
--skip-initfor sweeps after first run - Check logs for parameter values (Oh, Bo, gravity)
- Use restart files for long runs
- Keep
dumpInitonce generated
- Compile init phase:
./runSimulation.sh --init-only --compile-only - Compile main phase:
./runSimulation.sh --main-only --compile-only - Run init phase:
./runSimulation.sh --init-only default.params - Verify
dumpInitcreated - Run main phase serial:
./runSimulation.sh --main-only default.params - Run main phase MPI:
./runSimulation.sh --main-only --mpi --cores 4 default.params - Check log file for correct Oh, Bo values
- Verify gravity effects in output
- Transfer
dumpInitto HPC - Test single case compilation on HPC
- Run single case with MPI:
srun -n 48 ./jumpingDrops_main tmax Oh Bo MAXlevel - Submit parameter sweep:
sbatch runSweepSnellius.sbatch - Verify log files show correct parameters
- Check that all cases complete successfully
- Support different STL geometries per case
- Automatic
dumpInitsynchronization script - Parameter validation in shell scripts
- Progress monitoring during long runs
- Automatic restart on HPC node failure
- Post-processing integration
- Author: Vatsal Sanjay
- Email: vatsalsanjay@gmail.com
- Physics of Fluids