/* This file is part of the OpenLB library
*
* Copyright (C) 2012, 2016 Jonas Kratzke, 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.
*/
/** \file
* A helper for initialising 2D boundaries -- generic implementation.
*/
#ifndef OFF_BOUNDARY_CONDITION_2D_HH
#define OFF_BOUNDARY_CONDITION_2D_HH
#include "offBoundaryCondition2D.h"
#include "offBoundaryInstantiator2D.h"
#include "offBoundaryPostProcessors2D.h"
namespace olb {
/**
* Boundary Managers provide specific Boundary Processors by creating them
*/
////////// BouzidiBoundaryManager2D /////////////////////////////////////////
template
class BouzidiBoundaryManager2D {
public:
static PostProcessorGenerator2D*
getOnePointZeroVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist);
static PostProcessorGenerator2D*
getTwoPointZeroVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist);
static PostProcessorGenerator2D*
getOnePointVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist);
static PostProcessorGenerator2D*
getTwoPointVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist);
static Dynamics*
getOffDynamics(T location[DESCRIPTOR::d]);
static Dynamics*
getOffDynamics(T location[DESCRIPTOR::d], T distances[DESCRIPTOR::q]);
};
template
PostProcessorGenerator2D*
BouzidiBoundaryManager2D::
getOnePointZeroVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist)
{
return new ZeroVelocityBounceBackPostProcessorGenerator2D
(iX, iY, iPop, dist);
}
template
PostProcessorGenerator2D*
BouzidiBoundaryManager2D::
getTwoPointZeroVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist)
{
return new ZeroVelocityBouzidiLinearPostProcessorGenerator2D
(iX, iY, iPop, dist);
}
template
PostProcessorGenerator2D*
BouzidiBoundaryManager2D::
getOnePointVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist)
{
return new VelocityBounceBackPostProcessorGenerator2D
(iX, iY, iPop, dist);
}
template
PostProcessorGenerator2D*
BouzidiBoundaryManager2D::
getTwoPointVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist)
{
return new VelocityBouzidiLinearPostProcessorGenerator2D
(iX, iY, iPop, dist);
}
template
Dynamics*
BouzidiBoundaryManager2D::
getOffDynamics(T location[DESCRIPTOR::d])
{
return new OffDynamics(location);
}
template
Dynamics*
BouzidiBoundaryManager2D::
getOffDynamics(T location[DESCRIPTOR::d], T distances[DESCRIPTOR::q])
{
return new OffDynamics(location, distances);
}
////////// BounceBackBoundaryManager2D /////////////////////////////////////////
template
class BounceBackBoundaryManager2D {
public:
static PostProcessorGenerator2D*
getOnePointZeroVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist);
static PostProcessorGenerator2D*
getTwoPointZeroVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist);
static PostProcessorGenerator2D*
getOnePointVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist);
static PostProcessorGenerator2D*
getTwoPointVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist);
static Dynamics*
getOffDynamics(T location[DESCRIPTOR::d]);
static Dynamics*
getOffDynamics(T location[DESCRIPTOR::d], T distances[DESCRIPTOR::q]);
};
template
PostProcessorGenerator2D*
BounceBackBoundaryManager2D::
getOnePointZeroVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist)
{
return new ZeroVelocityBounceBackPostProcessorGenerator2D
(iX, iY, iPop, dist);
}
template
PostProcessorGenerator2D*
BounceBackBoundaryManager2D::
getTwoPointZeroVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist)
{
return new ZeroVelocityBouzidiLinearPostProcessorGenerator2D
(iX, iY, iPop, dist);
}
template
PostProcessorGenerator2D*
BounceBackBoundaryManager2D::
getOnePointVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist)
{
return new VelocityBounceBackPostProcessorGenerator2D
(iX, iY, iPop, dist);
}
template
PostProcessorGenerator2D*
BounceBackBoundaryManager2D::
getTwoPointVelocityBoundaryProcessor(int iX, int iY, int iPop, T dist)
{
return new VelocityBouzidiLinearPostProcessorGenerator2D
(iX, iY, iPop, dist);
}
template
Dynamics*
BounceBackBoundaryManager2D::
getOffDynamics(T location[DESCRIPTOR::d])
{
return new OffDynamics(location);
}
template
Dynamics*
BounceBackBoundaryManager2D::
getOffDynamics(T location[DESCRIPTOR::d], T distances[DESCRIPTOR::q])
{
return new OffDynamics(location, distances);
}
////////// Convenience wrappers for boundary functions ////////////////////////
template
void OffLatticeBoundaryCondition2D::addOffDynamics(
BlockGeometryStructure2D& blockGeometryStructure, int material)
{
BlockIndicatorMaterial2D indicator(blockGeometryStructure, material);
addOffDynamics(indicator);
}
template
void OffLatticeBoundaryCondition2D::addZeroVelocityBoundary(
BlockGeometryStructure2D& blockGeometryStructure, int iX, int iY,
IndicatorF2D& geometryIndicator, std::vector bulkMaterials)
{
BlockIndicatorMaterial2D bulkIndicator(blockGeometryStructure, bulkMaterials);
addZeroVelocityBoundary(blockGeometryStructure, iX, iY,
bulkIndicator, geometryIndicator);
}
template
void OffLatticeBoundaryCondition2D::addZeroVelocityBoundary(
BlockGeometryStructure2D& blockGeometryStructure, int material,
IndicatorF2D& geometryIndicator, std::vector bulkMaterials)
{
BlockIndicatorMaterial2D boundaryIndicator(blockGeometryStructure, material);
BlockIndicatorMaterial2D bulkIndicator(blockGeometryStructure, bulkMaterials);
addZeroVelocityBoundary(boundaryIndicator,
bulkIndicator,
geometryIndicator);
}
template
void OffLatticeBoundaryCondition2D::addZeroVelocityBoundary(
BlockGeometryStructure2D& blockGeometryStructure, int material, std::vector bulkMaterials)
{
BlockIndicatorMaterial2D boundaryIndicator(blockGeometryStructure, material);
BlockIndicatorMaterial2D bulkIndicator(blockGeometryStructure, bulkMaterials);
addZeroVelocityBoundary(boundaryIndicator, bulkIndicator);
}
template
void OffLatticeBoundaryCondition2D::addVelocityBoundary(
BlockGeometryStructure2D& blockGeometryStructure, int iX, int iY,
IndicatorF2D& geometryIndicator, std::vector bulkMaterials)
{
BlockIndicatorMaterial2D bulkIndicator(blockGeometryStructure, bulkMaterials);
addVelocityBoundary(blockGeometryStructure, iX, iY,
bulkIndicator, geometryIndicator);
}
template
void OffLatticeBoundaryCondition2D::addVelocityBoundary(
BlockGeometryStructure2D& blockGeometryStructure, int material, IndicatorF2D& geometryIndicator, std::vector bulkMaterials)
{
BlockIndicatorMaterial2D boundaryIndicator(blockGeometryStructure, material);
BlockIndicatorMaterial2D bulkIndicator(blockGeometryStructure, bulkMaterials);
addVelocityBoundary(boundaryIndicator, bulkIndicator, geometryIndicator);
}
template
void OffLatticeBoundaryCondition2D::addVelocityBoundary(
BlockGeometryStructure2D& blockGeometryStructure, int material, std::vector bulkMaterials)
{
BlockIndicatorMaterial2D boundaryIndicator(blockGeometryStructure, material);
BlockIndicatorMaterial2D bulkIndicator(blockGeometryStructure, bulkMaterials);
addVelocityBoundary(boundaryIndicator, bulkIndicator);
}
template
void OffLatticeBoundaryCondition2D::addPressureBoundary(
BlockGeometryStructure2D& blockGeometryStructure, int material,
IndicatorF2D& geometryIndicator, std::vector bulkMaterials)
{
BlockIndicatorMaterial2D boundaryIndicator(blockGeometryStructure, material);
BlockIndicatorMaterial2D bulkIndicator(blockGeometryStructure, bulkMaterials);
addPressureBoundary(boundaryIndicator, bulkIndicator, geometryIndicator);
}
template
void OffLatticeBoundaryCondition2D::addPressureBoundary(
BlockGeometryStructure2D& blockGeometryStructure, int material, std::vector bulkMaterials)
{
BlockIndicatorMaterial2D boundaryIndicator(blockGeometryStructure, material);
BlockIndicatorMaterial2D bulkIndicator(blockGeometryStructure, bulkMaterials);
addPressureBoundary(boundaryIndicator, bulkIndicator);
}
template
void OffLatticeBoundaryCondition2D::
defineU(BlockGeometryStructure2D& blockGeometryStructure, int material,
AnalyticalF2D& u, std::vector bulkMaterials)
{
BlockIndicatorMaterial2D indicator(blockGeometryStructure, material);
BlockIndicatorMaterial2D bulkIndicator(blockGeometryStructure, bulkMaterials);
defineU(indicator, bulkIndicator, u);
}
template
void OffLatticeBoundaryCondition2D::
defineRho(BlockGeometryStructure2D& blockGeometryStructure, int material,
AnalyticalF2D& rho, std::vector bulkMaterials)
{
BlockIndicatorMaterial2D indicator(blockGeometryStructure, material);
BlockIndicatorMaterial2D bulkIndicator(blockGeometryStructure, bulkMaterials);
defineRho(indicator, bulkIndicator, rho);
}
////////// Factory functions //////////////////////////////////////////////////
template
OffLatticeBoundaryCondition2D*
createBouzidiBoundaryCondition2D(BlockLatticeStructure2D& block)
{
return new OffBoundaryConditionInstantiator2D <
T, DESCRIPTOR,
BouzidiBoundaryManager2D > (block);
}
} // namespace olb
#endif