/* This file is part of the OpenLB library
*
* Copyright (C) 2014 Albert Mink, Mathias J. Krause
* 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_2D_H
#define SUPER_LATTICE_LOCAL_F_2D_H
#include
#include "superBaseF2D.h"
#include "core/superLattice2D.h"
#include "indicator/superIndicatorBaseF2D.h"
#include "utilities/functorPtr.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 {
template class SuperGeometry2D;
////////////////////////////////////////////////////////////////////////////////
//////if globIC is not on the local processor, the returned vector is empty/////
////////////////////////////////////////////////////////////////////////////////
/// functor to get pointwise dissipation density on local lattices
template
class SuperLatticeDissipation2D final : public SuperLatticeF2D {
private:
const UnitConverter& _converter;
public:
SuperLatticeDissipation2D(SuperLattice2D& sLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// functor to get pointwise dissipation density on local lattices
template
class SuperLatticePhysDissipation2D final : public SuperLatticePhysF2D {
public:
SuperLatticePhysDissipation2D(SuperLattice2D& sLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// functor to get pointwise density rho on local lattices
template
class SuperLatticeDensity2D final : public SuperLatticeF2D {
public:
SuperLatticeDensity2D(SuperLattice2D& sLattice);
bool operator() (T output[], const int input[]) override;
};
/// functor to get pointwise velocity on local lattice
template
class SuperLatticeVelocity2D final : public SuperLatticeF2D {
public:
SuperLatticeVelocity2D(SuperLattice2D& 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 SuperLatticePhysStrainRate2D final : public SuperLatticePhysF2D {
public:
SuperLatticePhysStrainRate2D(SuperLattice2D& sLattice,
const UnitConverter& converter);
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 SuperLatticePhysWallShearStress2D final : public SuperLatticePhysF2D {
private:
SuperGeometry2D& _superGeometry;
const int _material;
public:
SuperLatticePhysWallShearStress2D(SuperLattice2D& sLattice,
SuperGeometry2D& superGeometry, const int material,
const UnitConverter& converter,
IndicatorF2D& indicator);
bool operator() (T output[], const int input[]) override;
};
/// functor to get pointwise the material no. presenting the geometry on local lattice
template
class SuperLatticeGeometry2D final : public SuperLatticeF2D {
private:
SuperGeometry2D& _superGeometry;
const int _material;
public:
SuperLatticeGeometry2D(SuperLattice2D& sLattice,
SuperGeometry2D& 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 SuperLatticeRank2D final : public SuperLatticeF2D {
public:
SuperLatticeRank2D(SuperLattice2D& sLattice);
bool operator() (T output[], const int input[]) override;
};
/// functor to get pointwise the cuboid no. + 1 on local lattice
template
class SuperLatticeCuboid2D final : public SuperLatticeF2D {
public:
SuperLatticeCuboid2D(SuperLattice2D& sLattice);
bool operator() (T output[], const int input[]) override;
};
/// functor to get pointwise phys pressure from rho on local lattices
template
class SuperLatticePhysPressure2D final : public SuperLatticePhysF2D {
public:
SuperLatticePhysPressure2D(SuperLattice2D& sLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// functor to get pointwise phys velocity on local lattice
template
class SuperLatticePhysVelocity2D final : public SuperLatticePhysF2D {
public:
SuperLatticePhysVelocity2D(SuperLattice2D& sLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
template
class SuperLatticePhysExternalPorosity2D final : public SuperLatticePhysF2D {
public:
SuperLatticePhysExternalPorosity2D(SuperLattice2D& sLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]);
};
template
class SuperLatticeField2D final : public SuperLatticeF2D {
public:
SuperLatticeField2D(SuperLattice2D& sLattice);
bool operator() (T output[], const int input[]);
};
template
class SuperLatticePhysExternalVelocity2D final : public SuperLatticePhysF2D {
public:
SuperLatticePhysExternalVelocity2D(SuperLattice2D& sLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]);
};
template
class SuperLatticePhysExternalParticleVelocity2D final : public SuperLatticePhysF2D {
public:
SuperLatticePhysExternalParticleVelocity2D(SuperLattice2D& sLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]);
};
/// functor to get pointwise phys force acting on a boundary with a given material on local lattice
template
class SuperLatticePhysBoundaryForce2D : public SuperLatticePhysF2D {
private:
FunctorPtr> _indicatorF;
public:
SuperLatticePhysBoundaryForce2D(SuperLattice2D& sLattice,
FunctorPtr>&& indicatorF,
const UnitConverter& converter);
SuperLatticePhysBoundaryForce2D(SuperLattice2D& sLattice,
SuperGeometry2D& 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 SuperLatticePSMPhysForce2D : public SuperLatticePhysF2D {
public:
SuperLatticePSMPhysForce2D(SuperLattice2D& sLattice,
const UnitConverter& converter,
int mode_);
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 SuperLatticePhysCorrBoundaryForce2D final : public SuperLatticePhysF2D {
private:
SuperGeometry2D& _superGeometry;
const int _material;
public:
SuperLatticePhysCorrBoundaryForce2D(SuperLattice2D& sLattice,
SuperGeometry2D& superGeometry, const int material,
const UnitConverter& converter);
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 SuperLatticePorosity2D final : public SuperLatticePhysF2D {
private:
SuperGeometry2D& _superGeometry;
const int _material;
public:
SuperLatticePorosity2D(SuperLattice2D& sLattice,
SuperGeometry2D& superGeometry, const int material,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// functor to get pointwise an approx. for the volume fraction
template
class SuperLatticeVolumeFractionApproximation2D final : public SuperLatticeF2D {
public:
SuperLatticeVolumeFractionApproximation2D(SuperLattice2D& sLattice, SuperGeometry2D& superGeometry,
IndicatorF2D& indicator, int refinementLevel, const UnitConverter& converter, bool insideOut = false);
bool operator() (T output[], const int input[]);
};
/// functor to get pointwise an approx. for the volume fraction
template
class SuperLatticeVolumeFractionPolygonApproximation2D final : public SuperLatticeF2D {
public:
SuperLatticeVolumeFractionPolygonApproximation2D(SuperLattice2D& sLattice, SuperGeometry2D& superGeometry,
IndicatorF2D& indicator, 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 SuperLatticePhysPermeability2D final : public SuperLatticePhysF2D {
private:
SuperGeometry2D& _superGeometry;
const int _material;
public:
SuperLatticePhysPermeability2D(SuperLattice2D& sLattice,
SuperGeometry2D& superGeometry,
const int material, const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// computes pointwise -nu/K*u on the lattice, can be used with SuperSum2D as objective
template
class SuperLatticePhysDarcyForce2D final : public SuperLatticePhysF2D {
private:
SuperGeometry2D& _superGeometry;
const int _material;
public:
SuperLatticePhysDarcyForce2D(SuperLattice2D& sLattice,
SuperGeometry2D& superGeometry, const int material,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// functor that returns pointwise the l2-norm, e.g. of a velocity
template
class SuperEuklidNorm2D final : public SuperLatticeF2D {
private:
SuperLatticeF2D& _f;
public:
SuperEuklidNorm2D(SuperLatticeF2D& f);
bool operator() (T output[], const int input[]) override;
};
/// functor to get pointwise phys temperature from rho on local lattices
template
class SuperLatticePhysTemperature2D final : public SuperLatticeThermalPhysF2D {
public:
SuperLatticePhysTemperature2D(SuperLattice2D& sLattice,
ThermalUnitConverter const& converter);
bool operator() (T output[], const int input[]);
};
/** 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[1] translational force - physical units
* \return output[3] torque - physical units
* \return output[4] number of voxels
*/
template
class SuperLatticePorousMomentumLossForce2D final : public SuperLatticePhysF2D {
public:
SuperLatticePorousMomentumLossForce2D(SuperLattice2D& sLattice,
SuperGeometry2D& superGeometry,
std::vector* >& indicator,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// functor to get pointwise heat flux on local lattice
template
class SuperLatticePhysHeatFlux2D final : public SuperLatticeThermalPhysF2D {
public:
SuperLatticePhysHeatFlux2D(SuperLattice2D& sLattice,
const ThermalUnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// functor that returns 1 if SmoothIndicatorF A intersects IndicatorF B; otherwise, 0
template
class SuperLatticeIndicatorSmoothIndicatorIntersection2D final : public SuperLatticeF2D {
public:
SuperLatticeIndicatorSmoothIndicatorIntersection2D(SuperLattice2D& sLattice,
SuperGeometry2D& superGeometry,
IndicatorF2D& normalInd, SmoothIndicatorF2D& 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 SuperLatticeGuoZhaoEpsilon2D final : public SuperLatticeF2D {
public:
SuperLatticeGuoZhaoEpsilon2D(SuperLattice2D& 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 SuperLatticeGuoZhaoPhysK2D final : public SuperLatticePhysF2D {
public:
SuperLatticeGuoZhaoPhysK2D(SuperLattice2D& 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 SuperLatticeGuoZhaoPhysBodyForce2D final : public SuperLatticePhysF2D {
public:
SuperLatticeGuoZhaoPhysBodyForce2D(SuperLattice2D& sLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
} // end namespace olb
#endif