/* This file is part of the OpenLB library
*
* Copyright (C) 2008 Orestis Malaspinas, Andrea Parmigiani
* E-mail contact: info@openlb.net
* The most recent release of OpenLB can be downloaded at
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/** \file
* A collection of dynamics classes (e.g. BGK) with which a Cell object
* can be instantiated -- generic implementation.
*/
#ifndef ADVECTION_DIFFUSION_MOMENTA_HH
#define ADVECTION_DIFFUSION_MOMENTA_HH
#include "advectionDiffusionMomenta.h"
#include "lbHelpers.h"
namespace olb {
////////////////////// Class AdvectionDiffusionBulkMomenta //////////////////////////
template
T AdvectionDiffusionBulkMomenta::computeRho(Cell const& cell) const
{
return lbHelpers::computeRho(cell);
}
template
void AdvectionDiffusionBulkMomenta::computeU(Cell const& cell, T u[DESCRIPTOR::d]) const
{
const T *u_ = cell.template getFieldPointer();
for (int iD = 0; iD < DESCRIPTOR::d; ++iD) {
u[iD] = u_[iD];
}
}
template
void AdvectionDiffusionBulkMomenta::computeJ(Cell const& cell, T j[DESCRIPTOR::d]) const
{
lbHelpers::computeJ(cell, j);
}
template
void AdvectionDiffusionBulkMomenta::computeStress (
Cell const& cell,
T rho, const T u[DESCRIPTOR::d],
T pi[util::TensorVal::n] ) const
{
}
template
void AdvectionDiffusionBulkMomenta::computeRhoU (
Cell const& cell,
T& rho, T u[DESCRIPTOR::d] ) const
{
rho = cell.computeRho();
const T *u_ = cell.template getFieldPointer();
for (int iD = 0; iD < DESCRIPTOR::d; ++iD) {
u[iD] = u_[iD];
}
}
template
void AdvectionDiffusionBulkMomenta::computeAllMomenta (
Cell const& cell,
T& rho, T u[DESCRIPTOR::d],
T pi[util::TensorVal::n] ) const
{
rho = cell.computeRho();
const T *u_ = cell.template getFieldPointer();
for (int iD = 0; iD < DESCRIPTOR::d; ++iD) {
u[iD] = u_[iD];
}
}
template
void AdvectionDiffusionBulkMomenta::defineRho(Cell& cell, T rho)
{
T *u = cell.template getFieldPointer();
for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
cell[iPop] = lbHelpers::equilibriumFirstOrder( iPop, rho, u );
}
}
template
void AdvectionDiffusionBulkMomenta::defineU (
Cell& cell,
const T u[DESCRIPTOR::d])
{
T rho = cell.computeRho();
T *u_ = cell.template getFieldPointer();
for (int iD = 0; iD < DESCRIPTOR::d; ++iD) {
u_[iD] = u[iD];
}
for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
cell[iPop] = lbHelpers::equilibriumFirstOrder( iPop, rho, u );
}
}
template
void AdvectionDiffusionBulkMomenta::defineRhoU (
Cell& cell,
T rho, const T u[DESCRIPTOR::d])
{
T *u_ = cell.template getFieldPointer();
for (int iD = 0; iD < DESCRIPTOR::d; ++iD) {
u_[iD] = u[iD];
}
for (int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
cell[iPop] = lbHelpers::equilibriumFirstOrder( iPop, rho, u );
}
}
template
void AdvectionDiffusionBulkMomenta::defineAllMomenta (
Cell& cell,
T rho, const T u[DESCRIPTOR::d],
const T pi[util::TensorVal::n] )
{
T *u_ = cell.template getFieldPointer();
for (int iD = 0; iD < DESCRIPTOR::d; ++iD) {
u_[iD] = u[iD];
}
for (int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
cell[iPop] = lbHelpers::equilibriumFirstOrder( iPop, rho, u );
}
}
/////////////// Singletons //////////////////////////////////
namespace instances {
template
AdvectionDiffusionBulkMomenta& getAdvectionDiffusionBulkMomenta()
{
static AdvectionDiffusionBulkMomenta bulkMomentaSingleton;
return bulkMomentaSingleton;
}
}
}
#endif