/* This file is part of the OpenLB library * * Copyright (C) 2006-2018 Jonas Latt, 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. */ /** \file * Dynamics for a generic 3D block structure -- header file. */ #ifndef BLOCK_LATTICE_STRUCTURE_3D_H #define BLOCK_LATTICE_STRUCTURE_3D_H #include #include "cell.h" #include "blockData3D.h" #include "blockStructure3D.h" #include "postProcessing.h" #include "serializer.h" #include "spatiallyExtendedObject3D.h" #include "geometry/blockGeometryStructure3D.h" #include "latticeStatistics.h" #include "functors/analytical/analyticalF.h" #include "functors/analytical/indicator/indicatorBaseF3D.h" namespace olb { template class AnalyticalF3D; template struct Dynamics; template class Cell; template struct WriteCellFunctional; template class BlockIndicatorF3D; template class IndicatorSphere3D; /** BlockLatticeStructure3D is a interface class for defining dynamics on a BlockStructure3D. * The pure virtual methods are wrapped by generic methods. */ template class BlockLatticeStructure3D : public BlockStructure3D, public SpatiallyExtendedObject3D { public: BlockLatticeStructure3D(int nx, int ny, int nz) : BlockStructure3D(nx,ny,nz) {}; ~BlockLatticeStructure3D() override { } public: /// Define rho on a domain described by an indicator /** * \param indicator Block indicator describing the target domain * \param rho Analytical functor (global) **/ virtual void defineRho(BlockIndicatorF3D& indicator, AnalyticalF3D& rho); /// Define rho on a domain with a particular material number virtual void defineRho(BlockGeometryStructure3D& blockGeometry, int material, AnalyticalF3D& rho); /// Define u on a domain described by an indicator /** * \param indicator Block indicator describing the target domain * \param u Analytical functor (global) **/ virtual void defineU(BlockIndicatorF3D& indicator, AnalyticalF3D& u); /// Define u on a domain with a particular material number virtual void defineU(BlockGeometryStructure3D& blockGeometry, int material, AnalyticalF3D& u); /// Define rho and u on a domain described by an indicator /** * \param indicator Block indicator describing the target domain * \param rho Analytical functor (global) * \param u Analytical functor (global) **/ virtual void defineRhoU(BlockIndicatorF3D& indicator, AnalyticalF3D& rho, AnalyticalF3D& u); /// Define rho and u on a domain with a particular material number virtual void defineRhoU(BlockGeometryStructure3D& blockGeometry, int material, AnalyticalF3D& rho, AnalyticalF3D& u); /// Define a population on a domain described by an indicator /** * \param indicator Block indicator describing the target domain * \param Pop Analytical functor (global), target dimension DESCRIPTOR::q **/ virtual void definePopulations(BlockIndicatorF3D& indicator, AnalyticalF3D& Pop); /// Define a population on a domain with a particular material number virtual void definePopulations(BlockGeometryStructure3D& blockGeometry, int material, AnalyticalF3D& Pop); /** * \param indicator Block indicator describing the target domain * \param Pop Block functor, target dimension DESCRIPTOR::q **/ virtual void definePopulations(BlockIndicatorF3D& indicator, BlockF3D& Pop); /// Define a population on a domain with a particular material number virtual void definePopulations(BlockGeometryStructure3D& blockGeometry, int material, BlockF3D& Pop); /// Define a field on a domain described by an indicator /** * \param indicator Block indicator describing the target domain * \param field Analytical functor (global) **/ template void defineField(BlockIndicatorF3D& indicator, AnalyticalF3D& field); /// Define a field on a domain with a particular material number template void defineField(BlockGeometryStructure3D& blockGeometry, int material, AnalyticalF3D& field); /// Define a field on a domain described by an analytical indicator /** * \param indicatorF Domain indicator to be reduced to BlockIndicatorFfromIndicatorF3D **/ template void defineField(BlockGeometryStructure3D& blockGeometry, IndicatorF3D& indicatorF, AnalyticalF3D& field); /// Initialize by equilibrium on a domain described by an indicator /** * \param indicator Block indicator describing the target domain * \param rho Analytical functor (global) * \param u Analytical functor (global) **/ virtual void iniEquilibrium(BlockIndicatorF3D& indicator, AnalyticalF3D& rho, AnalyticalF3D& u); /// Initialize by equilibrium on a domain with a particular material number virtual void iniEquilibrium(BlockGeometryStructure3D& blockGeometry, int material, AnalyticalF3D& rho, AnalyticalF3D& u); #ifndef OLB_PRECOMPILED virtual void setExternalParticleField(BlockGeometryStructure3D& blockGeometry, AnalyticalF3D& velocity, SmoothIndicatorF3D& sIndicator); #endif // pure virtual member functions virtual Cell& get(int iX, int iY, int iZ) =0; virtual Cell& get(const int latticeR[]) =0; virtual Cell const& get(int iX, int iY, int iZ) const =0; virtual void initialize() =0; /// Define the dynamics on a lattice site virtual void defineDynamics(int iX, int iY, int iZ, Dynamics* dynamics) = 0; /// Define the dynamics on a 3D sub-box virtual void defineDynamics(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, Dynamics* dynamics) = 0; /// Define the dynamics on a domain described by an indicator virtual void defineDynamics(BlockIndicatorF3D& indicator, Dynamics* dynamics) = 0; /// Define the dynamics on a domain with a particular material number virtual void defineDynamics(BlockGeometryStructure3D& blockGeometry, int material, Dynamics* dynamics) = 0; virtual Dynamics* getDynamics(int iX, int iY, int iZ) = 0; virtual void collide(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) =0; virtual void collide() =0; virtual void stream(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) =0; virtual void stream(bool periodic=false) =0; virtual void collideAndStream(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) =0; virtual void collideAndStream(bool periodic=false) =0; virtual T computeAverageDensity(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) const =0; virtual T computeAverageDensity() const =0; virtual void computeStress(int iX, int iY, int iZ, T pi[util::TensorVal::n]) = 0; virtual void stripeOffDensityOffset(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, T offset) =0; virtual void stripeOffDensityOffset(T offset) =0; virtual void forAll(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, WriteCellFunctional const& application) =0; virtual void forAll(WriteCellFunctional const& application) =0; virtual void addPostProcessor(PostProcessorGenerator3D const& ppGen) =0; virtual void resetPostProcessors() =0; virtual void postProcess(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) =0; virtual void postProcess() =0; virtual void addLatticeCoupling(LatticeCouplingGenerator3D const& lcGen, std::vector partners ) =0; virtual void executeCoupling(int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) =0; virtual void executeCoupling() =0; virtual LatticeStatistics& getStatistics() =0; virtual LatticeStatistics const& getStatistics() const =0; }; } // namespace olb #endif