/* This file is part of the OpenLB library
*
* Copyright (C) 2008 Orestis Malaspinas, Andrea Parmigiani
* 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 ADVECTION_DIFFUSION_BOUNDARY_CONDITION_3D_HH
#define ADVECTION_DIFFUSION_BOUNDARY_CONDITION_3D_HH
#include "advectionDiffusionBoundaries.h"
#include "advectionDiffusionBoundaries.hh"
#include "advectionDiffusionBoundaryCondition3D.h"
#include "advectionDiffusionBoundaryInstantiator3D.h"
#include "advectionDiffusionBoundaryInstantiator3D.hh"
#include "momentaOnBoundaries.h"
#include "functors/lattice/indicator/blockIndicatorF3D.h"
#include "advectionDiffusionMomentaOnBoundaries.h"
#include "advectionDiffusionMomentaOnBoundaries.hh"
namespace olb {
template
class AdvectionDiffusionBoundaryManager3D {
public:
template
static Momenta* getTemperatureBoundaryMomenta();
template
static Dynamics* getTemperatureBoundaryDynamics(T omega, Momenta& momenta);
template
static PostProcessorGenerator3D* getTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1, int z0, int z1);
template
static Momenta* getTemperatureBoundaryEdgeMomenta();
template
static Dynamics* getTemperatureBoundaryEdgeDynamics(T omega, Momenta& momenta);
template
static PostProcessorGenerator3D* getTemperatureBoundaryEdgeProcessor(int x0, int x1, int y0, int y1, int z0, int z1);
template
static Momenta* getTemperatureBoundaryCornerMomenta();
template
static Dynamics* getTemperatureBoundaryCornerDynamics(T omega, Momenta& momenta);
template
static PostProcessorGenerator3D* getTemperatureBoundaryCornerProcessor(int x, int y, int z);
};
//================== Flat ================================
template
template
Momenta* AdvectionDiffusionBoundaryManager3D::
getTemperatureBoundaryMomenta()
{
return new EquilibriumBM;
}
template
template
Dynamics* AdvectionDiffusionBoundaryManager3D::
getTemperatureBoundaryDynamics(T omega, Momenta& momenta)
{
return new AdvectionDiffusionBoundariesDynamics(omega, momenta);
}
template
template
PostProcessorGenerator3D* AdvectionDiffusionBoundaryManager3D::
getTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1, int z0, int z1)
{
return nullptr;
}
//================== Edges ================================
template
template
Momenta* AdvectionDiffusionBoundaryManager3D::
getTemperatureBoundaryEdgeMomenta()
{
return new EquilibriumBM;
}
template
template
Dynamics* AdvectionDiffusionBoundaryManager3D::
getTemperatureBoundaryEdgeDynamics(T omega, Momenta& momenta)
{
return new AdvectionDiffusionEdgesDynamics(omega, momenta);
}
template
template
PostProcessorGenerator3D* AdvectionDiffusionBoundaryManager3D::
getTemperatureBoundaryEdgeProcessor(int x0, int x1, int y0, int y1, int z0, int z1)
{
return nullptr;
}
//================== Corners ================================
template
template
Momenta* AdvectionDiffusionBoundaryManager3D::
getTemperatureBoundaryCornerMomenta()
{
return new EquilibriumBM;
}
template
template
Dynamics* AdvectionDiffusionBoundaryManager3D::
getTemperatureBoundaryCornerDynamics(T omega, Momenta& momenta)
{
return new AdvectionDiffusionCornerDynamics3D(omega, momenta);
}
template
template
PostProcessorGenerator3D* AdvectionDiffusionBoundaryManager3D::
getTemperatureBoundaryCornerProcessor(int x, int y, int z)
{
return nullptr;
}
//================== Convenience wrappers for boundary functions ======
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addTemperatureBoundary(
BlockGeometryStructure3D& blockGeometryStructure, int material,
int x0, int x1, int y0, int y1, int z0, int z1, T omega)
{
BlockIndicatorMaterial3D indicator(blockGeometryStructure, material);
addTemperatureBoundary(indicator, x0, x1, y0, y1, z0, z1, omega);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addTemperatureBoundary(
BlockIndicatorF3D& indicator, T omega, bool includeOuterCells)
{
auto& blockGeometryStructure = indicator.getBlockGeometryStructure();
const int margin = includeOuterCells ? 0 : 1;
addTemperatureBoundary(indicator,
margin, blockGeometryStructure.getNx()-1 -margin,
margin, blockGeometryStructure.getNy()-1 -margin,
margin, blockGeometryStructure.getNz()-1 -margin,
omega);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addTemperatureBoundary(
BlockGeometryStructure3D& blockGeometryStructure, int material, T omega, bool includeOuterCells)
{
BlockIndicatorMaterial3D indicator(blockGeometryStructure, material);
addTemperatureBoundary(indicator, omega, includeOuterCells);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addConvectionBoundary(
BlockGeometryStructure3D& blockGeometryStructure, int material,
int x0, int x1, int y0, int y1, int z0, int z1)
{
BlockIndicatorMaterial3D indicator(blockGeometryStructure, material);
addConvectionBoundary(indicator, x0, x1, y0, y1, z0, z1);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addConvectionBoundary(
BlockIndicatorF3D& indicator, bool includeOuterCells)
{
auto& blockGeometryStructure = indicator.getBlockGeometryStructure();
const int margin = includeOuterCells ? 0 : 1;
addConvectionBoundary(indicator,
margin, blockGeometryStructure.getNx()-1 -margin,
margin, blockGeometryStructure.getNy()-1 -margin,
margin, blockGeometryStructure.getNz()-1 -margin);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addConvectionBoundary(
BlockGeometryStructure3D& blockGeometryStructure, int material, bool includeOuterCells)
{
BlockIndicatorMaterial3D indicator(blockGeometryStructure, material);
addConvectionBoundary(indicator, includeOuterCells);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addExtFieldBoundary(
BlockGeometryStructure3D& blockGeometryStructure, int material,
int offset, int x0, int x1, int y0, int y1, int z0, int z1)
{
BlockIndicatorMaterial3D indicator(blockGeometryStructure, material);
addExtFieldBoundary(indicator, offset, x0, x1, y0, y1, z0, z1);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addExtFieldBoundary(
BlockIndicatorF3D& indicator, int offset, bool includeOuterCells)
{
auto& blockGeometryStructure = indicator.getBlockGeometryStructure();
const int margin = includeOuterCells ? 0 : 1;
addExtFieldBoundary(indicator, offset,
margin, blockGeometryStructure.getNx()-1 -margin,
margin, blockGeometryStructure.getNy()-1 -margin,
margin, blockGeometryStructure.getNz()-1 -margin);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addExtFieldBoundary(
BlockGeometryStructure3D& blockGeometryStructure, int material, int offset, bool includeOuterCells)
{
BlockIndicatorMaterial3D indicator(blockGeometryStructure, material);
addExtFieldBoundary(indicator, offset, includeOuterCells);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addZeroDistributionBoundary(
BlockGeometryStructure3D& blockGeometryStructure, int material,
int x0, int x1, int y0, int y1, int z0, int z1)
{
BlockIndicatorMaterial3D indicator(blockGeometryStructure, material);
addZeroDistributionBoundary(indicator, x0, x1, y0, y1, z0, z1);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addZeroDistributionBoundary(
BlockIndicatorF3D& indicator, bool includeOuterCells)
{
auto& blockGeometryStructure = indicator.getBlockGeometryStructure();
const int margin = includeOuterCells ? 0 : 1;
addZeroDistributionBoundary(indicator,
margin, blockGeometryStructure.getNx()-1 -margin,
margin, blockGeometryStructure.getNy()-1 -margin,
margin, blockGeometryStructure.getNz()-1 -margin);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition3D::addZeroDistributionBoundary(
BlockGeometryStructure3D& blockGeometryStructure, int material, bool includeOuterCells)
{
BlockIndicatorMaterial3D indicator(blockGeometryStructure, material);
addZeroDistributionBoundary(indicator, includeOuterCells);
}
//================== Factory functions ================================
template
OnLatticeAdvectionDiffusionBoundaryCondition3D*
createAdvectionDiffusionBoundaryCondition3D(BlockLatticeStructure3D& block)
{
return new AdvectionDiffusionBoundaryConditionInstantiator3D > (block);
}
template
void createAdvectionDiffusionBoundaryCondition3D(sOnLatticeBoundaryCondition3D& sBC)
{
int nC = sBC.getSuperLattice().getLoadBalancer().size();
sBC.setOverlap(1);
for (int iC = 0; iC < nC; iC++) {
OnLatticeAdvectionDiffusionBoundaryCondition3D* blockBC =
createAdvectionDiffusionBoundaryCondition3D(
sBC.getSuperLattice().getExtendedBlockLattice(iC));
sBC.getADblockBCs().push_back(blockBC);
}
}
} // namespace olb
#endif