OpenLB 1.7
Loading...
Searching...
No Matches
setBounceBackVelocityBoundary3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2020 Max Gaedtke
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#ifndef SET_BOUNCE_BACK_VELOCITY_BOUNDARY_3D_HH
25#define SET_BOUNCE_BACK_VELOCITY_BOUNDARY_3D_HH
26
28
29namespace olb {
30
31
33template<typename T,typename DESCRIPTOR>
34void setBounceBackVelocityBoundary(SuperGeometry<T,3>& superGeometry, int material, T omega, SuperLattice<T, DESCRIPTOR>& sLattice)
35{
36 setBounceBackVelocityBoundary<T,DESCRIPTOR>(superGeometry.getMaterialIndicator(material),omega,sLattice);
37}
38
39template<typename T, typename DESCRIPTOR>
41{
42 OstreamManager clout(std::cout, "BounceBackVelocityBoundary");
43 bool includeOuterCells = false;
44 if (indicator->getSuperGeometry().getOverlap() == 1) {
45 includeOuterCells = true;
46 clout << "WARNING: overlap == 1, boundary conditions set on overlap despite unknown neighbor materials" << std::endl;
47 }
48 clout << sLattice.getLoadBalancer().size() <<"sLattice.getLoadBalancer.size()" << std::endl;
49 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
50 setBounceBackVelocityBoundary<T,DESCRIPTOR>(indicator->getBlockIndicatorF(iC),omega,includeOuterCells,sLattice.getBlock(iC));
51 }
52}
53
54
55
56template<typename T, typename DESCRIPTOR>
57void setBounceBackVelocityBoundary(BlockIndicatorF3D<T>& indicator, T omega, bool includeOuterCells,BlockLattice<T,DESCRIPTOR>& _block)
58{
59 auto& blockGeometryStructure = indicator.getBlockGeometry();
60 const int margin = includeOuterCells ? 0 : 1;
61 std::vector<int> discreteNormal(4,0);
62 T default_rho = 1.0;
63 T default_u[] = {0.0, 0.0, 0.0};
64 blockGeometryStructure.forSpatialLocations([&](auto iX, auto iY, auto iZ) {
65 if (blockGeometryStructure.getNeighborhoodRadius({iX, iY, iZ}) >= margin
66 && indicator(iX, iY, iZ)) {
67 Dynamics<T,DESCRIPTOR>* dynamics = nullptr;
68 PostProcessorGenerator3D<T,DESCRIPTOR>* postProcessor = nullptr;
69 dynamics = new BounceBackVelocity<T,DESCRIPTOR>(default_rho, default_u);
70
71 setBoundary(_block, iX,iY,iZ, dynamics, postProcessor);
72 }
73 });
74}
75
76}//namespace olb
77#endif
Base block indicator functor.
BlockGeometry< T, 3 > & getBlockGeometry()
Get underlying block geometry structure.
Platform-abstracted block lattice for external access and inter-block interaction.
Smart pointer for managing the various ways of passing functors around.
Definition functorPtr.h:60
class for marking output with some text
Representation of a statistic for a parallel 2D geometry.
std::unique_ptr< SuperIndicatorF< T, D > > getMaterialIndicator(std::vector< int > &&materials)
Returns a material indicator using the given vector of materials.
Base indicator functor (discrete)
Super class maintaining block lattices for a cuboid decomposition.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Top level namespace for all of OpenLB.
void setBounceBackVelocityBoundary(SuperGeometry< T, 3 > &superGeometry, int material, T omega, SuperLattice< T, DESCRIPTOR > &sLattice)
Initialising the setLocalVelocityBoundary function on the superLattice domain.
void setBoundary(BlockLattice< T, DESCRIPTOR > &block, int iX, int iY, Dynamics< T, DESCRIPTOR > *dynamics, PostProcessorGenerator2D< T, DESCRIPTOR > *postProcessor)
Interface for per-cell dynamics.
Definition interface.h:54
Dynamics constructed as a tuple of momenta, equilibrium and collision.
Definition interface.h:182