hemocell
Loading...
Searching...
No Matches
hemocellInit.hh
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 HEMOCELLINIT_HH
25#define HEMOCELLINIT_HH
26
27#include "palabos3D.h"
28#include "palabos3D.hh"
29
30template <typename T>
32public:
33 CouetteDensityAndVelocity(T shearRateLU_, T zeroCoordinate_);
34 void operator()(plint iX, plint iY, plint iZ, T & rho, hemo::Array<T, 3> & u) const;
35
36private:
39};
40
41T couetteVelocity(plint iY, T shearRateLU, T zeroCoordinate) {
42 return shearRateLU * (iY - zeroCoordinate);
43}
44template <typename T>
46 : shearRateLU(shearRateLU_), zeroCoordinate(zeroCoordinate_) {}
47
48template <typename T>
50 rho = (T)1;
51 u[0] = couetteVelocity(iY, shearRateLU, zeroCoordinate);
52 u[1] = T();
53 u[2] = T();
54}
55
56/* ************* iniLatticeSquareCouette ******************* */
57template <typename T, template <class U> class Descriptor>
58void iniLatticeSquareCouette(plb::MultiBlockLattice3D<T, Descriptor> & lattice, plint nx, plint ny, plint nz,
59 plb::OnLatticeBoundaryCondition3D<T, Descriptor> & boundaryCondition, T shearRate) {
60 plb::Box3D top = plb::Box3D(0, nx - 1, 0, ny - 1, nz - 1, nz - 1);
61 plb::Box3D bottom = plb::Box3D(0, nx - 1, 0, ny - 1, 0, 0);
62
63 //lattice.periodicity().toggleAll(true);
64 lattice.periodicity().toggle(0, true);
65 lattice.periodicity().toggle(1, true);
66 lattice.periodicity().toggle(2, false);
67
68 boundaryCondition.setVelocityConditionOnBlockBoundaries(lattice, top);
69 boundaryCondition.setVelocityConditionOnBlockBoundaries(lattice, bottom);
70
71 T vHalf = (nz - 1) * shearRate * 0.5;
72 setBoundaryVelocity(lattice, top, plb::Array<T, 3>(-vHalf, 0.0, 0.0));
73 setBoundaryVelocity(lattice, bottom, plb::Array<T, 3>(vHalf, 0.0, 0.0));
74
75 // plb::Cell<double, plb::descriptors::ForcedD3Q19Descriptor> cell = lattice.get(0,0,0);
76 // // plb::Dynamics<double, plb::descriptors::ForcedD3Q19Descriptor> cellDynamics = cell.getDynamics();
77 // plb::Array<double, 19ul> rawPop = cell.getRawPopulations();
78 // cout << rawPop[0] << std::endl;
79
80
81 setExternalVector(lattice, lattice.getBoundingBox(), Descriptor<T>::ExternalField::forceBeginsAt,
82 plb::Array<T, Descriptor<T>::d>(0.0, 0.0, 0.0));
83
84 // For shearing test this results in a dirac delta in force -> viscous force will not like it
85 //initializeAtEquilibrium(lattice, lattice.getBoundingBox(), CouetteDensityAndVelocity<T>(shearRate, (ny-1)*0.5 ));
86
87 lattice.initialize();
88}
89
90#endif // HEMOCELLINIT_HH
Definition hemocellInit.hh:31
T zeroCoordinate
Definition hemocellInit.hh:38
T shearRateLU
Definition hemocellInit.hh:37
void operator()(plint iX, plint iY, plint iZ, T &rho, hemo::Array< T, 3 > &u) const
Definition hemocellInit.hh:49
CouetteDensityAndVelocity(T shearRateLU_, T zeroCoordinate_)
Definition hemocellInit.hh:45
double T
Definition constant_defaults.h:137
long int plint
Definition constant_defaults.h:149
T couetteVelocity(plint iY, T shearRateLU, T zeroCoordinate)
Definition hemocellInit.hh:41
void iniLatticeSquareCouette(plb::MultiBlockLattice3D< T, Descriptor > &lattice, plint nx, plint ny, plint nz, plb::OnLatticeBoundaryCondition3D< T, Descriptor > &boundaryCondition, T shearRate)
Definition hemocellInit.hh:58
Definition array.h:40