24#ifndef IMMERSEDBOUNDARYMETHOD_H
25#define IMMERSEDBOUNDARYMETHOD_H
34 return x[0] >= box.x0 && x[0] <= box.x1 && x[1] >= box.y0 && x[1] <= box.y1 && x[2] >= box.z0 && x[2] <= box.z1;
39 return std::max(x, (
T)0.0);
51template <
typename T,
template <
typename U>
class Descriptor>
53 std::vector<plb::Dot3D> & cellPos, std::vector<T> & weights);
55template <
typename T,
template <
typename U>
class Descriptor>
57 std::vector<plb::Dot3D> & cellPos, std::vector<T> & weights);
77#ifdef INTERIOR_VISCOSITY
78 particle.kernelCoordinates.clear();
79 particle.kernelCoordinates.reserve(8);
82 const plb::Dot3D location = block.getLocation();
83 const plb::Box3D boundingBox = block.getBoundingBox();
84 const plint lower[3] = {boundingBox.x0, boundingBox.y0, boundingBox.z0};
85 const plint upper[3] = {boundingBox.x1, boundingBox.y1, boundingBox.z1};
95 for (
int d = 0; d < 3; ++d) {
96 const plint base =
plint(std::floor(position[d]));
97 for (
int i = 0; i < 2; ++i) {
98 node[d][i] = base + i;
99 weight1D[d][i] =
phi2(position[d] - node[d][i]);
100 inside[d][i] = node[d][i] >= lower[d] && node[d][i] <= upper[d];
105 for (
int i = 0; i < 2; ++i) {
106 if (!inside[0][i]) {
continue; }
107 for (
int j = 0; j < 2; ++j) {
108 if (!inside[1][j]) {
continue; }
109 for (
int k = 0; k < 2; ++k) {
110 if (!inside[2][k]) {
continue; }
111 const T weight = weight1D[0][i] * weight1D[1][j] * weight1D[2][k];
112 if (weight == 0.0) {
continue; }
114 plb::Cell<T, DESCRIPTOR> &
cell = block.get(node[0][i], node[1][j], node[2][k]);
115 if (
cell.getDynamics().isBoundary()) {
continue; }
117 total_weight += weight;
120#ifdef INTERIOR_VISCOSITY
121 particle.kernelCoordinates.push_back({node[0][i], node[1][j], node[2][k]});
126 const T weight_coeff = 1.0 / total_weight;
128 weight_ *= weight_coeff;
132template <
typename T,
template <
typename U>
class Descriptor>
135 plb::BlockLattice3D<T, Descriptor>
const & block,
hemo::Array<T, 3> const & position,
136 std::vector<plb::Dot3D> & cellPos, std::vector<T> & weights);
140 std::vector<double> & weights);
142template <
typename T,
template <
typename U>
class Descriptor>
145 std::vector<T> & weights);
151template <
typename T,
template <
typename U>
class Descriptor>
153 std::vector<T> & weights);
Definition hemoCellParticle.h:44
std::vector< T > kernelWeights
Definition hemoCellParticle.h:79
serializeValues_t sv
Definition hemoCellParticle.h:68
std::vector< plb::Cell< T, DESCRIPTOR > * > kernelLocations
Definition hemoCellParticle.h:78
double T
Definition constant_defaults.h:137
long int plint
Definition constant_defaults.h:149
void interpolationCoefficientsPhi4c(plb::BlockLattice3D< T, Descriptor > const &block, hemo::Array< T, 3 > const &position, std::vector< plb::Dot3D > &cellPos, std::vector< T > &weights)
void curateInterpolationCoefficients(plb::BlockLattice3D< T, Descriptor > &fluid, std::vector< plb::Dot3D > &cellPos, std::vector< T > &weights)
void interpolationCoefficientsPhi4(plb::BlockLattice3D< double, DESCRIPTOR > const &block, hemo::Array< double, 3 > const &position, std::vector< plb::Dot3D > &cellPos, std::vector< double > &weights)
void interpolationCoefficientsPhi3(plb::BlockLattice3D< T, Descriptor > const &block, hemo::Array< T, 3 > const &position, std::vector< plb::Dot3D > &cellPos, std::vector< T > &weights)
bool contained_sane(hemo::Array< plint, 3 > const &x, plb::Box3D const &box)
Decide if a Lagrangian point is contained in 3D box, boundaries exclusive.
Definition immersedBoundaryMethod.h:33
void interpolationCoefficientsPhi1(plb::BlockLattice3D< T, Descriptor > const &block, hemo::Array< T, 3 > const &position, std::vector< plb::Dot3D > &cellPos, std::vector< T > &weights)
void interpolationCoefficientsPhi2(plb::BlockLattice3D< T, DESCRIPTOR > &block, HemoCellParticle &particle)
Compute the IBM kernel of a particle with the 2-point hat function phi2 (trilinear weights): kernelLo...
Definition immersedBoundaryMethod.h:73
T phi2(T x)
Definition immersedBoundaryMethod.h:36
void interpolationCoefficients(plb::BlockLattice3D< T, Descriptor > const &block, hemo::Array< T, 3 > const &position, std::vector< plb::Dot3D > &cellPos, std::vector< T > &weights)
hemo::Array< T, 3 > position
Definition hemoCellParticle.h:50