/* 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 -- header file.
*/
#ifndef OFF_BOUNDARY_CONDITION_2D_H
#define OFF_BOUNDARY_CONDITION_2D_H
#include
#include "core/blockLatticeStructure2D.h"
#include "core/blockLatticeStructure2D.h"
#include "offBoundaryCondition2D.h"
#include "dynamics/dynamics.h"
#include "geometry/blockGeometryStatistics2D.h"
#include "io/stlReader.h"
namespace olb {
/**
* This class provides a general off lattice boundary condition
*/
template
class OffLatticeBoundaryCondition2D {
protected:
T _epsFraction;
public:
virtual ~OffLatticeBoundaryCondition2D() { }
/// Using Bouzidi BC OnePoint corresponds to Bounce Back and TwoPoint to linear interpolation
virtual void addOnePointZeroVelocityBoundary(int iX, int iY, int iPop, T dist) =0;
virtual void addTwoPointZeroVelocityBoundary(int iX, int iY, int iPop, T dist) =0;
virtual void addOnePointVelocityBoundary(int iX, int iY, int iPop, T dist) =0;
virtual void addTwoPointVelocityBoundary(int iX, int iY, int iPop, T dist) =0;
virtual void addOffDynamics(int iX, int iY, T location[DESCRIPTOR::d]) =0;
virtual void addOffDynamics(int iX, int iY, T location[DESCRIPTOR::d], T distances[DESCRIPTOR::q]) =0;
virtual void addOffDynamics(BlockIndicatorF2D& indicator) =0;
virtual void addZeroVelocityBoundary(BlockGeometryStructure2D& blockGeometryStructure, int iX, int iY, int iPop, T dist) =0;
virtual void addZeroVelocityBoundary(BlockGeometryStructure2D& blockGeometryStructure, int iX, int iY, BlockIndicatorF2D& bulkIndicator, IndicatorF2D& geometryIndicator) =0;
virtual void addZeroVelocityBoundary(BlockIndicatorF2D& boundaryIndicator, BlockIndicatorF2D& bulkIndicator, IndicatorF2D& geometryIndicator) =0;
virtual void addZeroVelocityBoundary(BlockIndicatorF2D& boundaryIndicator, BlockIndicatorF2D& bulkIndicator) =0;
virtual void addVelocityBoundary(BlockGeometryStructure2D& blockGeometryStructure, int x, int y, int iPop, T dist) =0;
virtual void addVelocityBoundary(BlockGeometryStructure2D& blockGeometryStructure, int iX, int iY, BlockIndicatorF2D& bulkIndicator, IndicatorF2D& geometryIndicator) =0;
virtual void addVelocityBoundary(BlockIndicatorF2D& boundaryIndicator, BlockIndicatorF2D& bulkIndicator, IndicatorF2D& geometryIndicator) =0;
virtual void addVelocityBoundary(BlockIndicatorF2D& boundaryIndicator, BlockIndicatorF2D& bulkIndicator) =0;
virtual void addPressureBoundary(BlockIndicatorF2D& boundaryIndicator, BlockIndicatorF2D& bulkIndicator, IndicatorF2D& geometryIndicator) =0;
virtual void addPressureBoundary(BlockIndicatorF2D& boundaryIndicator, BlockIndicatorF2D& bulkIndicator) =0;
virtual void defineU(int iX, int iY, int iPop, const T u[DESCRIPTOR::d]) =0;
virtual void defineU(BlockIndicatorF2D& indicator, BlockIndicatorF2D& bulkIndicator, AnalyticalF2D& u) =0;
virtual void defineRho(int iX, int iY, int iPop, const T rho) =0;
virtual void defineRho(BlockIndicatorF2D& indicator, BlockIndicatorF2D& bulkIndicator, AnalyticalF2D& rho) =0;
/**
* \name Convenience wrappers for boundary functions
* \{
**/
void addOffDynamics(BlockGeometryStructure2D& blockGeometryStructure, int material);
void addZeroVelocityBoundary(BlockGeometryStructure2D& blockGeometryStructure, int iX, int iY, IndicatorF2D& geometryIndicator, std::vector bulkMaterials = std::vector(1,1));
void addZeroVelocityBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, IndicatorF2D& geometryIndicator, std::vector bulkMaterials = std::vector(1,1));
void addZeroVelocityBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, std::vector bulkMaterials = std::vector(1,1));
void addVelocityBoundary(BlockGeometryStructure2D& blockGeometryStructure, int iX, int iY, IndicatorF2D& geometryIndicator, std::vector bulkMaterials = std::vector(1,1));
void addVelocityBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, IndicatorF2D& geometryIndicator, std::vector bulkMaterials = std::vector(1,1));
void addVelocityBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, std::vector bulkMaterials = std::vector(1,1));
void addPressureBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, IndicatorF2D& geometryIndicator, std::vector bulkMaterials = std::vector(1,1));
void addPressureBoundary(BlockGeometryStructure2D& blockGeometryStructure, int material, std::vector bulkMaterials = std::vector(1,1));
void defineU(BlockGeometryStructure2D& blockGeometryStructure, int material, AnalyticalF2D& u, std::vector bulkMaterials = std::vector(1,1) );
void defineRho(BlockGeometryStructure2D& blockGeometryStructure, int material, AnalyticalF2D& rho, std::vector bulkMaterials = std::vector(1,1) );
///\}
virtual BlockLatticeStructure2D& getBlock() =0;
virtual BlockLatticeStructure2D const& getBlock() const =0;
virtual void outputOn() =0;
virtual void outputOff() =0;
};
////////// Factory functions //////////////////////////////////////////////////
/**
* Create specific off lattice boundary conditions
*/
template >
OffLatticeBoundaryCondition2D*
createBouzidiBoundaryCondition2D(BlockLatticeStructure2D& block);
template
OffLatticeBoundaryCondition2D*
createBounceBackBoundaryCondition2D(BlockLatticeStructure2D& block)
{
return createBounceBackBoundaryCondition2D(block);
}
}
#endif