OpenLB 1.7
Loading...
Searching...
No Matches
superLatticeIntegralF2D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2012-2017 Lukas Baron, Tim Dornieden, Mathias J. Krause,
4 * Albert Mink, Fabian Klemens, Benjamin Förster, Adrian Kummerlaender
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#ifndef SUPER_LATTICE_INTEGRAL_F_2D_HH
26#define SUPER_LATTICE_INTEGRAL_F_2D_HH
27
28#include <cmath>
29#include <algorithm>
30
34#include "io/ostreamManager.h"
36
37
38namespace olb {
39
40
41template<typename T, typename DESCRIPTOR>
44 FunctorPtr<SuperIndicatorF2D<T>>&& indicatorF,
45 const UnitConverter<T,DESCRIPTOR>& converter)
46 : SuperLatticePhysF2D<T, DESCRIPTOR>(sLattice, converter, 2),
47 _indicatorF(std::move(indicatorF)),
48 _facesF(*_indicatorF, converter),
49 _pBoundForceF(sLattice, *_indicatorF, converter),
50 _sumF(_pBoundForceF, *_indicatorF),
51 _factor(2./( converter.getPhysDensity()*converter.getCharPhysVelocity()*converter.getCharPhysVelocity() ))
52{
53 this->getName() = "physDrag";
54
55 for (int iC = 0; iC < this->getSuperStructure().getLoadBalancer().size(); ++iC) {
56 this->_blockF.emplace_back(
58 sLattice.getBlock(iC),
59 indicatorF->getBlockIndicatorF(iC),
60 converter)
61 );
62 }
63}
64
65template<typename T, typename DESCRIPTOR>
68 SuperGeometry<T,2>& superGeometry, const int material,
69 const UnitConverter<T,DESCRIPTOR>& converter)
70 : SuperLatticePhysDrag2D(sLattice,
71 superGeometry.getMaterialIndicator(material),
72 converter)
73{ }
74
75template<typename T, typename DESCRIPTOR>
76bool SuperLatticePhysDrag2D<T, DESCRIPTOR>::operator()(T output[], const int input[])
77{
78 T faces[5] = { };
79 T sum[3] = { };
80 _sumF(sum, input);
81 _facesF(faces, input);
82
83 output[0] = _factor * sum[0] / faces[0];
84 output[1] = _factor * sum[1] / faces[1];
85
86 return true;
87}
88
89template<typename T, typename DESCRIPTOR>
92 FunctorPtr<SuperIndicatorF2D<T>>&& indicatorF,
93 const UnitConverter<T,DESCRIPTOR>& converter)
94 : SuperLatticePhysF2D<T, DESCRIPTOR>(sLattice, converter, 2),
95 _indicatorF(std::move(indicatorF)),
96 _facesF(*_indicatorF, converter),
97 _pBoundForceF(sLattice, *_indicatorF, converter),
98 _sumF(_pBoundForceF, *_indicatorF),
99 _factor(2./( converter.getPhysDensity()*converter.getCharPhysVelocity()*converter.getCharPhysVelocity() ))
100{
101 this->getName() = "physCorrDrag";
102
103 for (int iC = 0; iC < this->getSuperStructure().getLoadBalancer().size(); ++iC) {
104 this->_blockF.emplace_back(
106 sLattice.getBlock(iC),
107 indicatorF->getBlockIndicatorF(iC),
108 converter)
109 );
110 }
111}
112
113template<typename T, typename DESCRIPTOR>
116 SuperGeometry<T,2>& superGeometry, const int material,
117 const UnitConverter<T,DESCRIPTOR>& converter)
119 superGeometry.getMaterialIndicator(material),
120 converter)
121{ }
122
123template<typename T, typename DESCRIPTOR>
125{
126 T faces[5] = { };
127 T sum[3] = { };
128 _sumF(sum, input);
129 _facesF(faces, input);
130
131 output[0] = _factor * sum[0] / faces[0];
132 output[1] = _factor * sum[1] / faces[1];
133
134 return true;
135}
136
137
138} // end namespace olb
139
140#endif
functor to get pointwise phys force acting on a indicated boundary on local lattice
functor to get pointwise phys force acting on a indicated boundary on local lattice
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
std::vector< std::unique_ptr< BlockF2D< T > > > _blockF
Super functors may consist of several BlockF2D<W> derived functors.
SuperStructure< T, 2 > & getSuperStructure()
Representation of a statistic for a parallel 2D geometry.
functor to get pointwise phys force acting on a indicated boundary on local lattice
SuperLatticePhysCorrDrag2D(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperIndicatorF2D< T > > &&indicatorF, const UnitConverter< T, DESCRIPTOR > &converter)
bool operator()(T output[], const int input[]) override
functor to get pointwise phys force acting on a indicated boundary on local lattice
bool operator()(T output[], const int input[]) override
SuperLatticePhysDrag2D(SuperLattice< T, DESCRIPTOR > &sLattice, FunctorPtr< SuperIndicatorF2D< T > > &&indicatorF, const UnitConverter< T, DESCRIPTOR > &converter)
represents all functors that operate on a DESCRIPTOR with output in Phys, e.g. physVelocity(),...
Super class maintaining block lattices for a cuboid decomposition.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Conversion between physical and lattice units, as well as discretization.
Top level namespace for all of OpenLB.