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 --- .../lattice/integral/superPlaneIntegralFluxF3D.hh | 317 +++++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 src/functors/lattice/integral/superPlaneIntegralFluxF3D.hh (limited to 'src/functors/lattice/integral/superPlaneIntegralFluxF3D.hh') diff --git a/src/functors/lattice/integral/superPlaneIntegralFluxF3D.hh b/src/functors/lattice/integral/superPlaneIntegralFluxF3D.hh new file mode 100644 index 0000000..a218e1d --- /dev/null +++ b/src/functors/lattice/integral/superPlaneIntegralFluxF3D.hh @@ -0,0 +1,317 @@ +/* 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_F_3D_HH +#define SUPER_PLANE_INTEGRAL_FLUX_F_3D_HH + +#include "superPlaneIntegralFluxF3D.h" + +#include "io/ostreamManager.h" +#include "utilities/vectorHelpers.h" +#include "utilities/functorPtr.hh" +#include "functors/lattice/indicator/indicator2D.hh" + +namespace olb { + + +template class F> +template +SuperPlaneIntegralFluxF3D::SuperPlaneIntegralFluxF3D( + SuperLattice3D& sLattice, + const UnitConverter& converter, + SuperGeometry3D& geometry, + const HyperplaneLattice3D& hyperplaneLattice, + FunctorPtr>&& integrationIndicator, + FunctorPtr>&& subplaneIndicator, + BlockDataReductionMode mode) + : SuperPlaneIntegralF3D( + std::unique_ptr>(new F(sLattice, converter)), + geometry, + hyperplaneLattice, + std::forward(integrationIndicator), + std::forward(subplaneIndicator), + mode) +{ + this->getName() = "SuperPlaneIntegralFluxF3D"; +} + +template class F> +template +SuperPlaneIntegralFluxF3D::SuperPlaneIntegralFluxF3D( + SuperLattice3D& sLattice, + const UnitConverter& converter, + SuperGeometry3D& geometry, + const Hyperplane3D& hyperplane, + FunctorPtr>&& integrationIndicator, + FunctorPtr>&& subplaneIndicator, + BlockDataReductionMode mode) + : SuperPlaneIntegralF3D( + std::unique_ptr>(new F(sLattice, converter)), + geometry, + hyperplane, + std::forward(integrationIndicator), + std::forward(subplaneIndicator), + mode) +{ + this->getName() = "SuperPlaneIntegralFluxF3D"; +} + +template class F> +template +SuperPlaneIntegralFluxF3D::SuperPlaneIntegralFluxF3D( + SuperLattice3D& sLattice, + const UnitConverter& converter, + SuperGeometry3D& geometry, + const Hyperplane3D& hyperplane, + FunctorPtr>&& integrationIndicator, + BlockDataReductionMode mode) + : SuperPlaneIntegralF3D( + std::unique_ptr>(new F(sLattice, converter)), + geometry, + hyperplane, + std::forward(integrationIndicator), + mode) +{ + this->getName() = "SuperPlaneIntegralFluxF3D"; +} + +template class F> +template +SuperPlaneIntegralFluxF3D::SuperPlaneIntegralFluxF3D( + SuperLattice3D& sLattice, + const UnitConverter& converter, + SuperGeometry3D& geometry, + const Vector& origin, const Vector& u, const Vector& v, + std::vector materials, + BlockDataReductionMode mode) + : SuperPlaneIntegralF3D( + std::unique_ptr>(new F(sLattice, converter)), + geometry, + origin, u, v, + std::move(materials), + mode) +{ + this->getName() = "SuperPlaneIntegralFluxF3D"; +} + +template class F> +template +SuperPlaneIntegralFluxF3D::SuperPlaneIntegralFluxF3D( + SuperLattice3D& sLattice, + const UnitConverter& converter, + SuperGeometry3D& geometry, + const Vector& origin, const Vector& u, const Vector& v, + BlockDataReductionMode mode) + : SuperPlaneIntegralF3D( + std::unique_ptr>(new F(sLattice, converter)), + geometry, + origin, u, v, + mode) +{ + this->getName() = "SuperPlaneIntegralFluxF3D"; +} + +template class F> +template +SuperPlaneIntegralFluxF3D::SuperPlaneIntegralFluxF3D( + SuperLattice3D& sLattice, + const UnitConverter& converter, + SuperGeometry3D& geometry, + const Vector& origin, const Vector& normal, + std::vector materials, + BlockDataReductionMode mode) + : SuperPlaneIntegralF3D( + std::unique_ptr>(new F(sLattice, converter)), + geometry, + origin, normal, + std::move(materials), + mode) +{ + this->getName() = "SuperPlaneIntegralFluxF3D"; +} + +template class F> +template +SuperPlaneIntegralFluxF3D::SuperPlaneIntegralFluxF3D( + SuperLattice3D& sLattice, + const UnitConverter& converter, + SuperGeometry3D& geometry, + const Vector& origin, const Vector& normal, + BlockDataReductionMode mode) + : SuperPlaneIntegralF3D( + std::unique_ptr>(new F(sLattice, converter)), + geometry, + origin, normal, + mode) +{ + this->getName() = "SuperPlaneIntegralFluxF3D"; +} + +template class F> +template +SuperPlaneIntegralFluxF3D::SuperPlaneIntegralFluxF3D( + SuperLattice3D& sLattice, + const UnitConverter& converter, + SuperGeometry3D& geometry, + const Vector& normal, + std::vector materials, + BlockDataReductionMode mode) + : SuperPlaneIntegralF3D( + std::unique_ptr>(new F(sLattice, converter)), + geometry, + normal, + std::move(materials), + mode) +{ + this->getName() = "SuperPlaneIntegralFluxF3D"; +} + +template class F> +template +SuperPlaneIntegralFluxF3D::SuperPlaneIntegralFluxF3D( + SuperLattice3D& sLattice, + const UnitConverter& converter, + SuperGeometry3D& geometry, + const Vector& normal, + BlockDataReductionMode mode) + : SuperPlaneIntegralF3D( + std::unique_ptr>(new F(sLattice, converter)), + geometry, + normal, + mode) +{ + this->getName() = "SuperPlaneIntegralFluxF3D"; +} + +template class F> +template +SuperPlaneIntegralFluxF3D::SuperPlaneIntegralFluxF3D( + SuperLattice3D& sLattice, + const UnitConverter& converter, + SuperGeometry3D& geometry, + IndicatorCircle3D& circle, + std::vector materials, + BlockDataReductionMode mode) + : SuperPlaneIntegralF3D( + std::unique_ptr>(new F(sLattice, converter)), + geometry, + circle, + std::move(materials), + mode) +{ + this->getName() = "SuperPlaneIntegralFluxF3D"; +} + +template class F> +template +SuperPlaneIntegralFluxF3D::SuperPlaneIntegralFluxF3D( + SuperLattice3D& sLattice, + const UnitConverter& converter, + SuperGeometry3D& geometry, + IndicatorCircle3D& circle, + BlockDataReductionMode mode) + : SuperPlaneIntegralF3D( + std::unique_ptr>(new F(sLattice, converter)), + geometry, + circle, + mode) +{ + this->getName() = "SuperPlaneIntegralFluxF3D"; +} + +template +void SuperPlaneIntegralFluxPressure3D::print( + std::string regionName, std::string fluxSiScaleName, std::string meanSiScaleName) +{ + OstreamManager clout("SuperPlaneIntegralFluxPressure3D"); + int input[1] = { }; + T output[this->getTargetDim()]; + this->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 ( fluxSiScaleName == "MN" ) { + std::cout << "; force[MN]=" << output[0] / T(1.e6) << std::flush; + } + else if ( fluxSiScaleName == "kN" ) { + std::cout << "; force[kN]=" << output[0] / T(1.e3) << std::flush; + } + else { + std::cout << "; force[N]=" << output[0] << std::flush; + } + if ( meanSiScaleName == "mmHg" ) { + std::cout << "; meanPressure[mmHg]=" << std::abs(output[0])/output[1]/T(133.322) << std::endl; + } + else { + std::cout << "; meanPressure[Pa]=" << std::abs(output[0])/output[1] << std::endl; + } + } +} + + +template +void SuperPlaneIntegralFluxVelocity3D::print( + std::string regionName, std::string fluxSiScaleName, std::string meanSiScaleName) +{ + OstreamManager clout("SuperPlaneIntegralFluxVelocity3D"); + int input[1] = { }; + T output[this->getTargetDim()]; + this->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 ( fluxSiScaleName == "ml/s" ) { + std::cout << "; volumetricFlowRate[ml/s]=" << output[0] * T(1.e6) + << std::flush; + } + else if ( fluxSiScaleName == "l/s" ) { + std::cout << "; volumetricFlowRate[l/s]=" << output[0] * T(1.e3) + << std::flush; + } + else { + std::cout << "; volumetricFlowRate[m^3/s]=" << output[0] << std::flush; + } + if ( meanSiScaleName == "mm/s" ) { + std::cout << "; meanVelocity[mm/s]=" << output[0] / output[1] * T(1.e3) + << std::endl; + } + else { + std::cout << "; meanVelocity[m/s]=" << output[0] / output[1] << std::endl; + } + } +} + + +} + +#endif -- cgit v1.2.3