OpenLB 1.7
Loading...
Searching...
No Matches
defineU3D.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_3D_HH
25#define DEFINE_U_3D_HH
26
27#include "defineU3D.h"
28
29namespace olb {
30
31namespace legacy {
32
34template<typename T, typename DESCRIPTOR>
35void defineUBouzidi(SuperLattice<T,DESCRIPTOR>& sLattice, SuperGeometry<T,3>& superGeometry, int material,
36 AnalyticalF3D<T,T>& u, std::vector<int> bulkMaterials)
37{
38 defineUBouzidi<T,DESCRIPTOR>(sLattice, superGeometry.getMaterialIndicator(material), u, bulkMaterials);
39}
40
41
42template<typename T, typename DESCRIPTOR>
44 AnalyticalF3D<T,T>& u, std::vector<int> bulkMaterials)
45{
46 defineUBouzidi<T,DESCRIPTOR>(sLattice, std::forward<decltype(boundaryIndicator)>(boundaryIndicator),
47 boundaryIndicator->getSuperGeometry().getMaterialIndicator(std::move(bulkMaterials)),
48 u);
49}
50
51template<typename T, typename DESCRIPTOR>
54{
55
56 for (int iCloc = 0; iCloc < sLattice.getLoadBalancer().size(); ++iCloc) {
57 defineUBouzidi<T,DESCRIPTOR>(sLattice.getBlock(iCloc),
58 boundaryIndicator->getBlockIndicatorF(iCloc),
59 bulkIndicator->getBlockIndicatorF(iCloc),u);
60 }
61
62}
63
64
66template<typename T, typename DESCRIPTOR>
68{
69 _block.forSpatialLocations([&](auto iX, auto iY, auto iZ) {
70 if (indicator(iX,iY,iZ)) {
71 for (int q = 1; q < DESCRIPTOR::q ; ++q) {
72 // Get direction
73 const int iXn = iX + descriptors::c<DESCRIPTOR>(q,0);
74 const int iYn = iY + descriptors::c<DESCRIPTOR>(q,1);
75 const int iZn = iZ + descriptors::c<DESCRIPTOR>(q,2);
76 if (_block.isInside({iXn,iYn,iZn}) && bulkIndicator(iXn,iYn,iZn)) {
77 T intersection[3] = { };
78 const int opp = descriptors::opposite<DESCRIPTOR>(q);
79 if (getBoundaryIntersection<T,DESCRIPTOR>(_block, iX, iY, iZ, opp, intersection)) {
80 T vel[3]= { };
81 u(vel, intersection);
82 defineUBouzidi<T,DESCRIPTOR>(_block, iX, iY, iZ, opp, vel);
83 }
84 }
85 }
86 }
87 });
88}
89
90
91
92template<typename T, typename DESCRIPTOR>
93void defineUBouzidi(BlockLattice<T,DESCRIPTOR>& _block, int iX, int iY, int iZ, int iPop, const T u[DESCRIPTOR::d])
94{
95 OstreamManager clout(std::cout, "defineUBouzidi");
96 bool _output = false;
97 static_cast<legacy::OffDynamics<T,DESCRIPTOR>*>(_block.getDynamics(iX, iY, iZ))->defineU(iPop, u);
98 if (_output) {
99 clout << "defineUBouzidi(" << iX << ", " << iY << ", " << iZ << " )" << std::endl;
100 }
101
102}
103
104template<typename T, typename DESCRIPTOR>
105bool getBoundaryIntersection(BlockLattice<T,DESCRIPTOR>& _block, int iX, int iY, int iZ, int iPop, T point[DESCRIPTOR::d])
106{
107 return static_cast<legacy::OffDynamics<T,DESCRIPTOR>*>(_block.getDynamics(iX, iY, iZ))->getBoundaryIntersection(iPop, point);
108}
109
110template<typename T, typename DESCRIPTOR>
111void setBoundaryIntersection(BlockLattice<T,DESCRIPTOR>& _block, int iX, int iY, int iZ, int iPop, T distance)
112{
113 bool _output = false;
114 OstreamManager clout(std::cout, "setBoundaryIntersection");
115 _block.getDynamics(iX, iY, iZ)->setBoundaryIntersection(iPop, distance);
116 if (_output) {
117 clout << "setBoundaryIntersection(" << iX << ", " << iY << ", " << iZ << " )" << std::endl;
118 }
119}
120
121}
122
123}//namespace olb
124
125#endif
AnalyticalF are applications from DD to XD, where X is set by the constructor.
Base block indicator functor.
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.
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.
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.