Initial Conditions

See also the user interface.

Base class

class InitialConditions

Initializer for objects in group PVs.

ICs are temporary objects and do not need name or checkpoint/restart mechanism. The exec() member function is called by the Simulation when the ParticleVector is registered.

Subclassed by mirheo::FromArrayIC, mirheo::MembraneIC, mirheo::RandomChainsIC, mirheo::RestartIC, mirheo::RigidIC, mirheo::RodIC, mirheo::StraightChainsIC, mirheo::UniformFilteredIC, mirheo::UniformIC, mirheo::UniformSphereIC

Public Functions

virtual void exec(const MPI_Comm &comm, ParticleVector *pv, cudaStream_t stream) = 0

Initialize a given ParticleVector.

Parameters
  • comm: A Cartesian MPI communicator from the simulation tasks
  • pv: The resulting ParticleVector to be initialized (on chip data)
  • stream: cuda stream

Derived classes

class RestartIC : public mirheo::InitialConditions

Initialize a ParticleVector from a checkpoint file.

Will call the restart() member function of the given ParticleVector.

Public Functions

RestartIC(const std::string &path)

Construct a RestartIC object.

Parameters
  • path: The directory containing the restart files.

void exec(const MPI_Comm &comm, ParticleVector *pv, cudaStream_t stream)

Initialize a given ParticleVector.

Parameters
  • comm: A Cartesian MPI communicator from the simulation tasks
  • pv: The resulting ParticleVector to be initialized (on chip data)
  • stream: cuda stream

class UniformIC : public mirheo::InitialConditions

Fill the domain with uniform number density.

Initialize particles uniformly with the given number density on the whole domain. The domain considered is that of the ParticleVector. ObjectVector objects are not supported.

Public Functions

UniformIC(real numDensity)

Construct a UniformIC object.

Parameters
  • numDensity: Number density of the particles to initialize

void exec(const MPI_Comm &comm, ParticleVector *pv, cudaStream_t stream)

Initialize a given ParticleVector.

Parameters
  • comm: A Cartesian MPI communicator from the simulation tasks
  • pv: The resulting ParticleVector to be initialized (on chip data)
  • stream: cuda stream

class UniformSphereIC : public mirheo::InitialConditions

Fill the domain with uniform number density in a given ball.

Initialize particles uniformly with the given number density inside or outside a ball. The domain considered is that of the ParticleVector. ObjectVector objects are not supported.

Public Functions

UniformSphereIC(real numDensity, real3 center, real radius, bool inside)

Construct a UniformSphereIC object.

Parameters
  • numDensity: Number density of the particles to initialize
  • center: Center of the ball
  • radius: Radius of the ball
  • inside: The particles will be inside the ball if set to true, outside otherwise.

void exec(const MPI_Comm &comm, ParticleVector *pv, cudaStream_t stream)

Initialize a given ParticleVector.

Parameters
  • comm: A Cartesian MPI communicator from the simulation tasks
  • pv: The resulting ParticleVector to be initialized (on chip data)
  • stream: cuda stream

class UniformFilteredIC : public mirheo::InitialConditions

Fill the domain with uniform number density in a given region.

Initialize particles uniformly with the given number density on a specified region of the domain. The region is specified by a filter functor. The domain considered is that of the ParticleVector. ObjectVector objects are not supported.

Public Functions

UniformFilteredIC(real numDensity, PositionFilter filter)

Construct a UniformFilteredIC object.

Parameters
  • numDensity: Number density of the particles to initialize
  • filter: Indicator function that maps a position of the domain to a boolean value. It returns true if the position is inside the region.

void exec(const MPI_Comm &comm, ParticleVector *pv, cudaStream_t stream)

Initialize a given ParticleVector.

Parameters
  • comm: A Cartesian MPI communicator from the simulation tasks
  • pv: The resulting ParticleVector to be initialized (on chip data)
  • stream: cuda stream

class FromArrayIC : public mirheo::InitialConditions

Initialize particles to given positions and velocities.

ObjectVector objects are not supported.

Public Functions

FromArrayIC(const std::vector<real3> &pos, const std::vector<real3> &vel)

Construct a FromArrayIC object.

Parameters
  • pos: list of initial positions in global coordinates. The size will determine the maximum number of particles. Positions outside the domain are filtered out.
  • vel: list of initial velocities. Must have the same size as pos.

void exec(const MPI_Comm &comm, ParticleVector *pv, cudaStream_t stream)

Initialize a given ParticleVector.

Parameters
  • comm: A Cartesian MPI communicator from the simulation tasks
  • pv: The resulting ParticleVector to be initialized (on chip data)
  • stream: cuda stream

class RigidIC : public mirheo::InitialConditions

Initialize RigidObjectVector objects.

Initialize rigid objects from center of mass positions, orientations and frozen particles.

Public Functions

RigidIC(const std::vector<ComQ> &comQ, const std::string &xyzfname)

Construct a RigidIC object.

This method will die if the file does not exist.

Parameters
  • comQ: List of (position, orientation) corresponding to each object. The size of the list is the number of rigid objects that will be initialized.
  • xyzfname: The name of a file in xyz format. It contains the list of coordinates of the frozen particles (in the object frame of reference).

RigidIC(const std::vector<ComQ> &comQ, const std::vector<real3> &coords)

Construct a RigidIC object.

Parameters
  • comQ: List of (position, orientation) corresponding to each object. The size of the list is the number of rigid objects that will be initialized.
  • coords: List of positions of the frozen particles of one object, in the object frame of reference.

RigidIC(const std::vector<ComQ> &comQ, const std::vector<real3> &coords, const std::vector<real3> &comVelocities)

Construct a RigidIC object.

Parameters
  • comQ: List of (position, orientation) corresponding to each object. The size of the list is the number of rigid objects that will be initialized.
  • coords: List of positions of the frozen particles of one object, in the object frame of reference.
  • comVelocities: List of velocities of the velocities of the objects center of mass. Must have the same size as comQ.

void exec(const MPI_Comm &comm, ParticleVector *pv, cudaStream_t stream)

Initialize a given ParticleVector.

Parameters
  • comm: A Cartesian MPI communicator from the simulation tasks
  • pv: The resulting ParticleVector to be initialized (on chip data)
  • stream: cuda stream

class MembraneIC : public mirheo::InitialConditions

Initialize MembraneVector objects.

Initialize membrane objects from center of mass positions and orientations.

Subclassed by mirheo::MembraneWithTypeIdsIC

Public Functions

MembraneIC(const std::vector<ComQ> &comQ, real globalScale = 1.0)

Construct a MembraneIC object.

Parameters
  • comQ: List of (position, orientation) corresponding to each object. The size of the list is the number of membrane objects that will be initialized.
  • globalScale: scale the membranes by this scale when placing the initial vertices.

void exec(const MPI_Comm &comm, ParticleVector *pv, cudaStream_t stream)

Initialize a given ParticleVector.

Parameters
  • comm: A Cartesian MPI communicator from the simulation tasks
  • pv: The resulting ParticleVector to be initialized (on chip data)
  • stream: cuda stream

class MembraneWithTypeIdsIC : public mirheo::MembraneIC

Initialize MembraneVector objects with a typeId.

See MembraneIC. Attach an additional typeId field to each membrane. This is useful to have different membrane forces without having many MembraneVector objects.

Public Functions

MembraneWithTypeIdsIC(const std::vector<ComQ> &comQ, const std::vector<int> &typeIds, real globalScale = 1.0)

Construct a MembraneWithTypeIdsIC object.

Parameters
  • comQ: List of (position, orientation) corresponding to each object. The size of the list is the number of membrane objects that will be initialized.
  • typeIds: List of type Ids. must have the same size as comQ.
  • globalScale: scale the membranes by this scale when placing the initial vertices.

void exec(const MPI_Comm &comm, ParticleVector *pv, cudaStream_t stream)

Initialize a given ParticleVector.

Parameters
  • comm: A Cartesian MPI communicator from the simulation tasks
  • pv: The resulting ParticleVector to be initialized (on chip data)
  • stream: cuda stream

class RodIC : public mirheo::InitialConditions

Initialize RodVector objects.

All rods will have the same torsion and centerline in there frame of reference. Each rod has a specific center of mass and orientation.

Public Types

using MappingFunc3D = std::function<real3(real)>

a map from [0,1] to R^3

using MappingFunc1D = std::function<real(real)>

a map from [0,1] to R

Public Functions

RodIC(const std::vector<ComQ> &comQ, MappingFunc3D centerLine, MappingFunc1D torsion, real a, real3 initialMaterialFrame = DefaultFrame)

Construct a RodIC object.

Parameters
  • comQ: list of center of mass and orientation of each rod. This will determine the number of rods. The rods with center of mass outside of the domain will be discarded.
  • centerLine: Function describing the centerline in the frame of reference of the rod
  • torsion: Function describing the torsion along the centerline.
  • a: The width of the rod (the cross particles are separated by a).
  • initialMaterialFrame: If set, this describes the orientation of the local material frame at the start of the rod (in the object frame of reference). If not set, this is chosen arbitrarily.

void exec(const MPI_Comm &comm, ParticleVector *pv, cudaStream_t stream)

Initialize a given ParticleVector.

Parameters
  • comm: A Cartesian MPI communicator from the simulation tasks
  • pv: The resulting ParticleVector to be initialized (on chip data)
  • stream: cuda stream

Public Static Attributes

const real Default

default real value, used to pass default parameters

const real3 DefaultFrame

default orientation, used to pass default parameters