hemocell
Loading...
Searching...
No Matches
hemoCellFields.h
Go to the documentation of this file.
1/*
2This file is part of the HemoCell library
3
4HemoCell is developed and maintained by the Computational Science Lab
5in the University of Amsterdam. Any questions or remarks regarding this library
6can be sent to: info@hemocell.eu
7
8When using the HemoCell library in scientific work please cite the
9corresponding paper: https://doi.org/10.3389/fphys.2017.00563
10
11The HemoCell library is free software: you can redistribute it and/or
12modify it under the terms of the GNU Affero General Public License as
13published by the Free Software Foundation, either version 3 of the
14License, or (at your option) any later version.
15
16The library is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU Affero General Public License for more details.
20
21You should have received a copy of the GNU Affero General Public License
22along with this program. If not, see <http://www.gnu.org/licenses/>.
23*/
24#ifndef HEMOCELLFIELDS_H
25#define HEMOCELLFIELDS_H
26namespace hemo {
27class HemoCellFields;
28}
30#include "genericFunctions.h"
31#include "hemoCellFunctional.h"
32#include "hemoCellField.h"
33#include "hemoCellParticle.h"
34#include "config.h"
35#include <unistd.h>
36
37#include "latticeBoltzmann/advectionDiffusionLattices.hh"
38#include "multiBlock/multiBlockLattice3D.hh"
39#include "offLattice/triangularSurfaceMesh.hh"
40#include "libraryInterfaces/TINYXML_xmlIO.hh"
41#include "particles/multiParticleField3D.hh"
42#include "parallelism/parallelBlockCommunicator3D.h"
43
44namespace hemo {
45class HemoCell;
46
53{
54public:
55
57 HemoCellFields(plb::MultiBlockLattice3D<T, DESCRIPTOR> & lattice_, unsigned int particleEnvelopeWidth,HemoCell &);
58
59 /*
60 * Create the particle field seperately, takes the arguments set in the constructor
61 * Is called in the constructor as well
62 */
63 void createParticleField(plb::SparseBlockStructure3D* sbStructure_ = 0, plb::ThreadAttribution * tAttribution_ = 0);
64
65 void createCEPACfield();
66
69
70public:
73
75 HemoCellField * addCellType(std::string name_, int constructType);
76
78 HemoCellField * operator[](unsigned int index);
79
81 HemoCellField * operator[](string name);
82
84 unsigned int size();
85
86 /*Checkpoint functions*/
87private:
88 void copyXMLreader2XMLwriter(plb::XMLreader const& reader, plb::XMLwriter & writer);
89 void copyXMLreader2XMLwriter(plb::XMLreaderProxy readerProxy, plb::XMLwriter & writer);
90public:
92 void load(plb::XMLreader * documentXML, unsigned int & iter, Config * cfg = NULL);
94 void save(plb::XMLreader * documentXML, unsigned int iter, Config * cfg = NULL);
95
97 plb::MultiParticleField3D<HemoCellParticleField> & getParticleField3D();
99 void readPositionsCellFields(std::string particlePosFile);
100
101 //Class functionals
103 void advanceParticles();
104
105 // Find interior lattice points and set omega
107
108 // Look for lattice nodes near the membrane and update those
110
113
115 void spreadParticleForce();
116
119
121 void unify_force_vectors();
122
124 void applyRepulsionForce();
125
128
130 void deleteIncompleteCells(bool verbose = true);
131
133 void applyConstitutiveModel(bool forced = false);
134
136 void syncEnvelopes();
137
139 void getParticles(vector<HemoCellParticle*> & particles, plb::Box3D & domain);
140
142 void addParticles(vector<HemoCellParticle> & particles);
143
146
148 void populateBindingSites(plb::Box3D * box = 0);
149
151 void deleteNonLocalParticles(int envelope);
152
154 void solidifyCells();
156
158 void updateResidenceTime(unsigned int rtime);
159
160 //Class Variables
161
163 plb::MultiBlockLattice3D<T, DESCRIPTOR> * lattice;
166
171 vector<HemoCellField *> cellFields;
175 plb::MultiParticleField3D<HemoCellParticleField> * immersedParticles = 0;
177 plb::MultiParticleField3D<HemoCellParticleField> * preinlet_immersedParticles = 0, * domain_immersedParticles = 0;
178
180 plb::MultiBlockLattice3D<T,CEPAC_DESCRIPTOR> * CEPACfield = 0;
181
188
195
198
200
203
205 int periodicity_limit[3] = {100};
206 //Internal calculation of offset created by flattening limits
209
210private:
211 vector<vector<NoInitChar>> sendBuffers, recvBuffers;
212public:
213
219 inline int base_cell_id(int wrapped) {
221 }
222 unsigned int max_neighbours = 0;
223
224 plb::CommunicationStructure3D * large_communicator = 0;
225 plb::ParallelBlockCommunicator3D envelope_communicator;
226
228
229 /*
230 * Functionals needed for access of the cellfields
231 */
233 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
235 };
237 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
239 };
241 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
243 };
245 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
247 };
248
250 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
252 };
253
254
256 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
258 };
260 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
261 HemoAdvanceParticles * clone() const;
262 };
264 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
266 public:
267 bool forced = false;
268 };
270 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
271 HemoRepulsionForce * clone() const;
272 };
274 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
276 };
278 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
280 public:
282 };
284 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
285 HemoSyncEnvelopes * clone() const;
286 void getTypeOfModification(std::vector<plb::modif::ModifT>& modified) const;
287 };
289 vector<HemoCellParticle *> & particles;
290 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
291 HemoGetParticles * clone() const;
292 public:
293 HemoGetParticles(vector<HemoCellParticle *> & particles_) : particles(particles_) {}
294 };
296 vector<HemoCellParticle> & particles;
297 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
298 HemoSetParticles * clone() const;
299 public:
300 HemoSetParticles(vector<HemoCellParticle> & particles_) : particles(particles_) {}
301 };
303 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
305 };
307 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
309 };
311 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
313 public:
315 HemoDeleteNonLocalParticles(int envelope_) : envelopeSize(envelope_) {}
316 };
318 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
319 HemoSolidifyCells * clone() const;
320 };
322 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
324 };
326 void processGenericBlocks(plb::Box3D, std::vector<plb::AtomicBlock3D*>);
328 public:
329 unsigned int rtime;
330 };
331};
332}
333#endif
Definition config.h:58
Definition hemoCellField.h:42
Definition hemoCellFields.h:259
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:501
HemoAdvanceParticles * clone() const
Definition hemoCellFields.cpp:716
bool forced
Definition hemoCellFields.h:267
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:527
HemoApplyConstitutiveModel * clone() const
Definition hemoCellFields.cpp:717
HemoBoundaryRepulsionForce * clone() const
Definition hemoCellFields.cpp:720
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:569
bool verbose
Definition hemoCellFields.h:281
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:636
HemoDeleteIncompleteCells * clone() const
Definition hemoCellFields.cpp:721
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:676
HemoDeleteNonLocalParticles * clone() const
Definition hemoCellFields.cpp:725
int envelopeSize
Definition hemoCellFields.h:314
HemoDeleteNonLocalParticles(int envelope_)
Definition hemoCellFields.h:315
HemoFindInternalParticleGridPoints * clone() const
Definition hemoCellFields.cpp:711
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:327
Definition hemoCellFields.h:288
vector< HemoCellParticle * > & particles
Definition hemoCellFields.h:289
HemoGetParticles(vector< HemoCellParticle * > &particles_)
Definition hemoCellFields.h:293
HemoGetParticles * clone() const
Definition hemoCellFields.cpp:722
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:650
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:338
HemoInternalGridPointsMembrane * clone() const
Definition hemoCellFields.cpp:710
HemoInterpolateFluidVelocity * clone() const
Definition hemoCellFields.cpp:715
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:350
Definition hemoCellFields.h:306
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:593
HemoPopulateBindingSites * clone() const
Definition hemoCellFields.cpp:728
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:583
HemoPopulateBoundaryParticles * clone() const
Definition hemoCellFields.cpp:724
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:700
HemoPrepareSolidification * clone() const
Definition hemoCellFields.cpp:727
Definition hemoCellFields.h:269
HemoRepulsionForce * clone() const
Definition hemoCellFields.cpp:719
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:555
Definition hemoCellFields.h:232
HemoSeperateForceVectors * clone() const
Definition hemoCellFields.cpp:712
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:624
Definition hemoCellFields.h:295
HemoSetParticles(vector< HemoCellParticle > &particles_)
Definition hemoCellFields.h:300
HemoSetParticles * clone() const
Definition hemoCellFields.cpp:723
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:661
vector< HemoCellParticle > & particles
Definition hemoCellFields.h:296
Definition hemoCellFields.h:317
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:690
HemoSolidifyCells * clone() const
Definition hemoCellFields.cpp:726
Definition hemoCellFields.h:240
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:514
HemoSpreadParticleForce * clone() const
Definition hemoCellFields.cpp:714
Definition hemoCellFields.h:283
HemoSyncEnvelopes * clone() const
Definition hemoCellFields.cpp:718
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:374
void getTypeOfModification(std::vector< plb::modif::ModifT > &modified) const
Definition hemoCellFields.cpp:732
Definition hemoCellFields.h:236
HemoUnifyForceVectors * clone() const
Definition hemoCellFields.cpp:713
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:542
Definition hemoCellFields.h:325
void processGenericBlocks(plb::Box3D, std::vector< plb::AtomicBlock3D * >)
Definition hemoCellFields.cpp:611
unsigned int rtime
Definition hemoCellFields.h:329
HemoupdateResidenceTime * clone() const
Definition hemoCellFields.cpp:729
Definition hemoCellFields.h:53
void prepareSolidification()
Definition hemoCellFields.cpp:704
vector< int > desiredCEPACfieldOutputVariables
Definition hemoCellFields.h:167
pluint solidifyTimescale
Definition hemoCellFields.h:199
pluint boundaryRepulsionTimescale
Timescale seperation for boundary repulsion, set through hemocell.h.
Definition hemoCellFields.h:194
void unify_force_vectors()
Unify the force vectors of particles to point to a single force.
Definition hemoCellFields.cpp:545
unsigned int size()
Get the number of celltypes.
Definition hemoCellFields.cpp:148
T repulsionCutoff
Repulsion variable set through hemocell.h.
Definition hemoCellFields.h:183
plb::MultiParticleField3D< HemoCellParticleField > * immersedParticles
palabos field storing the particles
Definition hemoCellFields.h:175
void getParticles(vector< HemoCellParticle * > &particles, plb::Box3D &domain)
Get particles in a given domain.
Definition hemoCellFields.cpp:656
T boundaryRepulsionConstant
Boundary repulsion variable set through hemocell.h.
Definition hemoCellFields.h:192
void addParticles(vector< HemoCellParticle > &particles)
Add particles to local processors.
Definition hemoCellFields.cpp:669
int periodicity_limit[3]
Limit of cycles in a direction (xyz)
Definition hemoCellFields.h:205
void internalGridPointsMembrane()
Definition hemoCellFields.cpp:342
HemoCell & hemocell
Reference to parent.
Definition hemoCellFields.h:169
HemoCellField * addCellType(std::string name_, int constructType)
Add an celltype with a certain mesh, the name also specifies <name_>.xml and <name_>....
Definition hemoCellFields.cpp:141
void solidifyCells()
Conditionally solidify cells if requested.
Definition hemoCellFields.cpp:694
void createCEPACfield()
Definition hemoCellFields.cpp:113
void populateBindingSites(plb::Box3D *box=0)
Add bindingSites.
Definition hemoCellFields.cpp:596
vector< vector< NoInitChar > > recvBuffers
Definition hemoCellFields.h:211
void spreadParticleForce()
Spread the force of all particles over the fluid in this iteration.
Definition hemoCellFields.cpp:517
int base_cell_id(int wrapped)
Definition hemoCellFields.h:219
void applyBoundaryRepulsionForce()
Apply (and calculate) the repulsion force between particles and the boundary.
Definition hemoCellFields.cpp:572
void createParticleField(plb::SparseBlockStructure3D *sbStructure_=0, plb::ThreadAttribution *tAttribution_=0)
Definition hemoCellFields.cpp:70
void applyRepulsionForce()
Apply (and calculate) the repulsion force between particles.
Definition hemoCellFields.cpp:558
~HemoCellFields()
Generic Destructor.
Definition hemoCellFields.cpp:55
void applyConstitutiveModel(bool forced=false)
Apply the material model of the cells to the particles, updating their force.
Definition hemoCellFields.cpp:530
plb::MultiParticleField3D< HemoCellParticleField > * domain_immersedParticles
Definition hemoCellFields.h:177
void updateResidenceTime(unsigned int rtime)
increment cell residence time
Definition hemoCellFields.cpp:614
pluint envelopeSize
The envelopeSize for the particles.
Definition hemoCellFields.h:173
void save(plb::XMLreader *documentXML, unsigned int iter, Config *cfg=NULL)
Save a checkpoint.
Definition hemoCellFields.cpp:277
int periodicity_limit_offset_z
Definition hemoCellFields.h:208
plb::MultiBlockLattice3D< T, DESCRIPTOR > * lattice
the fluid lattice
Definition hemoCellFields.h:163
pluint interiorViscosityEntireGridTimescale
Definition hemoCellFields.h:202
void advanceParticles()
Advance the particles in an iteration.
Definition hemoCellFields.cpp:504
plb::CommunicationStructure3D * large_communicator
Definition hemoCellFields.h:224
void deleteNonLocalParticles(int envelope)
Delete non local particles (do not delete in envelopesize)
Definition hemoCellFields.cpp:680
void copyXMLreader2XMLwriter(plb::XMLreader const &reader, plb::XMLwriter &writer)
void copyXMLreader2XMLwriter(plb::XMLreaderProxy readerProxy, plb::XMLwriter &writer)
plb::ParallelBlockCommunicator3D envelope_communicator
Definition hemoCellFields.h:225
vector< vector< NoInitChar > > sendBuffers
Definition hemoCellFields.h:211
T boundaryRepulsionCutoff
Boundary repulsion variable set through hemocell.h.
Definition hemoCellFields.h:190
void populateBoundaryParticles()
Add boundary particles on the fluid-solid boundary.
Definition hemoCellFields.cpp:586
vector< HemoCellField * > cellFields
Vector containing the cellTypes.
Definition hemoCellFields.h:171
pluint repulsionTimescale
Timescale seperation for repulsion, set through hemocell.h.
Definition hemoCellFields.h:187
void readPositionsCellFields(std::string particlePosFile)
Legacy reads in only RBC an PLT from a single pos file.
plb::MultiParticleField3D< HemoCellParticleField > & getParticleField3D()
Legacy Helper function to get the particle field, mostly unused as direct access is available.
Definition hemoCellFields.cpp:738
unsigned int max_neighbours
Definition hemoCellFields.h:222
void separate_force_vectors()
Separate the force vectors of particles so it becomes clear what the vector for each separate force i...
Definition hemoCellFields.cpp:627
vector< int > desiredFluidOutputVariables
A vector specifying the output variables (from const_defaults.h)
Definition hemoCellFields.h:165
void load(plb::XMLreader *documentXML, unsigned int &iter, Config *cfg=NULL)
Load a checkpoint, store the current iteration in &iter.
Definition hemoCellFields.cpp:240
plb::MultiParticleField3D< HemoCellParticleField > * preinlet_immersedParticles
seperate preinlet and domain pointers whenever necessary
Definition hemoCellFields.h:177
void calculateCommunicationStructure()
Definition hemoCellFields.cpp:363
void syncEnvelopes()
Sync the particle envelopes between domains.
Definition hemoCellFields.cpp:377
void interpolateFluidVelocity()
Interpolate the velocity of the fluid to the individual particles.
Definition hemoCellFields.cpp:353
pluint particleVelocityUpdateTimescale
Timescale seperation for the velocity interpolation from the fluid to the particle.
Definition hemoCellFields.h:197
pluint interiorViscosityTimescale
Definition hemoCellFields.h:201
void deleteIncompleteCells(bool verbose=true)
Delete any incomplete cells on a block.
Definition hemoCellFields.cpp:639
plb::MultiBlockLattice3D< T, CEPAC_DESCRIPTOR > * CEPACfield
palabos field for storing the CPAC scalar field if used
Definition hemoCellFields.h:180
int periodicity_limit_offset_y
Definition hemoCellFields.h:207
T repulsionConstant
Repulsion variable set through hemocell.h.
Definition hemoCellFields.h:185
void findInternalParticleGridPoints()
Definition hemoCellFields.cpp:331
int number_of_cells
Definition hemoCellFields.h:218
HemoCellField * operator[](unsigned int index)
Easy access to contained celltypes.
Definition hemoCellFields.cpp:153
void InitAfterLoadCheckpoint()
Used to set variables inside the celltypes for correct access, called through createParticleField.
Definition hemoCellFields.cpp:202
Definition hemoCellFunctional.h:36
Definition hemocell.h:68
double T
Definition constant_defaults.h:118
long unsigned int pluint
Definition constant_defaults.h:130
Definition config.cpp:34