OpenLB 1.7
Loading...
Searching...
No Matches
backCouplingModels.h
Go to the documentation of this file.
1/* Lattice Boltzmann sample, written in C++, using the OpenLB
2 * library
3 *
4 * Copyright (C) 2019 Davide Dapelo
5 * E-mail contact: info@openlb.net
6 * The most recent release of OpenLB can be downloaded at
7 * <http://www.openlb.net/>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 */
24
25/* Models for Lagrangian back-coupling methods -- header file.
26 */
27
28#ifndef LB_BACK_COUPLING_MODELS_H
29#define LB_BACK_COUPLING_MODELS_H
30
33
34namespace olb {
35
39template<typename T, template<typename V> class Particle>
41public:
43 virtual void communicate()=0;
45 virtual bool operator() (Particle<T>* p, int globic, int material, int subCycles=1)=0;
47 virtual void resetExternalField(int material)=0;
48};
49
54template<typename T, typename Lattice, template<typename V> class Particle>
55class BaseBackCouplingModel : public BackCouplingModel<T,Particle> {
56public:
58 virtual void resetExternalField(int material) override;
59protected:
63 SuperGeometry<T,3>& sGeometry,
64 int overlap );
65 UnitConverter<T, Lattice>& _converter; // reference to a UnitConverter
67 SuperLattice<T, Lattice>& _sLattice; // reference to a lattice
69private:
70 // Pointers to functions to reset fluid force
71 std::shared_ptr<AnalyticalConst3D<T, T> > _zeroAnalytical;
72 std::shared_ptr<AnalyticalComposed3D<T, T> > _zeroField;
73};
74
78template<typename T, typename Lattice, template<typename V> class Particle>
79class BaseLocalBackCouplingModel : public BaseBackCouplingModel<T,Lattice,Particle> {
80public:
82 virtual void communicate() override;
86 SuperGeometry<T,3>& sGeometry,
87 int overlap );
88};
89
93template<typename T, typename Lattice, template<typename V> class Particle>
94class BaseNonLocalBackCouplingModel : public BaseBackCouplingModel<T,Lattice,Particle> {
95public:
97 virtual void communicate() override;
100 SuperLattice<T, Lattice>& sLattice,
101 SuperGeometry<T,3>& sGeometry,
102 int overlap );
103private:
104 SuperCommunicator<T, SuperLattice<T, Lattice>> _commForce; // Communicator for force
105};
106
110template<typename T, typename Lattice, template<typename V> class Particle>
111class LocalBackCouplingModel : public BaseLocalBackCouplingModel<T,Lattice,Particle> {
112public:
115 SuperLattice<T, Lattice>& sLattice,
116 SuperGeometry<T,3>& sGeometry,
117 int overlap );
119 virtual bool operator() (Particle<T>* p, int globic, int material, int subCycles=1) override;
120};
121
126template<typename T, typename Lattice, template<typename V> class Particle>
128public:
131 SuperLattice<T, Lattice>& sLattice,
132 SuperGeometry<T,3>& sGeometry,
133 int overlap );
135 virtual bool operator() (Particle<T>* p, int globic, int material, int subCycles=1) override;
136protected:
137 int _range = 1;
138 T _delta[4][4][4] = { T() };
139 std::shared_ptr<SuperLatticeSmoothDiracDelta3D<T, Lattice> > _cubicDeltaFunctional;
140};
141
147template<typename T, typename Lattice, template<typename V> class Particle>
149public:
152 SuperLattice<T, Lattice>& sLattice,
153 SuperGeometry<T,3>& sGeometry,
154 std::shared_ptr<SmoothingFunctional<T, Lattice>> smoothingFunctional,
155 int overlap );
157 virtual bool operator() (Particle<T>* p, int globic, int material, int subCycles=1) override;
158protected:
159 std::shared_ptr<SmoothingFunctional<T, Lattice>> _smoothingFunctional; // Functional to treat non-local smoothing
160};
161
162}
163
164#endif
Abstact base class for BaseBackCouplingModel.
virtual void resetExternalField(int material)=0
Resets external field.
virtual void communicate()=0
Communicates POPULATION and FORCE fields if the model is non-local.
virtual bool operator()(Particle< T > *p, int globic, int material, int subCycles=1)=0
Class operator to apply the coupling, for overload.
Abstact class for all the back-coupling models, viz., momentum coupling from particle to fluid.
BaseBackCouplingModel(UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, int overlap)
Constructor.
UnitConverter< T, Lattice > & _converter
SuperLattice< T, Lattice > & _sLattice
virtual void resetExternalField(int material) override
Resets external field.
SuperGeometry< T, 3 > & _sGeometry
SuperCommunicator< T, SuperLattice< T, Lattice > > _commPopulation
Abstact class for all the local back-coupling models.
virtual void communicate() override
Communicates POPULATION and FORCE fields if the model is non-local.
BaseLocalBackCouplingModel(UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, int overlap)
Constructor.
Abstact class for all the non-local back-coupling models.
virtual void communicate() override
Communicates POPULATION and FORCE fields if the model is non-local.
BaseNonLocalBackCouplingModel(UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, int overlap)
Constructor.
Back-coupling is performed on the cell containing the particle and its neighbours within a cube of on...
CubicDeltaBackCouplingModel(UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, int overlap)
Constructor.
std::shared_ptr< SuperLatticeSmoothDiracDelta3D< T, Lattice > > _cubicDeltaFunctional
virtual bool operator()(Particle< T > *p, int globic, int material, int subCycles=1) override
Class operator to apply the coupling.
Back-coupling is performed only on the cell containing the particle.
LocalBackCouplingModel(UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, int overlap)
Constructor.
virtual bool operator()(Particle< T > *p, int globic, int material, int subCycles=1) override
Class operator to apply the coupling.
Class for a generic non-local back-coupling model (but this is NOT VIRTUAL!), viz....
NonLocalBaseBackCouplingModel(UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, std::shared_ptr< SmoothingFunctional< T, Lattice > > smoothingFunctional, int overlap)
Constructor.
virtual bool operator()(Particle< T > *p, int globic, int material, int subCycles=1) override
Class operator to apply the coupling.
std::shared_ptr< SmoothingFunctional< T, Lattice > > _smoothingFunctional
Abstact class for all the smoothing functionals.
Generic communicator for overlaps between blocks of SUPER.
Representation of a statistic for a parallel 2D geometry.
Super class maintaining block lattices for a cuboid decomposition.
Conversion between physical and lattice units, as well as discretization.
Top level namespace for all of OpenLB.