cuboidWall.cpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 
22 #include "cuboidWall.hpp"
23 #include "planeWall.hpp"
24 
25 
26 
28 (
29  const dictionary& dict
30 )
31 {
32 
33  auto center = dict.getVal<realx3>("center");
34  auto edgeLength= dict.getVal<realx3>("edgeLength");
35  auto numDivs = dict.getValOrSet<int32x3>("numDivs", int32x3(1,1,1));
36 
37  numDivs = max(numDivs, int32x3(1,1,1));
38 
39  realx3 p1,p2,p3,p4;
40 
41  // left plane
42  p1 = center + edgeLength*realx3(-0.5,-0.5,-0.5);
43  p2 = center + edgeLength*realx3(-0.5, 0.5,-0.5);
44  p3 = center + edgeLength*realx3(-0.5, 0.5, 0.5);
45  p4 = center + edgeLength*realx3(-0.5,-0.5, 0.5);
46 
47  planeWall left(p1,p2,p3,p4, numDivs.y(), numDivs.z());
48 
49  for(const auto& t:left.triangles())
50  {
51  triangles_.push_back(t);
52  }
53 
54  // right plane
55  p1 = center + edgeLength*realx3( 0.5,-0.5,-0.5);
56  p2 = center + edgeLength*realx3( 0.5,-0.5, 0.5);
57  p3 = center + edgeLength*realx3( 0.5, 0.5, 0.5);
58  p4 = center + edgeLength*realx3( 0.5, 0.5,-0.5);
59 
60  planeWall right(p1,p2,p3,p4, numDivs.z(), numDivs.y());
61 
62  for(const auto& t:right.triangles())
63  {
64  triangles_.push_back(t);
65  }
66 
67  // bottom plane
68  p1 = center + edgeLength*realx3(-0.5,-0.5,-0.5);
69  p2 = center + edgeLength*realx3(-0.5,-0.5, 0.5);
70  p3 = center + edgeLength*realx3( 0.5,-0.5, 0.5);
71  p4 = center + edgeLength*realx3( 0.5,-0.5,-0.5);
72 
73  planeWall bottom(p1,p2,p3,p4, numDivs.z(), numDivs.x());
74 
75  for(const auto& t:bottom.triangles())
76  {
77  triangles_.push_back(t);
78  }
79 
80  // top plane
81  p1 = center + edgeLength*realx3(-0.5, 0.5,-0.5);
82  p2 = center + edgeLength*realx3( 0.5, 0.5,-0.5);
83  p3 = center + edgeLength*realx3( 0.5, 0.5, 0.5);
84  p4 = center + edgeLength*realx3(-0.5, 0.5, 0.5);
85 
86  planeWall top(p1,p2,p3,p4, numDivs.x(), numDivs.z());
87 
88  for(const auto& t:top.triangles())
89  {
90  triangles_.push_back(t);
91  }
92 
93  // back plane
94  p1 = center + edgeLength*realx3(-0.5,-0.5,-0.5);
95  p2 = center + edgeLength*realx3( 0.5,-0.5,-0.5);
96  p3 = center + edgeLength*realx3( 0.5, 0.5,-0.5);
97  p4 = center + edgeLength*realx3(-0.5, 0.5,-0.5);
98 
99 
100  planeWall back(p1,p2,p3,p4, numDivs.x(), numDivs.y());
101 
102  for(const auto& t:back.triangles())
103  {
104  triangles_.push_back(t);
105  }
106 
107 
108  // fron plane
109  p1 = center + edgeLength*realx3(-0.5,-0.5, 0.5);
110  p2 = center + edgeLength*realx3(-0.5, 0.5, 0.5);
111  p3 = center + edgeLength*realx3( 0.5, 0.5, 0.5);
112  p4 = center + edgeLength*realx3( 0.5,-0.5, 0.5);
113 
114  planeWall front(p1,p2,p3,p4, numDivs.y(), numDivs.x());
115 
116  for(const auto& t:front.triangles())
117  {
118  triangles_.push_back(t);
119  }
120 
121 
122  return true;
123 
124 }
125 
127 {}
128 
130 (
131  const dictionary& dict
132 )
133 :
134  Wall(dict)
135 {
136  if(!readcuboidWall(dict))
137  {
138  fatalExit;
139  }
140 }
pFlow::planeWall
Definition: planeWall.hpp:32
pFlow::dictionary::getValOrSet
T getValOrSet(const word &keyword, const T &setVal) const
Definition: dictionary.hpp:325
fatalExit
#define fatalExit
Definition: error.hpp:57
pFlow::Wall::triangles
const auto & triangles() const
Definition: Wall.hpp:82
cuboidWall.hpp
pFlow::int32x3
triple< int32 > int32x3
Definition: types.hpp:41
pFlow::cuboidWall::readcuboidWall
bool readcuboidWall(const dictionary &dict)
Definition: cuboidWall.cpp:28
pFlow::realx3
triple< real > realx3
Definition: types.hpp:48
planeWall.hpp
pFlow::triple::y
INLINE_FUNCTION_HD T & y()
Definition: triple.hpp:141
pFlow::algorithms::KOKKOS::max
INLINE_FUNCTION_H Type max(const Type *first, int32 numElems)
Definition: kokkosAlgorithms.hpp:104
pFlow::cuboidWall::cuboidWall
cuboidWall()
Definition: cuboidWall.cpp:126
pFlow::triple::z
INLINE_FUNCTION_HD T & z()
Definition: triple.hpp:144
pFlow::dictionary::getVal
T getVal(const word &keyword) const
Definition: dictionary.hpp:309
pFlow::triple::x
INLINE_FUNCTION_HD T & x()
Definition: triple.hpp:138
pFlow::triple< real >
pFlow::Wall
Definition: Wall.hpp:41
pFlow::dictionary
Definition: dictionary.hpp:38