/* This file is part of the OpenLB library
*
* Copyright (C) 2012 Lukas Baron, 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 BLOCK_LATTICE_LOCAL_F_2D_H
#define BLOCK_LATTICE_LOCAL_F_2D_H
#include
#include "blockBaseF2D.h"
#include "geometry/blockGeometry2D.h"
#include "core/blockLattice2D.h"
#include "core/blockLatticeStructure2D.h"
#include "indicator/blockIndicatorF2D.h"
#include "dynamics/porousBGKdynamics.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//////
////////////////////////////////////////////////////////////////////////////////
/// BlockLatticeDissipation2D returns pointwise dissipation density on local lattices.
template
class BlockLatticeDissipation2D final : public BlockLatticeF2D {
protected:
const UnitConverter& _converter;
public:
BlockLatticeDissipation2D(BlockLatticeStructure2D& blockLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// BlockLatticePhysDissipation2D returns pointwise physical dissipation density on local lattices.
template
class BlockLatticePhysDissipation2D final : public BlockLatticePhysF2D {
public:
BlockLatticePhysDissipation2D(BlockLatticeStructure2D& blockLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// BlockLatticeDensity2D returns pointwise density rho on local lattices.
template
class BlockLatticeDensity2D final : public BlockLatticeF2D {
public:
BlockLatticeDensity2D(BlockLatticeStructure2D& blockLattice);
bool operator() (T output[], const int input[]) override;
};
/// BlockLatticeVelocity2D returns pointwise velocity on local lattices.
template
class BlockLatticeVelocity2D final : public BlockLatticeF2D {
public:
BlockLatticeVelocity2D(BlockLatticeStructure2D& blockLattice);
bool operator() (T output[], const int input[]) override;
};
/// BlockLatticeGeometry2D returns pointwise the material no. presenting the geometry on local lattice.
template
class BlockLatticeGeometry2D final : public BlockLatticeF2D {
private:
BlockGeometryStructure2D& _blockGeometry;
int _material;
public:
BlockLatticeGeometry2D(BlockLatticeStructure2D& blockLattice,
BlockGeometryStructure2D& blockGeometry, int material = -1);
bool operator() (T output[], const int input[]) override;
};
/// BlockLatticeRank2D returns pointwise the rank no. + 1 on local lattice.
template
class BlockLatticeRank2D final : public BlockLatticeF2D {
public:
BlockLatticeRank2D(BlockLatticeStructure2D& blockLattice);
bool operator() (T output[], const int input[]) override;
};
/// BlockLatticeCuboid2D returns pointwise the cuboid no. + 1 on local lattice.
template
class BlockLatticeCuboid2D final : public BlockLatticeF2D {
public:
BlockLatticeCuboid2D(BlockLatticeStructure2D& blockLattice, const int iC);
bool operator() (T output[], const int input[]) override;
private:
// holds cuboid nmb of current block
const int _iC;
};
/// BlockLatticePhysPressure2D returns pointwise phys pressure from rho on local lattices.
template
class BlockLatticePhysPressure2D final : public BlockLatticePhysF2D {
public:
BlockLatticePhysPressure2D(BlockLatticeStructure2D& blockLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// BlockLatticePhysVelocity2D returns pointwise phys velocity on local lattice.
template
class BlockLatticePhysVelocity2D final : public BlockLatticePhysF2D {
public:
BlockLatticePhysVelocity2D(BlockLatticeStructure2D& blockLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
template
class BlockLatticeField2D final : public BlockLatticeF2D {
public:
BlockLatticeField2D(BlockLatticeStructure2D& blockLattice);
bool operator() (T output[], const int input[]);
};
template
class BlockLatticePhysExternalPorosity2D final : public BlockLatticePhysF2D {
private:
const int _overlap;
public:
BlockLatticePhysExternalPorosity2D(BlockLatticeStructure2D& blockLattice,
int overlap,
const UnitConverter& converter);
bool operator() (T output[], const int input[]);
};
/**
* functor returns pointwise an approximation for the volume fraction
*/
template
class BlockLatticeVolumeFractionApproximation2D final : public BlockLatticeF2D {
private:
BlockGeometryStructure2D& _blockGeometry;
IndicatorF2D& _indicator;
int _refinementLevel;
const UnitConverter& _converter;
bool _insideOut;
T _physSubGridMinPhysRshift;
T _physSubGridDeltaX;
T _latticeSubGridVolume;
public:
BlockLatticeVolumeFractionApproximation2D(BlockLatticeStructure2D& blockLattice,
BlockGeometryStructure2D& blockGeometry,
IndicatorF2D& indicator,
int refinementLevel,
const UnitConverter& converter, bool insideOut);
bool operator() (T output[], const int input[]);
};
/**
* functor returns pointwise an approximation for the volume fraction
*/
template
class BlockLatticeVolumeFractionPolygonApproximation2D final : public BlockLatticeF2D {
private:
BlockGeometryStructure2D& _blockGeometry;
IndicatorF2D& _indicator;
const UnitConverter& _converter;
bool _insideOut;
public:
BlockLatticeVolumeFractionPolygonApproximation2D(BlockLatticeStructure2D& blockLattice,
BlockGeometryStructure2D& blockGeometry,
IndicatorF2D& indicator,
const UnitConverter& converter, bool insideOut);
bool operator() (T output[], const int input[]);
};
template
class BlockLatticePhysExternalVelocity2D final : public BlockLatticePhysF2D {
private:
const int _overlap;
public:
BlockLatticePhysExternalVelocity2D(BlockLatticeStructure2D& blockLattice,
int overlap,
const UnitConverter& converter);
bool operator() (T output[], const int input[]);
};
template
class BlockLatticePhysExternalParticleVelocity2D final : public BlockLatticePhysF2D {
public:
BlockLatticePhysExternalParticleVelocity2D(BlockLatticeStructure2D& blockLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]);
};
/// BlockLatticeStrainRate2D returns pointwise strain rate on local lattice.
template
class BlockLatticeStrainRate2D final : public BlockLatticePhysF2D {
public:
BlockLatticeStrainRate2D(BlockLatticeStructure2D& blockLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]);
};
/// BlockLatticePhysStrainRate2D returns pointwise phys strain rate on local lattice.
template
class BlockLatticePhysStrainRate2D final : public BlockLatticePhysF2D {
public:
BlockLatticePhysStrainRate2D(BlockLatticeStructure2D& blockLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// BlockLatticePhysBoundaryForce2D returns pointwise phys force acting on a boundary
template
class BlockLatticePhysBoundaryForce2D final : public BlockLatticePhysF2D {
private:
BlockIndicatorF2D& _indicatorF;
BlockGeometryStructure2D& _blockGeometry;
public:
BlockLatticePhysBoundaryForce2D(BlockLatticeStructure2D& blockLattice,
BlockIndicatorF2D& indicatorF,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// functor returns pointwise phys force for PSM dynamics
template
class BlockLatticePSMPhysForce2D final : public BlockLatticePhysF2D {
public:
BlockLatticePSMPhysForce2D(BlockLatticeStructure2D& blockLattice,
const UnitConverter& converter,
int mode_);
bool operator() (T output[], const int input[]) override;
private:
Mode mode;
};
/// BlockLatticePhysBoundaryForce2D returns pointwise wall shear stress
template
class BlockLatticePhysWallShearStress2D final : public BlockLatticePhysF2D {
private:
BlockGeometryStructure2D& _blockGeometry;
const int _overlap;
const int _material;
std::vector>> _discreteNormal;
std::vector>> _normal;
T _physFactor;
public:
BlockLatticePhysWallShearStress2D(BlockLatticeStructure2D& blockLattice,
BlockGeometryStructure2D& blockGeometry,
int overlap,
int material,
const UnitConverter& converter,
IndicatorF2D& indicator);
bool operator() (T output[], const int input[]) override;
};
/**
* BlockLatticePhysCorrBoundaryForce2D returns 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 BlockLatticePhysCorrBoundaryForce2D final : public BlockLatticePhysF2D {
private:
BlockGeometry2D& _blockGeometry;
int _material;
public:
BlockLatticePhysCorrBoundaryForce2D(BlockLatticeStructure2D& blockLattice,
BlockGeometry2D& blockGeometry, int material,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/**
* BlockLatticePorosity2D returns pointwise, lattice-dependent porosity values in [0,1]
* in combination with (Extended)PorousBGKdynamics: 0->solid, 1->fluid.
*/
template
class BlockLatticePorosity2D final : public BlockLatticePhysF2D {
private:
BlockGeometryStructure2D& _blockGeometry;
int _material;
public:
BlockLatticePorosity2D(BlockLatticeStructure2D& blockLattice,
BlockGeometryStructure2D& blockGeometry, int material,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/**
* BlockLatticePhysPermeability2D returns pointwise mesh-independent permeability
* values in (0,inf) in combination with (Extended)PorousBGKdynamics
* note: result is cropped to 999999.
*/
template
class BlockLatticePhysPermeability2D final : public BlockLatticePhysF2D {
private:
BlockGeometryStructure2D& _blockGeometry;
int _material;
public:
BlockLatticePhysPermeability2D(BlockLatticeStructure2D& blockLattice,
BlockGeometryStructure2D& blockGeometry,
int material, const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// BlockLatticePhysDarcyForce2D computes pointwise -nu/K*u on the lattice. can be used with BlockSum2D as objective
template
class BlockLatticePhysDarcyForce2D final : public BlockLatticePhysF2D {
private:
BlockGeometry2D& _blockGeometry;
int _material;
public:
BlockLatticePhysDarcyForce2D(BlockLatticeStructure2D& blockLattice,
BlockGeometry2D& blockGeometry, int material,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/**
* BlockLatticeAverage2D returns pointwise local average of a passed functor with
* a given material and radius on local lattice.
* the output data must be of the same size and dimension like f.
*/
template
class BlockLatticeAverage2D final : public BlockLatticeF2D {
private:
BlockLatticeF2D& _f;
BlockGeometry2D& _blockGeometry;
int _material;
T _radius;
public:
BlockLatticeAverage2D(BlockLatticeF2D& f,
BlockGeometry2D& blockGeometry, int material, T radius);
bool operator() (T output[], const int input[]) override;
};
/// BlockL2Norm2D returns pointwise the l2-norm, e.g. of a velocity.
template
class BlockEuklidNorm2D final : public BlockF2D {
private:
BlockF2D& _f;
public:
BlockEuklidNorm2D(BlockF2D& f);
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 BlockLatticePorousMomentumLossForce2D final : public BlockLatticePhysF2D {
private:
BlockGeometryStructure2D& _blockGeometry;
std::vector* >& _vectorOfIndicator;
public:
BlockLatticePorousMomentumLossForce2D(BlockLatticeStructure2D& blockLattice,
BlockGeometryStructure2D& blockGeometry,
std::vector* >& indicator,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// BlockLatticePhysTemperature2D returns pointwise phys temperature from rho on local lattices.
template
class BlockLatticePhysTemperature2D final : public BlockLatticeThermalPhysF2D {
public:
BlockLatticePhysTemperature2D(BlockLatticeStructure2D& blockLattice,
ThermalUnitConverter const& converter);
bool operator() (T output[], const int input[]);
};
/// BlockLatticePhysHeatFlux2D returns pointwise phys heat flux on local lattice.
template
class BlockLatticePhysHeatFlux2D final : public BlockLatticeThermalPhysF2D {
public:
BlockLatticePhysHeatFlux2D(BlockLatticeStructure2D& blockLattice,
const ThermalUnitConverter& converter);
bool operator() (T output[], const int input[]) override;
private:
T _temp; // contains latticeSpecificHeatCapacity * (tau - 0.5) / tau
};
/// functor that returns 1 if SmoothIndicatorF A intersects IndicatorF B; otherwise, 0
template
class BlockLatticeIndicatorSmoothIndicatorIntersection2D final : public BlockLatticeF2D {
private:
BlockGeometryStructure2D& _blockGeometry;
IndicatorF2D& _normalInd;
SmoothIndicatorF2D& _smoothInd;
public:
BlockLatticeIndicatorSmoothIndicatorIntersection2D( BlockLatticeStructure2D& blockLattice,
BlockGeometryStructure2D& blockGeometry,
IndicatorF2D& normalInd, SmoothIndicatorF2D& smoothInd );
bool operator() (T output[], const int input[]) override;
};
/// Returns pointwise porosity on local lattices for Guo & Zhao (2002)'s model.
template
class BlockLatticeGuoZhaoEpsilon2D final : public BlockLatticeF2D {
public:
BlockLatticeGuoZhaoEpsilon2D(BlockLatticeStructure2D& blockLattice);
bool operator() (T output[], const int input[]) override;
};
/// Returns pointwise porous conductivity on local lattices for Guo & Zhao (2002)'s model.
template
class BlockLatticeGuoZhaoPhysK2D final : public BlockLatticePhysF2D {
public:
BlockLatticeGuoZhaoPhysK2D(BlockLatticeStructure2D& blockLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
/// Returns pointwise body force on local lattices for Guo & Zhao (2002)'s model.
template
class BlockLatticeGuoZhaoPhysBodyForce2D final : public BlockLatticePhysF2D {
public:
BlockLatticeGuoZhaoPhysBodyForce2D(BlockLatticeStructure2D& blockLattice,
const UnitConverter& converter);
bool operator() (T output[], const int input[]) override;
};
} // end namespace olb
#endif