OpenLB 1.7
Loading...
Searching...
No Matches
superLatticeInteraction.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2021 Nicolas Hafen, Mathias J. Krause
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 SUPER_LATTICE_INTERACTION_HH
25#define SUPER_LATTICE_INTERACTION_HH
26
28
29namespace olb {
30
31namespace particles {
32
33template<typename T, typename DESCRIPTOR, typename PARTICLETYPE>
36 UnitConverter<T,DESCRIPTOR> const& converter,
38 const Vector<bool,DESCRIPTOR::d>& periodicity )
39{
40 constexpr unsigned D = DESCRIPTOR::d;
41 const PhysR<T,D> min = communication::getCuboidMin<T,D>(sGeometry.getCuboidGeometry());
42 const PhysR<T,D> max = communication::getCuboidMax<T,D>(sGeometry.getCuboidGeometry(), min);
43
44
45 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
46 if ( isPeriodic(periodicity) ) {
48 sLattice.getBlock(iC), converter, min, max,
49 particle, periodicity);
50 }
51 else {
53 sLattice.getBlock(iC), converter, particle);
54 }
55 }
56}
57
58template<typename T, typename DESCRIPTOR, typename PARTICLETYPE,
59 typename PARTICLECONTACTTYPE, typename WALLCONTACTTYPE, typename F>
61 const PhysR<T,DESCRIPTOR::d>& min,
62 const PhysR<T,DESCRIPTOR::d>& max,
64 UnitConverter<T,DESCRIPTOR> const& converter,
65 ParticleSystem<T,PARTICLETYPE>& particleSystem,
67 const size_t iP,
69 std::vector<SolidBoundary<T,DESCRIPTOR::d>>& solidBoundaries,
70 F getSetupPeriodicity,
71 int globaliC)
72{
73 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
74 if(globaliC == sLattice.getLoadBalancer().glob(iC)
75 || !particles::access::providesParallelization<PARTICLETYPE>()) {
76 if constexpr ( isPeriodic(getSetupPeriodicity()) ) {
78 sLattice.getBlock(iC), converter, min, max,
79 particleSystem, contactContainer, iP,
80 particle, solidBoundaries, getSetupPeriodicity);
81 }
82 else {
84 sLattice.getBlock(iC), converter, particleSystem, contactContainer,
85 iP, particle, solidBoundaries);
86 }
87 }
88 }
89}
90
91template<typename T, typename DESCRIPTOR>
94{
95 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
96 resetBlockParticleField( sGeometry.getBlockGeometry(iC), sLattice.getBlock(iC));
97 }
98}
99
100//TODO: HOTFIX ONLY
101template<typename T, typename DESCRIPTOR>
104{
105 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
106 resetBlockContactField( sGeometry.getBlockGeometry(iC), sLattice.getBlock(iC));
107 }
108}
109
110} // namespace particles
111
112} // namespace olb
113
114#endif
Representation of a statistic for a parallel 2D geometry.
BlockGeometry< T, D > & getBlockGeometry(int locIC)
Read and write access to a single block geometry.
Super class maintaining block lattices for a cuboid decomposition.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
CuboidGeometry< T, D > & getCuboidGeometry()
Read and write access to cuboid geometry.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Conversion between physical and lattice units, as well as discretization.
Plain old scalar vector.
Definition vector.h:47
void resetContactField(SuperGeometry< T, DESCRIPTOR::d > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice)
void resetBlockParticleField(const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice)
constexpr bool isPeriodic(const Vector< bool, D > &periodic)
void setBlockParticleField(const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice, UnitConverter< T, DESCRIPTOR > const &converter, Particle< T, PARTICLETYPE > &particle)
void resetBlockContactField(const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice)
void resetSuperParticleField(SuperGeometry< T, DESCRIPTOR::d > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice)
Reset particle field.
void setSuperParticleField(const SuperGeometry< T, DESCRIPTOR::d > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, UnitConverter< T, DESCRIPTOR > const &converter, Particle< T, PARTICLETYPE > &particle, const Vector< bool, DESCRIPTOR::d > &periodicity)
Set particle field with peridic support.
Top level namespace for all of OpenLB.