/* This file is part of the OpenLB library * * Copyright (C) 2017 Adrian Kummerlaender * E-mail contact: info@openlb.net * The most recent release of OpenLB can be downloaded at * * * 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_PLANE_INTEGRAL_FLUX_MASS_3D_HH #define SUPER_PLANE_INTEGRAL_FLUX_MASS_3D_HH #include "superPlaneIntegralFluxMass3D.h" #include "io/ostreamManager.h" #include "utilities/vectorHelpers.h" #include "utilities/functorPtr.hh" #include "functors/lattice/indicator/indicator2D.hh" #include "functors/lattice/superLatticeLocalF3D.h" #include "functors/lattice/superCalcF3D.h" #include "functors/lattice/superCalcF3D.hh" namespace olb { template SuperPlaneIntegralFluxMass3D::SuperPlaneIntegralFluxMass3D( FunctorPtr>&& velocityF, FunctorPtr>&& densityF, SuperGeometry3D& geometry, T conversationFactorMass, T conversationFactorTime, const HyperplaneLattice3D& hyperplaneLattice, FunctorPtr>&& integrationIndicator, FunctorPtr>&& subplaneIndicator, BlockDataReductionMode mode) : SuperPlaneIntegralF3D( (*densityF) * (*velocityF), geometry, hyperplaneLattice, std::forward(integrationIndicator), std::forward(subplaneIndicator), mode), _velocityF(std::move(velocityF)), _densityF(std::move(densityF)), _conversationFactorMass(conversationFactorMass), _conversationFactorTime(conversationFactorTime) { this->getName() = "SuperPlaneIntegralFluxMass3D"; } template SuperPlaneIntegralFluxMass3D::SuperPlaneIntegralFluxMass3D( FunctorPtr>&& velocityF, FunctorPtr>&& densityF, SuperGeometry3D& geometry, T conversationFactorMass, T conversationFactorTime, const Hyperplane3D& hyperplane, FunctorPtr>&& integrationIndicator, FunctorPtr>&& subplaneIndicator, BlockDataReductionMode mode) : SuperPlaneIntegralF3D( (*densityF) * (*velocityF), geometry, hyperplane, std::forward(integrationIndicator), std::forward(subplaneIndicator), mode), _velocityF(std::move(velocityF)), _densityF(std::move(densityF)), _conversationFactorMass(conversationFactorMass), _conversationFactorTime(conversationFactorTime) { this->getName() = "SuperPlaneIntegralFluxMass3D"; } template SuperPlaneIntegralFluxMass3D::SuperPlaneIntegralFluxMass3D( FunctorPtr>&& velocityF, FunctorPtr>&& densityF, SuperGeometry3D& geometry, T conversationFactorMass, T conversationFactorTime, const Hyperplane3D& hyperplane, FunctorPtr>&& integrationIndicator, BlockDataReductionMode mode) : SuperPlaneIntegralF3D( (*densityF) * (*velocityF), geometry, hyperplane, std::forward(integrationIndicator), mode), _velocityF(std::move(velocityF)), _densityF(std::move(densityF)), _conversationFactorMass(conversationFactorMass), _conversationFactorTime(conversationFactorTime) { this->getName() = "SuperPlaneIntegralFluxMass3D"; } template SuperPlaneIntegralFluxMass3D::SuperPlaneIntegralFluxMass3D( FunctorPtr>&& velocityF, FunctorPtr>&& densityF, SuperGeometry3D& geometry, T conversationFactorMass, T conversationFactorTime, const Vector& origin, const Vector& u, const Vector& v, std::vector materials, BlockDataReductionMode mode) : SuperPlaneIntegralF3D( (*densityF) * (*velocityF), geometry, origin, u, v, std::move(materials), mode), _velocityF(std::move(velocityF)), _densityF(std::move(densityF)), _conversationFactorMass(conversationFactorMass), _conversationFactorTime(conversationFactorTime) { this->getName() = "SuperPlaneIntegralFluxMass3D"; } template SuperPlaneIntegralFluxMass3D::SuperPlaneIntegralFluxMass3D( FunctorPtr>&& velocityF, FunctorPtr>&& densityF, SuperGeometry3D& geometry, T conversationFactorMass, T conversationFactorTime, const Vector& origin, const Vector& u, const Vector& v, BlockDataReductionMode mode) : SuperPlaneIntegralF3D( (*densityF) * (*velocityF), geometry, origin, u, v, mode), _velocityF(std::move(velocityF)), _densityF(std::move(densityF)), _conversationFactorMass(conversationFactorMass), _conversationFactorTime(conversationFactorTime) { this->getName() = "SuperPlaneIntegralFluxMass3D"; } template SuperPlaneIntegralFluxMass3D::SuperPlaneIntegralFluxMass3D( FunctorPtr>&& velocityF, FunctorPtr>&& densityF, SuperGeometry3D& geometry, T conversationFactorMass, T conversationFactorTime, IndicatorCircle3D& circle, std::vector materials, BlockDataReductionMode mode) : SuperPlaneIntegralF3D( (*densityF) * (*velocityF), geometry, circle, std::move(materials), mode), _velocityF(std::move(velocityF)), _densityF(std::move(densityF)), _conversationFactorMass(conversationFactorMass), _conversationFactorTime(conversationFactorTime) { this->getName() = "SuperPlaneIntegralFluxMass3D"; } template SuperPlaneIntegralFluxMass3D::SuperPlaneIntegralFluxMass3D( FunctorPtr>&& velocityF, FunctorPtr>&& densityF, SuperGeometry3D& geometry, T conversationFactorMass, T conversationFactorTime, IndicatorCircle3D& circle, BlockDataReductionMode mode) : SuperPlaneIntegralF3D( (*densityF) * (*velocityF), geometry, circle, mode), _velocityF(std::move(velocityF)), _densityF(std::move(densityF)), _conversationFactorMass(conversationFactorMass), _conversationFactorTime(conversationFactorTime) { this->getName() = "SuperPlaneIntegralFluxMass3D"; } template bool SuperPlaneIntegralFluxMass3D::operator()(T output[], const int input[]) { const bool result = SuperPlaneIntegralF3D::operator()(output, input); output[0] = output[0] * _conversationFactorMass / _conversationFactorTime; return result; } template void SuperPlaneIntegralFluxMass3D::print( std::string regionName, std::string massFluxSiScaleName) { OstreamManager clout("SuperPlaneIntegralFluxMass3D"); int input[1] = { }; T output[this->getTargetDim()]; // = 5 operator()(output, input); if (regionName != "") { clout << "regionName=" << regionName << "; regionSize[m^2]=" << output[1] << std::flush; } else { clout << "regionSize[m^2]=" << output[1] << std::flush; } if (singleton::mpi().isMainProcessor()) { if (massFluxSiScaleName == "mcg/s") { // milli gramm std::cout << "; massFlowRate[mcg/s]=" << output[0] * T(1.e6) << std::endl; } else if (massFluxSiScaleName == "mg/s") { // micro gramm std::cout << "; massFlowRate[mg/s]=" << output[0] * T(1.e3) << std::endl; } else { std::cout << "; massFlowRate[kg/s]=" << output[0] << std::endl; } } } } #endif