PDRarrays.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016 Shell Research Ltd.
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::PDRarrays
29 
30 Description
31  Work array definitions for PDR fields
32 
33 SourceFiles
34  PDRarrays.C
35  PDRarraysCalc.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef PDRarrays_H
40 #define PDRarrays_H
41 
42 #include "symmTensor.H"
43 #include "symmTensor2D.H"
44 #include "SquareMatrix.H"
45 #include "IjkField.H"
46 #include <functional>
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward Declarations
54 class PDRblock;
55 class PDRmeshArrays;
56 class PDRobstacle;
57 class PDRpatchDef;
58 
59 
60 /*---------------------------------------------------------------------------*\
61  Class PDRarrays Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class PDRarrays
65 {
66  //- Reference to PDRblock
67  std::reference_wrapper<const PDRblock> pdrBlock_;
68 
69 public:
70 
71  // Data Members
72  // Entries used for analysis and when writing fields
73 
74  //- Volume blockage
76 
77  //- Surface area in cell
79 
80  //- Obstacle size in cell
82 
83  //- Summed area blockage (directional) from sharp obstacles
85 
86  //- Summed area blockage (directional) from round obstacles
88 
89  //- A total directional blockage in the cell
91 
92  //- Face area blockage for face,
93  //- summed from cell centre-plane to cell centre-plane
95 
96  //- Longitudinal area blockage from obstacles that extend all the way
97  //- through the cell in a given direction.
99 
101 
102  //- Number of obstacles in cell.
103  // Can be non-integer if an obstacle does not pass all way through cell
105 
106  //- Number of obstacles parallel to specified direction
108 
109  //- Addition to count to account for grating comprises many bars
110  //- (to get Lobs right)
112 
113  //- Tensorial drag from sharp obstacles
115 
116  //- Directional drag from round obstacles
118 
119 
120  // Next arrays are for 2D calculations of intersection
121 
122  // One-dimensional scratch areas for cell overlaps
124 
125  // In two dimensions, area of cell covered by circle
127 
128  // In two dimensions, length of perimeter of circle witthin cell
130 
131  // For offset cells, i.e. face blockage
133 
134  // For centred cells
136 
137  // The count in the cells
139 
140  //- Cell-centred drag
142 
143  //- Face field for (directional) for patch Id
145 
146  //- Face field for (directional) hole in face
148 
149 
150  // Constructors
151 
152  //- Construct null
153  PDRarrays();
154 
155  //- Construct and reset
156  explicit PDRarrays(const PDRblock& pdrBlock);
157 
158 
159  //- Destructor
160  ~PDRarrays() = default;
161 
162 
163  // Member Functions
164 
165  //- Reset PDRblock reference, resize and zero arrays
166  void reset(const PDRblock& pdrBlock);
167 
168  //- Reference to PDRblock
169  const PDRblock& block() const
170  {
171  return pdrBlock_.get();
172  }
173 
174  //- Summary of the blockages
175  // For diagnostics and general overview
176  void blockageSummary() const;
177 
178  //- Add cylinder blockage
179  void addCylinder(const PDRobstacle& obs);
180 
181  //- Add general (non-cylinder) blockage
182  void addBlockage
183  (
184  const PDRobstacle& obs,
186  const int volumeSign
187  );
188 
189 
190  static void calculateAndWrite
191  (
192  PDRarrays& arr,
193  const PDRmeshArrays& meshIndexing,
194  const fileName& casepath,
196  );
197 
198  void calculateAndWrite
199  (
200  const fileName& casepath,
201  const PDRmeshArrays& meshIndexing,
203  );
204 };
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #endif
214 
215 // ************************************************************************* //
Foam::PDRarrays::PDRarrays
PDRarrays()
Construct null.
Foam::PDRarrays::ac_lblock
SquareMatrix< scalar > ac_lblock
Definition: PDRarrays.H:134
Foam::PDRarrays::a_lblock
SquareMatrix< scalar > a_lblock
Definition: PDRarrays.H:131
Foam::PDRarrays::overlap_1d
Vector< List< scalar > > overlap_1d
Definition: PDRarrays.H:122
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::PDRarrays::drag_s
IjkField< symmTensor > drag_s
Tensorial drag from sharp obstacles.
Definition: PDRarrays.H:113
Foam::PDRarrays::~PDRarrays
~PDRarrays()=default
Destructor.
symmTensor2D.H
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:55
Foam::PDRarrays::addBlockage
void addBlockage(const PDRobstacle &obs, DynamicList< PDRpatchDef > &patches, const int volumeSign)
Add general (non-cylinder) blockage.
Foam::PDRarrays::v_block
IjkField< scalar > v_block
Volume blockage.
Definition: PDRarrays.H:74
Foam::PDRarrays::bc_lblock
SquareMatrix< scalar > bc_lblock
Definition: PDRarrays.H:134
IjkField.H
Foam::PDRarrays::calculateAndWrite
static void calculateAndWrite(PDRarrays &arr, const PDRmeshArrays &meshIndexing, const fileName &casepath, const UList< PDRpatchDef > &patches)
Foam::PDRarrays::blockageSummary
void blockageSummary() const
Summary of the blockages.
Foam::PDRarrays::face_block
IjkField< vector > face_block
Definition: PDRarrays.H:93
Foam::PDRarrays::dirn_block
IjkField< Vector< bool > > dirn_block
A total directional blockage in the cell.
Definition: PDRarrays.H:89
Foam::PDRarrays::b_lblock
SquareMatrix< scalar > b_lblock
Definition: PDRarrays.H:131
symmTensor.H
Foam::PDRarrays::sub_count
IjkField< vector > sub_count
Number of obstacles parallel to specified direction.
Definition: PDRarrays.H:106
Foam::PDRarrays::along_block
IjkField< vector > along_block
Definition: PDRarrays.H:97
Foam::PDRarrays::obs_size
IjkField< scalar > obs_size
Obstacle size in cell.
Definition: PDRarrays.H:80
Foam::PDRarrays
Work array definitions for PDR fields.
Definition: PDRarrays.H:63
Foam::PDRarrays::c_drag
SquareMatrix< symmTensor2D > c_drag
Cell-centred drag.
Definition: PDRarrays.H:140
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::PDRblock
A single block x-y-z rectilinear mesh addressable as i,j,k with simplified creation....
Definition: PDRblock.H:153
Foam::IjkField< scalar >
Foam::PDRarrays::surf
IjkField< scalar > surf
Surface area in cell.
Definition: PDRarrays.H:77
Foam::PDRarrays::area_block_r
IjkField< vector > area_block_r
Summed area blockage (directional) from round obstacles.
Definition: PDRarrays.H:86
Foam::SquareMatrix< scalar >
Foam::PDRarrays::addCylinder
void addCylinder(const PDRobstacle &obs)
Add cylinder blockage.
Foam::PDRarrays::reset
void reset(const PDRblock &pdrBlock)
Reset PDRblock reference, resize and zero arrays.
Foam::PDRarrays::betai_inv1
IjkField< vector > betai_inv1
Definition: PDRarrays.H:99
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:62
Foam::PDRobstacle
Obstacle definitions for PDR.
Definition: PDRobstacle.H:74
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::PDRarrays::obs_count
IjkField< scalar > obs_count
Number of obstacles in cell.
Definition: PDRarrays.H:103
Foam::PDRarrays::grating_count
IjkField< vector > grating_count
Definition: PDRarrays.H:110
patches
const polyBoundaryMesh & patches
Definition: convertProcessorPatches.H:65
Foam::PDRmeshArrays
OpenFOAM/PDRblock addressing information.
Definition: PDRmeshArrays.H:65
Foam::PDRarrays::area_block_s
IjkField< vector > area_block_s
Summed area blockage (directional) from sharp obstacles.
Definition: PDRarrays.H:83
Foam::PDRarrays::c_count
SquareMatrix< scalar > c_count
Definition: PDRarrays.H:137
SquareMatrix.H
Foam::PDRarrays::face_patch
IjkField< labelVector > face_patch
Face field for (directional) for patch Id.
Definition: PDRarrays.H:143
Foam::PDRarrays::hole_in_face
IjkField< Vector< bool > > hole_in_face
Face field for (directional) hole in face.
Definition: PDRarrays.H:146
Foam::PDRarrays::aboverlap
SquareMatrix< scalar > aboverlap
Definition: PDRarrays.H:125
Foam::PDRarrays::drag_r
IjkField< vector > drag_r
Directional drag from round obstacles.
Definition: PDRarrays.H:116
Foam::PDRarrays::abperim
SquareMatrix< scalar > abperim
Definition: PDRarrays.H:128
Foam::PDRarrays::block
const PDRblock & block() const
Reference to PDRblock.
Definition: PDRarrays.H:168