Mirheo¶
The main coordinator class
API¶
-
class
Mirheo
¶ Coordinator class for a full simulation.
Manages and splits work between
Simulation
andPostprocess
ranks.Public Functions
-
Mirheo
(int3 nranks3D, real3 globalDomainSize, LogInfo logInfo, CheckpointInfo checkpointInfo, real maxObjHalfLength, bool gpuAwareMPI = false)¶ Construct a
Mirheo
object using MPI_COMM_WORLD.The product of
nranks3D
must be equal to the number of available ranks (or hals if postprocess is used)- Note
- MPI will be initialized internally. If this constructor is used, the destructor will also finalize MPI.
- Parameters
nranks3D
: Number of ranks along each cartesian direction.globalDomainSize
: The full domain dimensions in length units. Must be positive.logInfo
: Information about loggingcheckpointInfo
: Information about checkpointmaxObjHalfLength
: Half of the maximum length of all objects.gpuAwareMPI
:true
to use RDMA (must be compile with a MPI version that supports it)
-
Mirheo
(MPI_Comm comm, int3 nranks3D, real3 globalDomainSize, LogInfo logInfo, CheckpointInfo checkpointInfo, real maxObjHalfLength, bool gpuAwareMPI = false)¶ Construct a
Mirheo
object using a given communicator.- Note
- MPI will be NOT be initialized. If this constructor is used, the destructor will NOT finalize MPI.
-
void
restart
(std::string folder = "restart/")¶ reset the internal state from a checkpoint folder
-
MPI_Comm
getWorldComm
() const¶ - Return
- the world communicator
-
bool
isComputeTask
() const¶ - Return
true
if the current rank is aSimulation
rank
-
bool
isMasterTask
() const¶ - Return
true
if the current rank is the root (i.e. rank = 0)
-
bool
isSimulationMasterTask
() const¶ - Return
true
if the current rank is the root within the simulation communicator
-
bool
isPostprocessMasterTask
() const¶ - Return
true
if the current rank is the root within the postprocess communicator
-
void
startProfiler
()¶ start profiling for nvvp
-
void
stopProfiler
()¶ stop profiling for nvvp
-
void
dumpDependencyGraphToGraphML
(const std::string &fname, bool current) const¶ dump the task dependency of the simulation in graphML format.
- Parameters
fname
: The file name to dump the graph to (without extension).current
: iftrue
, will only dump the current tasks; otherwise, will dump all possible ones.
-
void
run
(MirState::StepType niters, real dt)¶ advance the system for a given number of time steps
- Parameters
niters
: number of interationsdt
: time step duration
register a ParticleVector in the simulation and initialize it with the gien InitialConditions.
- Parameters
pv
: The ParticleVector to registeric
: The InitialConditions that will be applied topv
when registered
register an
Interaction
- See
- setInteraction().
- Parameters
interaction
: theInteraction
to register.
register an
Integrator
- See
- setIntegrator().
- Parameters
integrator
: theIntegrator
to register.
register a
Wall
- Parameters
wall
: TheWall
to registercheckEvery
: The particles that will bounce against this wall will be checked (inside/outside log info) every this number of time steps. 0 means no check.
register a
Bouncer
- See
- setBouncer().
- Parameters
bouncer
: theBouncer
to register.
register a SimulationPlugin
- Parameters
simPlugin
: the SimulationPlugin to register (only relevant if the current rank is a compute task).postPlugin
: the PostprocessPlugin to register (only relevant if the current rank is a postprocess task).
-
void
registerPlugins
(const PairPlugin &plugins)¶ More generic version of registerPlugins()
register a ObjectBelongingChecker
- See
- applyObjectBelongingChecker()
- Parameters
checker
: the ObjectBelongingChecker to register.ov
: the associated ObjectVector (must be registered).
-
void
deregisterIntegrator
(Integrator *integrator)¶ deregister an
Integrator
- See
- registerIntegrator().
- Parameters
integrator
: theIntegrator
to deregister.
-
void
deregisterPlugins
(SimulationPlugin *simPlugin, PostprocessPlugin *postPlugin)¶ deregister a Plugin
- Parameters
simPlugin
: the SimulationPlugin to deregister (only relevant if the current rank is a compute task).postPlugin
: the PostprocessPlugin to deregister (only relevant if the current rank is a postprocess task).
-
void
setIntegrator
(Integrator *integrator, ParticleVector *pv)¶ Assign a registered
Integrator
to a registered ParticleVector.- Parameters
integrator
: The registered integrator (will die if it was not registered)pv
: The registered ParticleVector (will die if it was not registered)
-
void
setInteraction
(Interaction *interaction, ParticleVector *pv1, ParticleVector *pv2)¶ Assign two registered
Interaction
to two registered ParticleVector objects.This was designed to handle PairwiseInteraction, which needs up to two
ParticleVector. For self interaction cases (such as MembraneInteraction),pv1
andpv2
must be the same.- Parameters
interaction
: The registered interaction (will die if it is not registered)pv1
: The first registered ParticleVector (will die if it is not registered)pv2
: The second registered ParticleVector (will die if it is not registered)
-
void
setBouncer
(Bouncer *bouncer, ObjectVector *ov, ParticleVector *pv)¶ Assign a registered
Bouncer
to registered ObjectVector and ParticleVector.- Parameters
bouncer
: The registered bouncer (will die if it is not registered)ov
: The registered ObjectVector that contains the surface to bounce on (will die if it is not registered)pv
: The registered ParticleVector to bounce (will die if it is not registered)
-
void
setWallBounce
(Wall *wall, ParticleVector *pv, real maximumPartTravel = 0.25f)¶ Set a registered ParticleVector to bounce on a registered
Wall
.- Parameters
wall
: The registered wall (will die if it is not registered)pv
: The registered ParticleVector (will die if it is not registered)maximumPartTravel
: Performance parameter. SeeWall
for more information.
-
Simulation *
getSimulation
()¶ - Return
- the Simulation object;
nullptr
on postprocess tasks.
-
const Simulation *
getSimulation
() const¶ see getSimulation(); const version
-
std::shared_ptr<MirState>
getMirState
()¶ see getMirState(); shared_ptr version
Compute the SDF field from the given walls and dump it to a file in xmf+h5 format.
- Parameters
walls
: List ofWall
objects. The union of these walls will be dumped.h
: The grid spacingfilename
: The base name of the dumped files (without extension)
Compute the volume inside the geometry formed by the given walls with simple Monte-Carlo integration.
- Return
- The Monte-Carlo estimate of the volume
- Parameters
walls
: List ofWall
objects. The union of these walls form the geometry.nSamplesPerRank
: The number of Monte-Carlo samples per rank
Create a layer of frozen particles inside the given walls.
This will run a simulation of “bulk” particles and select the particles that are inside the effective cut-off radius of the given list of interactions.
- Return
- The frozen particles
- Parameters
pvName
: The name of the frozen ParticleVector that will be createdwalls
: The list of registered walls that need frozen particlesinteractions
: List of interactions (not necessarily registered) that will be used to equilibrate the particlesintegrator
:Integrator
object used to equilibrate the particlesnumDensity
: The number density used to initialize the particlesmass
: The mass of one particledt
: Equilibration time stepnsteps
: Number of equilibration steps
Create frozen particles inside the given objects.
This will run a simulation of “bulk” particles and select the particles that are inside
shape
.- Return
- The frozen particles, with name “inside_” + name of
shape
- Note
- For now, the output ParticleVector has mass 1.0.
- Parameters
checker
: The ObjectBelongingChecker to split inside particlesshape
: The ObjectVector that will be used to define inside particlesicShape
: The InitialConditions object used to set the objects positionsinteractions
: List of interactions (not necessarily registered) that will be used to equilibrate the particlesintegrator
:Integrator
object used to equilibrate the particlesnumDensity
: The number density used to initialize the particlesmass
: The mass of one particledt
: Equilibration time stepnsteps
: Number of equilibration steps
-
std::shared_ptr<ParticleVector>
applyObjectBelongingChecker
(ObjectBelongingChecker *checker, ParticleVector *pv, int checkEvery, std::string inside = "", std::string outside = "")¶ Enable a registered ObjectBelongingChecker to split particles of a registered ParticleVector.
inside
oroutside
can take the reserved value “none”, in which case the corresponding particles will be deleted. Furthermore, exactly one ofinside
andoutside
must be the same aspv
.- Parameters
checker
: The ObjectBelongingChecker (will die if it is not registered)pv
: The registered ParticleVector that must be split (will die if it is not registered)checkEvery
: The particle split will be performed every this amount of time steps.inside
: Name of the ParticleVector that will contain the particles ofpv
that are inside the objects. See below for more information.outside
: Name of the ParticleVector that will contain the particles ofpv
that are outside the objects. See below for more information.
If
inside
oroutside
has the name of a ParticleVector that is not registered, this call will create an empty ParticleVector with the given name and register it in theSimulation
. Otherwise the already registered ParticleVector will be used.
-
void
logCompileOptions
() const¶ print the list of all compile options and their current value in the logs
-