/* 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 2D boundaries -- generic implementation.
*/
#ifndef ADVECTION_DIFFUSION_BOUNDARY_CONDITION_2D_HH
#define ADVECTION_DIFFUSION_BOUNDARY_CONDITION_2D_HH
#include "advectionDiffusionBoundaries.h"
#include "advectionDiffusionBoundaries.hh"
#include "advectionDiffusionMomentaOnBoundaries.h"
#include "advectionDiffusionMomentaOnBoundaries.hh"
#include "advectionDiffusionBoundaryCondition2D.h"
#include "advectionDiffusionBoundaryInstantiator2D.h"
#include "functors/lattice/indicator/blockIndicatorF2D.h"
namespace olb {
////////// AdvectionDiffusionBoundaryManager2D /////////////////////////////////////////
template
template
Momenta*
AdvectionDiffusionBoundaryManager2D::getTemperatureBoundaryMomenta()
{
return new EquilibriumBM;
// return new RegularizedTemperatureBM;
}
template
template
Dynamics* AdvectionDiffusionBoundaryManager2D::
getTemperatureBoundaryDynamics(T omega, Momenta& momenta)
{
return new AdvectionDiffusionBoundariesDynamics(omega, momenta);
}
template
template
PostProcessorGenerator2D*
AdvectionDiffusionBoundaryManager2D::
getTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1)
{
return nullptr;
}
//================== Corners ================================
template
template
Momenta*
AdvectionDiffusionBoundaryManager2D::getTemperatureCornerMomenta()
{
return new EquilibriumBM;
}
template
template
Dynamics* AdvectionDiffusionBoundaryManager2D::
getTemperatureCornerDynamics(T omega, Momenta& momenta)
{
return new AdvectionDiffusionCornerDynamics2D(omega, momenta);
}
template
template
PostProcessorGenerator2D*
AdvectionDiffusionBoundaryManager2D::
getTemperatureCornerProcessor(int x, int y)
{
return nullptr;
}
template
template
Momenta*
AdvectionDiffusionBoundaryManager2D::getRegularizedTemperatureBoundaryMomenta()
{
return new RegularizedTemperatureBM;
}
template
template
Dynamics* AdvectionDiffusionBoundaryManager2D::
getRegularizedTemperatureBoundaryDynamics(T omega, Momenta& momenta)
{
return new CombinedAdvectionDiffusionRLBdynamics(omega, momenta);
}
template
template
PostProcessorGenerator2D*
AdvectionDiffusionBoundaryManager2D::
getRegularizedTemperatureBoundaryProcessor(int x0, int x1, int y0, int y1)
{
return nullptr;
}
//================== Corners ================================
template
template
Momenta*
AdvectionDiffusionBoundaryManager2D::getRegularizedTemperatureCornerMomenta()
{
return new EquilibriumBM;
}
template
template
Dynamics* AdvectionDiffusionBoundaryManager2D::
getRegularizedTemperatureCornerDynamics(T omega, Momenta& momenta)
{
return new AdvectionDiffusionCornerDynamics2D(omega, momenta);
}
template
template
PostProcessorGenerator2D*
AdvectionDiffusionBoundaryManager2D::
getRegularizedTemperatureCornerProcessor(int x, int y)
{
return nullptr;
}
////////// Convenience wrappers for boundary functions ////////////////////////
template
void OnLatticeAdvectionDiffusionBoundaryCondition2D::addTemperatureBoundary(
BlockGeometryStructure2D& blockGeometryStructure, int material,
int x0, int x1, int y0, int y1, T omega)
{
BlockIndicatorMaterial2D indicator(blockGeometryStructure, material);
addTemperatureBoundary(indicator, x0, x1, y0, y1, omega);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition2D::addTemperatureBoundary(
BlockIndicatorF2D& 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,
omega);
}
template
void OnLatticeAdvectionDiffusionBoundaryCondition2D::addTemperatureBoundary(
BlockGeometryStructure2D& blockGeometryStructure, int material,
T omega, bool includeOuterCells)
{
BlockIndicatorMaterial2D indicator(blockGeometryStructure, material);
addTemperatureBoundary(indicator, omega, includeOuterCells);
}
template
template
Momenta*
AdvectionDiffusionBoundaryManager2D::getRegularizedHeatFluxBoundaryMomenta(T *heatFlux)
{
return new RegularizedHeatFluxBM(heatFlux);
}
template
template
Dynamics* AdvectionDiffusionBoundaryManager2D::
getRegularizedHeatFluxBoundaryDynamics(T omega, Momenta& momenta)
{
return new CombinedAdvectionDiffusionRLBdynamics(omega, momenta);
}
template
template
PostProcessorGenerator2D*
AdvectionDiffusionBoundaryManager2D::
getRegularizedHeatFluxBoundaryProcessor(int x0, int x1, int y0, int y1)
{
return nullptr;
}
//================== Corners ================================
template
template
Momenta*
AdvectionDiffusionBoundaryManager2D::getRegularizedHeatFluxCornerMomenta()
{
return new EquilibriumBM;
}
template
template
Dynamics* AdvectionDiffusionBoundaryManager2D::
getRegularizedHeatFluxCornerDynamics(T omega, Momenta& momenta)
{
return new AdvectionDiffusionCornerDynamics2D(omega, momenta);
}
template
template
PostProcessorGenerator2D*
AdvectionDiffusionBoundaryManager2D::
getRegularizedHeatFluxCornerProcessor(int x, int y)
{
return nullptr;
}
////////// Factory functions //////////////////////////////////////////////////
template
OnLatticeAdvectionDiffusionBoundaryCondition2D*
createAdvectionDiffusionBoundaryCondition2D(BlockLatticeStructure2D& block)
{
return new AdvectionDiffusionBoundaryConditionInstantiator2D > (block);
}
template
void createAdvectionDiffusionBoundaryCondition2D(sOnLatticeBoundaryCondition2D& sBC)
{
int nC = sBC.getSuperLattice().getLoadBalancer().size();
sBC.setOverlap(1);
for (int iC = 0; iC < nC; iC++) {
OnLatticeAdvectionDiffusionBoundaryCondition2D* blockBC =
createAdvectionDiffusionBoundaryCondition2D(
sBC.getSuperLattice().getExtendedBlockLattice(iC));
sBC.getADblockBCs().push_back(blockBC);
}
}
} // namespace olb
#endif