summaryrefslogtreecommitdiff
path: root/src/functors/lattice/superLatticeIntegralF2D.h
blob: b42110fd386715fdff92c8969a67daf4b1ab1037 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*  This file is part of the OpenLB library
 *
 *  Copyright (C) 2014 Albert Mink, Mathias J. Krause, Adrian Kummerlaender
 *  E-mail contact: info@openlb.net
 *  The most recent release of OpenLB can be downloaded at
 *  <http://www.openlb.net/>
 *
 *  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 SUPER_LATTICE_INTEGRAL_F_2D_H
#define SUPER_LATTICE_INTEGRAL_F_2D_H

#include<vector>
#include<cmath>

#include "functors/genericF.h"
#include "superBaseF2D.h"
#include "superLatticeLocalF2D.h"
#include "indicator/superIndicatorBaseF2D.h"
#include "functors/analytical/interpolationF2D.h"
#include "core/superLattice2D.h"
#include "core/vector.h"

/** Note: Throughout the whole source code directory genericFunctions, the
 *  template parameters for i/o dimensions are:
 *           F: S^m -> T^n  (S=source, T=target)
 */

namespace olb {

////////////////////////////////////////////////////////////////////////////////
//////if globIC is not on the local processor, the returned vector is empty/////
////////////////////////////////////////////////////////////////////////////////


/// functor that returns the max in each component of all points of a certain material
template <typename T>
class SuperMax2D final : public SuperF2D<T> {
private:
  SuperF2D<T>& _f;
  SuperGeometry2D<T>& _superGeometry;
  const int _material;
public:
  SuperMax2D(SuperF2D<T>& f, SuperGeometry2D<T>& superGeometry,
             const int material);
  bool operator() (T output[], const int input[]) override;
};


/// functor that returns the min in each component of all points of a certain material
template <typename T>
class SuperMin2D final : public SuperF2D<T> {
private:
  SuperF2D<T>& _f;
  SuperGeometry2D<T>& _superGeometry;
  const int _material;
public:
  SuperMin2D(SuperF2D<T>& f, SuperGeometry2D<T>& superGeometry,
             const int material);
  bool operator() (T output[], const int input[]) override;
};

/// sums over all cells of a certain material number
template <typename T>
class SuperSum2D final : public SuperF2D<T> {
private:
  SuperF2D<T>& _f;
  SuperGeometry2D<T>& _superGeometry;
  const int _material;
public:
  SuperSum2D(SuperF2D<T>& f, SuperGeometry2D<T>& superGeometry,
             const int material);
  bool operator() (T output[], const int input[]) override;
};


template <typename T>
class SuperIntegral2D final : public SuperF2D<T> {
private:
  SuperF2D<T>& _f;
  SuperGeometry2D<T>& _superGeometry;
  const int _material;
public:
  SuperIntegral2D(SuperF2D<T>& f, SuperGeometry2D<T>& superGeometry,
                  const int material);
  bool operator() (T output[], const int input[]) override;
};


/// functor counts to get the discrete surface for a material no. in direction (1,0,0), (0,1,0), (0,0,1), (-1,0,0), (0,-1,0), (0,0,-1) and total surface, then it converts it into phys units
template <typename T>
class SuperGeometryFaces2D final : public GenericF<T,int> {
private:
  SuperGeometry2D<T>&   _superGeometry;
  const int             _material;
  const T _latticeL;
public:
  template<typename DESCRIPTOR>
  SuperGeometryFaces2D(SuperGeometry2D<T>& superGeometry, const int material, const UnitConverter<T,DESCRIPTOR>& converter);
  SuperGeometryFaces2D(SuperGeometry2D<T>& superGeometry, const int material, T latticeL);
  bool operator() (T output[], const int input[]) override;
};


/// functor counts to get the discrete surface for a material no. in direction (1,0,0), (0,1,0), (0,0,1), (-1,0,0), (0,-1,0), (0,0,-1) and total surface, then it converts it into phys units
template <typename T, bool HLBM>
class SuperGeometryFacesIndicator2D final : public GenericF<T,int> {
private:
  SuperGeometry2D<T>&   _superGeometry;
  SmoothIndicatorF2D<T,T,HLBM>& _indicator;
  const int             _material;
  T _latticeL;
public:
  SuperGeometryFacesIndicator2D(SuperGeometry2D<T>& superGeometry, SmoothIndicatorF2D<T,T,HLBM>& indicator, const int material,
                                T deltaX);
  bool operator() (T output[], const int input[]) override;
};


/// functor to get pointwise phys force acting on a boundary with a given material on local lattice
template <typename T, typename DESCRIPTOR>
class SuperLatticePhysDrag2D final : public SuperLatticePhysF2D<T,DESCRIPTOR> {
private:
  SuperGeometry2D<T>& _superGeometry;
  const int _material;
public:
  SuperLatticePhysDrag2D(SuperLattice2D<T,DESCRIPTOR>& sLattice,
                         SuperGeometry2D<T>& superGeometry, const int material,
                         const UnitConverter<T,DESCRIPTOR>& converter);
  bool operator() (T output[], const int input[]) override;
};


/**
 *  functor to get pointwise phys force acting on a boundary with a given material on local lattice
 *  see: Caiazzo, Junk: Boundary Forces in lattice Boltzmann: Analysis of MEA
 */
template <typename T, typename DESCRIPTOR>
class SuperLatticePhysCorrDrag2D final : public SuperLatticePhysF2D<T,DESCRIPTOR> {
private:
  SuperGeometry2D<T>& _superGeometry;
  const int _material;
public:
  SuperLatticePhysCorrDrag2D(SuperLattice2D<T,DESCRIPTOR>& sLattice,
                             SuperGeometry2D<T>& superGeometry, const int material,
                             const UnitConverter<T,DESCRIPTOR>& converter);
  bool operator() (T output[], const int input[]) override;
};


} // end namespace olb

#endif