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 --- src/boundary/MakeHeader | 51 + src/boundary/advectionDiffusionBoundaries.h | 122 ++ src/boundary/advectionDiffusionBoundaries.hh | 313 ++++ .../advectionDiffusionBoundaryCondition2D.cpp | 33 + .../advectionDiffusionBoundaryCondition2D.h | 157 ++ .../advectionDiffusionBoundaryCondition2D.hh | 262 ++++ .../advectionDiffusionBoundaryCondition3D.cpp | 33 + .../advectionDiffusionBoundaryCondition3D.h | 126 ++ .../advectionDiffusionBoundaryCondition3D.hh | 292 ++++ .../advectionDiffusionBoundaryInstantiator2D.h | 523 +++++++ .../advectionDiffusionBoundaryInstantiator3D.h | 79 + .../advectionDiffusionBoundaryInstantiator3D.hh | 325 +++++ .../advectionDiffusionBoundaryPostProcessor3D.cpp | 39 + .../advectionDiffusionBoundaryPostProcessor3D.h | 159 ++ .../advectionDiffusionBoundaryPostProcessor3D.hh | 291 ++++ .../advectionDiffusionMomentaOnBoundaries.h | 80 + .../advectionDiffusionMomentaOnBoundaries.hh | 175 +++ src/boundary/boundary2D.h | 42 + src/boundary/boundary2D.hh | 42 + src/boundary/boundary3D.h | 44 + src/boundary/boundary3D.hh | 45 + src/boundary/boundaryCondition2D.cpp | 72 + src/boundary/boundaryCondition2D.h | 217 +++ src/boundary/boundaryCondition2D.hh | 588 ++++++++ src/boundary/boundaryCondition3D.cpp | 58 + src/boundary/boundaryCondition3D.h | 287 ++++ src/boundary/boundaryCondition3D.hh | 783 ++++++++++ src/boundary/boundaryInstantiator2D.h | 816 +++++++++++ src/boundary/boundaryInstantiator3D.h | 1535 ++++++++++++++++++++ src/boundary/boundaryPostProcessors2D.cpp | 78 + src/boundary/boundaryPostProcessors2D.h | 340 +++++ src/boundary/boundaryPostProcessors2D.hh | 757 ++++++++++ src/boundary/boundaryPostProcessors3D.cpp | 121 ++ src/boundary/boundaryPostProcessors3D.h | 392 +++++ src/boundary/boundaryPostProcessors3D.hh | 994 +++++++++++++ .../extendedFiniteDifferenceBoundary2D.cpp | 57 + src/boundary/extendedFiniteDifferenceBoundary2D.h | 87 ++ src/boundary/extendedFiniteDifferenceBoundary2D.hh | 363 +++++ .../extendedFiniteDifferenceBoundary3D.cpp | 62 + src/boundary/extendedFiniteDifferenceBoundary3D.h | 84 ++ src/boundary/extendedFiniteDifferenceBoundary3D.hh | 459 ++++++ src/boundary/inamuroAnalyticalDynamics.cpp | 48 + src/boundary/inamuroAnalyticalDynamics.h | 57 + src/boundary/inamuroAnalyticalDynamics.hh | 159 ++ src/boundary/inamuroBoundary2D.cpp | 50 + src/boundary/inamuroBoundary2D.h | 41 + src/boundary/inamuroBoundary2D.hh | 194 +++ src/boundary/inamuroBoundary3D.cpp | 50 + src/boundary/inamuroBoundary3D.h | 39 + src/boundary/inamuroBoundary3D.hh | 262 ++++ src/boundary/inamuroNewtonRaphsonDynamics.cpp | 56 + src/boundary/inamuroNewtonRaphsonDynamics.h | 84 ++ src/boundary/inamuroNewtonRaphsonDynamics.hh | 456 ++++++ src/boundary/module.mk | 27 + src/boundary/momentaOnBoundaries.h | 184 +++ src/boundary/momentaOnBoundaries.hh | 427 ++++++ src/boundary/momentaOnBoundaries2D.cpp | 75 + src/boundary/momentaOnBoundaries2D.h | 71 + src/boundary/momentaOnBoundaries2D.hh | 168 +++ src/boundary/momentaOnBoundaries3D.cpp | 104 ++ src/boundary/momentaOnBoundaries3D.h | 107 ++ src/boundary/momentaOnBoundaries3D.hh | 300 ++++ src/boundary/offBoundaryCondition2D.cpp | 50 + src/boundary/offBoundaryCondition2D.h | 128 ++ src/boundary/offBoundaryCondition2D.hh | 309 ++++ src/boundary/offBoundaryCondition3D.cpp | 46 + src/boundary/offBoundaryCondition3D.h | 114 ++ src/boundary/offBoundaryCondition3D.hh | 166 +++ src/boundary/offBoundaryInstantiator2D.h | 715 +++++++++ src/boundary/offBoundaryInstantiator3D.h | 576 ++++++++ src/boundary/offBoundaryPostProcessors2D.cpp | 45 + src/boundary/offBoundaryPostProcessors2D.h | 242 +++ src/boundary/offBoundaryPostProcessors2D.hh | 455 ++++++ src/boundary/offBoundaryPostProcessors3D.cpp | 41 + src/boundary/offBoundaryPostProcessors3D.h | 179 +++ src/boundary/offBoundaryPostProcessors3D.hh | 346 +++++ src/boundary/rtlbmBoundary.h | 61 + src/boundary/rtlbmBoundary.hh | 260 ++++ src/boundary/rtlbmBoundaryDynamics.h | 177 +++ src/boundary/rtlbmBoundaryDynamics.hh | 377 +++++ src/boundary/superBoundaryCondition2D.cpp | 55 + src/boundary/superBoundaryCondition2D.h | 189 +++ src/boundary/superBoundaryCondition2D.hh | 483 ++++++ src/boundary/superBoundaryCondition3D.cpp | 55 + src/boundary/superBoundaryCondition3D.h | 191 +++ src/boundary/superBoundaryCondition3D.hh | 589 ++++++++ src/boundary/superOffBoundaryCondition2D.cpp | 51 + src/boundary/superOffBoundaryCondition2D.h | 163 +++ src/boundary/superOffBoundaryCondition2D.hh | 388 +++++ src/boundary/superOffBoundaryCondition3D.cpp | 46 + src/boundary/superOffBoundaryCondition3D.h | 133 ++ src/boundary/superOffBoundaryCondition3D.hh | 316 ++++ .../wallFunctionBoundaryPostProcessors3D.cpp | 41 + .../wallFunctionBoundaryPostProcessors3D.h | 193 +++ .../wallFunctionBoundaryPostProcessors3D.hh | 876 +++++++++++ src/boundary/zouHeBoundary2D.cpp | 50 + src/boundary/zouHeBoundary2D.h | 41 + src/boundary/zouHeBoundary2D.hh | 195 +++ src/boundary/zouHeBoundary3D.cpp | 50 + src/boundary/zouHeBoundary3D.h | 41 + src/boundary/zouHeBoundary3D.hh | 264 ++++ src/boundary/zouHeDynamics.cpp | 72 + src/boundary/zouHeDynamics.h | 58 + src/boundary/zouHeDynamics.hh | 136 ++ 104 files changed, 23305 insertions(+) create mode 100644 src/boundary/MakeHeader create mode 100644 src/boundary/advectionDiffusionBoundaries.h create mode 100644 src/boundary/advectionDiffusionBoundaries.hh create mode 100644 src/boundary/advectionDiffusionBoundaryCondition2D.cpp create mode 100644 src/boundary/advectionDiffusionBoundaryCondition2D.h create mode 100644 src/boundary/advectionDiffusionBoundaryCondition2D.hh create mode 100644 src/boundary/advectionDiffusionBoundaryCondition3D.cpp create mode 100644 src/boundary/advectionDiffusionBoundaryCondition3D.h create mode 100644 src/boundary/advectionDiffusionBoundaryCondition3D.hh create mode 100644 src/boundary/advectionDiffusionBoundaryInstantiator2D.h create mode 100644 src/boundary/advectionDiffusionBoundaryInstantiator3D.h create mode 100644 src/boundary/advectionDiffusionBoundaryInstantiator3D.hh create mode 100644 src/boundary/advectionDiffusionBoundaryPostProcessor3D.cpp create mode 100644 src/boundary/advectionDiffusionBoundaryPostProcessor3D.h create mode 100644 src/boundary/advectionDiffusionBoundaryPostProcessor3D.hh create mode 100644 src/boundary/advectionDiffusionMomentaOnBoundaries.h create mode 100644 src/boundary/advectionDiffusionMomentaOnBoundaries.hh create mode 100644 src/boundary/boundary2D.h create mode 100644 src/boundary/boundary2D.hh create mode 100644 src/boundary/boundary3D.h create mode 100644 src/boundary/boundary3D.hh create mode 100644 src/boundary/boundaryCondition2D.cpp create mode 100644 src/boundary/boundaryCondition2D.h create mode 100644 src/boundary/boundaryCondition2D.hh create mode 100644 src/boundary/boundaryCondition3D.cpp create mode 100644 src/boundary/boundaryCondition3D.h create mode 100644 src/boundary/boundaryCondition3D.hh create mode 100644 src/boundary/boundaryInstantiator2D.h create mode 100644 src/boundary/boundaryInstantiator3D.h create mode 100644 src/boundary/boundaryPostProcessors2D.cpp create mode 100644 src/boundary/boundaryPostProcessors2D.h create mode 100644 src/boundary/boundaryPostProcessors2D.hh create mode 100644 src/boundary/boundaryPostProcessors3D.cpp create mode 100644 src/boundary/boundaryPostProcessors3D.h create mode 100644 src/boundary/boundaryPostProcessors3D.hh create mode 100644 src/boundary/extendedFiniteDifferenceBoundary2D.cpp create mode 100644 src/boundary/extendedFiniteDifferenceBoundary2D.h create mode 100644 src/boundary/extendedFiniteDifferenceBoundary2D.hh create mode 100644 src/boundary/extendedFiniteDifferenceBoundary3D.cpp create mode 100644 src/boundary/extendedFiniteDifferenceBoundary3D.h create mode 100644 src/boundary/extendedFiniteDifferenceBoundary3D.hh create mode 100644 src/boundary/inamuroAnalyticalDynamics.cpp create mode 100644 src/boundary/inamuroAnalyticalDynamics.h create mode 100644 src/boundary/inamuroAnalyticalDynamics.hh create mode 100644 src/boundary/inamuroBoundary2D.cpp create mode 100644 src/boundary/inamuroBoundary2D.h create mode 100644 src/boundary/inamuroBoundary2D.hh create mode 100644 src/boundary/inamuroBoundary3D.cpp create mode 100644 src/boundary/inamuroBoundary3D.h create mode 100644 src/boundary/inamuroBoundary3D.hh create mode 100644 src/boundary/inamuroNewtonRaphsonDynamics.cpp create mode 100644 src/boundary/inamuroNewtonRaphsonDynamics.h create mode 100644 src/boundary/inamuroNewtonRaphsonDynamics.hh create mode 100644 src/boundary/module.mk create mode 100644 src/boundary/momentaOnBoundaries.h create mode 100644 src/boundary/momentaOnBoundaries.hh create mode 100644 src/boundary/momentaOnBoundaries2D.cpp create mode 100644 src/boundary/momentaOnBoundaries2D.h create mode 100644 src/boundary/momentaOnBoundaries2D.hh create mode 100644 src/boundary/momentaOnBoundaries3D.cpp create mode 100644 src/boundary/momentaOnBoundaries3D.h create mode 100644 src/boundary/momentaOnBoundaries3D.hh create mode 100644 src/boundary/offBoundaryCondition2D.cpp create mode 100644 src/boundary/offBoundaryCondition2D.h create mode 100644 src/boundary/offBoundaryCondition2D.hh create mode 100644 src/boundary/offBoundaryCondition3D.cpp create mode 100644 src/boundary/offBoundaryCondition3D.h create mode 100644 src/boundary/offBoundaryCondition3D.hh create mode 100644 src/boundary/offBoundaryInstantiator2D.h create mode 100644 src/boundary/offBoundaryInstantiator3D.h create mode 100644 src/boundary/offBoundaryPostProcessors2D.cpp create mode 100644 src/boundary/offBoundaryPostProcessors2D.h create mode 100644 src/boundary/offBoundaryPostProcessors2D.hh create mode 100644 src/boundary/offBoundaryPostProcessors3D.cpp create mode 100644 src/boundary/offBoundaryPostProcessors3D.h create mode 100644 src/boundary/offBoundaryPostProcessors3D.hh create mode 100644 src/boundary/rtlbmBoundary.h create mode 100644 src/boundary/rtlbmBoundary.hh create mode 100644 src/boundary/rtlbmBoundaryDynamics.h create mode 100644 src/boundary/rtlbmBoundaryDynamics.hh create mode 100644 src/boundary/superBoundaryCondition2D.cpp create mode 100644 src/boundary/superBoundaryCondition2D.h create mode 100644 src/boundary/superBoundaryCondition2D.hh create mode 100644 src/boundary/superBoundaryCondition3D.cpp create mode 100644 src/boundary/superBoundaryCondition3D.h create mode 100644 src/boundary/superBoundaryCondition3D.hh create mode 100644 src/boundary/superOffBoundaryCondition2D.cpp create mode 100644 src/boundary/superOffBoundaryCondition2D.h create mode 100644 src/boundary/superOffBoundaryCondition2D.hh create mode 100644 src/boundary/superOffBoundaryCondition3D.cpp create mode 100644 src/boundary/superOffBoundaryCondition3D.h create mode 100644 src/boundary/superOffBoundaryCondition3D.hh create mode 100644 src/boundary/wallFunctionBoundaryPostProcessors3D.cpp create mode 100644 src/boundary/wallFunctionBoundaryPostProcessors3D.h create mode 100644 src/boundary/wallFunctionBoundaryPostProcessors3D.hh create mode 100644 src/boundary/zouHeBoundary2D.cpp create mode 100644 src/boundary/zouHeBoundary2D.h create mode 100644 src/boundary/zouHeBoundary2D.hh create mode 100644 src/boundary/zouHeBoundary3D.cpp create mode 100644 src/boundary/zouHeBoundary3D.h create mode 100644 src/boundary/zouHeBoundary3D.hh create mode 100644 src/boundary/zouHeDynamics.cpp create mode 100644 src/boundary/zouHeDynamics.h create mode 100644 src/boundary/zouHeDynamics.hh (limited to 'src/boundary') diff --git a/src/boundary/MakeHeader b/src/boundary/MakeHeader new file mode 100644 index 0000000..e82060a --- /dev/null +++ b/src/boundary/MakeHeader @@ -0,0 +1,51 @@ +# This file is part of the OpenLB library +# +# Copyright (C) 2007 Mathias Krause +# 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. + + +generic := + +precompiled := boundaryCondition2D \ + boundaryCondition3D \ + boundaryPostProcessors2D \ + boundaryPostProcessors3D \ + extendedFiniteDifferenceBoundary2D \ + extendedFiniteDifferenceBoundary3D \ + inamuroAnalyticalDynamics \ + inamuroBoundary2D \ + inamuroBoundary3D \ + inamuroNewtonRaphsonDynamics \ + momentaOnBoundaries2D \ + momentaOnBoundaries3D \ + offBoundaryCondition2D \ + offBoundaryCondition3D \ + offBoundaryPostProcessors2D \ + offBoundaryPostProcessors3D \ + superBoundaryCondition2D \ + superBoundaryCondition3D \ + superOffBoundaryCondition2D \ + superOffBoundaryCondition3D \ + zouHeBoundary2D \ + zouHeBoundary3D \ + zouHeDynamics \ + advectionDiffusionBoundaryCondition2D \ + advectionDiffusionBoundaryCondition3D + diff --git a/src/boundary/advectionDiffusionBoundaries.h b/src/boundary/advectionDiffusionBoundaries.h new file mode 100644 index 0000000..86ebd5b --- /dev/null +++ b/src/boundary/advectionDiffusionBoundaries.h @@ -0,0 +1,122 @@ +/* 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. +*/ + +#ifndef ADVECTION_DIFFUSION_BOUNDARIES_H +#define ADVECTION_DIFFUSION_BOUNDARIES_H + +#include "dynamics/latticeDescriptors.h" +#include "dynamics/advectionDiffusionDynamics.h" +#include "dynamics/dynamics.h" + +namespace olb { + +//=================================================================================== +//================= AdvectionDiffusionDynamcison Flat Boundaries ========= +//=================================================================================== +template +class AdvectionDiffusionBoundariesDynamics : public BasicDynamics { +public: + /// Constructor + AdvectionDiffusionBoundariesDynamics(T omega_, Momenta& momenta_); + /// Compute equilibrium distribution function + T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override; + /// Collision step for flat boundary and given rho + /* Working principle: + * 1. Compute rho_current by summing up all known f_i + * 2. Get difference (rho - rho_current) and initialise the unknown f_i + */ + void collide(Cell& cell, LatticeStatistics& statistics) override; + /// Get local relaxation parameter of the dynamics + T getOmega() const override; + /// Set local relaxation parameter of the dynamics + void setOmega(T omega_) override; +private: + Dynamics boundaryDynamics; +}; + +//=================================================================================== +//================= AdvectionDiffusionDynamcis On Edges ========= +//=================================================================================== +template +class AdvectionDiffusionEdgesDynamics : public BasicDynamics { +public: + /// Constructor + AdvectionDiffusionEdgesDynamics(T omega_, Momenta& momenta_); + /// Compute equilibrium distribution function + T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override; + /// Collision step + void collide(Cell& cell, LatticeStatistics& statistics) override; + /// Get local relaxation parameter of the dynamics + T getOmega() const override; + /// Set local relaxation parameter of the dynamics + void setOmega(T omega_) override; +private: + Dynamics boundaryDynamics; +}; + + +//=================================================================================== +//================= AdvectionDiffusionDynamics on Corners for 2D Boundaries ========= +//=================================================================================== +template +class AdvectionDiffusionCornerDynamics2D : public BasicDynamics { +public: + /// Constructor + AdvectionDiffusionCornerDynamics2D(T omega_, Momenta& momenta_); + /// Compute equilibrium distribution function + T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override; + /// Collision step + void collide(Cell& cell, LatticeStatistics& statistics) override; + /// Get local relaxation parameter of the dynamics + T getOmega() const override; + /// Set local relaxation parameter of the dynamics + void setOmega(T omega_) override; +private: + Dynamics boundaryDynamics; +}; + +//=================================================================================== +//================= AdvectionDiffusionDynamics on Corners for 3D Boundaries ========= +//=================================================================================== +template +class AdvectionDiffusionCornerDynamics3D : public BasicDynamics { +public: + /// Constructor + AdvectionDiffusionCornerDynamics3D(T omega_, Momenta& momenta_); + /// Compute equilibrium distribution function + T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override; + /// Collision step + void collide(Cell& cell, LatticeStatistics& statistics) override; + /// Get local relaxation parameter of the dynamics + T getOmega() const override; + /// Set local relaxation parameter of the dynamics + void setOmega(T omega_) override; +private: + Dynamics boundaryDynamics; +}; + + + +} // namespace olb + +#endif diff --git a/src/boundary/advectionDiffusionBoundaries.hh b/src/boundary/advectionDiffusionBoundaries.hh new file mode 100644 index 0000000..7c7f391 --- /dev/null +++ b/src/boundary/advectionDiffusionBoundaries.hh @@ -0,0 +1,313 @@ +/* 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. +*/ + +#ifndef ADVECTION_DIFFUSION_BOUNDARIES_HH +#define ADVECTION_DIFFUSION_BOUNDARIES_HH + +#include "advectionDiffusionBoundaries.h" +#include "dynamics/latticeDescriptors.h" +#include "core/util.h" +#include "dynamics/lbHelpers.h" + +namespace olb { + + + +//================================================================================================== +//==================== For regularized Advection Diffusion Boundary Condition ====================== +//============================================================================================ + + +// For flat Walls + +template +AdvectionDiffusionBoundariesDynamics:: +AdvectionDiffusionBoundariesDynamics( T omega_, Momenta& momenta_) + : BasicDynamics(momenta_), boundaryDynamics(omega_, momenta_) +{ +} + +template +T AdvectionDiffusionBoundariesDynamics:: +computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const +{ + return lbHelpers::equilibriumFirstOrder( iPop, rho, u ); +} + + +template +void AdvectionDiffusionBoundariesDynamics:: +collide(Cell& cell,LatticeStatistics& statistics) +{ + typedef DESCRIPTOR L; + typedef lbHelpers lbH; + + T dirichletTemperature = this->_momenta.computeRho(cell); + T* u = cell.template getFieldPointer(); + + std::vector unknownIndexes = util::subIndexOutgoing(); + std::vector knownIndexes = util::remainingIndexes(unknownIndexes); + + int missingNormal = 0; + + if ((L::d == 3 && L::q == 7)||(L::d == 2 && L::q == 5)) { + T sum = T(); + for (unsigned i = 0; i < knownIndexes.size(); ++i) { + sum += cell[knownIndexes[i]]; + } + + T difference = dirichletTemperature - (T) 1 - sum; // on cell there are non-shiftet values -> temperature has to be changed + + // here I know all missing and non missing f_i + for (unsigned i = 0; i < unknownIndexes.size(); ++i) { + int numOfNonNullComp = 0; + for (int iDim = 0; iDim < L::d; ++iDim) { + numOfNonNullComp += abs(descriptors::c(unknownIndexes[i],iDim)); + } + if (numOfNonNullComp == 1) { + missingNormal = unknownIndexes[i]; + // here missing diagonal directions are erased + // just the normal direction stays (D3Q7) + unknownIndexes.erase(unknownIndexes.begin() + i); + break; + + } + } + cell[missingNormal] = difference; // on cell there are non-shiftet values -> temperature has to be changed + boundaryDynamics.collide(cell, statistics); // only for D3Q7 + } else { + // part for q=19 copied from AdvectionDiffusionEdgesDynamics.collide() + // but here just all missing directions, even at border of inlet area + // has to be checked! + for (unsigned iteratePop = 0; iteratePop < unknownIndexes.size(); + ++iteratePop) { + cell[unknownIndexes[iteratePop]] = + lbH::equilibriumFirstOrder(unknownIndexes[iteratePop], dirichletTemperature, u) + - (cell[util::opposite(unknownIndexes[iteratePop])] + - lbH::equilibriumFirstOrder( + util::opposite(unknownIndexes[iteratePop]), + dirichletTemperature, u)); + } + } +} + +template +T AdvectionDiffusionBoundariesDynamics:: +getOmega() const +{ + return boundaryDynamics.getOmega(); +} + +template +void AdvectionDiffusionBoundariesDynamics:: +setOmega(T omega_) +{ + boundaryDynamics.setOmega(omega_); +} + +//================================================================= +// For 2D Corners with regularized Dynamic ============================================== +//================================================================= +template +AdvectionDiffusionCornerDynamics2D::AdvectionDiffusionCornerDynamics2D( + T omega_, Momenta& momenta_) + : BasicDynamics(momenta_), + boundaryDynamics(omega_, momenta_) +{ +} + +template +T AdvectionDiffusionCornerDynamics2D::computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const +{ + return lbHelpers::equilibriumFirstOrder( iPop, rho, u ); +} + + +template +void AdvectionDiffusionCornerDynamics2D::collide(Cell& cell,LatticeStatistics& statistics) +{ + typedef DESCRIPTOR L; + typedef lbHelpers lbH; + + T temperature = this->_momenta.computeRho(cell); + T* u = cell.template getFieldPointer(); + // I need to get Missing information on the corners !!!! + std::vector unknownIndexes = util::subIndexOutgoing2DonCorners(); + // here I know all missing and non missing f_i + + + // The collision procedure for D2Q5 and D3Q7 lattice is the same ... + // Given the rule f_i_neq = -f_opposite(i)_neq + // I have the right number of equations for the number of unknowns using these lattices + + for (unsigned iPop = 0; iPop < unknownIndexes.size(); ++iPop) { + cell[unknownIndexes[iPop]] = lbH::equilibriumFirstOrder(unknownIndexes[iPop], temperature, u) + -(cell[util::opposite(unknownIndexes[iPop])] + - lbH::equilibriumFirstOrder(util::opposite(unknownIndexes[iPop]), temperature, u) ) ; + } + + // Once all the f_i are known, I can call the collision for the Regularized Model. + boundaryDynamics.collide(cell, statistics); + +} + +template +T AdvectionDiffusionCornerDynamics2D::getOmega() const +{ + return boundaryDynamics.getOmega(); +} + +template +void AdvectionDiffusionCornerDynamics2D::setOmega(T omega_) +{ + boundaryDynamics.setOmega(omega_); +} + + + +//================================================================= +// For 3D Corners with regularized Dynamic ============================================== +//================================================================= +template +AdvectionDiffusionCornerDynamics3D::AdvectionDiffusionCornerDynamics3D( + T omega_, Momenta& momenta_) + : BasicDynamics(momenta_), + boundaryDynamics(omega_, momenta_) +{ +} + +template +T AdvectionDiffusionCornerDynamics3D::computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const +{ + return lbHelpers::equilibriumFirstOrder( iPop, rho, u ); +} + + +template +void AdvectionDiffusionCornerDynamics3D::collide(Cell& cell,LatticeStatistics& statistics) +{ + typedef DESCRIPTOR L; + typedef lbHelpers lbH; + + T temperature = this->_momenta.computeRho(cell); + T* u = cell.template getFieldPointer(); + // I need to get Missing information on the corners !!!! + std::vector unknownIndexes = util::subIndexOutgoing3DonCorners(); + // here I know all missing and non missing f_i + + + // The collision procedure for D2Q5 and D3Q7 lattice is the same ... + // Given the rule f_i_neq = -f_opposite(i)_neq + // I have the right number of equations for the number of unknowns using these lattices + + for (unsigned iPop = 0; iPop < unknownIndexes.size(); ++iPop) { + cell[unknownIndexes[iPop]] = lbH::equilibriumFirstOrder(unknownIndexes[iPop], temperature, u) + -(cell[util::opposite(unknownIndexes[iPop])] + - lbH::equilibriumFirstOrder(util::opposite(unknownIndexes[iPop]), temperature, u) ) ; + } + + // Once all the f_i are known, I can call the collision for the Regularized Model. + boundaryDynamics.collide(cell, statistics); + +} + +template +T AdvectionDiffusionCornerDynamics3D::getOmega() const +{ + return boundaryDynamics.getOmega(); +} + +template +void AdvectionDiffusionCornerDynamics3D::setOmega(T omega_) +{ + boundaryDynamics.setOmega(omega_); +} + +//================================================================= +// For 3D Edges with regularized Dynamic ============================================== +//================================================================= +template +AdvectionDiffusionEdgesDynamics::AdvectionDiffusionEdgesDynamics( + T omega_, Momenta& momenta_) + : BasicDynamics(momenta_), + boundaryDynamics(omega_, momenta_) +{ +} + +template +T AdvectionDiffusionEdgesDynamics::computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const +{ + return lbHelpers::equilibriumFirstOrder( iPop, rho, u ); +} + + +template +void AdvectionDiffusionEdgesDynamics::collide(Cell& cell,LatticeStatistics& statistics) +{ + typedef DESCRIPTOR L; + typedef lbHelpers lbH; + + T temperature = this->_momenta.computeRho(cell); + T* u = cell.template getFieldPointer(); + // I need to get Missing information on the corners !!!! + std::vector unknownIndexes = util::subIndexOutgoing3DonEdges(); + // here I know all missing and non missing f_i + + + // The collision procedure for D2Q5 and D3Q7 lattice is the same ... + // Given the rule f_i_neq = -f_opposite(i)_neq + // I have the right number of equations for the number of unknowns using these lattices + + for (unsigned iPop = 0; iPop < unknownIndexes.size(); ++iPop) { + cell[unknownIndexes[iPop]] = lbH::equilibriumFirstOrder(unknownIndexes[iPop], temperature, u) + -(cell[util::opposite(unknownIndexes[iPop])] + - lbH::equilibriumFirstOrder(util::opposite(unknownIndexes[iPop]), temperature, u) ) ; + } + + // Once all the f_i are known, I can call the collision for the Regularized Model. + boundaryDynamics.collide(cell, statistics); + +} + +template +T AdvectionDiffusionEdgesDynamics::getOmega() const +{ + return boundaryDynamics.getOmega(); +} + +template +void AdvectionDiffusionEdgesDynamics::setOmega(T omega_) +{ + boundaryDynamics.setOmega(omega_); +} + + + + +} // namespace olb + + + + +#endif diff --git a/src/boundary/advectionDiffusionBoundaryCondition2D.cpp b/src/boundary/advectionDiffusionBoundaryCondition2D.cpp new file mode 100644 index 0000000..3a2180c --- /dev/null +++ b/src/boundary/advectionDiffusionBoundaryCondition2D.cpp @@ -0,0 +1,33 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2018 Adrian Kummerlaender + * 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. +*/ + +#include "advectionDiffusionBoundaryCondition2D.h" +#include "advectionDiffusionBoundaryCondition2D.hh" +#include "dynamics/latticeDescriptors.h" + + +namespace olb { + +template class OnLatticeAdvectionDiffusionBoundaryCondition2D>; + +} diff --git a/src/boundary/advectionDiffusionBoundaryCondition2D.h b/src/boundary/advectionDiffusionBoundaryCondition2D.h new file mode 100644 index 0000000..e47d9d1 --- /dev/null +++ b/src/boundary/advectionDiffusionBoundaryCondition2D.h @@ -0,0 +1,157 @@ +/* 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 helper for initialising 2D boundaries -- header file. + */ + +#ifndef ADVECTION_DIFFUSION_BOUNDARY_CONDITION_2D_H +#define ADVECTION_DIFFUSION_BOUNDARY_CONDITION_2D_H + +#include "momentaOnBoundaries2D.h" +#include "advectionDiffusionMomentaOnBoundaries.h" +#include "dynamics/dynamics.h" +#include "dynamics/advectionDiffusionDynamics.h" +#include "functors/lattice/indicator/blockIndicatorBaseF2D.h" + +#include +#include + +namespace olb { + +template +class sOnLatticeBoundaryCondition2D; + +template +class OnLatticeAdvectionDiffusionBoundaryCondition2D { +public: + virtual ~OnLatticeAdvectionDiffusionBoundaryCondition2D() { } + + virtual void addTemperatureBoundary0N(int x0, int x1, int y0, int y1,T omega) =0; + virtual void addTemperatureBoundary0P(int x0, int x1, int y0, int y1,T omega) =0; + virtual void addTemperatureBoundary1N(int x0, int x1, int y0, int y1,T omega) =0; + virtual void addTemperatureBoundary1P(int x0, int x1, int y0, int y1,T omega) =0; + + virtual void addTemperatureCornerNN(int x, int y, T omega) =0; + virtual void addTemperatureCornerNP(int x, int y, T omega) =0; + virtual void addTemperatureCornerPN(int x, int y, T omega) =0; + virtual void addTemperatureCornerPP(int x, int y, T omega) =0; + + BlockLatticeStructure2D& getBlock(); + BlockLatticeStructure2D const& getBlock() const; + + /// Add temperature boundary for indicated cells in range + virtual void addTemperatureBoundary(BlockIndicatorF2D& indicator, + int x0, int x1, int y0, int y1, + T omega) =0; + + /** + * \name Convenience wrappers for temperature boundary functions + * \{ + **/ + + void addTemperatureBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, + int x0, int x1, int y0, int y1, + T omega); + void addTemperatureBoundary(BlockIndicatorF2D& indicator, + T omega, bool includeOuterCells=false); + void addTemperatureBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, + T omega, bool includeOuterCells=false); + + ///\} + + /// adds a temperature boundary for one material or a range (x0-x1, y0-y1, z0-z1) + virtual void addRegularizedTemperatureBoundary(BlockIndicatorF2D& indicator, int x0, int x1, int y0, int y1, T omega) =0; + virtual void addRegularizedTemperatureBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, int x0, int x1, int y0, int y1, T omega) =0; + virtual void addRegularizedTemperatureBoundary(BlockIndicatorF2D& indicator, T omega) =0; + virtual void addRegularizedTemperatureBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, T omega) =0; + + virtual void addRegularizedHeatFluxBoundary(BlockIndicatorF2D& indicator, int x0, int x1, int y0, int y1, T omega, T *heatFlux) =0; + virtual void addRegularizedHeatFluxBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, int x0, int x1, int y0, int y1, T omega, T *heatFlux) =0; + virtual void addRegularizedHeatFluxBoundary(BlockIndicatorF2D& indicator, T omega, T *heatFlux) =0; + virtual void addRegularizedHeatFluxBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, T omega, T *heatFlux) =0; +}; + +template +class AdvectionDiffusionBoundaryManager2D { +public: + template static Momenta* + getTemperatureBoundaryMomenta(); + template static Dynamics* + getTemperatureBoundaryDynamics(T omega, Momenta& momenta); + template static PostProcessorGenerator2D* + getTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1); + + template static Momenta* + getTemperatureCornerMomenta(); + template static Dynamics* + getTemperatureCornerDynamics(T omega, Momenta& momenta); + template static PostProcessorGenerator2D* + getTemperatureCornerProcessor(int x, int y); + + + template static Momenta* + getRegularizedTemperatureBoundaryMomenta(); + template static Dynamics* + getRegularizedTemperatureBoundaryDynamics(T omega, Momenta& momenta); + template static PostProcessorGenerator2D* + getRegularizedTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1); + + template static Momenta* + getRegularizedTemperatureCornerMomenta(); + template static Dynamics* + getRegularizedTemperatureCornerDynamics(T omega, Momenta& momenta); + template static PostProcessorGenerator2D* + getRegularizedTemperatureCornerProcessor(int x, int y); + + template static Momenta* + getRegularizedHeatFluxBoundaryMomenta(T *heatFlux); + template static Dynamics* + getRegularizedHeatFluxBoundaryDynamics(T omega, Momenta& momenta); + template static PostProcessorGenerator2D* + getRegularizedHeatFluxBoundaryProcessor(int x0, int x1, int y0, int y1); + + template static Momenta* + getRegularizedHeatFluxCornerMomenta(); + template static Dynamics* + getRegularizedHeatFluxCornerDynamics(T omega, Momenta& momenta); + template static PostProcessorGenerator2D* + getRegularizedHeatFluxCornerProcessor(int x, int y); +}; + +////// Factory function for Regularized Thermal BC + +/// blockLattice creator +template > +OnLatticeAdvectionDiffusionBoundaryCondition2D* +createAdvectionDiffusionBoundaryCondition2D(BlockLatticeStructure2D& block); + +/// superLattice creator, calls createAdvectionDiffusionBoundaryCondidtion3D from above. +template > +void createAdvectionDiffusionBoundaryCondition2D(sOnLatticeBoundaryCondition2D& sBC); + + +} //namespace olb + + +#endif diff --git a/src/boundary/advectionDiffusionBoundaryCondition2D.hh b/src/boundary/advectionDiffusionBoundaryCondition2D.hh new file mode 100644 index 0000000..0c8397d --- /dev/null +++ b/src/boundary/advectionDiffusionBoundaryCondition2D.hh @@ -0,0 +1,262 @@ +/* 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 helper for initialising 2D boundaries -- generic implementation. + */ +#ifndef ADVECTION_DIFFUSION_BOUNDARY_CONDITION_2D_HH +#define ADVECTION_DIFFUSION_BOUNDARY_CONDITION_2D_HH + +#include "advectionDiffusionBoundaries.h" +#include "advectionDiffusionBoundaries.hh" +#include "advectionDiffusionMomentaOnBoundaries.h" +#include "advectionDiffusionMomentaOnBoundaries.hh" +#include "advectionDiffusionBoundaryCondition2D.h" +#include "advectionDiffusionBoundaryInstantiator2D.h" +#include "functors/lattice/indicator/blockIndicatorF2D.h" + + +namespace olb { + + +////////// AdvectionDiffusionBoundaryManager2D ///////////////////////////////////////// + +template +template +Momenta* +AdvectionDiffusionBoundaryManager2D::getTemperatureBoundaryMomenta() +{ + return new EquilibriumBM; + // return new RegularizedTemperatureBM; +} + +template +template +Dynamics* AdvectionDiffusionBoundaryManager2D:: +getTemperatureBoundaryDynamics(T omega, Momenta& momenta) +{ + return new AdvectionDiffusionBoundariesDynamics(omega, momenta); +} + +template +template +PostProcessorGenerator2D* +AdvectionDiffusionBoundaryManager2D:: +getTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1) +{ + return nullptr; +} + +//================== Corners ================================ + +template +template +Momenta* +AdvectionDiffusionBoundaryManager2D::getTemperatureCornerMomenta() +{ + return new EquilibriumBM; +} + +template +template +Dynamics* AdvectionDiffusionBoundaryManager2D:: +getTemperatureCornerDynamics(T omega, Momenta& momenta) +{ + return new AdvectionDiffusionCornerDynamics2D(omega, momenta); +} + +template +template +PostProcessorGenerator2D* +AdvectionDiffusionBoundaryManager2D:: +getTemperatureCornerProcessor(int x, int y) +{ + return nullptr; +} + + + +template +template +Momenta* +AdvectionDiffusionBoundaryManager2D::getRegularizedTemperatureBoundaryMomenta() +{ + return new RegularizedTemperatureBM; +} + +template +template +Dynamics* AdvectionDiffusionBoundaryManager2D:: +getRegularizedTemperatureBoundaryDynamics(T omega, Momenta& momenta) +{ + return new CombinedAdvectionDiffusionRLBdynamics(omega, momenta); +} + +template +template +PostProcessorGenerator2D* +AdvectionDiffusionBoundaryManager2D:: +getRegularizedTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1) +{ + return nullptr; +} + +//================== Corners ================================ + +template +template +Momenta* +AdvectionDiffusionBoundaryManager2D::getRegularizedTemperatureCornerMomenta() +{ + return new EquilibriumBM; +} + +template +template +Dynamics* AdvectionDiffusionBoundaryManager2D:: +getRegularizedTemperatureCornerDynamics(T omega, Momenta& momenta) +{ + return new AdvectionDiffusionCornerDynamics2D(omega, momenta); +} + +template +template +PostProcessorGenerator2D* +AdvectionDiffusionBoundaryManager2D:: +getRegularizedTemperatureCornerProcessor(int x, int y) +{ + return nullptr; +} + +////////// Convenience wrappers for boundary functions //////////////////////// + +template +void OnLatticeAdvectionDiffusionBoundaryCondition2D::addTemperatureBoundary( + BlockGeometryStructure2D& blockGeometryStructure, int material, + int x0, int x1, int y0, int y1, T omega) +{ + BlockIndicatorMaterial2D indicator(blockGeometryStructure, material); + addTemperatureBoundary(indicator, x0, x1, y0, y1, omega); +} + +template +void OnLatticeAdvectionDiffusionBoundaryCondition2D::addTemperatureBoundary( + BlockIndicatorF2D& indicator, T omega, bool includeOuterCells) +{ + auto& blockGeometryStructure = indicator.getBlockGeometryStructure(); + const int margin = includeOuterCells ? 0 : 1; + addTemperatureBoundary(indicator, + margin, blockGeometryStructure.getNx()-1 -margin, + margin, blockGeometryStructure.getNy()-1 -margin, + omega); +} + +template +void OnLatticeAdvectionDiffusionBoundaryCondition2D::addTemperatureBoundary( + BlockGeometryStructure2D& blockGeometryStructure, int material, + T omega, bool includeOuterCells) +{ + BlockIndicatorMaterial2D indicator(blockGeometryStructure, material); + addTemperatureBoundary(indicator, omega, includeOuterCells); +} + +template +template +Momenta* +AdvectionDiffusionBoundaryManager2D::getRegularizedHeatFluxBoundaryMomenta(T *heatFlux) +{ + return new RegularizedHeatFluxBM(heatFlux); +} + +template +template +Dynamics* AdvectionDiffusionBoundaryManager2D:: +getRegularizedHeatFluxBoundaryDynamics(T omega, Momenta& momenta) +{ + return new CombinedAdvectionDiffusionRLBdynamics(omega, momenta); +} + +template +template +PostProcessorGenerator2D* +AdvectionDiffusionBoundaryManager2D:: +getRegularizedHeatFluxBoundaryProcessor(int x0, int x1, int y0, int y1) +{ + return nullptr; +} + +//================== Corners ================================ + +template +template +Momenta* +AdvectionDiffusionBoundaryManager2D::getRegularizedHeatFluxCornerMomenta() +{ + return new EquilibriumBM; +} + +template +template +Dynamics* AdvectionDiffusionBoundaryManager2D:: +getRegularizedHeatFluxCornerDynamics(T omega, Momenta& momenta) +{ + return new AdvectionDiffusionCornerDynamics2D(omega, momenta); +} + +template +template +PostProcessorGenerator2D* +AdvectionDiffusionBoundaryManager2D:: +getRegularizedHeatFluxCornerProcessor(int x, int y) +{ + return nullptr; +} + + +////////// Factory functions ////////////////////////////////////////////////// + +template +OnLatticeAdvectionDiffusionBoundaryCondition2D* +createAdvectionDiffusionBoundaryCondition2D(BlockLatticeStructure2D& block) +{ + return new AdvectionDiffusionBoundaryConditionInstantiator2D > (block); +} + +template +void createAdvectionDiffusionBoundaryCondition2D(sOnLatticeBoundaryCondition2D& sBC) +{ + int nC = sBC.getSuperLattice().getLoadBalancer().size(); + sBC.setOverlap(1); + for (int iC = 0; iC < nC; iC++) { + OnLatticeAdvectionDiffusionBoundaryCondition2D* blockBC = + createAdvectionDiffusionBoundaryCondition2D( + sBC.getSuperLattice().getExtendedBlockLattice(iC)); + sBC.getADblockBCs().push_back(blockBC); + } +} + + +} // namespace olb + +#endif diff --git a/src/boundary/advectionDiffusionBoundaryCondition3D.cpp b/src/boundary/advectionDiffusionBoundaryCondition3D.cpp new file mode 100644 index 0000000..f2848db --- /dev/null +++ b/src/boundary/advectionDiffusionBoundaryCondition3D.cpp @@ -0,0 +1,33 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2018 Adrian Kummerlaender + * 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. +*/ + +#include "advectionDiffusionBoundaryCondition3D.h" +#include "advectionDiffusionBoundaryCondition3D.hh" +#include "dynamics/latticeDescriptors.h" + + +namespace olb { + +template class OnLatticeAdvectionDiffusionBoundaryCondition3D>; + +} diff --git a/src/boundary/advectionDiffusionBoundaryCondition3D.h b/src/boundary/advectionDiffusionBoundaryCondition3D.h new file mode 100644 index 0000000..eae8c1c --- /dev/null +++ b/src/boundary/advectionDiffusionBoundaryCondition3D.h @@ -0,0 +1,126 @@ +/* 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 helper for initialising 3D boundaries -- header file. + */ + +#ifndef ADVECTION_DIFFUSION_BOUNDARY_CONDITION_3D_H +#define ADVECTION_DIFFUSION_BOUNDARY_CONDITION_3D_H + + +#include "dynamics/advectionDiffusionDynamics.h" +#include "geometry/blockGeometryStructure3D.h" + +namespace olb { + +template +class BlockIndicatorF3D; + +template +class sOnLatticeBoundaryCondition3D; + +/* Interface class whose childs are boundary instantiators. +* Instantiators have a third template parameter BoundaryManager that finaly implements the interfaces from here. +*/ +template +class OnLatticeAdvectionDiffusionBoundaryCondition3D { +public: + virtual ~OnLatticeAdvectionDiffusionBoundaryCondition3D() { } + + /** + * \anchor AdvDiffBCimplI3D + * \name Indicator-accepting boundary condition interfaces + * + * \param indicator Block indicator defining boundary cells + * \param x0,x1,y0,y1,z0,z1 Range of cells to be traversed + * \{ + **/ + + virtual void addTemperatureBoundary(BlockIndicatorF3D& indicator, + int x0, int x1, int y0, int y1, int z0, int z1, + T omega) =0; + virtual void addConvectionBoundary(BlockIndicatorF3D& indicator, + int x0, int x1, int y0, int y1, int z0, int z1) =0; + virtual void addExtFieldBoundary(BlockIndicatorF3D& indicator, + int offset, + int x0, int x1, int y0, int y1, int z0, int z1) =0; + /// Add BC that initializes zero distributions and computes the density that entered the boundary + virtual void addZeroDistributionBoundary(BlockIndicatorF3D& indicator, + int x0, int x1, int y0, int y1, int z0, int z1) =0; + + ///\} + + /** + * \name Convenience wrappers for boundary functions + * In practice it is often preferable to define a boundary on a single material + * number instead of instantiating an appropriate indicator by hand. + * + * These convenience functions are simple wrappers around the actual + * \ref AdvDiffBCimplI3D "boundary condition interfaces". + * \{ + **/ + + void addTemperatureBoundary(BlockGeometryStructure3D& blockGeometryStructure, int material, + int x0, int x1, int y0, int y1, int z0, int z1, + T omega); + void addTemperatureBoundary(BlockIndicatorF3D& indicator, + T omega, bool includeOuterCells=false); + void addTemperatureBoundary(BlockGeometryStructure3D& blockGeometryStructure, int material, + T omega, bool includeOuterCells=false); + + void addConvectionBoundary(BlockGeometryStructure3D& blockGeometryStructure, int material, + int x0, int x1, int y0, int y1, int z0, int z1); + void addConvectionBoundary(BlockIndicatorF3D& indicator, bool includeOuterCells=false); + void addConvectionBoundary(BlockGeometryStructure3D& blockGeometryStructure, int material, bool includeOuterCells=false); + + void addExtFieldBoundary(BlockGeometryStructure3D& blockGeometryStructure, int material, + int offset, + int x0, int x1, int y0, int y1, int z0, int z1); + void addExtFieldBoundary(BlockIndicatorF3D& indicator, + int offset, bool includeOuterCells=false); + void addExtFieldBoundary(BlockGeometryStructure3D& blockGeometryStructure, int material, + int offset, bool includeOuterCells=false); + + void addZeroDistributionBoundary(BlockGeometryStructure3D& blockGeometryStructure, int material, + int x0, int x1, int y0, int y1, int z0, int z1); + void addZeroDistributionBoundary(BlockIndicatorF3D& indicator, bool includeOuterCells=false); + void addZeroDistributionBoundary(BlockGeometryStructure3D& blockGeometryStructure, int material, bool includeOuterCells=false); + + ///\} +}; + +/// blockLattice creator +template > +OnLatticeAdvectionDiffusionBoundaryCondition3D* +createAdvectionDiffusionBoundaryCondition3D(BlockLatticeStructure3D& block); + +/// superLattice creator, calls createAdvectionDiffusionBoundaryCondidtion3D from above. +template > +void createAdvectionDiffusionBoundaryCondition3D(sOnLatticeBoundaryCondition3D& sBC); + + +} //namespace olb + + +#endif diff --git a/src/boundary/advectionDiffusionBoundaryCondition3D.hh b/src/boundary/advectionDiffusionBoundaryCondition3D.hh new file mode 100644 index 0000000..8b5a9e4 --- /dev/null +++ b/src/boundary/advectionDiffusionBoundaryCondition3D.hh @@ -0,0 +1,292 @@ +/* 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 helper for initialising 3D boundaries -- generic implementation. + */ +#ifndef ADVECTION_DIFFUSION_BOUNDARY_CONDITION_3D_HH +#define ADVECTION_DIFFUSION_BOUNDARY_CONDITION_3D_HH + +#include "advectionDiffusionBoundaries.h" +#include "advectionDiffusionBoundaries.hh" +#include "advectionDiffusionBoundaryCondition3D.h" +#include "advectionDiffusionBoundaryInstantiator3D.h" +#include "advectionDiffusionBoundaryInstantiator3D.hh" +#include "momentaOnBoundaries.h" +#include "functors/lattice/indicator/blockIndicatorF3D.h" +#include "advectionDiffusionMomentaOnBoundaries.h" +#include "advectionDiffusionMomentaOnBoundaries.hh" + + +namespace olb { + +template +class AdvectionDiffusionBoundaryManager3D { +public: + template + static Momenta* getTemperatureBoundaryMomenta(); + template + static Dynamics* getTemperatureBoundaryDynamics(T omega, Momenta& momenta); + template + static PostProcessorGenerator3D* getTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1, int z0, int z1); + + template