15template <MInt nDim, MInt nDist,
class SysEqn>
18 const MInt solverId = s->solverId();
21 m_mode = Mode::DIRECT;
22 for(
MInt i = 0; i < nDim; i++) {
31 m_acceleration[i] = Context::getSolverProperty<MFloat>(
"volumeAcceleration", solverId, AT_, i);
42 m_mode = Mode::GALILEO;
44 const MFloat nu = s->m_Ma / F1BCS / s->m_Re * s->m_referenceLength;
45 for(
MInt n = 0; n < nDim; n++) {
46 m_Ga[n] = Context::getSolverProperty<MFloat>(
"Ga", solverId, AT_, m_Ga.data(), n);
47 const MFloat gravity = m_Ga[n] *
POW2(nu) /
POW3(s->m_referenceLength);
48 m_acceleration[n] = gravity;
53 for(
MInt n = 0; n < nDim; n++) {
54 m_solver->m_volumeAccel[n] = m_acceleration[n];
58template <MInt nDim, MInt nDist,
class SysEqn>
62 std::array<MFloat, nDim> densityGradient{};
63 for(
MInt n = 0; n < nDim; n++) {
64 densityGradient[n] = m_acceleration[n] * F1BCSsq;
67 for(
MInt dir = 0; dir < nDim; dir++) {
68 for(
MInt mi = 0; mi < Ld::dxQyFld(); mi++) {
69 m_forcing[Ld::nFld(dir, mi)] += Ld::tp(Ld::distType(Ld::nFld(dir, mi))) * -1.0 * densityGradient[dir];
70 m_forcing[Ld::pFld(dir, mi)] += Ld::tp(Ld::distType(Ld::pFld(dir, mi))) * 1.0 * densityGradient[dir];
75 for(
MInt j = 0; j < nDist; j++) {
76 m_solver->m_Fext[j] = m_forcing[j];
80template <MInt nDim, MInt nDist,
class SysEqn>
83 const auto& s = m_solver;
85 const MInt timeStep = s->getCurrentTimeStep();
86 maia::parallelFor<true>(0, s->m_currentMaxNoCells, [=](
MInt index) {
87 const MInt cellId = s->m_activeCellList[index];
88 const MInt lvlDiff = s->maxLevel() - s->a_level(cellId);
89 if((timeStep) % IPOW2(lvlDiff) != 0) return;
90 for(MInt j = 0; j < nDist - 1; j++) {
91 s->a_oldDistribution(cellId, j) += FPOW2(lvlDiff) * m_forcing[j];
97static const LbRegSrcTerm<LbSrcTermGravity<2, 9, LbSysEqnCompressible<2, 9>>> reg_SpongeRhoConstd2q9C(
"LB_GRAVITY");
98static const LbRegSrcTerm<LbSrcTermGravity<2, 9, LbSysEqnIncompressible<2, 9>>> reg_SpongeRhoConstd2q9(
"LB_GRAVITY");
99static const LbRegSrcTerm<LbSrcTermGravity<3, 27, LbSysEqnCompressible<3, 27>>> reg_SpongeRhoConstd3q27C(
"LB_GRAVITY");
100static const LbRegSrcTerm<LbSrcTermGravity<3, 27, LbSysEqnIncompressible<3, 27>>> reg_SpongeRhoConstd3q27(
"LB_GRAVITY");
static MInt propertyLength(const MString &name, MInt solverId=m_noSolvers)
Returns the number of elements of a property.
static MBool propertyExists(const MString &name, MInt solver=m_noSolvers)
This function checks if a property exists in general.
void apply_postPropagation() override
void readProperties() override
constexpr Real POW3(const Real x)
constexpr Real POW2(const Real x)
LB lattice descriptor for arrays depending on D and Q.