OpenLB 1.7
Loading...
Searching...
No Matches
superPlaneIntegralFluxF2D.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_F_2D_HH
25#define SUPER_PLANE_INTEGRAL_FLUX_F_2D_HH
26
28
29#include "io/ostreamManager.h"
33
34namespace olb {
35
36
37template<typename T, template<typename, typename> class F>
38template<typename DESCRIPTOR>
41 const UnitConverter<T,DESCRIPTOR>& converter,
42 SuperGeometry<T,2>& geometry,
43 const HyperplaneLattice2D<T>& hyperplaneLattice,
44 FunctorPtr<SuperIndicatorF2D<T>>&& integrationIndicator,
45 FunctorPtr<IndicatorF2D<T>>&& subplaneIndicator,
48 std::unique_ptr<SuperF2D<T>>(new F<T, DESCRIPTOR>(sLattice, converter)),
49 geometry,
50 hyperplaneLattice,
51 std::forward<decltype(integrationIndicator)>(integrationIndicator),
52 std::forward<decltype(subplaneIndicator)>(subplaneIndicator),
53 mode)
54{
55 this->getName() = "SuperPlaneIntegralFluxF2D";
56}
57
58template<typename T, template<typename, typename> class F>
59template<typename DESCRIPTOR>
62 const UnitConverter<T,DESCRIPTOR>& converter,
63 SuperGeometry<T,2>& geometry,
64 const Hyperplane2D<T>& hyperplane,
65 FunctorPtr<SuperIndicatorF2D<T>>&& integrationIndicator,
66 FunctorPtr<IndicatorF2D<T>>&& subplaneIndicator,
69 std::unique_ptr<SuperF2D<T>>(new F<T, DESCRIPTOR>(sLattice, converter)),
70 geometry,
71 hyperplane,
72 std::forward<decltype(integrationIndicator)>(integrationIndicator),
73 std::forward<decltype(subplaneIndicator)>(subplaneIndicator),
74 mode)
75{
76 this->getName() = "SuperPlaneIntegralFluxF2D";
77}
78
79template<typename T, template<typename, typename> class F>
80template<typename DESCRIPTOR>
83 const UnitConverter<T,DESCRIPTOR>& converter,
84 SuperGeometry<T,2>& geometry,
85 const Hyperplane2D<T>& hyperplane,
86 FunctorPtr<SuperIndicatorF2D<T>>&& integrationIndicator,
89 std::unique_ptr<SuperF2D<T>>(new F<T, DESCRIPTOR>(sLattice, converter)),
90 geometry,
91 hyperplane,
92 std::forward<decltype(integrationIndicator)>(integrationIndicator),
93 mode)
94{
95 this->getName() = "SuperPlaneIntegralFluxF2D";
96}
97
98template<typename T, template<typename, typename> class F>
99template<typename DESCRIPTOR>
102 const UnitConverter<T,DESCRIPTOR>& converter,
103 SuperGeometry<T,2>& geometry,
104 const Vector<T,2>& origin, const Vector<T,2>& u,
105 std::vector<int> materials,
108 std::unique_ptr<SuperF2D<T>>(new F<T, DESCRIPTOR>(sLattice, converter)),
109 geometry,
110 origin, u,
111 std::move(materials),
112 mode)
113{
114 this->getName() = "SuperPlaneIntegralFluxF2D";
115}
116
117template<typename T, template<typename, typename> class F>
118template<typename DESCRIPTOR>
121 const UnitConverter<T,DESCRIPTOR>& converter,
122 SuperGeometry<T,2>& geometry,
123 const Vector<T,2>& origin, const Vector<T,2>& u,
126 std::unique_ptr<SuperF2D<T>>(new F<T, DESCRIPTOR>(sLattice, converter)),
127 geometry,
128 origin, u,
129 mode)
130{
131 this->getName() = "SuperPlaneIntegralFluxF2D";
132}
133
134
135template<typename T>
137 std::string regionName, std::string fluxSiScaleName, std::string meanSiScaleName)
138{
139 OstreamManager clout("SuperPlaneIntegralFluxPressure2D");
140 int input[1] = { };
141 T output[this->getTargetDim()];
142 this->operator()(output, input);
143 if ( regionName != "" ) {
144 clout << "regionName=" << regionName << "; regionSize[m]=" << output[1] << std::flush;
145 }
146 else {
147 clout << "regionSize[m]=" << output[1] << std::flush;
148 }
149 if ( singleton::mpi().isMainProcessor() ) {
150 if ( fluxSiScaleName == "MN" ) {
151 std::cout << "; force[MN]=" << output[0]/T(1.e6) << std::flush;
152 }
153 else if ( fluxSiScaleName == "kN") {
154 std::cout << "; force[kN]=" << output[0]/T(1.e3) << std::flush;
155 }
156 else {
157 std::cout << "; force[N]=" << output[0] << std::flush;
158 }
159 if ( meanSiScaleName == "mmHg" ) {
160 std::cout << "; meanPressure[mmHg]=" << util::fabs(output[0])/output[1]/T(133.322) << std::endl;
161 }
162 else {
163 std::cout << "; meanPressure[Pa]=" << util::fabs(output[0])/output[1] << std::endl;
164 }
165 }
166}
167
168
169template<typename T>
171 std::string regionName, std::string fluxSiScaleName, std::string meanSiScaleName)
172{
173 OstreamManager clout("SuperPlaneIntegralFluxVelocity2D");
174 int input[1] = { };
175 T output[this->getTargetDim()];
176 this->operator()(output, input);
177 if ( regionName != "" ) {
178 clout << "regionName=" << regionName << "; regionSize[m]=" << output[1] << std::flush;
179 }
180 else {
181 clout << "regionSize[m]=" << output[1] << std::flush;
182 }
183 if ( singleton::mpi().isMainProcessor() ) {
184 std::cout << "; flowRate[m^2/s]=" << output[0] << std::flush;
185 if ( meanSiScaleName == "mm/s" ) {
186 std::cout << "; meanVelocity[mm/s]=" << output[0]/output[1]*T(1.e3) << std::endl;
187 }
188 else {
189 std::cout << "; meanVelocity[m/s]=" << output[0]/output[1] << std::endl;
190 }
191 }
192}
193
194
195}
196
197#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.
Super class maintaining block lattices for a cuboid decomposition.
Surface integral of a subset of a interpolated hyperplane.
Template class for building flux integrals based on SuperLatticePhysF2D functors.
SuperPlaneIntegralFluxF2D(SuperLattice< T, DESCRIPTOR > &sLattice, const UnitConverter< T, DESCRIPTOR > &converter, SuperGeometry< T, 2 > &geometry, const HyperplaneLattice2D< T > &hyperplaneLattice, FunctorPtr< SuperIndicatorF2D< T > > &&integrationIndicator, FunctorPtr< IndicatorF2D< T > > &&subplaneIndicator, BlockDataReductionMode mode=BlockDataReductionMode::Analytical)
void print(std::string regionName="", std::string fluxSiScaleName="N", std::string meanSiScaleName="Pa")
void print(std::string regionName="", std::string fluxSiScaleName="m^2/s", std::string meanSiScaleName="m/s")
Conversion between physical and lattice units, as well as discretization.
Plain old scalar vector.
Definition vector.h:47
Groups all include files for the directory genericFunctions.
MpiManager & mpi()
cpu::simd::Pack< T > fabs(cpu::simd::Pack< T > value)
Definition pack.h:106
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.