42template <
typename T,
typename DESCRIPTOR>
47 _populations{_block.getPopulationPointers(iCell)}
50template <
typename T,
typename DESCRIPTOR>
56template <
typename T,
typename DESCRIPTOR>
62template <
typename T,
typename DESCRIPTOR>
63template <
typename FIELD>
67 "FIELD must be structured data field");
68 return _block.template getField<FIELD>().getPointer(_iCell);
71template <
typename T,
typename DESCRIPTOR>
72template <
typename FIELD>
76 "FIELD must be structured data field");
77 return this->_block.template getField<FIELD>().getPointer(this->_iCell);
80template <
typename T,
typename DESCRIPTOR>
81template <
typename FIELD>
85 "FIELD must be structured data field");
86 return _block.template getField<FIELD>()[iD][_iCell];
89template <
typename T,
typename DESCRIPTOR>
95template <
typename T,
typename DESCRIPTOR>
101template <
typename T,
typename DESCRIPTOR>
104 return *_populations[iPop];
107template <
typename T,
typename DESCRIPTOR>
110 return *this->_populations[iPop];
113template <
typename T,
typename DESCRIPTOR>
119template <
typename T,
typename DESCRIPTOR>
125template <
typename T,
typename DESCRIPTOR>
131template <
typename T,
typename DESCRIPTOR>
137template <
typename T,
typename DESCRIPTOR>
138template <
typename FIELD>
141 return _block.template getField<FIELD>().get(_iCell);
144template <
typename T,
typename DESCRIPTOR>
145template <
typename FIELD>
148 return this->_block.template getField<FIELD>().set(this->_iCell, field);
151template <
typename T,
typename DESCRIPTOR>
152template <
typename FIELD>
153std::enable_if_t<(DESCRIPTOR::template size<FIELD>() == 1),
void>
156 return this->_block.template getField<FIELD>().set(this->_iCell,
160template <
typename T,
typename DESCRIPTOR>
161template <
typename FIELD>
164 this->_block.template getField<FIELD>()[iD][this->_iCell] = value;
167template<
typename T,
typename DESCRIPTOR>
170 return _block.getDynamics(_iCell);
173template<
typename T,
typename DESCRIPTOR>
176 return this->_block.getDynamics(this->_iCell);
179template <
typename T,
typename DESCRIPTOR>
180template <
typename FIELD>
183 auto field = getFieldPointer<FIELD>();
184 for (
long unsigned int i=0; i < DESCRIPTOR::template size<FIELD>(); ++i) {
189template<
typename T,
typename DESCRIPTOR>
192 for (
int iPop=1; iPop <= descriptors::q<DESCRIPTOR>()/2; ++iPop) {
195 operator[](iPop+descriptors::q<DESCRIPTOR>()/2));
199template<
typename T,
typename DESCRIPTOR>
202 return getDynamics()->collide(*
this);
205template<
typename T,
typename DESCRIPTOR>
208 return getDynamics()->computeRho(self());
211template<
typename T,
typename DESCRIPTOR>
214 getDynamics()->computeU(self(), u);
217template<
typename T,
typename DESCRIPTOR>
220 getDynamics()->computeJ(self(), j);
223template<
typename T,
typename DESCRIPTOR>
226 T rho, u[descriptors::d<DESCRIPTOR>()];
227 getDynamics()->computeRhoU(self(), rho, u);
228 getDynamics()->computeStress(self(), rho, u, pi);
231template<
typename T,
typename DESCRIPTOR>
234 getDynamics()->computeRhoU(self(), rho, u);
237template<
typename T,
typename DESCRIPTOR>
242 computeRhoU(rho, u.data());
244 for (
int iPop=0; iPop < descriptors::q<DESCRIPTOR>(); ++iPop) {
249template <
typename T,
typename DESCRIPTOR>
253 T u[descriptors::d<DESCRIPTOR>()] { };
258template<
typename T,
typename DESCRIPTOR>
261 T u[descriptors::d<DESCRIPTOR>()],
264 getDynamics()->computeAllMomenta(self(), rho, u, pi);
267template<
typename T,
typename DESCRIPTOR>
270 getDynamics()->defineRho(*
this, rho);
273template<
typename T,
typename DESCRIPTOR>
276 getDynamics()->defineU(*
this, u);
279template<
typename T,
typename DESCRIPTOR>
282 getDynamics()->defineRhoU(*
this, rho, u);
285template<
typename T,
typename DESCRIPTOR>
288 for (
int iPop = 0; iPop < descriptors::q<DESCRIPTOR>(); ++iPop) {
289 operator[](iPop) = data[iPop];
293template<
typename T,
typename DESCRIPTOR>
296 getDynamics()->iniEquilibrium(*
this, rho, u);
299template<
typename T,
typename DESCRIPTOR>
302 const T u[descriptors::d<DESCRIPTOR>()],
305 getDynamics()->iniRegularized(*
this, rho, u, pi);
Definition of a LB cell – header file.
Platform-abstracted block lattice for external access and inter-block interaction.
Highest-level interface to Cell data.
auto getFieldPointer(FIELD field=FIELD())
Return field accessor.
CellStatistic< T > collide()
Apply LB collision to the cell according to local dynamics.
void setField(const FieldD< T, DESCRIPTOR, FIELD > &field)
Set value of FIELD from a vector.
void definePopulations(const T *f_)
Define particle populations through the dynamics object.
Dynamics< T, DESCRIPTOR > * getDynamics()
Get a pointer to the dynamics.
void setFieldComponent(unsigned iD, typename FIELD::template value_type< T > value)
Cell< T, DESCRIPTOR > neighbor(Vector< int, DESCRIPTOR::d > c)
void defineU(const T u[descriptors::d< DESCRIPTOR >()])
Set fluid velocity on the cell.
void defineRho(T rho)
Set density on the cell.
void revert()
Revert ("bounce-back") the distribution functions.
T & operator[](unsigned iPop)
Read-write access to distribution functions.
void defineRhoU(T rho, const T u[descriptors::d< DESCRIPTOR >()])
Define fluid velocity and particle density on the cell.
void iniRegularized(T rho, const T u[descriptors::d< DESCRIPTOR >()], const T pi[util::TensorVal< DESCRIPTOR >::n])
Initialize all f values with local equilibrium and non equilibrium part.
void iniEquilibrium(T rho, const T u[descriptors::d< DESCRIPTOR >()])
Initialize all f values to their local equilibrium.
Highest-level interface to read-only Cell data.
bool operator<=(ConstCell< T, DESCRIPTOR > &rhs) const
bool operator!=(ConstCell< T, DESCRIPTOR > &rhs) const
void computeJ(T j[descriptors::d< DESCRIPTOR >()]) const
Compute fluid momentum (j = rho * u) on the cell.
bool operator<(ConstCell< T, DESCRIPTOR > &rhs) const
bool operator==(ConstCell< T, DESCRIPTOR > &rhs) const
ConstCell< T, DESCRIPTOR > neighbor(Vector< int, DESCRIPTOR::d > c) const
void computeFeq(T fEq[descriptors::q< DESCRIPTOR >()]) const
Compute equilibrium part of cell distribution.
void computeAllMomenta(T &rho, T u[descriptors::d< DESCRIPTOR >()], T pi[util::TensorVal< DESCRIPTOR >::n]) const
Compute all momenta on the celll, up to second order.
T operator[](unsigned iPop) const
Read-only access to distribution functions.
T computeRho() const
Compute particle density on the cell.
void computeFneq(T fNeq[descriptors::q< DESCRIPTOR >()]) const
Compute non-equilibrium part of cell distribution.
auto getFieldPointer(FIELD field=FIELD()) const
Return read-only field accessor.
const Dynamics< T, DESCRIPTOR > * getDynamics() const
Get a pointer to the dynamics.
void computeField(T *data) const
Copy FIELD content to given memory location.
void computeRhoU(T &rho, T u[descriptors::d< DESCRIPTOR >()]) const
Compute fluid velocity and particle density on the cell.
ConstCell(const BlockLattice< T, DESCRIPTOR > &block, std::size_t iCell)
auto getFieldComponent(unsigned iD) const
Return copy of field component.
void computeU(T u[descriptors::d< DESCRIPTOR >()]) const
Compute fluid velocity on the cell.
auto getField(FIELD field=FIELD()) const
Return copy of descriptor-declared FIELD as a vector.
std::size_t getCellId() const
Return memory ID of the currently represented cell.
void computeStress(T pi[util::TensorVal< DESCRIPTOR >::n]) const
Compute components of the stress tensor on the cell.
std::integral_constant< bool, !is_tag_field< FIELD >::value > is_data_field
Top level namespace for all of OpenLB.
constexpr T norm_squared(const ScalarVector< T, D, IMPL > &a)
Squared euclidean vector norm.
Return value of any collision.
Interface for per-cell dynamics.
Collection of common computations for LBM.
static void computeFneq(CELL &cell, FNEQ &fNeq, const RHO &rho, const U &u) any_platform
Computation of non-equilibrium distribution.
Compute number of elements of a symmetric d-dimensional tensor.
Set of functions commonly used in LB computations – header file.