From 94d3e79a8617f88dc0219cfdeedfa3147833719d Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 24 Jun 2019 14:43:36 +0200 Subject: Initialize at openlb-1-3 --- .../integral/superPlaneIntegralFluxMass2D.hh | 203 +++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 src/functors/lattice/integral/superPlaneIntegralFluxMass2D.hh (limited to 'src/functors/lattice/integral/superPlaneIntegralFluxMass2D.hh') diff --git a/src/functors/lattice/integral/superPlaneIntegralFluxMass2D.hh b/src/functors/lattice/integral/superPlaneIntegralFluxMass2D.hh new file mode 100644 index 0000000..45dd2f2 --- /dev/null +++ b/src/functors/lattice/integral/superPlaneIntegralFluxMass2D.hh @@ -0,0 +1,203 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2018 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_2D_HH +#define SUPER_PLANE_INTEGRAL_FLUX_MASS_2D_HH + +#include "superPlaneIntegralFluxMass2D.h" + +#include "io/ostreamManager.h" +#include "utilities/vectorHelpers.h" +#include "utilities/functorPtr.hh" +#include "functors/lattice/indicator/indicator2D.hh" + +#include "functors/lattice/superLatticeLocalF2D.h" +#include "functors/lattice/superCalcF2D.h" +#include "functors/lattice/superCalcF2D.hh" + +namespace olb { + + +template +SuperPlaneIntegralFluxMass2D::SuperPlaneIntegralFluxMass2D( + FunctorPtr>&& velocityF, + FunctorPtr>&& densityF, + SuperGeometry2D& geometry, + T conversationFactorMass, + T conversationFactorTime, + const HyperplaneLattice2D& hyperplaneLattice, + FunctorPtr>&& integrationIndicator, + FunctorPtr>&& subplaneIndicator, + BlockDataReductionMode mode) + : SuperPlaneIntegralF2D( + (*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() = "SuperPlaneIntegralFluxMass2D"; +} + +template +SuperPlaneIntegralFluxMass2D::SuperPlaneIntegralFluxMass2D( + FunctorPtr>&& velocityF, + FunctorPtr>&& densityF, + SuperGeometry2D& geometry, + T conversationFactorMass, + T conversationFactorTime, + const Hyperplane2D& hyperplane, + FunctorPtr>&& integrationIndicator, + FunctorPtr>&& subplaneIndicator, + BlockDataReductionMode mode) + : SuperPlaneIntegralF2D( + (*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() = "SuperPlaneIntegralFluxMass2D"; +} + +template +SuperPlaneIntegralFluxMass2D::SuperPlaneIntegralFluxMass2D( + FunctorPtr>&& velocityF, + FunctorPtr>&& densityF, + SuperGeometry2D& geometry, + T conversationFactorMass, + T conversationFactorTime, + const Hyperplane2D& hyperplane, + FunctorPtr>&& integrationIndicator, + BlockDataReductionMode mode) + : SuperPlaneIntegralF2D( + (*densityF) * (*velocityF), + geometry, + hyperplane, + std::forward(integrationIndicator), + mode), + _velocityF(std::move(velocityF)), + _densityF(std::move(densityF)), + _conversationFactorMass(conversationFactorMass), + _conversationFactorTime(conversationFactorTime) +{ + this->getName() = "SuperPlaneIntegralFluxMass2D"; +} + +template +SuperPlaneIntegralFluxMass2D::SuperPlaneIntegralFluxMass2D( + FunctorPtr>&& velocityF, + FunctorPtr>&& densityF, + SuperGeometry2D& geometry, + T conversationFactorMass, + T conversationFactorTime, + const Vector& origin, const Vector& u, + std::vector materials, + BlockDataReductionMode mode) + : SuperPlaneIntegralF2D( + (*densityF) * (*velocityF), + geometry, + origin, u, + std::move(materials), + mode), + _velocityF(std::move(velocityF)), + _densityF(std::move(densityF)), + _conversationFactorMass(conversationFactorMass), + _conversationFactorTime(conversationFactorTime) +{ + this->getName() = "SuperPlaneIntegralFluxMass2D"; +} + +template +SuperPlaneIntegralFluxMass2D::SuperPlaneIntegralFluxMass2D( + FunctorPtr>&& velocityF, + FunctorPtr>&& densityF, + SuperGeometry2D& geometry, + T conversationFactorMass, + T conversationFactorTime, + const Vector& origin, const Vector& u, + BlockDataReductionMode mode) + : SuperPlaneIntegralF2D( + (*densityF) * (*velocityF), + geometry, + origin, u, + mode), + _velocityF(std::move(velocityF)), + _densityF(std::move(densityF)), + _conversationFactorMass(conversationFactorMass), + _conversationFactorTime(conversationFactorTime) +{ + this->getName() = "SuperPlaneIntegralFluxMass2D"; +} + +template +bool SuperPlaneIntegralFluxMass2D::operator()(T output[], const int input[]) +{ + const bool result = SuperPlaneIntegralF2D::operator()(output, input); + + output[0] = output[0] * _conversationFactorMass / _conversationFactorTime; + + return result; +} + +template +void SuperPlaneIntegralFluxMass2D::print( + std::string regionName, std::string massFluxSiScaleName) +{ + OstreamManager clout("SuperPlaneIntegralFluxMass2D"); + int input[1] = { }; + T output[this->getTargetDim()]; // = 5 + operator()(output, input); + if (regionName != "") { + clout << "regionName=" << regionName << "; regionSize[m]=" << output[1] + << std::flush; + } else { + clout << "regionSize[m]=" << 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 -- cgit v1.2.3