/* This file is part of the OpenLB library * * Copyright (C) 2012, 2014 Lukas Baron, Tim Dornieden, Mathias J. Krause, * Albert Mink * 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_LATTICE_LOCAL_F_3D_HH #define SUPER_LATTICE_LOCAL_F_3D_HH #include // for generic i/o #include // for lpnorm #include "superBaseF3D.h" #include "superLatticeLocalF3D.h" #include "functors/analytical/indicator/indicatorBaseF3D.h" #include "indicator/superIndicatorF3D.h" #include "dynamics/lbHelpers.h" // for computation of lattice rho and velocity #include "geometry/superGeometry3D.h" namespace olb { template SuperLatticeFpop3D::SuperLatticeFpop3D( SuperLattice3D& sLattice) : SuperLatticeF3D(sLattice, DESCRIPTOR::q) { this->getName() = "fPop"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticeFpop3D(this->_sLattice.getBlockLattice(iC))); } } template bool SuperLatticeFpop3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticeDissipation3D::SuperLatticeDissipation3D( SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticeF3D(sLattice, 1), _converter(converter) { this->getName() = "dissipation"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticeDissipation3D(this->_sLattice.getBlockLattice(iC),this->_converter)); } } template bool SuperLatticeDissipation3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticePhysDissipation3D::SuperLatticePhysDissipation3D( SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 1) { this->getName() = "physDissipation"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePhysDissipation3D( this->_sLattice.getExtendedBlockLattice(iC), this->_sLattice.getOverlap(), this->_converter) ); } } template bool SuperLatticePhysDissipation3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { const int loc = this->_sLattice.getLoadBalancer().loc(input[0]); return this->getBlockF(loc)(output,&input[1]); } else { return false; } } template SuperLatticeEffevtiveDissipation3D::SuperLatticeEffevtiveDissipation3D( SuperLattice3D& sLattice, const UnitConverter& converter, T smagoConst, LESDynamics& LESdynamics) : SuperLatticeF3D(sLattice, 1), _converter(converter) { this->getName() = "EffevtiveDissipation"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticeEffevtiveDissipation3D(this->_sLattice.getBlockLattice(iC), this->_converter, smagoConst, LESdynamics)); } } template bool SuperLatticeEffevtiveDissipation3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticePhysEffevtiveDissipation3D::SuperLatticePhysEffevtiveDissipation3D( SuperLattice3D& sLattice, const UnitConverter& converter, T smagoConst, LESDynamics& LESdynamics) : SuperLatticePhysF3D(sLattice, converter, 1) { this->getName() = "physEffevtiveDissipation"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticePhysEffevtiveDissipation3D(this->_sLattice.getBlockLattice(iC), this->_converter, smagoConst, LESdynamics)); } } template bool SuperLatticePhysEffevtiveDissipation3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticeDensity3D::SuperLatticeDensity3D( SuperLattice3D& sLattice) : SuperLatticeF3D(sLattice, 1) { this->getName() = "density"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticeDensity3D(this->_sLattice.getBlockLattice(iC))); } } template bool SuperLatticeDensity3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticeVelocity3D::SuperLatticeVelocity3D( SuperLattice3D& sLattice) : SuperLatticeF3D(sLattice, 3) { this->getName() = "velocity"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticeVelocity3D(this->_sLattice.getBlockLattice(iC))); } } template bool SuperLatticeVelocity3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticeExternalVelocity3D::SuperLatticeExternalVelocity3D( SuperLattice3D& sLattice) : SuperLatticeF3D(sLattice, 3) { this->getName() = "externalVelocity"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticeExternalVelocity3D(this->_sLattice.getBlockLattice(iC))); } } template bool SuperLatticeExternalVelocity3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticeFlux3D::SuperLatticeFlux3D( SuperLattice3D& sLattice) : SuperLatticeF3D(sLattice, 3) { this->getName() = "flux"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticeFlux3D(this->_sLattice.getBlockLattice(iC))); } } template bool SuperLatticeFlux3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticeStrainRate3D::SuperLatticeStrainRate3D( SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticeF3D(sLattice, 9), _converter(converter) { this->getName() = "strainRate"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticeStrainRate3D(this->_sLattice.getBlockLattice(iC),this->_converter)); } } template bool SuperLatticeStrainRate3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticePhysStrainRate3D::SuperLatticePhysStrainRate3D( SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 9) { this->getName() = "physStrainRate"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePhysStrainRate3D( this->_sLattice.getExtendedBlockLattice(iC), this->_sLattice.getOverlap(), this->_converter) ); } } template bool SuperLatticePhysStrainRate3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { const int loc = this->_sLattice.getLoadBalancer().loc(input[0]); return this->getBlockF(loc)(output,&input[1]); } else { return false; } } template SuperLatticeGeometry3D::SuperLatticeGeometry3D( SuperLattice3D& sLattice, SuperGeometry3D& superGeometry, const int material) : SuperLatticeF3D(sLattice, 1), _superGeometry(superGeometry), _material(material) { this->getName() = "geometry"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticeGeometry3D( this->_sLattice.getBlockLattice(iC), this->_superGeometry.getBlockGeometry(iC), _material) ); } } template bool SuperLatticeGeometry3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticeRank3D::SuperLatticeRank3D( SuperLattice3D& sLattice) : SuperLatticeF3D(sLattice, 1) { this->getName() = "rank"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticeRank3D(this->_sLattice.getBlockLattice(iC)) ); } } template bool SuperLatticeRank3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { this->getBlockF( this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); return true; } else { return false; } } template SuperLatticeCuboid3D::SuperLatticeCuboid3D( SuperLattice3D& sLattice) : SuperLatticeF3D(sLattice, 1) { this->getName() = "cuboid"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticeCuboid3D(this->_sLattice.getBlockLattice(iC), this->_sLattice.getLoadBalancer().glob(iC)) ); } } template bool SuperLatticeCuboid3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { this->getBlockF( this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); return true; } else { return false; } } template SuperLatticePhysPressure3D::SuperLatticePhysPressure3D( SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 1) { this->getName() = "physPressure"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePhysPressure3D( this->_sLattice.getExtendedBlockLattice(iC), this->_sLattice.getOverlap(), this->_converter) ); } } template bool SuperLatticePhysPressure3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { const int loc = this->_sLattice.getLoadBalancer().loc(input[0]); return this->getBlockF(loc)(output,&input[1]); } else { return false; } } template SuperLatticePhysVelocity3D::SuperLatticePhysVelocity3D( SuperLattice3D& sLattice, const UnitConverter& converter, bool print) : SuperLatticePhysF3D(sLattice, converter, 3), _print(print) { this->getName() = "physVelocity"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePhysVelocity3D( this->_sLattice.getExtendedBlockLattice(iC), this->_sLattice.getOverlap(), this->_converter, _print) ); } } template bool SuperLatticePhysVelocity3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { const int loc = this->_sLattice.getLoadBalancer().loc(input[0]); return this->getBlockF(loc)(output,&input[1]); } else { return false; } } template SuperLatticePhysExternal3D::SuperLatticePhysExternal3D( SuperLattice3D& sLattice, T convFactorToPhysUnits, int offset, int size) : SuperLatticeF3D(sLattice, 3) { this->getName() = "physExtField"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePhysExternal3D( this->_sLattice.getBlockLattice(iC), convFactorToPhysUnits, offset, size) ); } } template bool SuperLatticePhysExternal3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { const int loc = this->_sLattice.getLoadBalancer().loc(input[0]); return this->getBlockF(loc)(output,&input[1]); } else { return false; } } template SuperLatticePhysExternalPorosity3D::SuperLatticePhysExternalPorosity3D (SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice,converter,1) { this->getName() = "ExtPorosityField"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePhysExternalPorosity3D( this->_sLattice.getExtendedBlockLattice(iC), this->_sLattice.getOverlap(), this->_converter) ); } } template bool SuperLatticePhysExternalPorosity3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { const int loc = this->_sLattice.getLoadBalancer().loc(input[0]); return this->getBlockF(loc)(output,&input[1]); } else { return false; } } template SuperLatticePhysExternalVelocity3D::SuperLatticePhysExternalVelocity3D( SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 3) { this->getName() = "physVelExtField"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePhysExternalVelocity3D( this->_sLattice.getBlockLattice(iC), this->_converter) ); } } template bool SuperLatticePhysExternalVelocity3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { const int loc = this->_sLattice.getLoadBalancer().loc(input[0]); return this->getBlockF(loc)(output, &input[1]); } else { return false; } } template SuperLatticePhysExternalParticleVelocity3D::SuperLatticePhysExternalParticleVelocity3D( SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 2) { this->getName() = "ExtPartVelField"; for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) { this->_blockF.emplace_back( new BlockLatticePhysExternalParticleVelocity3D( sLattice.getExtendedBlockLattice(iC), converter) ); } } template bool SuperLatticePhysExternalParticleVelocity3D::operator()( T output[], const int input[]) { auto& load = this->_sLattice.getLoadBalancer(); const int& globIC = input[0]; if (load.rank(globIC) == singleton::mpi().getRank()) { const int overlap = this->_sLattice.getOverlap(); int inputLocal[3] = { }; inputLocal[0] = input[1] + overlap; inputLocal[1] = input[2] + overlap; inputLocal[2] = input[3] + overlap; return this->getBlockF(load.loc(globIC))(output, inputLocal); } else { return false; } } template SuperLatticePhysBoundaryForce3D::SuperLatticePhysBoundaryForce3D( SuperLattice3D& sLattice, FunctorPtr>&& indicatorF, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 3), _indicatorF(std::move(indicatorF)) { this->getName() = "physBoundaryForce"; for (int iC = 0; iC < this->_sLattice.getLoadBalancer().size(); ++iC) { this->_blockF.emplace_back( new BlockLatticePhysBoundaryForce3D( this->_sLattice.getBlockLattice(iC), _indicatorF->getBlockIndicatorF(iC), this->_converter)); } } template SuperLatticePhysBoundaryForce3D::SuperLatticePhysBoundaryForce3D( SuperLattice3D& sLattice, SuperGeometry3D& superGeometry, const int material, const UnitConverter& converter) : SuperLatticePhysBoundaryForce3D(sLattice, superGeometry.getMaterialIndicator(material), converter) { } template bool SuperLatticePhysBoundaryForce3D::operator() (T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]))(output, &input[1]); } else { return false; } } template SuperLatticePSMPhysForce3D::SuperLatticePSMPhysForce3D( SuperLattice3D& sLattice, const UnitConverter& converter, int mode_) : SuperLatticePhysF3D(sLattice, converter, 3) { this->getName() = "PSMPhysForce"; for (int iC = 0; iC < this->_sLattice.getLoadBalancer().size(); ++iC) { this->_blockF.emplace_back( new BlockLatticePSMPhysForce3D( this->_sLattice.getBlockLattice(iC), this->_converter, mode_)); } } template bool SuperLatticePSMPhysForce3D::operator() (T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]))(output, &input[1]); } else { return false; } } template SuperLatticePhysWallShearStress3D::SuperLatticePhysWallShearStress3D( SuperLattice3D& sLattice, SuperGeometry3D& superGeometry, const int material, const UnitConverter& converter, IndicatorF3D& indicator) : SuperLatticePhysF3D(sLattice, converter, 1), _superGeometry(superGeometry), _material(material) { this->getName() = "physWallShearStress"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePhysWallShearStress3D( this->_sLattice.getExtendedBlockLattice(iC), _superGeometry.getExtendedBlockGeometry(iC), this->_sLattice.getOverlap(), _material, this->_converter, indicator) ); } } template bool SuperLatticePhysWallShearStress3D::operator() (T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]))(output, &input[1]); } else { return false; } } template SuperLatticePhysCorrBoundaryForce3D::SuperLatticePhysCorrBoundaryForce3D( SuperLattice3D& sLattice, FunctorPtr>&& indicatorF, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 3), _indicatorF(std::move(indicatorF)) { this->getName() = "physCorrBoundaryForce"; for (int iC = 0; iC < this->_sLattice.getLoadBalancer().size(); ++iC) { this->_blockF.emplace_back( new BlockLatticePhysCorrBoundaryForce3D( this->_sLattice.getBlockLattice(iC), _indicatorF->getBlockIndicatorF(iC), this->_converter)); } } template SuperLatticePhysCorrBoundaryForce3D::SuperLatticePhysCorrBoundaryForce3D( SuperLattice3D& sLattice, SuperGeometry3D& superGeometry, const int material, const UnitConverter& converter) : SuperLatticePhysCorrBoundaryForce3D(sLattice, superGeometry.getMaterialIndicator(material), converter) { } template bool SuperLatticePhysCorrBoundaryForce3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]))(output,&input[1]); } else { return false; } } template SuperLatticeField3D::SuperLatticeField3D( SuperLattice3D& sLattice) : SuperLatticeF3D(sLattice, DESCRIPTOR::template size()) { this->getName() = "externalField"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; ++iC) { this->_blockF.emplace_back( new BlockLatticeField3D(this->_sLattice.getBlockLattice(iC))); } } template bool SuperLatticeField3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().isLocal(input[0])) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]))(output,&input[1]); } else { return false; } } template SuperLatticePorosity3D::SuperLatticePorosity3D( SuperLattice3D& sLattice) : SuperLatticeF3D(sLattice, 1) { this->getName() = "porosity"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticePorosity3D(this->_sLattice.getBlockLattice(iC))); } } template bool SuperLatticePorosity3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticeVolumeFractionApproximation3D::SuperLatticeVolumeFractionApproximation3D( SuperLattice3D& sLattice, SuperGeometry3D& superGeometry, IndicatorF3D& indicator, int refinementLevel, const UnitConverter& converter, bool insideOut) : SuperLatticeF3D(sLattice, 1) { this->getName() = "volumeFractionApproximation"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticeVolumeFractionApproximation3D(this->_sLattice.getBlockLattice(iC), superGeometry.getBlockGeometry(iC), indicator, refinementLevel, converter, insideOut)); } } template bool SuperLatticeVolumeFractionApproximation3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticePhysPermeability3D::SuperLatticePhysPermeability3D( SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 1) { this->getName() = "permeability"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePhysPermeability3D( this->_sLattice.getBlockLattice(iC), this->getConverter() ) ); } } template bool SuperLatticePhysPermeability3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF( this->_sLattice.getLoadBalancer().loc(input[0]) )(output, &input[1]); } else { return false; } } template SuperLatticePhysCroppedPermeability3D::SuperLatticePhysCroppedPermeability3D( SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 1) { this->getName() = "cropped_permeability"; for (int iC = 0; iC < this->_sLattice.getLoadBalancer().size(); iC++ ) { this->_blockF.emplace_back( new BlockLatticePhysCroppedPermeability3D( this->_sLattice.getBlockLattice(iC), this->getConverter() ) ); } } template bool SuperLatticePhysCroppedPermeability3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF( this->_sLattice.getLoadBalancer().loc(input[0]) )(output, &input[1]); } else { return false; } } template SuperLatticePhysDarcyForce3D::SuperLatticePhysDarcyForce3D( SuperLattice3D& sLattice, SuperGeometry3D& superGeometry, const int material, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 3), _superGeometry(superGeometry), _material(material) { this->getName() = "alphaU"; } template bool SuperLatticePhysDarcyForce3D::operator()(T output[], const int input[]) { SuperLatticePhysPermeability3D permeability(this->_sLattice, this->_converter); SuperLatticeVelocity3D velocity(this->_sLattice); T nu = this->_converter.getPhysViscosity(); T K; T u[velocity.getTargetDim()]; permeability(&K,input); velocity(u,input); output[0] = -nu / K * u[0]; output[1] = -nu / K * u[1]; output[2] = -nu / K * u[2]; return true; } template SuperEuklidNorm3D::SuperEuklidNorm3D( SuperLatticeF3D& f) : SuperLatticeF3D(f.getSuperLattice(), 1), _f(f) { this->getName() = "EuklidNorm(" + _f.getName() + ")"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockEuklidNorm3D(f.getBlockF(iC))); } } template bool SuperEuklidNorm3D::operator() (T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]))(output,&input[1]); } else { return false; } } template SuperLatticeInterpPhysVelocity3D::SuperLatticeInterpPhysVelocity3D( SuperLattice3D& sLattice, UnitConverter const& converter) : SuperLatticePhysF3D(sLattice, converter, 3) { this->getName() = "InterpVelocity"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int lociC = 0; lociC < maxC; lociC++) { int globiC = this->_sLattice.getLoadBalancer().glob(lociC); this->_blockF.emplace_back( new BlockLatticeInterpPhysVelocity3D( sLattice.getExtendedBlockLattice(lociC), converter, &sLattice.getCuboidGeometry().get(globiC), sLattice.getOverlap()) ); } } template bool SuperLatticeInterpPhysVelocity3D::operator()(T output[], const int input[]) { return false; } template void SuperLatticeInterpPhysVelocity3D::operator()(T output[], const T input[], const int globiC) { if (this->_sLattice.getLoadBalancer().isLocal(globiC)) { static_cast*>( this->_blockF[this->_sLattice.getLoadBalancer().loc(globiC)].get() )->operator()(output, input); } } template SuperLatticePorousMomentumLossForce3D::SuperLatticePorousMomentumLossForce3D (SuperLattice3D& sLattice, SuperGeometry3D& superGeometry, std::vector* >& indicator, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice,converter,7*indicator.size()) { this->getName() = "physPorousMomentumLossForce"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePorousMomentumLossForce3D(this->_sLattice.getBlockLattice(iC), superGeometry.getBlockGeometry(iC), indicator, converter)); } } template bool SuperLatticePorousMomentumLossForce3D::operator() (T output[], const int input[]) { for (int i=0; igetTargetDim(); i++) { output[i] = 0.; } for (int iC = 0; iC < this->_sLattice.getLoadBalancer().size(); ++iC) { int globiC = this->_sLattice.getLoadBalancer().glob(iC); if ( this->_sLattice.getLoadBalancer().rank(globiC) == singleton::mpi().getRank() ) { this->getBlockF(iC)(output,&input[1]); } } #ifdef PARALLEL_MODE_MPI for (int i = 0; i < this->getTargetDim(); ++i) { singleton::mpi().reduceAndBcast(output[i], MPI_SUM); } #endif return true; } template SuperLatticePhysBoundaryDistance3D::SuperLatticePhysBoundaryDistance3D (SuperLattice3D& sLattice, SuperGeometry3D& superGeometry, XMLreader const& xmlReader) : SuperLatticeF3D(sLattice,1), _superGeometry(superGeometry) { this->getName() = "physBoundaryDistance"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePhysBoundaryDistance3D(this->_sLattice.getBlockLattice(iC), this->_superGeometry.getBlockGeometry(iC), xmlReader)); } } template bool SuperLatticePhysBoundaryDistance3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticePhysTemperature3D::SuperLatticePhysTemperature3D( SuperLattice3D& sLattice, ThermalUnitConverter const& converter) : SuperLatticeThermalPhysF3D(sLattice, converter, 1) { this->getName() = "physTemperature"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticePhysTemperature3D(this->_sLattice.getBlockLattice(iC), this->_converter)); } } template bool SuperLatticePhysTemperature3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF( this->_sLattice.getLoadBalancer().loc(input[0]) )(output, &input[1]); } else { return false; } } template SuperLatticePhysHeatFlux3D::SuperLatticePhysHeatFlux3D( SuperLattice3D& sLattice, const ThermalUnitConverter& converter) : SuperLatticeThermalPhysF3D(sLattice, converter, 3) { this->getName() = "physHeatFlux"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticePhysHeatFlux3D(this->_sLattice.getBlockLattice(iC), this->_converter)); } } template bool SuperLatticePhysHeatFlux3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticePhysPoreSizeDistribution3D::SuperLatticePhysPoreSizeDistribution3D (SuperLattice3D& sLattice, SuperGeometry3D& superGeometry, int material, XMLreader const& xmlReader) : SuperLatticeF3D(sLattice,1), _superGeometry(superGeometry) { this->getName() = "physPoreSizeDistribution"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticePhysPoreSizeDistribution3D(this->_sLattice.getBlockLattice(iC), this->_superGeometry.getBlockGeometry(iC), material, xmlReader)); } } template bool SuperLatticePhysPoreSizeDistribution3D::operator()( T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticePhysTauFromBoundaryDistance3D::SuperLatticePhysTauFromBoundaryDistance3D( SuperLattice3D& sLattice, SuperGeometry3D& sGeometry, XMLreader const& xmlReader, const ThermalUnitConverter& converter, const T p, const T T_avg, const T c_p, const T beta, const T lambda_0, const T sigma, const T p_0, const T n_0) : SuperLatticeThermalPhysF3D(sLattice, converter, 1) { this->getName() = "physTauFromBoundaryDistance"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back(new BlockLatticePhysTauFromBoundaryDistance3D(this->_sLattice.getBlockLattice(iC), sGeometry.getBlockGeometry(iC), xmlReader, this->_converter, p, T_avg, c_p, beta, lambda_0, sigma, p_0, n_0)); } } template bool SuperLatticePhysTauFromBoundaryDistance3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { return this->getBlockF(this->_sLattice.getLoadBalancer().loc(input[0]) )(output,&input[1]); } else { return false; } } template SuperLatticeIndicatorSmoothIndicatorIntersection3D::SuperLatticeIndicatorSmoothIndicatorIntersection3D ( SuperLattice3D& sLattice, SuperGeometry3D& superGeometry, IndicatorF3D& normalInd, SmoothIndicatorF3D& smoothInd ) : SuperLatticeF3D(sLattice, 1) { this->getName() = "Indicator-SmoothIndicator Intersection"; int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticeIndicatorSmoothIndicatorIntersection3D(this->_sLattice.getExtendedBlockLattice(iC), superGeometry.getBlockGeometry(iC), normalInd, smoothInd)); } } template bool SuperLatticeIndicatorSmoothIndicatorIntersection3D::operator() (T output[], const int input[]) { output[0] = 0.; for (int iC = 0; iC < this->_sLattice.getLoadBalancer().size(); ++iC) { int globiC = this->_sLattice.getLoadBalancer().glob(iC); if ( this->_sLattice.getLoadBalancer().rank(globiC) == singleton::mpi().getRank() ) { this->getBlockF(iC)(output,&input[1]); } } #ifdef PARALLEL_MODE_MPI singleton::mpi().reduceAndBcast(output[0], MPI_MAX); #endif return true; } /////////// SuperLatticeGuoZhaoEpsilon3D ///////////////////////////////////////////// template SuperLatticeGuoZhaoEpsilon3D::SuperLatticeGuoZhaoEpsilon3D( SuperLattice3D& sLattice) : SuperLatticeF3D(sLattice, 1) { this->getName() = "epsilon"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticeGuoZhaoEpsilon3D( this->_sLattice.getExtendedBlockLattice(iC), this->_sLattice.getOverlap() ) ); } } template bool SuperLatticeGuoZhaoEpsilon3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { const int loc = this->_sLattice.getLoadBalancer().loc(input[0]); return this->getBlockF(loc)(output,&input[1]); } else { return false; } } /////////// SuperLatticeGuoZhaoPhysK3D ///////////////////////////////////////////// template SuperLatticeGuoZhaoPhysK3D::SuperLatticeGuoZhaoPhysK3D( SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 1) { this->getName() = "physK"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticeGuoZhaoPhysK3D( this->_sLattice.getExtendedBlockLattice(iC), this->_sLattice.getOverlap(), this->_converter) ); } } template bool SuperLatticeGuoZhaoPhysK3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { const int loc = this->_sLattice.getLoadBalancer().loc(input[0]); return this->getBlockF(loc)(output,&input[1]); } else { return false; } } /////////// SuperLatticeGuoZhaoPhysBodyForce3D ///////////////////////////////////////////// template SuperLatticeGuoZhaoPhysBodyForce3D::SuperLatticeGuoZhaoPhysBodyForce3D( SuperLattice3D& sLattice, const UnitConverter& converter) : SuperLatticePhysF3D(sLattice, converter, 3) { this->getName() = "physBodyForce"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticeGuoZhaoPhysBodyForce3D( this->_sLattice.getExtendedBlockLattice(iC), this->_sLattice.getOverlap(), this->_converter) ); } } template bool SuperLatticeGuoZhaoPhysBodyForce3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { const int loc = this->_sLattice.getLoadBalancer().loc(input[0]); return this->getBlockF(loc)(output,&input[1]); } else { return false; } } /////////// SuperLatticeTimeStepScale3D ///////////////////////////////////////////// template SuperLatticeTimeStepScale3D::SuperLatticeTimeStepScale3D( SuperLattice3D& sLattice, T oldTau, const UnitConverter& converter) : SuperLatticeF3D(sLattice, DESCRIPTOR::q) { this->getName() = "latticeTimeStepScale"; const int maxC = this->_sLattice.getLoadBalancer().size(); this->_blockF.reserve(maxC); for (int iC = 0; iC < maxC; iC++) { this->_blockF.emplace_back( new BlockLatticeTimeStepScale3D( this->_sLattice.getExtendedBlockLattice(iC), oldTau, converter) ); } } template bool SuperLatticeTimeStepScale3D::operator()(T output[], const int input[]) { if (this->_sLattice.getLoadBalancer().rank(input[0]) == singleton::mpi().getRank()) { const int loc = this->_sLattice.getLoadBalancer().loc(input[0]); return this->getBlockF(loc)(output,&input[1]); } else { return false; } } } // end namespace olb #endif