OpenLB 1.7
Loading...
Searching...
No Matches
defineU2D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2020 Alexander Schulz
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 DEFINE_U_2D_HH
25#define DEFINE_U_2D_HH
26
27#include "defineU2D.h"
28
29namespace olb {
30
31namespace legacy {
32
34template<typename T, typename DESCRIPTOR>
35void defineUBouzidi(SuperLattice<T, DESCRIPTOR>& sLattice, SuperGeometry<T,2>& superGeometry, int material,
37 std::vector<int> bulkMaterials)
38{
39 defineUBouzidi<T,DESCRIPTOR>(sLattice, superGeometry.getMaterialIndicator(material),
40 superGeometry.getMaterialIndicator(std::move(bulkMaterials)),
41 u);
42}
43
44template<typename T, typename DESCRIPTOR>
46 FunctorPtr<SuperIndicatorF2D<T>>&& bulkIndicator,
48{
49
50 for (int iCloc = 0; iCloc < sLattice.getLoadBalancer().size(); ++iCloc) {
51 defineUBouzidi<T,DESCRIPTOR>(sLattice.getBlockIndicator(iCloc), indicator->getBlockIndicatorF(iCloc),
52 bulkIndicator->getBlockIndicatorF(iCloc),
53 u);
54 }
55}
56
58
59template<typename T, typename DESCRIPTOR>
61{
62 block.forSpatialLocations([&](auto iX, auto iY) {
63 if (indicator(iX,iY)) {
64 for (int iPop = 1; iPop < DESCRIPTOR::q ; ++iPop) {
65 int iXn = iX + descriptors::c<DESCRIPTOR >(iPop,0);
66 int iYn = iY + descriptors::c<DESCRIPTOR >(iPop,1);
67 if (block.isInside({iXn,iYn}) && bulkIndicator(iXn, iYn)) {
68 T intersection[] = { T(), T() }; // coord. of intersection
69 int opp = descriptors::opposite<DESCRIPTOR >(iPop);
70 if (getBoundaryIntersection<T,DESCRIPTOR>(block, iX, iY, opp, intersection) ) {
71 T vel[]= {T(),T()};
72 u(vel,intersection);
73 defineUBouzidi<T,DESCRIPTOR>(iX, iY, opp, vel);
74 }
75 }
76 }
77 }
78 });
79}
80
81
82template<typename T, typename DESCRIPTOR>
83void defineUBouzidi(BlockLattice<T,DESCRIPTOR>& block, int iX, int iY, int iPop, const T u[DESCRIPTOR::d])
84{
85 bool _output = false;
86 OstreamManager clout(std::cout, "defineUBouzidi");
87 block.getDynamics(iX, iY)->defineU(iPop, u);
88 if (_output) {
89 clout << "defineUBouzidi(" << iX << ", " << iY << " )" << std::endl;
90 }
91}
92
93
94
95template<typename T, typename DESCRIPTOR>
96bool getBoundaryIntersection(BlockLattice<T,DESCRIPTOR>& block, int iX, int iY, int iPop, T point[DESCRIPTOR::d])
97{
98 return static_cast<legacy::OffDynamics<T,DESCRIPTOR>*>(block.getDynamics(iX,iY))->getBoundaryIntersection(iPop, point);
99}
100
101template<typename T, typename DESCRIPTOR>
102void setBoundaryIntersection(BlockLattice<T,DESCRIPTOR>& block, int iX, int iY, int iPop, T distance)
103{
104 bool _output = false;
105 OstreamManager clout(std::cout, "setBoundaryIntersection");
106 static_cast<legacy::OffDynamics<T,DESCRIPTOR>*>(block.getDynamics(iX,iY))->setBoundaryIntersection(iPop, distance);
107 if (_output) {
108 clout << "setBoundaryIntersection(" << iX << ", " << iY << " )" << std::endl;
109 }
110}
111
112}
113
114}//namespace olb
115
116#endif
AnalyticalF are applications from DD to XD, where X is set by the constructor.
Base block indicator functor (discrete)
Platform-abstracted block lattice for external access and inter-block interaction.
virtual Dynamics< T, DESCRIPTOR > * getDynamics(DynamicsPromise< T, DESCRIPTOR > &&)=0
Return pointer to dynamics yielded by promise.
void forSpatialLocations(F f) const
bool isInside(LatticeR< D > latticeR) const
Return whether location is valid.
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.
Super class maintaining block lattices for a cuboid decomposition.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Dynamics for offLattice boundary conditions OffDynamics are basically NoLatticeDynamics with the addi...
Definition dynamics.h:145
bool getBoundaryIntersection(BlockLattice< T, DESCRIPTOR > &block, int iX, int iY, int iPop, T point[DESCRIPTOR::d])
Definition defineU2D.hh:96
void defineUBouzidi(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 2 > &superGeometry, int material, AnalyticalF2D< T, T > &u, std::vector< int > bulkMaterials=std::vector< int >(1, 1))
Definition defineU2D.hh:35
void setBoundaryIntersection(BlockLattice< T, DESCRIPTOR > &block, int iX, int iY, int iPop, T distance)
Definition defineU2D.hh:102
Top level namespace for all of OpenLB.