47#include "palabos3D.hh"
56template <
typename T,
template <
typename U>
class Descriptor>
87 std::vector<T> pop(Descriptor<T>::q);
88 for(
plint i = 0; i < Descriptor<T>::q; i++) {
89 pop[i] = populations[i];
98 return (a % b + b) % b;
108 virtual void process(plb::Box3D domain, plb::BlockLattice3D<T, Descriptor> &lattice)
110 Dot3D absoluteOffset = lattice.getLocation();
113 double gfrac = std::fmod((*this->LEcurrentDisplacement), 1.0);
114 plint globalX, globalY;
115 plint globalZ0 = absoluteOffset.z + domain.z0;
116 plint globalZ1 = absoluteOffset.z + domain.z1;
117 Cell<T, Descriptor> curCell;
118 Cell<T, Descriptor> s1Cell;
119 Cell<T, Descriptor> s2Cell;
123 plb::Array<T, Descriptor<T>::d> j;
125 if (globalZ1 == this->nz - 1)
127 for (
plint iX = domain.x0; iX <= domain.x1; ++iX)
129 globalX = absoluteOffset.x + iX;
130 for (
plint iY = domain.y0; iY <= domain.y1; ++iY)
132 globalY = absoluteOffset.y + iY;
133 curCell = lattice.get(iX, iY, domain.z1);
136 curCell.getDynamics().computeRhoBarJ(curCell, rhoBar, j);
137 curCell.getDynamics().collideExternal(curCell, rhoBar, plb::Array<T,3>(this->topVelocity, 0.0, 0.0),
T(), lattice.getInternalStatistics());
145 s1Cell = lattice.get(s1, iY, domain.z1);
146 s2Cell = lattice.get(s2, iY, domain.z1);
149 (*this->
topPopulations)[globalX][globalY][3] = gfrac * s1Cell[3] + (1 - gfrac) * s2Cell[3];
150 (*this->
topPopulations)[globalX][globalY][6] = gfrac * s1Cell[16] + (1 - gfrac) * s2Cell[16];
151 (*this->
topPopulations)[globalX][globalY][8] = gfrac * s1Cell[8] + (1 - gfrac) * s2Cell[8];
152 (*this->
topPopulations)[globalX][globalY][16] = gfrac * s1Cell[6] + (1 - gfrac) * s2Cell[6];
153 (*this->
topPopulations)[globalX][globalY][18] = gfrac * s1Cell[18] + (1 - gfrac) * s2Cell[18];
159 for (
plint iX = domain.x0; iX <= domain.x1; ++iX)
161 globalX = absoluteOffset.x + iX;
162 for (
plint iY = domain.y0; iY <= domain.y1; ++iY)
164 globalY = absoluteOffset.y + iY;
165 curCell = lattice.get(iX, iY, domain.z0);
168 curCell.getDynamics().computeRhoBarJ(curCell, rhoBar, j);
169 curCell.getDynamics().collideExternal(curCell, rhoBar, plb::Array<T,3>(this->bottomVelocity, 0.0, 0.0),
T(), lattice.getInternalStatistics());
177 s1Cell = lattice.get(s1, iY, domain.z0);
178 s2Cell = lattice.get(s2, iY, domain.z0);
181 (*this->
bottomPopulations)[globalX][globalY][7] = gfrac * s1Cell[15] + (1 - gfrac) * s2Cell[15];
182 (*this->
bottomPopulations)[globalX][globalY][9] = gfrac * s1Cell[9] + (1 - gfrac) * s2Cell[9];
183 (*this->
bottomPopulations)[globalX][globalY][12] = gfrac * s1Cell[12] + (1 - gfrac) * s2Cell[12];
184 (*this->
bottomPopulations)[globalX][globalY][15] = gfrac * s1Cell[7] + (1 - gfrac) * s2Cell[7];
185 (*this->
bottomPopulations)[globalX][globalY][17] = gfrac * s1Cell[17] + (1 - gfrac) * s2Cell[17];
201 modified[0] = modif::nothing;
207 return BlockDomain::bulk;
215template <
typename T,
template <
typename U>
class Descriptor>
238 plb::Array<T, Descriptor<T>::q> pop;
239 for (
plint i = 0; i < DESCRIPTOR<T>::q; i++)
241 pop[i] = populations[i];
252 virtual void process(plb::Box3D domain, plb::BlockLattice3D<T, Descriptor> &lattice)
254 Dot3D absoluteOffset = lattice.getLocation();
256 plint globalZ0 = absoluteOffset.z + domain.z0;
257 plint globalZ1 = absoluteOffset.z + domain.z1;
258 plint globalX, globalY;
259 plb::Array<T, Descriptor<T>::q> populations;
261 if (globalZ1 == this->nz - 1) {
262 for (
plint iX = domain.x0; iX <= domain.x1; ++iX) {
263 globalX = absoluteOffset.x + iX;
264 for (
plint iY = domain.y0; iY <= domain.y1; ++iY) {
265 globalY = absoluteOffset.y + iY;
267 lattice.get(iX, iY, domain.z1).setPopulations(populations);
272 for (
plint iX = domain.x0; iX <= domain.x1; ++iX) {
273 globalX = absoluteOffset.x + iX;
274 for (
plint iY = domain.y0; iY <= domain.y1; ++iY) {
275 globalY = absoluteOffset.y + iY;
277 lattice.get(iX, iY, domain.z0).setPopulations(populations);
292 modified[0] = modif::staticVariables;
298 return BlockDomain::bulk;
305template<
typename T,
template<
class U>
class Descriptor>
309 plb::MultiBlockLattice3D<T,Descriptor> &
lattice;
330 this->LEdisplacement = shearRate *
dt;
331 T vHalf = (
nz - 1) * shearRate * 0.5;
332 this->topVelocity = -vHalf;
333 this->bottomVelocity = vHalf;
341 this->lattice.periodicity().toggleAll(
true);
343 this->topPopulations.resize(this->nx, std::vector<std::vector<T>>(this->ny, std::vector<T>(Descriptor<T>::q)));
344 this->bottomPopulations.resize(this->nx, std::vector<std::vector<T>>(this->ny, std::vector<T>(Descriptor<T>::q)));
347 integrateProcessingFunctional(
349 this->lattice.getBoundingBox(), this->lattice, this->dataProcessorLevel);
351 integrateProcessingFunctional(
353 this->lattice.getBoundingBox(), this->lattice, this->dataProcessorLevel + 1);
370template <
typename T,
template <
typename U>
class Descriptor>
373template <
typename T,
template <
typename U>
class Descriptor>
376template <
typename T,
template <
typename U>
class Descriptor>
Definition leesEdwardsBC.h:58
T topVelocity
Definition leesEdwardsBC.h:65
LeesEdwardsBCGetPopulations(plint nx, plint nz, T topVelocity, T bottomVelocity, double *LEcurrentDisplacement, std::vector< std::vector< std::vector< T > > > *topPopulations, std::vector< std::vector< std::vector< T > > > *bottomPopulations)
Definition leesEdwardsBC.h:68
plint nz
Definition leesEdwardsBC.h:61
double * LEcurrentDisplacement
Definition leesEdwardsBC.h:62
plint nx
Definition leesEdwardsBC.h:60
std::vector< std::vector< std::vector< T > > > * topPopulations
Definition leesEdwardsBC.h:63
plint modNonNegative(plint a, plint b)
Definition leesEdwardsBC.h:96
std::vector< std::vector< std::vector< T > > > * bottomPopulations
Definition leesEdwardsBC.h:64
virtual void getTypeOfModification(std::vector< plb::modif::ModifT > &modified) const
Definition leesEdwardsBC.h:199
virtual plb::BlockDomain::DomainT appliesTo() const
Definition leesEdwardsBC.h:205
virtual LeesEdwardsBCGetPopulations< T, Descriptor > * clone() const
Definition leesEdwardsBC.h:193
virtual void process(plb::Box3D domain, plb::BlockLattice3D< T, Descriptor > &lattice)
Definition leesEdwardsBC.h:108
std::vector< T > populationsArrayToVector(plb::Array< T, Descriptor< T >::q > populations)
Definition leesEdwardsBC.h:86
T bottomVelocity
Definition leesEdwardsBC.h:66
Definition leesEdwardsBC.h:217
plint nz
Definition leesEdwardsBC.h:219
LeesEdwardsBCSetPopulations(plint nz, std::vector< std::vector< std::vector< T > > > *topPopulations, std::vector< std::vector< std::vector< T > > > *bottomPopulations)
Definition leesEdwardsBC.h:223
std::vector< std::vector< std::vector< T > > > * topPopulations
Definition leesEdwardsBC.h:220
plb::Array< T, Descriptor< T >::q > populationsVectorToArray(std::vector< T > populations)
Definition leesEdwardsBC.h:236
virtual LeesEdwardsBCSetPopulations< T, Descriptor > * clone() const
Definition leesEdwardsBC.h:284
virtual plb::BlockDomain::DomainT appliesTo() const
Definition leesEdwardsBC.h:296
std::vector< std::vector< std::vector< T > > > * bottomPopulations
Definition leesEdwardsBC.h:221
virtual void getTypeOfModification(std::vector< plb::modif::ModifT > &modified) const
Definition leesEdwardsBC.h:290
virtual void process(plb::Box3D domain, plb::BlockLattice3D< T, Descriptor > &lattice)
Definition leesEdwardsBC.h:252
Definition leesEdwardsBC.h:307
T dt
Definition leesEdwardsBC.h:316
double LEdisplacement
Definition leesEdwardsBC.h:314
T topVelocity
Definition leesEdwardsBC.h:317
plb::MultiBlockLattice3D< T, Descriptor > & lattice
Definition leesEdwardsBC.h:309
plint ny
Definition leesEdwardsBC.h:311
void updateLECurDisplacement(unsigned int iter)
Definition leesEdwardsBC.h:360
T bottomVelocity
Definition leesEdwardsBC.h:318
plint nx
Definition leesEdwardsBC.h:310
static std::vector< std::vector< std::vector< T > > > bottomPopulations
Definition leesEdwardsBC.h:322
static std::vector< std::vector< std::vector< T > > > topPopulations
Definition leesEdwardsBC.h:321
LeesEdwardsBC(plb::MultiBlockLattice3D< T, Descriptor > &lattice, T shearRate, T dt, double **hemoCellLEcurrentDisplacement, plint dataProcessorLevel=1)
Definition leesEdwardsBC.h:324
static double LEcurrentDisplacement
Definition leesEdwardsBC.h:315
plint nz
Definition leesEdwardsBC.h:312
void initialize()
Definition leesEdwardsBC.h:338
plint dataProcessorLevel
Definition leesEdwardsBC.h:319
double T
Definition constant_defaults.h:118
long int plint
Definition constant_defaults.h:127