Algorithm#
-
namespace samurai#
Enums
Functions
-
template<std::size_t dim, class TInterval, std::size_t max_size, class Func>
void for_each_level(const CellArray<dim, TInterval, max_size> &ca, Func &&f, bool include_empty_levels = false)#
-
template<class Mesh, class Func>
void for_each_level(const Mesh &mesh, Func &&f, bool include_empty_levels = false)#
-
template<std::size_t dim, class TInterval, class Func>
void for_each_interval(const LevelCellArray<dim, TInterval> &lca, Func &&f)#
-
template<std::size_t dim, class TInterval, class Func>
void for_each_interval(LevelCellArray<dim, TInterval> &lca, Func &&f)#
-
template<std::size_t dim, class TInterval, std::size_t max_size, class Func>
void for_each_interval(const CellArray<dim, TInterval, max_size> &ca, Func &&f)#
-
template<std::size_t dim, class TInterval, std::size_t max_size, class Func>
void for_each_interval(CellArray<dim, TInterval, max_size> &ca, Func &&f)#
-
template<std::size_t dim, class TInterval, class Func>
void for_each_meshinterval(const LevelCellArray<dim, TInterval> &lca, Func &&f)#
-
template<std::size_t dim, class TInterval, std::size_t max_size, class Func>
void for_each_meshinterval(const CellArray<dim, TInterval, max_size> &ca, Func &&f)#
-
template<class MeshIntervalType, class SetType, class Func>
void for_each_meshinterval(SetType &set, Func &&f)#
-
template<class MeshIntervalType, class SetType, class Func>
void parallel_for_each_meshinterval(SetType &set, Func &&f)#
-
template<class MeshIntervalType, Run run_type, class SetType, class Func>
void for_each_meshinterval(SetType &set, Func &&f)#
-
template<std::size_t dim, class TInterval, class Func>
void for_each_cell(const LevelCellArray<dim, TInterval> &lca, Func &&f)#
-
template<std::size_t dim, class TInterval, class Func>
void parallel_for_each_cell(const LevelCellArray<dim, TInterval> &lca, Func &&f)#
-
template<Run run_type, std::size_t dim, class TInterval, class Func>
void for_each_cell(const LevelCellArray<dim, TInterval> &lca, Func &&f)#
-
template<std::size_t dim, class TInterval, class Func, class F, class ...CT>
void for_each_cell(const LevelCellArray<dim, TInterval> &lca, subset_operator<F, CT...> set, Func &&f)#
-
template<Run run_type, std::size_t dim, class TInterval, std::size_t max_size, class Func>
void for_each_cell(const CellArray<dim, TInterval, max_size> &ca, Func &&f)#
-
template<std::size_t dim, class TInterval, std::size_t max_size, class Func>
void for_each_cell(const CellArray<dim, TInterval, max_size> &ca, Func &&f)#
-
template<class Mesh, class coord_type, class Func>
void for_each_cell(const Mesh &mesh, std::size_t level, const typename Mesh::interval_t &i, const coord_type &index, Func &&f)#
-
template<class Mesh, class SetType, class Func>
void for_each_cell(const Mesh &mesh, SetType &set, Func &&f)#
-
template<std::size_t dim, class TInterval, class index_t = typename TInterval::index_t, class coord_index_t = typename TInterval::coord_index_t>
index_t find(const LevelCellArray<dim, TInterval> &lca, const xt::xtensor_fixed<coord_index_t, xt::xshape<dim>> &coord)#
-
template<std::size_t dim, class TInterval, class coord_index_t = typename TInterval::coord_index_t, class index_t = typename TInterval::index_t>
auto find_on_dim(const LevelCellArray<dim, TInterval> &lca, std::size_t d, std::size_t start_index, std::size_t end_index, coord_index_t coord)#
-
template<std::size_t dim, class TInterval>
auto find_cell(const LevelCellArray<dim, TInterval> &lca, const typename LevelCellArray<dim, TInterval>::cell_t::coords_t &cartesian_coords)#
-
template<std::size_t dim, class TInterval, std::size_t max_size>
auto find_cell(const CellArray<dim, TInterval, max_size> &ca, const typename CellArray<dim, TInterval, max_size>::cell_t::coords_t &cartesian_coords)#
-
template<class Mesh>
auto find_cell(const Mesh &mesh, const typename Mesh::cell_t::coords_t &cartesian_coords)#
-
template<std::size_t dim, class TInterval>
auto find_cell(const LevelCellArray<dim, TInterval> &lca, const typename LevelCellArray<dim, TInterval>::cell_t::indices_t &indices)#
-
template<std::size_t dim, class TInterval, std::size_t max_size>
auto find_cell(const CellArray<dim, TInterval, max_size> &ca, const typename CellArray<dim, TInterval, max_size>::cell_t::indices_t &indices, const std::size_t level_ref)#
-
template<std::size_t dim, class TInterval, std::size_t max_size>
auto find_cell(const CellArray<dim, TInterval, max_size> &ca, const typename CellArray<dim, TInterval, max_size>::cell_t::indices_t &indices)#
-
namespace detail#
Lattice-Boltzmann wall boundary conditions, attached to the distribution field f the same way as the finite-volume boundary conditions (see
make_bc), and applied byupdate_ghost_mrbefore the stream reads the ghosts.Both are half-way schemes realised as the SAME ghost fill: the outer ghost cell holds the inner cell’s distribution with every velocity reversed (c -> -c), so that after streaming the incoming populations equal the reflected outgoing ones. The reflection is a fixed permutation
opposite[alpha] (the index of the velocity -c_alpha), independent of the boundary direction. Bounce-back and anti-bounce-back differ ONLY by the reflection sign s inf_ghost(alpha) = s * f_inner(opposite[alpha]) + rhs(alpha)
s = +1 (bounce-back) closes the antisymmetric/odd part -> imposes the odd moments (velocity / momentum), even moments left free: a no-slip wall. rhs is the moving-wall momentum term -2 w_alpha rho (c_alpha . u_wall) / c_s^2, and vanishes for a wall at rest. s = -1 (anti-bounce-back) closes the symmetric/even part -> imposes the even moments (density / pressure / height / temperature), odd moments left free: a Dirichlet condition on that scalar.
Given an equilibrium
f^eq(m_wall) to reflect around, the rhs keeps exactly the parity thatsimposes:rhs(alpha) = f^eq_alpha(m_wall) - s * f^eq_opposite(alpha)(m_wall)
i.e. twice the EVEN part for anti-bounce-back (imposed density/height incl. its kinetic q^2/h energy) and twice the ODD part for bounce-back (moving-wall momentum). It vanishes for a homogeneous condition (wall at rest / zero scalar) and, when
f^eqis symmetric (fluid at rest), reduces to the familiar 2 f^eq_alpha. This matches Ginzburg & d’Humieres / Kruger, where bounce-back and anti-bounce-back are the odd and even link-wise closures of the very same reflection.m_wallis provided tomake_bceither as a CONSTANT equilibrium distribution (fluid at rest at the wall, e.g.LBMScheme::equilibrium_f({h_wall, 0, …})) or as a CALLABLEinner_f-> f^eq rebuilt every step from the LOCAL cell (LBMScheme::momentsthenequilibrium_fwith the imposed moment overridden). The velocity-consistent callable keeps the imposed even part in step with the through-flow and is what makes an open “reservoir” boundary stable under a sustained current.A single implementation
LbmReflectionImplrealises the formula: theBounceBack/AntiBounceBacktag fixes the base sign (+1 / -1), the optional per-block odd axes flip it (slip wall, see below) and the optionalm_wallsets the rhs.BounceBacktherefore also accepts anm_wall(moving wall) andAntiBounceBacka homogeneous form (zero scalar).Usage (velocities are the same list passed to
velocity_scheme): samurai::make_bc<samurai::BounceBack>(f, velocities)->on(left, right); samurai::make_bc<samurai::AntiBounceBack>(f, velocities, f_wall)->on(right); // constant samurai::make_bc<samurai::AntiBounceBack>(f, velocities, reservoir)->on(right); // callableNote on the sign vs the single-population picture above: here each conserved variable is the ZEROTH moment (the sum) of its own block, so negating it requires
sign= -1. In the usual single-population fluid the velocity is instead a FIRST moment, which plain bounce-back (sign= +1, reversing every c) already negates; the two conventions therefore look opposite but impose the same physics (zero normal velocity at the wall).- Multi-block reflecting (slip) wall
For a multi-block scheme (D1Q222, D2Q4444, … compressible Euler) the opposite velocity must be searched WITHIN each block, and a slip wall reverses the normal momentum: the block that carries the momentum component normal to the wall is reflected with
sign= -1, all the others (density, energy, tangential momentum) withsign= +1. Pass the block sizes and, per block, the axis of the momentum it carries (or -1 for a scalar such as density or energy): samurai::make_bc<samurai::BounceBack>(f, velocities, block_sizes, block_odd_axis); With a single block andblock_odd_axis= {-1} this is exactly the no-slip wall above (sign= +1 everywhere), so the single-argument overload is unchanged.
Functions
-
template<class ForwardIt, class T>
auto interval_search(ForwardIt first, ForwardIt last, const T &value)#
-
template<std::size_t dim, class TInterval, class index_t = typename TInterval::index_t, class coord_index_t = typename TInterval::coord_index_t>
index_t find_impl(const LevelCellArray<dim, TInterval> &lca, std::size_t start_index, std::size_t end_index, const xt::xtensor_fixed<coord_index_t, xt::xshape<dim>> &coord, std::integral_constant<std::size_t, 0>)#
-
template<std::size_t dim, class TInterval, class index_t = typename TInterval::index_t, class coord_index_t = typename TInterval::coord_index_t, std::size_t N>
index_t find_impl(const LevelCellArray<dim, TInterval> &lca, std::size_t start_index, std::size_t end_index, const xt::xtensor_fixed<coord_index_t, xt::xshape<dim>> &coord, std::integral_constant<std::size_t, N>)#
-
template<std::size_t dim, class TInterval, std::size_t max_size, class Func>
-
namespace placeholders#