The HemoCell API#
This page is a task-oriented guide to the hemo::HemoCell class — the object
you drive from a case’s main(). It groups the most commonly used methods by
what you do with them. For full signatures, overloads, and the rest of the C++
API, see the auto-generated Doxygen reference.
A minimal case follows the same skeleton in every example (see
Creating your own HemoCell Case for the full walk-through). The
library’s headers import no namespace; the examples start with
using namespace hemo; using namespace plb; using namespace std;.
HemoCell hemocell(argv[1], argc, argv); // 1. construct
hemocell.initializeLattice(management); // 2. set up the fluid
hemocell.initializeCellfield(); // 3. set up the cells
hemocell.addCellType<RbcHighOrderModel>("RBC", RBC_FROM_SPHERE);
hemocell.setOutputs("RBC", { /* ... */ });
hemocell.setFluidOutputs({ /* ... */ });
hemocell.loadParticles(); // 4. place the cells
while (hemocell.iter < tmax) { // 5. run
hemocell.iterate();
if (hemocell.iter % tmeas == 0) hemocell.writeOutput();
}
Construction and lifecycle#
Member |
Purpose |
|---|---|
|
Construct the simulation from a |
|
Same, but for when MPI is initialised outside HemoCell (HemoCell then
skips |
|
Ends the simulation and resets the process-wide state ( |
|
The current iteration counter (read it to drive your main loop). |
|
The parsed configuration; read values with
|
Setting up the fluid#
Member |
Purpose |
|---|---|
|
Create the fluid lattice from a Palabos |
|
Create the fluid lattice of a voxelised geometry (no pre-inlet):
bounce-back walls where the flag matrix is 0, no periodicity, fluid at
rest. Then call |
|
The underlying Palabos |
|
Initialise every fluid node to a density and velocity (lattice units). |
|
Make the whole system periodic along an axis. |
|
Number of periodic images of a cell distinguishable along an axis (default 100); see Cell IDs and periodicity. |
Setting up the cells#
Member |
Purpose |
|---|---|
|
Create the cell-fields / particle-field container. Call before adding cell types. |
|
Register a cell type with a mechanical model and a
construction method. The
|
|
Load the initial cell positions from the |
|
Keep cells at least |
|
Also place the cells that cross a periodic boundary (as periodic images
on both sides); only for |
Controlling cost (time-scale separation)#
See Time-scale separation for the concept.
Member |
Purpose |
|---|---|
|
Re-evaluate this cell type’s mechanical model every |
|
Interpolate fluid velocity to particles every |
|
Update cell–cell repulsion every |
|
Update interior viscosity every |
Optional physics#
Member |
Purpose |
|---|---|
|
Enable and parameterise short-range cell–cell repulsion (constant in
pN, cutoff in micrometres; the force is capped at |
|
Enable repulsion between cells and solid boundaries (same units;
|
|
Enable solidification (clotting) for a cell type. Requires the
|
Output and checkpointing#
Member |
Purpose |
|---|---|
|
Choose which per-cell fields to write for a cell type. See Output fields. |
|
Choose which fluid fields to write. |
|
Choose outputs for the advection–diffusion (CEPAC) field, when used. |
|
|
|
Write the requested HDF5/CSV output for the current iteration. It does not change the simulation state (a body force set before it is kept). |
|
Write / restore a full checkpoint (see Resuming from a checkpoint). |
Running and load balancing#
Member |
Purpose |
|---|---|
|
Advance the coupled fluid + cells by one fluid time step. If you drive
the flow with an external force vector, re-apply it after every
|
|
Collective. If any rank caught SIGINT, SIGTERM, SIGHUP, SIGQUIT,
SIGUSR1 or SIGUSR2, all ranks save a checkpoint (unless
|
|
Return the current fractional load imbalance across processes. |
|
Rebalance / restructure the domain across processes. See
Load balancing. Requires a build with
ParMETIS ( |