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