OpenLB 1.7
Loading...
Searching...
No Matches
superPlaneIntegralFluxMass2D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2018 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
24#ifndef SUPER_PLANE_INTEGRAL_FLUX_MASS_2D_HH
25#define SUPER_PLANE_INTEGRAL_FLUX_MASS_2D_HH
26
28
29#include "io/ostreamManager.h"
33
36
37namespace olb {
38
39
40template<typename T>
42 FunctorPtr<SuperF2D<T>>&& velocityF,
43 FunctorPtr<SuperF2D<T>>&& densityF,
44 SuperGeometry<T,2>& geometry,
45 T conversationFactorMass,
46 T conversationFactorTime,
47 const HyperplaneLattice2D<T>& hyperplaneLattice,
48 FunctorPtr<SuperIndicatorF2D<T>>&& integrationIndicator,
49 FunctorPtr<IndicatorF2D<T>>&& subplaneIndicator,
52 (*densityF) * (*velocityF),
53 geometry,
54 hyperplaneLattice,
55 std::forward<decltype(integrationIndicator)>(integrationIndicator),
56 std::forward<decltype(subplaneIndicator)>(subplaneIndicator),
57 mode),
58 _velocityF(std::move(velocityF)),
59 _densityF(std::move(densityF)),
60 _conversationFactorMass(conversationFactorMass),
61 _conversationFactorTime(conversationFactorTime)
62{
63 this->getName() = "SuperPlaneIntegralFluxMass2D";
64}
65
66template<typename T>
68 FunctorPtr<SuperF2D<T>>&& velocityF,
69 FunctorPtr<SuperF2D<T>>&& densityF,
70 SuperGeometry<T,2>& geometry,
71 T conversationFactorMass,
72 T conversationFactorTime,
73 const Hyperplane2D<T>& hyperplane,
74 FunctorPtr<SuperIndicatorF2D<T>>&& integrationIndicator,
75 FunctorPtr<IndicatorF2D<T>>&& subplaneIndicator,
78 (*densityF) * (*velocityF),
79 geometry,
80 hyperplane,
81 std::forward<decltype(integrationIndicator)>(integrationIndicator),
82 std::forward<decltype(subplaneIndicator)>(subplaneIndicator),
83 mode),
84 _velocityF(std::move(velocityF)),
85 _densityF(std::move(densityF)),
86 _conversationFactorMass(conversationFactorMass),
87 _conversationFactorTime(conversationFactorTime)
88{
89 this->getName() = "SuperPlaneIntegralFluxMass2D";
90}
91
92template<typename T>
94 FunctorPtr<SuperF2D<T>>&& velocityF,
95 FunctorPtr<SuperF2D<T>>&& densityF,
96 SuperGeometry<T,2>& geometry,
97 T conversationFactorMass,
98 T conversationFactorTime,
99 const Hyperplane2D<T>& hyperplane,
100 FunctorPtr<SuperIndicatorF2D<T>>&& integrationIndicator,
103 (*densityF) * (*velocityF),
104 geometry,
105 hyperplane,
106 std::forward<decltype(integrationIndicator)>(integrationIndicator),
107 mode),
108 _velocityF(std::move(velocityF)),
109 _densityF(std::move(densityF)),
110 _conversationFactorMass(conversationFactorMass),
111 _conversationFactorTime(conversationFactorTime)
112{
113 this->getName() = "SuperPlaneIntegralFluxMass2D";
114}
115
116template<typename T>
118 FunctorPtr<SuperF2D<T>>&& velocityF,
119 FunctorPtr<SuperF2D<T>>&& densityF,
120 SuperGeometry<T,2>& geometry,
121 T conversationFactorMass,
122 T conversationFactorTime,
123 const Vector<T,2>& origin, const Vector<T,2>& u,
124 std::vector<int> materials,
127 (*densityF) * (*velocityF),
128 geometry,
129 origin, u,
130 std::move(materials),
131 mode),
132 _velocityF(std::move(velocityF)),
133 _densityF(std::move(densityF)),
134 _conversationFactorMass(conversationFactorMass),
135 _conversationFactorTime(conversationFactorTime)
136{
137 this->getName() = "SuperPlaneIntegralFluxMass2D";
138}
139
140template<typename T>
142 FunctorPtr<SuperF2D<T>>&& velocityF,
143 FunctorPtr<SuperF2D<T>>&& densityF,
144 SuperGeometry<T,2>& geometry,
145 T conversationFactorMass,
146 T conversationFactorTime,
147 const Vector<T,2>& origin, const Vector<T,2>& u,
150 (*densityF) * (*velocityF),
151 geometry,
152 origin, u,
153 mode),
154 _velocityF(std::move(velocityF)),
155 _densityF(std::move(densityF)),
156 _conversationFactorMass(conversationFactorMass),
157 _conversationFactorTime(conversationFactorTime)
158{
159 this->getName() = "SuperPlaneIntegralFluxMass2D";
160}
161
162template<typename T>
163bool SuperPlaneIntegralFluxMass2D<T>::operator()(T output[], const int input[])
164{
165 const bool result = SuperPlaneIntegralF2D<T>::operator()(output, input);
166
167 output[0] = output[0] * _conversationFactorMass / _conversationFactorTime;
168
169 return result;
170}
171
172template<typename T>
174 std::string regionName, std::string massFluxSiScaleName)
175{
176 OstreamManager clout("SuperPlaneIntegralFluxMass2D");
177 int input[1] = { };
178 T output[this->getTargetDim()]; // = 5
179 operator()(output, input);
180 if (regionName != "") {
181 clout << "regionName=" << regionName << "; regionSize[m]=" << output[1]
182 << std::flush;
183 }
184 else {
185 clout << "regionSize[m]=" << output[1] << std::flush;
186 }
187 if (singleton::mpi().isMainProcessor()) {
188 if (massFluxSiScaleName == "mcg/s") { // milli gramm
189 std::cout << "; massFlowRate[mcg/s]=" << output[0] * T(1.e6)
190 << std::endl;
191 }
192 else if (massFluxSiScaleName == "mg/s") { // micro gramm
193 std::cout << "; massFlowRate[mg/s]=" << output[0] * T(1.e3)
194 << std::endl;
195 }
196 else {
197 std::cout << "; massFlowRate[kg/s]=" << output[0] << std::endl;
198 }
199 }
200}
201
202
203}
204
205#endif
Smart pointer for managing the various ways of passing functors around.
Definition functorPtr.h:60
std::string & getName()
read and write access to name
Definition genericF.hh:51
Parametrization of a hyperplane lattice (i.e. a line lattice).
IndicatorF2D is an application from .
class for marking output with some text
represents all functors that operate on a SuperStructure<T,2> in general
Representation of a statistic for a parallel 2D geometry.
Surface integral of a subset of a interpolated hyperplane.
bool operator()(T output[], const int input[]) override
Returns the line integral in the following structure:
void print(std::string regionName, std::string massFluxSiScaleName)
SuperPlaneIntegralFluxMass2D(FunctorPtr< SuperF2D< T > > &&velocityF, FunctorPtr< SuperF2D< T > > &&densityF, SuperGeometry< T, 2 > &geometry, T conversationFactorMass, T conversationFactorTime, const HyperplaneLattice2D< T > &hyperplaneLattice, FunctorPtr< SuperIndicatorF2D< T > > &&integrationIndicator, FunctorPtr< IndicatorF2D< T > > &&subplaneIndicator, BlockDataReductionMode mode)
Primary constructor.
bool operator()(T output[], const int input[]) override
Plain old scalar vector.
Definition vector.h:47
Groups all include files for the directory genericFunctions.
MpiManager & mpi()
Top level namespace for all of OpenLB.
BlockDataReductionMode
Mode of reducing block data from given, possibly higher dimensional data.
Definition of a analytical line embedded in 2D space.