OpenLB 1.8.1
Loading...
Searching...
No Matches
blockLatticeIntegralF2D.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, Mathias J. Krause,
4 * Albert Mink, Adrian Kummeränder
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 BLOCK_LATTICE_INTEGRAL_F_2D_HH
26#define BLOCK_LATTICE_INTEGRAL_F_2D_HH
27
28#include <vector>
29#include <cmath>
30
33#include "blockCalcF2D.h" // for IdentityF
34#include "core/olbDebug.h"
35
36namespace olb {
37
38
39template <typename T, typename DESCRIPTOR>
41 BlockLattice<T,DESCRIPTOR>& blockLattice,
42 BlockIndicatorF2D<T>& indicatorF,
43 const UnitConverter<T,DESCRIPTOR>& converter)
44 : BlockLatticePhysF2D<T,DESCRIPTOR>(blockLattice, converter, 2),
45 _indicatorF(indicatorF),
46 _facesF(indicatorF, converter.getConversionFactorLength()),
47 _pBoundForceF(blockLattice, indicatorF, converter),
48 _sumF(_pBoundForceF, indicatorF),
49 _factor(2./( converter.getPhysDensity()*converter.getCharPhysVelocity()*converter.getCharPhysVelocity() ))
50{
51 this->getName() = "physDrag";
52}
53
54template <typename T, typename DESCRIPTOR>
55bool BlockLatticePhysDrag2D<T,DESCRIPTOR>::operator() (T output[], const int input[])
56{
57 T faces[5] = { };
58 T sum[3] = { };
59 _sumF(sum, input);
60 _facesF(faces, input);
61
62 output[0] = _factor * sum[0] / faces[0];
63 output[1] = _factor * sum[1] / faces[1];
64
65 return true;
66}
67
68template <typename T, typename DESCRIPTOR>
70 BlockLattice<T,DESCRIPTOR>& blockLattice,
71 BlockIndicatorF2D<T>& indicatorF,
72 const UnitConverter<T,DESCRIPTOR>& converter)
73 : BlockLatticePhysF2D<T,DESCRIPTOR>(blockLattice, converter, 2),
74 _indicatorF(indicatorF),
75 _facesF(indicatorF, converter.getConversionFactorLength()),
76 _pBoundForceF(blockLattice, indicatorF, converter),
77 _sumF(_pBoundForceF, indicatorF),
78 _factor(2./( converter.getPhysDensity()*converter.getCharPhysVelocity()*converter.getCharPhysVelocity() ))
79{
80 this->getName() = "physCorrDrag";
81}
82
83template <typename T, typename DESCRIPTOR>
85{
86 T faces[5] = { };
87 T sum[3] = { };
88 _facesF(faces, input);
89 _sumF(sum, input);
90
91 output[0] = _factor * sum[0] / faces[0];
92 output[1] = _factor * sum[1] / faces[1];
93
94 return true;
95}
96
97
98} // end namespace olb
99
100#endif
Base block indicator functor (discrete)
Definition aliases.h:203
BlockLatticePhysCorrDrag2D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockIndicatorF2D< T > &indicatorF, const UnitConverter< T, DESCRIPTOR > &converter)
bool operator()(T output[], const int input[]) override
has to be implemented for 'every' derived class
BlockLatticePhysDrag2D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockIndicatorF2D< T > &indicatorF, const UnitConverter< T, DESCRIPTOR > &converter)
bool operator()(T output[], const int input[]) override
has to be implemented for 'every' derived class
represents all functors that operate on a DESCRIPTOR with output in Phys, e.g. physVelocity(),...
Definition aliases.h:324
std::string & getName()
Definition genericF.hh:51
Conversion between physical and lattice units, as well as discretization.
Top level namespace for all of OpenLB.