24#ifndef GPU_CUDA_DYNAMICS_HH
25#define GPU_CUDA_DYNAMICS_HH
40template <
typename T,
typename DESCRIPTOR>
62 T fEq[DESCRIPTOR::q] { };
64 for (
unsigned iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
65 cell[iPop] = fEq[iPop];
70 T rho, T* u, T* pi) __device__ {
72 for (
unsigned iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
82template <
typename T,
typename DESCRIPTOR,
typename DYNAMICS>
89 _parameters{parameters} {
94 return DYNAMICS().collide(cell, *_parameters);
98 return DYNAMICS::MomentaF().computeRho(cell);
101 DYNAMICS::MomentaF().computeU(cell, u);
104 DYNAMICS::MomentaF().computeJ(cell, j);
107 DYNAMICS::MomentaF().computeRhoU(cell, rho, u);
110 DYNAMICS::MomentaF().computeStress(cell, rho, u, pi);
113 DYNAMICS::MomentaF().computeAllMomenta(cell, rho, u, pi);
117 if constexpr (DYNAMICS::parameters::template contains<descriptors::OMEGA>()) {
118 return _parameters->template get<descriptors::OMEGA>();
125 DYNAMICS::EquilibriumF().compute(cell, rho, u, fEq);
129 typename DYNAMICS::MomentaF().defineRho(cell, rho);
133 typename DYNAMICS::MomentaF().defineU(cell, u);
137 typename DYNAMICS::MomentaF().defineRhoU(cell, rho, u);
141 typename DYNAMICS::MomentaF().defineAllMomenta(cell, rho, u, pi);
145 typename DYNAMICS::MomentaF().inverseShiftRhoU(cell, rho, u);
151 template <
typename T,
typename DESCRIPTOR>
154 collisionO->collide(lattice, iCell);
160 template <
typename T,
typename DESCRIPTOR>
163 statistic = collisionO->collide(lattice, iCell);
Implementation of gpu::cuda::Dynamics for concrete DYNAMICS.
void defineU(DataOnlyCell< T, DESCRIPTOR > &cell, T *u) override __device__
CellStatistic< T > collide(DeviceContext< T, DESCRIPTOR > lattice, CellID iCell) override __device__
void computeAllMomenta(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u, T *pi) override __device__
void computeJ(DataOnlyCell< T, DESCRIPTOR > &cell, T *j) override __device__
void inverseShiftRhoU(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u) override __device__
ConcreteDynamics(ParametersOfOperatorD< T, DESCRIPTOR, DYNAMICS > *parameters) __device__
void defineAllMomenta(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u, T *pi) override __device__
void computeEquilibrium(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u, T *fEq) override __device__
void computeU(DataOnlyCell< T, DESCRIPTOR > &cell, T *u) override __device__
void defineRho(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho) override __device__
void computeStress(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u, T *pi) override __device__
T computeRho(DataOnlyCell< T, DESCRIPTOR > &cell) override __device__
T getOmegaOrFallback(T fallback) override __device__
void defineRhoU(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u) override __device__
void computeRhoU(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u) override __device__
Device-side implementation of the data-only Cell concept for collision steps.
Structure for passing pointers to on-device data into CUDA kernels.
Top level namespace for all of OpenLB.
std::uint32_t CellID
Type for sequential block-local cell indices.
typename ParametersD< T, DESCRIPTOR >::template include< typename OPERATOR::parameters > ParametersOfOperatorD
Deduce ParametersD of OPERATOR w.r.t. T and DESCRIPTOR.
Return value of any collision.
On-device field mirroring BlockDynamicsMap.
Last node in a MaskedDynamics chain in kernel::call_operators.
bool operator()(DeviceContext< T, DESCRIPTOR > &lattice, CellID iCell, CellStatistic< T > &statistic) __device__
bool operator()(DeviceContext< T, DESCRIPTOR > &lattice, CellID iCell) __device__
Virtual interface for device-side dynamically-dispatched dynamics access.
void iniRegularized(DataOnlyCell< T, DESCRIPTOR > &cell, T rho, T *u, T *pi) __device__
virtual T getOmegaOrFallback(T fallback) __device__=0
virtual void defineRho(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho) __device__=0
virtual T computeRho(DataOnlyCell< T, DESCRIPTOR > &cell) __device__=0
virtual void computeStress(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u, T *pi) __device__=0
virtual void defineAllMomenta(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u, T *pi) __device__=0
virtual void computeRhoU(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u) __device__=0
virtual void inverseShiftRhoU(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u) __device__=0
virtual void computeAllMomenta(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u, T *pi) __device__=0
virtual void computeJ(DataOnlyCell< T, DESCRIPTOR > &cell, T *j) __device__=0
virtual CellStatistic< T > collide(DeviceContext< T, DESCRIPTOR > lattice, CellID iCell) __device__=0
virtual void defineRhoU(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u) __device__=0
virtual void computeU(DataOnlyCell< T, DESCRIPTOR > &cell, T *u) __device__=0
void iniEquilibrium(DataOnlyCell< T, DESCRIPTOR > &cell, T rho, T *u) __device__
virtual void computeEquilibrium(DataOnlyCell< T, DESCRIPTOR > &cell, T &rho, T *u, T *fEq) __device__=0
virtual void defineU(DataOnlyCell< T, DESCRIPTOR > &cell, T *u) __device__=0