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 --- src/functors/lattice/superLatticeLocalF3D.h | 494 ++++++++++++++++++++++++++++ 1 file changed, 494 insertions(+) create mode 100644 src/functors/lattice/superLatticeLocalF3D.h (limited to 'src/functors/lattice/superLatticeLocalF3D.h') diff --git a/src/functors/lattice/superLatticeLocalF3D.h b/src/functors/lattice/superLatticeLocalF3D.h new file mode 100644 index 0000000..5d86b19 --- /dev/null +++ b/src/functors/lattice/superLatticeLocalF3D.h @@ -0,0 +1,494 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2012 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_H +#define SUPER_LATTICE_LOCAL_F_3D_H + +#include + +#include "superBaseF3D.h" +#include "superCalcF3D.h" +#include "blockLatticeLocalF3D.h" +#include "functors/analytical/indicator/indicatorBaseF3D.h" +#include "core/superLattice3D.h" + +/** Note: Throughout the whole source code directory genericFunctions, the + * template parameters for i/o dimensions are: + * F: S^m -> T^n (S=source, T=target) + */ + +namespace olb { + + +//////////////////////////////////////////////////////////////////////////////// +//////if globIC is not on the local processor, the returned vector is empty///// +//////////////////////////////////////////////////////////////////////////////// + +/// functor to get pointwise f population on local lattices +template +class SuperLatticeFpop3D final : public SuperLatticeF3D { +public: + SuperLatticeFpop3D(SuperLattice3D& sLattice); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise dissipation density on local lattices +template +class SuperLatticeDissipation3D final : public SuperLatticeF3D { +private: + const UnitConverter& _converter; +public: + SuperLatticeDissipation3D(SuperLattice3D& sLattice, + const UnitConverter& converter); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise dissipation density on local lattices +template +class SuperLatticePhysDissipation3D final : public SuperLatticePhysF3D { +public: + SuperLatticePhysDissipation3D(SuperLattice3D& sLattice, + const UnitConverter& converter); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise turbulent dissipation density on local lattices +template +class SuperLatticeEffevtiveDissipation3D final : public SuperLatticeF3D { +private: + const UnitConverter& _converter; +public: + SuperLatticeEffevtiveDissipation3D(SuperLattice3D& sLattice, + const UnitConverter& converter, T smagoConst, + LESDynamics& LESdynamics); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise turbulent dissipation density on local lattices +template +class SuperLatticePhysEffevtiveDissipation3D final : public SuperLatticePhysF3D { +public: + SuperLatticePhysEffevtiveDissipation3D(SuperLattice3D& sLattice, + const UnitConverter& converter, T smagoConst, + LESDynamics& LESdynamics); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise density rho on local lattices +template +class SuperLatticeDensity3D final : public SuperLatticeF3D { +public: + SuperLatticeDensity3D(SuperLattice3D& sLattice); + bool operator() (T output[], const int input[]) override; +}; + + +/// functor to get pointwise velocity on local lattice +template +class SuperLatticeVelocity3D final : public SuperLatticeF3D { +public: + SuperLatticeVelocity3D(SuperLattice3D& sLattice); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise velocity on local lattice +template +class SuperLatticeExternalVelocity3D final : public SuperLatticeF3D { +public: + SuperLatticeExternalVelocity3D(SuperLattice3D& sLattice); + bool operator() (T output[], const int input[]); +}; + +/// functor to get pointwise strain rate on local lattice +/// s_ij = 1/2*(du_idr_j + du_jdr_i) +template +class SuperLatticeStrainRate3D final : public SuperLatticeF3D { +private: + const UnitConverter& _converter; +public: + SuperLatticeStrainRate3D(SuperLattice3D& sLattice, + const UnitConverter& converter); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise flux on local lattice +template +class SuperLatticeFlux3D final : public SuperLatticeF3D { +public: + SuperLatticeFlux3D(SuperLattice3D& sLattice); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise phys strain rate on local lattice +/// s_ij = 1/2*(du_idr_j + du_jdr_i) +template +class SuperLatticePhysStrainRate3D final : public SuperLatticePhysF3D { +public: + SuperLatticePhysStrainRate3D(SuperLattice3D& sLattice, + const UnitConverter& converter); + bool operator() (T output[], const int input[]); +}; + +/// functor to get pointwise the material no. presenting the geometry on local lattice +template +class SuperLatticeGeometry3D final : public SuperLatticeF3D { +private: + SuperGeometry3D& _superGeometry; + const int _material; +public: + SuperLatticeGeometry3D(SuperLattice3D& sLattice, + SuperGeometry3D& superGeometry, const int material = -1); + bool operator() (T output[], const int input[]) override; +}; + + +/// functor to get pointwise the rank no. + 1 on local lattice +template +class SuperLatticeRank3D final : public SuperLatticeF3D { +public: + SuperLatticeRank3D(SuperLattice3D& sLattice); + bool operator() (T output[], const int input[]) override; +}; + + +/// functor to get pointwise the cuboid no. + 1 on local lattice +template +class SuperLatticeCuboid3D final : public SuperLatticeF3D { +public: + SuperLatticeCuboid3D(SuperLattice3D& sLattice); + bool operator() (T output[], const int input[]) override; +}; + + +/// functor to get pointwise phys pressure from rho on local lattices +template +class SuperLatticePhysPressure3D final : public SuperLatticePhysF3D { +public: + SuperLatticePhysPressure3D(SuperLattice3D& sLattice, + const UnitConverter& converter); + bool operator() (T output[], const int input[]) override; +}; + + +/// functor to get pointwise phys velocity on local lattice +template +class SuperLatticePhysVelocity3D final : public SuperLatticePhysF3D { +public: + SuperLatticePhysVelocity3D(SuperLattice3D& sLattice, + const UnitConverter& converter, bool print=false); + bool operator() (T output[], const int input[]) override; +private: + bool _print; +}; + +template +class SuperLatticePhysExternalPorosity3D final : public SuperLatticePhysF3D { +public: + SuperLatticePhysExternalPorosity3D(SuperLattice3D& sLattice, + const UnitConverter& converter); + bool operator() (T output[], const int input[]); +}; + +template +class SuperLatticePhysExternalVelocity3D final : public SuperLatticePhysF3D { +public: + SuperLatticePhysExternalVelocity3D(SuperLattice3D& sLattice, + const UnitConverter& converter); + bool operator() (T output[], const int input[]); +}; + +template +class SuperLatticePhysExternalParticleVelocity3D final : public SuperLatticePhysF3D { +public: + SuperLatticePhysExternalParticleVelocity3D(SuperLattice3D& blockLattice, + const UnitConverter& converter); + bool operator() (T output[], const int input[]); +}; + +template +class SuperLatticePhysExternal3D final : public SuperLatticeF3D { +public: + SuperLatticePhysExternal3D(SuperLattice3D& sLattice, + T convFactorToPhysUnits, + int offset, int size); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise phys force acting on a boundary with a given material on local lattice +template +class SuperLatticePhysBoundaryForce3D : public SuperLatticePhysF3D { +private: + FunctorPtr> _indicatorF; +public: + SuperLatticePhysBoundaryForce3D(SuperLattice3D& sLattice, + FunctorPtr>&& indicatorF, + const UnitConverter& converter); + SuperLatticePhysBoundaryForce3D(SuperLattice3D& sLattice, + SuperGeometry3D& superGeometry, const int material, + const UnitConverter& converter); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise phys force for the PSM dynamics +template +class SuperLatticePSMPhysForce3D : public SuperLatticePhysF3D { +public: + SuperLatticePSMPhysForce3D(SuperLattice3D& sLattice, + const UnitConverter& converter, + int mode_=0); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise phys wall shear stress with a given material on local lattice +template +class SuperLatticePhysWallShearStress3D final : public SuperLatticePhysF3D { +private: + SuperGeometry3D& _superGeometry; + const int _material; +public: + SuperLatticePhysWallShearStress3D(SuperLattice3D& sLattice, + SuperGeometry3D& superGeometry, const int material, + const UnitConverter& converter, + IndicatorF3D& indicator); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise phys force acting on a boundary with a given material on local lattice +/// see: Caiazzo, Junk: Boundary Forces in lattice Boltzmann: Analysis of MEA +template +class SuperLatticePhysCorrBoundaryForce3D final : public SuperLatticePhysF3D { +private: + FunctorPtr> _indicatorF; +public: + SuperLatticePhysCorrBoundaryForce3D(SuperLattice3D& sLattice, + FunctorPtr>&& indicatorF, + const UnitConverter& converter); + SuperLatticePhysCorrBoundaryForce3D(SuperLattice3D& sLattice, + SuperGeometry3D& superGeometry, const int material, + const UnitConverter& converter); + bool operator() (T output[], const int input[]) override; +}; + + +/// functor to get pointwise, lattice-dependent external field +template +class SuperLatticeField3D final : public SuperLatticeF3D { +public: + SuperLatticeField3D(SuperLattice3D& sLattice); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise, lattice-dependent porosity values in [0,1] +/// in combination with (Extended)PorousBGKdynamics: 0->solid, 1->fluid +template +class SuperLatticePorosity3D final : public SuperLatticeF3D { +private: +public: + SuperLatticePorosity3D(SuperLattice3D& sLattice); + bool operator() (T output[], const int input[]); +}; + +/// functor to get pointwise an approx. for the volume fraction +template +class SuperLatticeVolumeFractionApproximation3D final : public SuperLatticeF3D { +public: + SuperLatticeVolumeFractionApproximation3D(SuperLattice3D& sLattice, SuperGeometry3D& superGeometry, + IndicatorF3D& indicator, int refinementLevel, const UnitConverter& converter, bool insideOut = false); + bool operator() (T output[], const int input[]); +}; + +/// functor to get pointwise mesh-independent permeability values in (0,inf) in combination with (Extended)PorousBGKdynamics +/// note: result is cropped to 999999 +template +class SuperLatticePhysPermeability3D final : public SuperLatticePhysF3D { +public: + SuperLatticePhysPermeability3D(SuperLattice3D& sLattice, const UnitConverter& converter); + bool operator() (T output[], const int input[]); +}; + +/// functor to get pointwise mesh-independent permeability values in (0,inf) in combination with (Extended)PorousBGKdynamics +/// note: result is cropped to 1 +template +class SuperLatticePhysCroppedPermeability3D final : public SuperLatticePhysF3D { +public: + SuperLatticePhysCroppedPermeability3D(SuperLattice3D& sLattice, const UnitConverter& converter); + bool operator() (T output[], const int input[]); +}; + + +/// computes pointwise -nu/K*u on the lattice, can be used with SuperSum3D as objective +template +class SuperLatticePhysDarcyForce3D final : public SuperLatticePhysF3D { +private: + SuperGeometry3D& _superGeometry; + const int _material; +public: + SuperLatticePhysDarcyForce3D(SuperLattice3D& sLattice, + SuperGeometry3D& superGeometry, + const int material, const UnitConverter& converter); + bool operator() (T output[], const int input[]); +}; + + +/// functor that returns pointwise the l2-norm, e.g. of a velocity +template +class SuperEuklidNorm3D final : public SuperLatticeF3D { +private: + SuperLatticeF3D& _f; +public: + SuperEuklidNorm3D(SuperLatticeF3D& f); + bool operator() (T output[], const int input[]) override; +}; + + +template +class SuperLatticeInterpPhysVelocity3D final : public SuperLatticePhysF3D { +public: + SuperLatticeInterpPhysVelocity3D(SuperLattice3D& sLattice, UnitConverter const& converter); + bool operator()(T output[], const int input[]) override; + void operator()(T output[], const T input[], const int iC); +}; + +/// functor to get pointwise phys temperature from rho on local lattices +template +class SuperLatticePhysTemperature3D final : public SuperLatticeThermalPhysF3D { // templatename before < +public: + SuperLatticePhysTemperature3D(SuperLattice3D& sLattice, + ThermalUnitConverter const& converter); + bool operator() (T output[], const int input[]); +}; + +/// functor to get pointwise heat flux on local lattice +template +class SuperLatticePhysHeatFlux3D final : public SuperLatticeThermalPhysF3D { +public: + SuperLatticePhysHeatFlux3D(SuperLattice3D& sLattice, + const ThermalUnitConverter& converter); + bool operator() (T output[], const int input[]) override; +}; + +/** Functor that returns forces acting on a particle surface, returns data in output for every particle in a row(described are return values for the first particle). + * \return output[0]-output[2] translational force - physical units + * \return output[3]-output[5] torque - physical units + * \return output[7] number of voxels + */ +template +class SuperLatticePorousMomentumLossForce3D final : public SuperLatticePhysF3D { +public: + SuperLatticePorousMomentumLossForce3D(SuperLattice3D& sLattice, + SuperGeometry3D& superGeometry, + std::vector* >& indicator, + const UnitConverter& converter); + bool operator() (T output[], const int input[]) override; +}; + + +/// functor that returns the minimum distance (in m) to a set of indicators given by an xmlReader +template +class SuperLatticePhysBoundaryDistance3D final : public SuperLatticeF3D { +private: + SuperGeometry3D& _superGeometry; +public: + SuperLatticePhysBoundaryDistance3D(SuperLattice3D& sLattice, + SuperGeometry3D& superGeometry, + XMLreader const& xmlReader); + bool operator() (T output[], const int input[]) override; +}; + +/// functor returns pointwise pore radius (in m) for packings of spheres given by an xmlReader +/// returns NAN for non-pore voxels +template +class SuperLatticePhysPoreSizeDistribution3D final : public SuperLatticeF3D { +private: + SuperGeometry3D& _superGeometry; +public: + SuperLatticePhysPoreSizeDistribution3D(SuperLattice3D& sLattice, + SuperGeometry3D& superGeometry, + int material, + XMLreader const& xmlReader); + bool operator() (T output[], const int input[]) override; +}; + +/// functor returns pointwise pore radius (in m) for packings of spheres given by an xmlReader +/// returns NAN for non-pore voxels +template +class SuperLatticePhysTauFromBoundaryDistance3D final : public SuperLatticeThermalPhysF3D { +public: + SuperLatticePhysTauFromBoundaryDistance3D(SuperLattice3D& sLattice, + SuperGeometry3D& sGeometry, + XMLreader const& xmlReader, + ThermalUnitConverter const& 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); + bool operator() (T output[], const int input[]) override; +}; + +/// functor that returns 1 if SmoothIndicatorF A intersects IndicatorF B; otherwise, 0 +template +class SuperLatticeIndicatorSmoothIndicatorIntersection3D final : public SuperLatticeF3D { +public: + SuperLatticeIndicatorSmoothIndicatorIntersection3D(SuperLattice3D& sLattice, + SuperGeometry3D& superGeometry, + IndicatorF3D& normalInd, SmoothIndicatorF3D& smoothInd ); + bool operator() (T output[], const int input[]) override; +}; + + +/// functor to get pointwise porosity on local lattice for Guo & Zhao (2002)'s model +template +class SuperLatticeGuoZhaoEpsilon3D final : public SuperLatticeF3D { +public: + SuperLatticeGuoZhaoEpsilon3D(SuperLattice3D& sLattice); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise porous conductivity on local lattice for Guo & Zhao (2002)'s model +template +class SuperLatticeGuoZhaoPhysK3D final : public SuperLatticePhysF3D { +public: + SuperLatticeGuoZhaoPhysK3D(SuperLattice3D& sLattice, + const UnitConverter& converter); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to get pointwise body force on local lattice for Guo & Zhao (2002)'s model +template +class SuperLatticeGuoZhaoPhysBodyForce3D final : public SuperLatticePhysF3D { +public: + SuperLatticeGuoZhaoPhysBodyForce3D(SuperLattice3D& sLattice, + const UnitConverter& converter); + bool operator() (T output[], const int input[]) override; +}; + +/// functor to scale particle distributions to a time step +template +class SuperLatticeTimeStepScale3D final : public SuperLatticeF3D { +public: + SuperLatticeTimeStepScale3D(SuperLattice3D& sLattice, + T oldTau, const UnitConverter& converter); + bool operator() (T output[], const int input[]) override; +}; + +} // end namespace olb + +#endif -- cgit v1.2.3