OpenLB 1.7
Loading...
Searching...
No Matches
blockLatticeStructure2D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2006-2018 Jonas Latt, Adrian Kummerlaender
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
27#ifndef BLOCK_LATTICE_STRUCTURE_2D_H
28#define BLOCK_LATTICE_STRUCTURE_2D_H
29
30#include <vector>
31#include "cell.h"
32#include "blockStructure2D.h"
33#include "postProcessing.h"
34#include "serializer.h"
35#include "spatiallyExtendedObject2D.h"
36#include "geometry/blockGeometryStructure2D.h"
37#include "latticeStatistics.h"
39
40
41namespace olb {
42
43template<typename T, typename DESCRIPTOR> struct Dynamics;
44template<typename T, typename DESCRIPTOR> struct WriteCellFunctional;
45template<typename T> class BlockIndicatorF2D;
46
47
49template<typename T, typename DESCRIPTOR>
50class BlockLatticeStructure2D : public BlockStructure2D, public SpatiallyExtendedObject2D {
51public:
52 BlockLatticeStructure2D(int nx, int ny) : BlockStructure2D(nx,ny) {};
54 std::vector<Momenta<T,DESCRIPTOR>*> momentaVector;
55 std::vector<Dynamics<T,DESCRIPTOR>*> dynamicsVector;
56public:
57 virtual void defineRho(BlockIndicatorF2D<T>& indicator,
59 virtual void defineRho(BlockGeometryStructure2D<T>& blockGeometry, int material,
61 virtual void defineU(BlockIndicatorF2D<T>& indicator,
63 virtual void defineU(BlockGeometryStructure2D<T>& blockGeometry, int material,
65 virtual void defineRhoU(BlockIndicatorF2D<T>& indicator,
67 virtual void defineRhoU(BlockGeometryStructure2D<T>& blockGeometry, int material,
69 virtual void definePopulations(BlockIndicatorF2D<T>& indicator,
71 virtual void definePopulations(BlockGeometryStructure2D<T>& blockGeometry, int material,
73
74 template <typename FIELD>
76 AnalyticalF<2,T,T>& field);
77 template <typename FIELD>
78 void defineField(BlockGeometryStructure2D<T>& blockGeometry, int material,
79 AnalyticalF<2,T,T>& field);
80 template <typename FIELD>
81 void defineField(BlockGeometryStructure2D<T>& blockGeometry,
82 IndicatorF2D<T>& indicator,
83 AnalyticalF<2,T,T>& field);
84 template <typename FIELD>
85 void addField(BlockGeometryStructure2D<T>& blockGeometry,
86 IndicatorF2D<T>& indicator,
87 AnalyticalF<2,T,T>& field);
88 template <typename FIELD>
89 void addField(BlockGeometryStructure2D<T>& blockGeometry,
90 IndicatorF2D<T>& indicator,
92 template <typename FIELD>
93 void multiplyField(BlockGeometryStructure2D<T>& blockGeometry,
94 IndicatorF2D<T>& indicator,
95 AnalyticalF<2,T,T>& field);
96
97
98 virtual void iniEquilibrium(BlockIndicatorF2D<T>& indicator,
100 virtual void iniEquilibrium(BlockGeometryStructure2D<T>& blockGeometry, int material,
102 virtual void iniRegularized(BlockIndicatorF2D<T>& indicator,
104 virtual void iniRegularized(BlockGeometryStructure2D<T>& blockGeometry, int material,
106
107 // pure virtual member functions
108 virtual Cell<T,DESCRIPTOR> get(int iX, int iY) =0;
109 virtual Cell<T,DESCRIPTOR> get(int latticeR[]) =0;
110 virtual ConstCell<T,DESCRIPTOR> get(int iX, int iY) const =0;
111
112 virtual T& getPop(std::size_t iCell, unsigned iPop) =0;
113 virtual T& getPop(int iX, int iY, unsigned iPop) =0;
114
115 virtual void initialize() =0;
116 virtual void defineDynamics(int x0_, int x1_, int y0_, int y1_,
117 Dynamics<T,DESCRIPTOR>* dynamics ) =0;
118 virtual void defineDynamics(int iX, int iY, Dynamics<T,DESCRIPTOR>* dynamics ) =0;
119 virtual Dynamics<T,DESCRIPTOR>* getDynamics(int iX, int iY) = 0;
120
121 virtual void collide(int x0_, int x1_, int y0_, int y1_) =0;
122 virtual void collide() =0;
123
124 virtual void stripeOffDensityOffset(int x0_, int x1_, int y0_, int y1_,
125 T offset ) =0;
126 virtual void stripeOffDensityOffset(T offset) =0;
128 virtual void resetPostProcessors() =0;
129 virtual void postProcess(int x0_, int x1_, int y0_, int y1_) =0;
130 virtual void postProcess() =0;
132 std::vector<SpatiallyExtendedObject2D*> partners ) =0;
133 virtual void executeCoupling(int x0_, int x1_, int y0_, int y1_) =0;
134 virtual void executeCoupling() =0;
136 virtual LatticeStatistics<T> const& getStatistics() const =0;
137
138 virtual void freeSurfacePostProcess(size_t i, int x0_, int x1_, int y0_, int y1_) =0;
139 virtual void freeSurfacePostProcess(size_t i) =0;
140
141 virtual void freeSurfaceInitialize() = 0;
142};
143
144
146
147template <typename T>
148bool getRangeBlockGeometrySmoothIndicatorIntersection2D(BlockGeometryStructure2D<T>& blockGeometry,
150 T invDeltaX, std::vector<int>& start, std::vector<int>& end);
151
152template <typename T, typename DESCRIPTOR>
153void setBlockExternalParticleField( BlockGeometryStructure2D<T>& blockGeometry, AnalyticalF<2,T,T>& velocity,
155 BlockLattice2D<T,DESCRIPTOR>& extendedBlockLattice );
156
157template <typename T, typename DESCRIPTOR>
158void setBlockExternalParticleField( BlockGeometryStructure2D<T>& blockGeometry, AnalyticalF<2,T,T>& velocity,
160 BlockLattice2D<T,DESCRIPTOR>& extendedBlockLattice,
161 Vector<T,2> cellMin, Vector<T,2> cellMax,
162 Vector<bool,2> periodic );
163
164//Geng2019
165template <typename T, typename DESCRIPTOR>
166void setBlockZetaParticleField( BlockGeometryStructure2D<T>& blockGeometry, AnalyticalF<2,T,T>& velocity,
168 BlockLattice2D<T,DESCRIPTOR>& extendedBlockLattice );
169
170} // namespace olb
171
172#endif
Dynamics for a generic 2D block – header file.
Definition of a LB cell – header file.
AnalyticalF are applications from DD to XD, where X is set by the constructor.
Base block indicator functor (discrete)
An interface to all the variants of (more or less) regular lattices.
virtual void definePopulations(BlockIndicatorF2D< T > &indicator, AnalyticalF< 2, T, T > &Pop)
virtual LatticeStatistics< T > & getStatistics()=0
virtual void defineDynamics(int iX, int iY, Dynamics< T, DESCRIPTOR > *dynamics)=0
virtual void defineDynamics(int x0_, int x1_, int y0_, int y1_, Dynamics< T, DESCRIPTOR > *dynamics)=0
virtual void freeSurfaceInitialize()=0
virtual void initialize()=0
virtual void defineRho(BlockIndicatorF2D< T > &indicator, AnalyticalF< 2, T, T > &rho)
virtual Cell< T, DESCRIPTOR > get(int iX, int iY)=0
virtual void defineRho(BlockGeometryStructure2D< T > &blockGeometry, int material, AnalyticalF< 2, T, T > &rho)
void addField(BlockGeometryStructure2D< T > &blockGeometry, IndicatorF2D< T > &indicator, AnalyticalF< 2, T, T > &field, AnalyticalF< 2, T, T > &porous)
virtual void defineRhoU(BlockIndicatorF2D< T > &indicator, AnalyticalF< 2, T, T > &rho, AnalyticalF< 2, T, T > &u)
virtual void executeCoupling(int x0_, int x1_, int y0_, int y1_)=0
virtual void defineU(BlockIndicatorF2D< T > &indicator, AnalyticalF< 2, T, T > &u)
virtual ConstCell< T, DESCRIPTOR > get(int iX, int iY) const =0
virtual void stripeOffDensityOffset(int x0_, int x1_, int y0_, int y1_, T offset)=0
virtual void addPostProcessor(PostProcessorGenerator2D< T, DESCRIPTOR > const &ppGen)=0
virtual void executeCoupling()=0
void defineField(BlockIndicatorF2D< T > &indicator, AnalyticalF< 2, T, T > &field)
virtual void addLatticeCoupling(LatticeCouplingGenerator2D< T, DESCRIPTOR > const &lcGen, std::vector< SpatiallyExtendedObject2D * > partners)=0
virtual LatticeStatistics< T > const & getStatistics() const =0
virtual void defineRhoU(BlockGeometryStructure2D< T > &blockGeometry, int material, AnalyticalF< 2, T, T > &rho, AnalyticalF< 2, T, T > &u)
void defineField(BlockGeometryStructure2D< T > &blockGeometry, IndicatorF2D< T > &indicator, AnalyticalF< 2, T, T > &field)
virtual void iniEquilibrium(BlockGeometryStructure2D< T > &blockGeometry, int material, AnalyticalF< 2, T, T > &rho, AnalyticalF< 2, T, T > &u)
virtual Dynamics< T, DESCRIPTOR > * getDynamics(int iX, int iY)=0
virtual void freeSurfacePostProcess(size_t i, int x0_, int x1_, int y0_, int y1_)=0
virtual void defineU(BlockGeometryStructure2D< T > &blockGeometry, int material, AnalyticalF< 2, T, T > &u)
std::vector< Momenta< T, DESCRIPTOR > * > momentaVector
virtual void iniRegularized(BlockIndicatorF2D< T > &indicator, AnalyticalF< 2, T, T > &rho, AnalyticalF< 2, T, T > &u, AnalyticalF< 2, T, T > &pi)
virtual void stripeOffDensityOffset(T offset)=0
virtual Cell< T, DESCRIPTOR > get(int latticeR[])=0
void defineField(BlockGeometryStructure2D< T > &blockGeometry, int material, AnalyticalF< 2, T, T > &field)
virtual void freeSurfacePostProcess(size_t i)=0
virtual T & getPop(std::size_t iCell, unsigned iPop)=0
virtual void iniRegularized(BlockGeometryStructure2D< T > &blockGeometry, int material, AnalyticalF< 2, T, T > &rho, AnalyticalF< 2, T, T > &u, AnalyticalF< 2, T, T > &pi)
virtual void collide(int x0_, int x1_, int y0_, int y1_)=0
virtual T & getPop(int iX, int iY, unsigned iPop)=0
virtual void postProcess(int x0_, int x1_, int y0_, int y1_)=0
virtual void iniEquilibrium(BlockIndicatorF2D< T > &indicator, AnalyticalF< 2, T, T > &rho, AnalyticalF< 2, T, T > &u)
std::vector< Dynamics< T, DESCRIPTOR > * > dynamicsVector
virtual void definePopulations(BlockGeometryStructure2D< T > &blockGeometry, int material, AnalyticalF< 2, T, T > &Pop)
virtual void resetPostProcessors()=0
void multiplyField(BlockGeometryStructure2D< T > &blockGeometry, IndicatorF2D< T > &indicator, AnalyticalF< 2, T, T > &field)
void addField(BlockGeometryStructure2D< T > &blockGeometry, IndicatorF2D< T > &indicator, AnalyticalF< 2, T, T > &field)
virtual void postProcess()=0
Highest-level interface to Cell data.
Definition cell.h:148
Highest-level interface to read-only Cell data.
Definition cell.h:53
IndicatorF2D is an application from .
Plain old scalar vector.
Definition vector.h:47
Interface for post-processing steps – header file.
Top level namespace for all of OpenLB.
void setBlockZetaParticleField(BlockGeometryStructure2D< T > &blockGeometry, AnalyticalF< 2, T, T > &velocity, SmoothIndicatorF2D< T, T, true > &sIndicator, BlockLattice2D< T, DESCRIPTOR > &extendedBlockLattice)
bool getRangeBlockGeometrySmoothIndicatorIntersection2D(BlockGeometryStructure2D< T > &blockGeometry, SmoothIndicatorF2D< T, T, true > &sIndicator, T invDeltaX, std::vector< int > &start, std::vector< int > &end)
void setBlockExternalParticleField(BlockGeometryStructure2D< T > &blockGeometry, AnalyticalF< 2, T, T > &velocity, SmoothIndicatorF2D< T, T, true > &sIndicator, BlockLattice2D< T, DESCRIPTOR > &extendedBlockLattice)
Interface for post-processing steps – header file.
Interface for per-cell dynamics.
Definition interface.h:54