/* This file is part of the OpenLB library
*
* Copyright (C) 2012 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 3D boundaries -- generic implementation.
*/
#ifndef OFF_BOUNDARY_CONDITION_3D_HH
#define OFF_BOUNDARY_CONDITION_3D_HH
#include "offBoundaryCondition3D.h"
#include "offBoundaryInstantiator3D.h"
#include "offBoundaryPostProcessors3D.h"
#include "functors/lattice/indicator/blockIndicatorF3D.h"
namespace olb {
/**
* Boundary Managers provide specific Boundary Processors by creating them
*/
template
class BouzidiBoundaryManager3D {
public:
static PostProcessorGenerator3D*
getOnePointZeroVelocityBoundaryProcessor(int x, int y, int z, int iPop, T dist);
static PostProcessorGenerator3D*
getTwoPointZeroVelocityBoundaryProcessor(int x, int y, int z, int iPop, T dist);
static PostProcessorGenerator3D*
getOnePointVelocityBoundaryProcessor(int x, int y, int z, int iPop, T dist);
static PostProcessorGenerator3D*
getTwoPointVelocityBoundaryProcessor(int x, int y, int z, int iPop, T dist);
static Dynamics*
getOffDynamics(T location[DESCRIPTOR::d]);
static Dynamics*
getOffDynamics(T location[DESCRIPTOR::d], T distances[DESCRIPTOR::q]);
};
////////// BouzidiBoundaryManager3D /////////////////////////////////////////
template
PostProcessorGenerator3D*
BouzidiBoundaryManager3D::
getOnePointZeroVelocityBoundaryProcessor(int x, int y, int z, int iPop, T dist)
{
return new ZeroVelocityBounceBackPostProcessorGenerator3D
(x, y, z, iPop, dist);
}
template
PostProcessorGenerator3D*
BouzidiBoundaryManager3D::
getTwoPointZeroVelocityBoundaryProcessor(int x, int y, int z, int iPop, T dist)
{
return new ZeroVelocityBouzidiLinearPostProcessorGenerator3D
(x, y, z, iPop, dist);
}
template
PostProcessorGenerator3D*
BouzidiBoundaryManager3D::
getOnePointVelocityBoundaryProcessor(int x, int y, int z, int iPop, T dist)
{
return new VelocityBounceBackPostProcessorGenerator3D
(x, y, z, iPop, dist);
}
template
PostProcessorGenerator3D*
BouzidiBoundaryManager3D::
getTwoPointVelocityBoundaryProcessor(int x, int y, int z, int iPop, T dist)
{
return new VelocityBouzidiLinearPostProcessorGenerator3D
(x, y, z, iPop, dist);
}
template
Dynamics*
BouzidiBoundaryManager3D::
getOffDynamics(T location[DESCRIPTOR::d])
{
return new OffDynamics(location);
}
template
Dynamics*
BouzidiBoundaryManager3D::
getOffDynamics(T location[DESCRIPTOR::d], T distances[DESCRIPTOR::q])
{
return new OffDynamics(location, distances);
}
////////// Convenience wrappers for boundary functions ////////////////////////
template
void OffLatticeBoundaryCondition3D::addOffDynamics(
BlockGeometryStructure3D& blockGeometryStructure, int material)
{
BlockIndicatorMaterial3D indicator(blockGeometryStructure, material);
addOffDynamics(indicator);
}
template
void OffLatticeBoundaryCondition3D::addZeroVelocityBoundary(
BlockGeometryStructure3D& blockGeometryStructure, int material,
IndicatorF3D& geometryIndicator, std::vector bulkMaterials)
{
BlockIndicatorMaterial3D bulkIndicator(blockGeometryStructure, bulkMaterials);
BlockIndicatorMaterial3D boundaryIndicator(blockGeometryStructure, material);
addZeroVelocityBoundary(boundaryIndicator, bulkIndicator, geometryIndicator);
}
template
void OffLatticeBoundaryCondition3D::addVelocityBoundary(
BlockGeometryStructure3D& blockGeometryStructure, int material,
IndicatorF3D& geometryIndicator, std::vector bulkMaterials)
{
BlockIndicatorMaterial3D boundaryIndicator(blockGeometryStructure, material);
BlockIndicatorMaterial3D bulkIndicator(blockGeometryStructure, bulkMaterials);
addVelocityBoundary(boundaryIndicator, bulkIndicator, geometryIndicator);
}
template
void OffLatticeBoundaryCondition3D::defineU(
BlockGeometryStructure3D& blockGeometryStructure, int material,
AnalyticalF3D& u, std::vector bulkMaterials)
{
BlockIndicatorMaterial3D indicator(blockGeometryStructure, material);
BlockIndicatorMaterial3D bulkIndicator(blockGeometryStructure, bulkMaterials);
defineU(indicator, bulkIndicator, u);
}
////////// Factory functions //////////////////////////////////////////////////
template
OffLatticeBoundaryCondition3D*
createBouzidiBoundaryCondition3D(BlockLatticeStructure3D& block)
{
return new OffBoundaryConditionInstantiator3D <
T, DESCRIPTOR,
BouzidiBoundaryManager3D > (block);
}
} // namespace olb
#endif