From 94d3e79a8617f88dc0219cfdeedfa3147833719d Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 24 Jun 2019 14:43:36 +0200 Subject: Initialize at openlb-1-3 --- .../advectionDiffusionMomentaOnBoundaries.hh | 175 +++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 src/boundary/advectionDiffusionMomentaOnBoundaries.hh (limited to 'src/boundary/advectionDiffusionMomentaOnBoundaries.hh') diff --git a/src/boundary/advectionDiffusionMomentaOnBoundaries.hh b/src/boundary/advectionDiffusionMomentaOnBoundaries.hh new file mode 100644 index 0000000..d5832be --- /dev/null +++ b/src/boundary/advectionDiffusionMomentaOnBoundaries.hh @@ -0,0 +1,175 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2006, 2007 Jonas Latt + * 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 + * Implementation of boundary cell dynamics -- generic implementation. + */ +#ifndef ADE_MOMENTA_ON_BOUNDARIES_HH +#define ADE_MOMENTA_ON_BOUNDARIES_HH + +#include +#include "advectionDiffusionMomentaOnBoundaries.h" +#include "dynamics/lbHelpers.h" +#include "dynamics/firstOrderLbHelpers.h" + +namespace olb { + +////////////////////// Class AdvectionDiffusionBM ////////////////////// + +template +RegularizedTemperatureBM::RegularizedTemperatureBM(const T temperature) : + AdvectionDiffusionBulkMomenta(), + _temperature(temperature) +{ +} + +template +T RegularizedTemperatureBM::computeRho( Cell const& cell ) const +{ + return _temperature; +} + +template +void RegularizedTemperatureBM::computeJ( Cell const& cell, T j[DESCRIPTOR::d] ) const +{ + const T* u = cell.template getFieldPointer(); + computeJneq( cell, j ); + + for (int iD=0; iD +void RegularizedTemperatureBM::computeJneq( Cell const& cell, T jNeq[DESCRIPTOR::d] ) const +{ + std::vector const& onWallIndices = util::subIndex(); + std::vector const& normalIndices = util::subIndex(); + + const T* u = cell.template getFieldPointer(); + + T jNeqOnWall[DESCRIPTOR::d], jNeqNormal[DESCRIPTOR::d]; + for (int iD=0; iD::equilibriumFirstOrder(onWallIndices[fIndex],_temperature,u)) * descriptors::c(onWallIndices[fIndex],iD); + } + } + + for (unsigned fIndex=0; fIndex::equilibriumFirstOrder(normalIndices[fIndex],_temperature,u)) * descriptors::c(normalIndices[fIndex],iD); + } + } + + for (int iD=0; iD +void RegularizedTemperatureBM::defineRho( Cell& cell, T rho ) +{ + _temperature = rho; +} + +template +void RegularizedTemperatureBM::defineRhoU( Cell& cell, T rho, const T u[DESCRIPTOR::d]) +{ + _temperature = rho; + 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 +RegularizedHeatFluxBM::RegularizedHeatFluxBM(T *heatFlux) : + AdvectionDiffusionBulkMomenta() +{ + for (int iDim = 0; iDim < DESCRIPTOR::d; iDim++) { + if (heatFlux == nullptr) + _heatFlux[iDim] = T(); + else + _heatFlux[iDim] = heatFlux[iDim]; + } +} + +template +T RegularizedHeatFluxBM::computeRho( Cell const& cell ) const +{ + std::vector const& onWallIndices = util::subIndex(); + std::vector const& normalIndices = util::subIndex(); + const T* u = cell.template getFieldPointer(); + + T rhoOnWall = T(); + for (unsigned fIndex=0; fIndex +void RegularizedHeatFluxBM::computeJ( Cell const& cell, T j[DESCRIPTOR::d] ) const +{ + T temperature = computeRho(cell); + const T* u = cell.template getFieldPointer(); + + for (int iD=0; iD +void RegularizedHeatFluxBM::computeJneq( Cell const& cell, T jNeq[DESCRIPTOR::d] ) const +{ + for (int iD=0; iD