hemocell
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
hemo::HemoCellFields Class Reference

#include <hemoCellFields.h>

Collaboration diagram for hemo::HemoCellFields:
Collaboration graph
[legend]

Classes

class  CompleteCellsScope
 Complete cells for reading, without changing the simulation. More...
 
class  HemoAdvanceParticles
 
class  HemoApplyConstitutiveModel
 
class  HemoBoundaryRepulsionForce
 
class  HemoDeleteIncompleteCells
 
class  HemoDeleteNonLocalParticles
 
class  HemoFindInternalParticleGridPoints
 
class  HemoGetParticles
 
class  HemoInternalGridPointsMembrane
 
class  HemoInterpolateFluidVelocity
 
class  HemoPopulateBindingSites
 
class  HemoPopulateBoundaryParticles
 
class  HemoPrepareSolidification
 
class  HemoRepulsionForce
 
class  HemoSeperateForceVectors
 
class  HemoSetParticles
 
class  HemoSolidifyCells
 
class  HemoSpreadParticleForce
 
class  HemoUnifyForceVectors
 
class  HemoupdateResidenceTime
 

Public Member Functions

 HemoCellFields (plb::MultiBlockLattice3D< T, DESCRIPTOR > &lattice_, unsigned int particleEnvelopeWidth, HemoCell &)
 Default constructor, needs an palabos lattice, envelope width (lbm units), and hemocell reference.
 
void createParticleField (plb::SparseBlockStructure3D *sbStructure_=0, plb::ThreadAttribution *tAttribution_=0)
 
void createCEPACfield ()
 
void InitAfterLoadCheckpoint ()
 Used to set variables inside the celltypes for correct access, called through createParticleField.
 
 ~HemoCellFields ()
 Generic Destructor.
 
HemoCellField * addCellType (std::string name_, int constructType)
 Add a cell type with a certain mesh; its name also selects name_.xml and name_.pos
 
HemoCellField * operator[] (unsigned int index)
 Easy access to contained celltypes.
 
HemoCellField * operator[] (std::string name)
 Easy access to contained celltypes.
 
unsigned int size ()
 Get the number of celltypes.
 
void load (plb::XMLreader *documentXML, unsigned int &iter, Config *cfg=NULL)
 
void save (plb::XMLreader *documentXML, unsigned int iter, Config *cfg=NULL)
 
void saveCheckPointDescription (plb::XMLreader *documentXML, unsigned int iter)
 
plb::MultiParticleField3D< HemoCellParticleField > & getParticleField3D ()
 Legacy Helper function to get the particle field, mostly unused as direct access is available.
 
void readPositionsCellFields (std::string particlePosFile)
 Legacy reads in only RBC an PLT from a single pos file.
 
void advanceParticles ()
 Advance the particles in an iteration.
 
void findInternalParticleGridPoints ()
 
void internalGridPointsMembrane ()
 
void interpolateFluidVelocity ()
 Interpolate the velocity of the fluid to the individual particles.
 
void spreadParticleForce ()
 Spread the force of all particles over the fluid in this iteration.
 
void separate_force_vectors ()
 Separate the force vectors of particles so it becomes clear what the vector for each separate force is.
 
void unify_force_vectors ()
 Unify the force vectors of particles to point to a single force.
 
void applyRepulsionForce ()
 Apply (and calculate) the repulsion force between particles.
 
void applyBoundaryRepulsionForce (bool resetFirst=false)
 
void capRepulsionForce ()
 
void deleteIncompleteCells (bool verbose=true)
 Delete any incomplete cells on a block.
 
void deleteBrokenCells (plint envelope, bool verbose)
 
void applyConstitutiveModel (bool forced=false)
 Apply the material model of the cells to the particles, updating their force.
 
void syncEnvelopes ()
 Sync the particle envelopes between domains.
 
void getParticles (std::vector< HemoCellParticle * > &particles, plb::Box3D &domain)
 Get particles in a given domain.
 
void addParticles (std::vector< HemoCellParticle > &particles)
 Add particles to local processors.
 
void populateBoundaryParticles ()
 Add boundary particles on the fluid-solid boundary.
 
void populateBindingSites (plb::Box3D *box=0)
 Add bindingSites.
 
void deleteNonLocalParticles (int envelope)
 Delete non local particles (do not delete in envelopesize)
 
void solidifyCells ()
 Conditionally solidify cells if requested.
 
void prepareSolidification ()
 
void updateResidenceTime (unsigned int rtime)
 increment cell residence time
 
plint base_cell_id (plint wrapped) const
 
void calculateCommunicationStructure ()
 

Public Attributes

plb::MultiBlockLattice3D< T, DESCRIPTOR > * lattice
 the fluid lattice
 
std::vector< int > desiredFluidOutputVariables
 A vector specifying the output variables (from const_defaults.h)
 
std::vector< int > desiredCEPACfieldOutputVariables
 
HemoCell & hemocell
 Reference to parent.
 
std::vector< HemoCellField * > cellFields
 Vector containing the cellTypes.
 
pluint envelopeSize
 The envelopeSize for the particles.
 
plb::MultiParticleField3D< HemoCellParticleField > * immersedParticles = 0
 palabos field storing the particles
 
plb::MultiParticleField3D< HemoCellParticleField > * preinlet_immersedParticles = 0
 seperate preinlet and domain pointers whenever necessary
 
plb::MultiParticleField3D< HemoCellParticleField > * domain_immersedParticles = 0
 
plb::MultiBlockLattice3D< T, CEPAC_DESCRIPTOR > * CEPACfield = 0
 palabos field for storing the CPAC scalar field if used
 
bool placeCellsAcrossPeriodicBoundaries = false
 
T repulsionCutoff = 0.0
 Repulsion cutoff [lattice units], set by HemoCell::setRepulsion()
 
T repulsionConstant = 0.0
 Repulsion constant [lattice force units], set by HemoCell::setRepulsion() (in pN)
 
pluint repulsionTimescale = 1
 Timescale seperation for repulsion, set through hemocell.h.
 
T boundaryRepulsionCutoff = 0.0
 Wall repulsion cutoff [lattice units], set by HemoCell::enableBoundaryParticles()
 
T boundaryRepulsionConstant = 0.0
 Wall repulsion constant [lattice force units], set by HemoCell::enableBoundaryParticles() (in pN)
 
pluint boundaryRepulsionTimescale = 1
 Timescale seperation for boundary repulsion, set through hemocell.h.
 
pluint particleVelocityUpdateTimescale = 1
 Timescale seperation for the velocity interpolation from the fluid to the particle.
 
pluint solidifyTimescale = 1
 
pluint interiorViscosityTimescale = 1
 
pluint interiorViscosityEntireGridTimescale = 1
 
int periodicity_limit [3] = {100, 100, 100}
 Limit of cycles in a direction (xyz); offsets below must match these defaults.
 
int periodicity_limit_offset_y = 100
 
int periodicity_limit_offset_z = 10000
 
int number_of_cells = 0
 
bool number_of_cells_from_checkpoint = false
 
unsigned int max_neighbours = 0
 
bindingFieldHelper * bindingHelper = 0
 
InteriorViscosityHelper * interiorViscosityHelper = 0
 
plb::CommunicationStructure3D * large_communicator = 0
 

Private Member Functions

void copyXMLreader2XMLwriter (plb::XMLreader const &reader, plb::XMLwriter &writer)
 
void copyXMLreader2XMLwriter (plb::XMLreaderProxy readerProxy, plb::XMLwriter &writer)
 
void checkCheckPointFingerprint (plb::XMLreader &documentXML)
 
void loadCEPACfield (const std::string &checkpointDirectory)
 Load the CEPAC field from a checkpoint directory if it is enabled and present.
 
void exchangeEnvelopes ()
 

Private Attributes

std::vector< std::vector< NoInitChar > > sendBuffers
 
std::vector< std::vector< NoInitChar > > recvBuffers
 
std::vector< int > envelopeSendRanks
 
std::vector< int > envelopeRecvRanks
 
std::vector< std::vector< int > > envelopeSendSizes
 
std::vector< std::vector< int > > envelopeRecvSizes
 
std::vector< std::vector< NoInitChar > > envelopeSendData
 
std::vector< std::vector< NoInitChar > > envelopeRecvData
 
std::vector< std::vector< const plb::CommunicationInfo3D * > > envelopeRecvInfos
 
MPI_Comm particleComm = MPI_COMM_NULL
 
unsigned int completeCellsScopes = 0
 Number of CompleteCellsScope objects that exist (they nest).
 

Detailed Description

This class can contain many cellTypes, it keeps track of all the particles of all types. The option exists to get exclusive access to a single cellType if necessary. all the particles are stored in a single particlefield

Constructor & Destructor Documentation

◆ HemoCellFields()

hemo::HemoCellFields::HemoCellFields ( plb::MultiBlockLattice3D< T, DESCRIPTOR > &  lattice_,
unsigned int  particleEnvelopeWidth,
HemoCell &   
)

Default constructor, needs an palabos lattice, envelope width (lbm units), and hemocell reference.

◆ ~HemoCellFields()

hemo::HemoCellFields::~HemoCellFields ( )

Generic Destructor.

Member Function Documentation

◆ addCellType()

HemoCellField * hemo::HemoCellFields::addCellType ( std::string  name_,
int  constructType 
)

Add a cell type with a certain mesh; its name also selects name_.xml and name_.pos

◆ addParticles()

void hemo::HemoCellFields::addParticles ( std::vector< HemoCellParticle > &  particles)

Add particles to local processors.

◆ advanceParticles()

void hemo::HemoCellFields::advanceParticles ( )

Advance the particles in an iteration.

◆ applyBoundaryRepulsionForce()

void hemo::HemoCellFields::applyBoundaryRepulsionForce ( bool  resetFirst = false)

Apply (and calculate) the repulsion force between particles and the boundary. It is added to sv.force_repulsion; with resetFirst that field is zeroed first (needed when particle-particle repulsion, which normally resets it, is not enabled).

◆ applyConstitutiveModel()

void hemo::HemoCellFields::applyConstitutiveModel ( bool  forced = false)

Apply the material model of the cells to the particles, updating their force.

◆ applyRepulsionForce()

void hemo::HemoCellFields::applyRepulsionForce ( )

Apply (and calculate) the repulsion force between particles.

◆ base_cell_id()

plint hemo::HemoCellFields::base_cell_id ( plint  wrapped) const
inline

The ID a cell was loaded with (0 .. number_of_cells - 1) from the ID of one of its periodic images, which grows by a multiple of number_of_cells at every periodic crossing (HemoCellParticleDataTransfer::getOffset()).

◆ calculateCommunicationStructure()

void hemo::HemoCellFields::calculateCommunicationStructure ( )

◆ capRepulsionForce()

void hemo::HemoCellFields::capRepulsionForce ( )

Limit the repulsion force (sv.force_repulsion, particle and wall repulsion together) of every particle to FORCE_LIMIT (param::f_limit); no-op if FORCE_LIMIT is not defined. Local to each block (no communication); called after a repulsion update.

◆ checkCheckPointFingerprint()

void hemo::HemoCellFields::checkCheckPointFingerprint ( plb::XMLreader &  documentXML)
private

Fatal error if the build fingerprint of a checkpoint does not match this build and setup; warning if the checkpoint has none (older versions).

◆ copyXMLreader2XMLwriter() [1/2]

void hemo::HemoCellFields::copyXMLreader2XMLwriter ( plb::XMLreader const &  reader,
plb::XMLwriter &  writer 
)
private

◆ copyXMLreader2XMLwriter() [2/2]

void hemo::HemoCellFields::copyXMLreader2XMLwriter ( plb::XMLreaderProxy  readerProxy,
plb::XMLwriter &  writer 
)
private

◆ createCEPACfield()

void hemo::HemoCellFields::createCEPACfield ( )

◆ createParticleField()

void hemo::HemoCellFields::createParticleField ( plb::SparseBlockStructure3D *  sbStructure_ = 0,
plb::ThreadAttribution *  tAttribution_ = 0 
)

◆ deleteBrokenCells()

void hemo::HemoCellFields::deleteBrokenCells ( plint  envelope,
bool  verbose 
)

Delete the cells that lost vertices, on every block that holds one of their vertices within envelope nodes of its bulk (see HemoCellParticleField::deleteBrokenCells()). Called by HemoCell::iterate() after the particles moved. Not collective.

◆ deleteIncompleteCells()

void hemo::HemoCellFields::deleteIncompleteCells ( bool  verbose = true)

Delete any incomplete cells on a block.

◆ deleteNonLocalParticles()

void hemo::HemoCellFields::deleteNonLocalParticles ( int  envelope)

Delete non local particles (do not delete in envelopesize)

◆ exchangeEnvelopes()

void hemo::HemoCellFields::exchangeEnvelopes ( )
private

Fill the particle envelopes of all blocks with the particles in the bulk of their neighbours (normal and enabled periodic overlaps of the particle field). Called by syncEnvelopes(); collective over all ranks.

◆ findInternalParticleGridPoints()

void hemo::HemoCellFields::findInternalParticleGridPoints ( )

◆ getParticleField3D()

MultiParticleField3D< HemoCellParticleField > & hemo::HemoCellFields::getParticleField3D ( )

Legacy Helper function to get the particle field, mostly unused as direct access is available.

◆ getParticles()

void hemo::HemoCellFields::getParticles ( std::vector< HemoCellParticle * > &  particles,
plb::Box3D &  domain 
)

Get particles in a given domain.

◆ InitAfterLoadCheckpoint()

void hemo::HemoCellFields::InitAfterLoadCheckpoint ( )

Used to set variables inside the celltypes for correct access, called through createParticleField.

◆ internalGridPointsMembrane()

void hemo::HemoCellFields::internalGridPointsMembrane ( )

◆ interpolateFluidVelocity()

void hemo::HemoCellFields::interpolateFluidVelocity ( )

Interpolate the velocity of the fluid to the individual particles.

◆ load()

void hemo::HemoCellFields::load ( plb::XMLreader *  documentXML,
unsigned int &  iter,
Config *  cfg = NULL 
)

Load a checkpoint, store the current iteration in iter. Checks the build fingerprint written by saveCheckPointDescription() (fatal error on a mismatch; older checkpoints without one load with a warning). Collective.

◆ loadCEPACfield()

void hemo::HemoCellFields::loadCEPACfield ( const std::string &  checkpointDirectory)
private

Load the CEPAC field from a checkpoint directory if it is enabled and present.

◆ operator[]() [1/2]

HemoCellField * hemo::HemoCellFields::operator[] ( std::string  name)

Easy access to contained celltypes.

◆ operator[]() [2/2]

HemoCellField * hemo::HemoCellFields::operator[] ( unsigned int  index)

Easy access to contained celltypes.

◆ populateBindingSites()

void hemo::HemoCellFields::populateBindingSites ( plb::Box3D *  box = 0)

Add bindingSites.

◆ populateBoundaryParticles()

void hemo::HemoCellFields::populateBoundaryParticles ( )

Add boundary particles on the fluid-solid boundary.

◆ prepareSolidification()

void hemo::HemoCellFields::prepareSolidification ( )

◆ readPositionsCellFields()

void hemo::HemoCellFields::readPositionsCellFields ( std::string  particlePosFile)

Legacy reads in only RBC an PLT from a single pos file.

◆ save()

void hemo::HemoCellFields::save ( plb::XMLreader *  documentXML,
unsigned int  iter,
Config *  cfg = NULL 
)

Write the checkpoint data files, after renaming the previous ones (including checkpoint.xml) to .old. checkpoint.xml itself is written last, by saveCheckPointDescription(), so that a checkpoint interrupted while saving has no checkpoint.xml instead of a mismatching one. Collective.

◆ saveCheckPointDescription()

void hemo::HemoCellFields::saveCheckPointDescription ( plb::XMLreader *  documentXML,
unsigned int  iter 
)

Write checkpoint.xml (configuration, iteration, number of cells and the build fingerprint) under a temporary name and rename it into place. Call after all checkpoint data files are written. Collective.

◆ separate_force_vectors()

void hemo::HemoCellFields::separate_force_vectors ( )

Separate the force vectors of particles so it becomes clear what the vector for each separate force is.

◆ size()

unsigned int hemo::HemoCellFields::size ( )

Get the number of celltypes.

◆ solidifyCells()

void hemo::HemoCellFields::solidifyCells ( )

Conditionally solidify cells if requested.

◆ spreadParticleForce()

void hemo::HemoCellFields::spreadParticleForce ( )

Spread the force of all particles over the fluid in this iteration.

◆ syncEnvelopes()

void hemo::HemoCellFields::syncEnvelopes ( )

Sync the particle envelopes between domains.

◆ unify_force_vectors()

void hemo::HemoCellFields::unify_force_vectors ( )

Unify the force vectors of particles to point to a single force.

◆ updateResidenceTime()

void hemo::HemoCellFields::updateResidenceTime ( unsigned int  rtime)

increment cell residence time

Member Data Documentation

◆ bindingHelper

bindingFieldHelper* hemo::HemoCellFields::bindingHelper = 0

Helpers created on first use through bindingFieldHelper::get() and InteriorViscosityHelper::get(); owned (and deleted) by this object.

◆ boundaryRepulsionConstant

T hemo::HemoCellFields::boundaryRepulsionConstant = 0.0

Wall repulsion constant [lattice force units], set by HemoCell::enableBoundaryParticles() (in pN)

◆ boundaryRepulsionCutoff

T hemo::HemoCellFields::boundaryRepulsionCutoff = 0.0

Wall repulsion cutoff [lattice units], set by HemoCell::enableBoundaryParticles()

◆ boundaryRepulsionTimescale

pluint hemo::HemoCellFields::boundaryRepulsionTimescale = 1

Timescale seperation for boundary repulsion, set through hemocell.h.

◆ cellFields

std::vector<HemoCellField *> hemo::HemoCellFields::cellFields

Vector containing the cellTypes.

◆ CEPACfield

plb::MultiBlockLattice3D<T, CEPAC_DESCRIPTOR>* hemo::HemoCellFields::CEPACfield = 0

palabos field for storing the CPAC scalar field if used

◆ completeCellsScopes

unsigned int hemo::HemoCellFields::completeCellsScopes = 0
private

Number of CompleteCellsScope objects that exist (they nest).

◆ desiredCEPACfieldOutputVariables

std::vector<int> hemo::HemoCellFields::desiredCEPACfieldOutputVariables

◆ desiredFluidOutputVariables

std::vector<int> hemo::HemoCellFields::desiredFluidOutputVariables

A vector specifying the output variables (from const_defaults.h)

◆ domain_immersedParticles

plb::MultiParticleField3D<HemoCellParticleField> * hemo::HemoCellFields::domain_immersedParticles = 0

◆ envelopeRecvData

std::vector<std::vector<NoInitChar> > hemo::HemoCellFields::envelopeRecvData
private

◆ envelopeRecvInfos

std::vector<std::vector<const plb::CommunicationInfo3D *> > hemo::HemoCellFields::envelopeRecvInfos
private

◆ envelopeRecvRanks

std::vector<int> hemo::HemoCellFields::envelopeRecvRanks
private

◆ envelopeRecvSizes

std::vector<std::vector<int> > hemo::HemoCellFields::envelopeRecvSizes
private

◆ envelopeSendData

std::vector<std::vector<NoInitChar> > hemo::HemoCellFields::envelopeSendData
private

◆ envelopeSendRanks

std::vector<int> hemo::HemoCellFields::envelopeSendRanks
private

Partner ranks (ascending) and per-partner message sizes, data and receive overlaps of exchangeEnvelopes(), kept between calls to avoid reallocation.

◆ envelopeSendSizes

std::vector<std::vector<int> > hemo::HemoCellFields::envelopeSendSizes
private

◆ envelopeSize

pluint hemo::HemoCellFields::envelopeSize

The envelopeSize for the particles.

◆ hemocell

HemoCell& hemo::HemoCellFields::hemocell

Reference to parent.

◆ immersedParticles

plb::MultiParticleField3D<HemoCellParticleField>* hemo::HemoCellFields::immersedParticles = 0

palabos field storing the particles

◆ interiorViscosityEntireGridTimescale

pluint hemo::HemoCellFields::interiorViscosityEntireGridTimescale = 1

◆ interiorViscosityHelper

InteriorViscosityHelper* hemo::HemoCellFields::interiorViscosityHelper = 0

◆ interiorViscosityTimescale

pluint hemo::HemoCellFields::interiorViscosityTimescale = 1

◆ large_communicator

plb::CommunicationStructure3D* hemo::HemoCellFields::large_communicator = 0

◆ lattice

plb::MultiBlockLattice3D<T, DESCRIPTOR>* hemo::HemoCellFields::lattice

the fluid lattice

◆ max_neighbours

unsigned int hemo::HemoCellFields::max_neighbours = 0

◆ number_of_cells

int hemo::HemoCellFields::number_of_cells = 0

Total number of cells in the simulation, should be constant Is set through hemocell::loadParticles() is added (TODO: also when removed)

◆ number_of_cells_from_checkpoint

bool hemo::HemoCellFields::number_of_cells_from_checkpoint = false

True once number_of_cells was restored from a checkpoint; it is then no longer re-derived from the .pos files (which may have changed since).

◆ particleComm

MPI_Comm hemo::HemoCellFields::particleComm = MPI_COMM_NULL
private

Private duplicate of MPI_COMM_WORLD for the particle exchanges in syncEnvelopes(), so their messages cannot be matched by Palabos or other HemoCell traffic. Created in the constructor (collective over all ranks), freed in the destructor.

◆ particleVelocityUpdateTimescale

pluint hemo::HemoCellFields::particleVelocityUpdateTimescale = 1

Timescale seperation for the velocity interpolation from the fluid to the particle.

◆ periodicity_limit

int hemo::HemoCellFields::periodicity_limit[3] = {100, 100, 100}

Limit of cycles in a direction (xyz); offsets below must match these defaults.

◆ periodicity_limit_offset_y

int hemo::HemoCellFields::periodicity_limit_offset_y = 100

◆ periodicity_limit_offset_z

int hemo::HemoCellFields::periodicity_limit_offset_z = 10000

◆ placeCellsAcrossPeriodicBoundaries

bool hemo::HemoCellFields::placeCellsAcrossPeriodicBoundaries = false

Place the periodic images of cells that cross a periodic boundary at load, see HemoCell::setPlaceCellsAcrossPeriodicBoundaries().

◆ preinlet_immersedParticles

plb::MultiParticleField3D<HemoCellParticleField>* hemo::HemoCellFields::preinlet_immersedParticles = 0

seperate preinlet and domain pointers whenever necessary

◆ recvBuffers

std::vector<std::vector<NoInitChar> > hemo::HemoCellFields::recvBuffers
private

◆ repulsionConstant

T hemo::HemoCellFields::repulsionConstant = 0.0

Repulsion constant [lattice force units], set by HemoCell::setRepulsion() (in pN)

◆ repulsionCutoff

T hemo::HemoCellFields::repulsionCutoff = 0.0

Repulsion cutoff [lattice units], set by HemoCell::setRepulsion()

◆ repulsionTimescale

pluint hemo::HemoCellFields::repulsionTimescale = 1

Timescale seperation for repulsion, set through hemocell.h.

◆ sendBuffers

std::vector<std::vector<NoInitChar> > hemo::HemoCellFields::sendBuffers
private

◆ solidifyTimescale

pluint hemo::HemoCellFields::solidifyTimescale = 1