viewFactorModel.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) 2023-2024 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Namespace
27  Foam::VF
28 
29 Description
30  A namespace for various \c viewFactor model implementations.
31 
32 Class
33  Foam::VF::viewFactorModel
34 
35 Description
36  A base class for \c viewFactor models.
37 
38 Usage
39  Minimal example in \c <constant>/viewFactorsDict:
40  \verbatim
41  // Mandatory entries
42  writeViewFactors <bool>;
43 
44  // Optional entries
45  writeRays <bool>;
46  \endverbatim
47 
48  where the entries mean:
49  \table
50  Property | Description | Type | Reqd | Deflt
51  writeViewFactors | Flag to write the view factor field | bool | yes | -
52  writeRays | Flag to write the ray geometry | bool | no | false
53  \endtable
54 
55 SourceFiles
56  viewFactorModel.C
57  viewFactorModelNew.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef Foam_vf_viewFactorModel_H
62 #define Foam_vf_viewFactorModel_H
63 
64 #include "autoPtr.H"
65 #include "pointField.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 // Forward Declarations
73 class fvMesh;
74 
75 namespace VF
76 {
77 
78 // Forward Declarations
79 class raySearchEngine;
80 
81 /*---------------------------------------------------------------------------*\
82  Class viewFactorModel Declaration
83 \*---------------------------------------------------------------------------*/
84 
85 class viewFactorModel
86 {
87 protected:
88 
89  // Protected Data
90 
91  //- Reference to the mesh database
92  const fvMesh& mesh_;
93 
94  //- Run-time selectable ray search engine
95  autoPtr<raySearchEngine> searchEnginePtr_;
96 
97  //- Flag to write the view factor field
98  bool writeViewFactors_;
99 
100  //- Flag to write the ray geometry
101  bool writeRays_;
102 
103 
104  // Protected Member Functions
105 
106  //- Write ray geometry to file
107  static void writeRays
108  (
109  const fileName& fName,
110  const pointField& compactCf,
111  const labelListList& visibleFaceFaces
112  );
114  //- Calculate the view factors using run-time selectable model
115  virtual scalarListList calculate
116  (
117  const labelListList& visibleFaceFaces,
118  const pointField& compactCoarseCf,
119  const vectorField& compactCoarseSf,
120  const List<List<vector>>& compactFineSf,
121  const List<List<point>>& compactFineCf,
122  const DynamicList<List<point>>& compactPoints,
123  const DynamicList<label>& compactPatchId
124  ) const = 0;
125 
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("viewFactorModel");
131 
132  //- Selection table
134  (
135  autoPtr,
137  mesh,
138  (
139  const fvMesh& mesh,
140  const dictionary& dict
141  ),
142  (mesh, dict)
143  );
144 
145  //- Selector
147  (
148  const fvMesh& mesh,
149  const dictionary& dict
150  );
151 
152 
153  // Generated Methods
154 
155  //- No copy construct
156  viewFactorModel(const viewFactorModel&) = delete;
157 
158  //- No copy assignment
159  void operator=(const viewFactorModel&) = delete;
160 
161 
162  //- Constructor
163  viewFactorModel(const fvMesh& mesh, const dictionary& dict);
164 
165  //- Destructor
166  virtual ~viewFactorModel();
167 
168 
169  // Public Member Functions
170 
171  //- Calculate the view factors
172  virtual void calculate();
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace VF
179 } // End namespace Foam
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #endif
184 
185 // ************************************************************************* //
const fvMesh & mesh_
Reference to the mesh database.
dictionary dict
A class for handling file names.
Definition: fileName.H:72
bool writeViewFactors_
Flag to write the view factor field.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
TypeName("viewFactorModel")
Runtime type information.
virtual ~viewFactorModel()
Destructor.
dynamicFvMesh & mesh
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:51
virtual void calculate()
Calculate the view factors.
A base class for viewFactor models.
void operator=(const viewFactorModel &)=delete
No copy assignment.
declareRunTimeSelectionTable(autoPtr, viewFactorModel, mesh,(const fvMesh &mesh, const dictionary &dict),(mesh, dict))
Selection table.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
viewFactorModel(const viewFactorModel &)=delete
No copy construct.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
autoPtr< raySearchEngine > searchEnginePtr_
Run-time selectable ray search engine.
static autoPtr< viewFactorModel > New(const fvMesh &mesh, const dictionary &dict)
Selector.
bool writeRays_
Flag to write the ray geometry.
Namespace for OpenFOAM.
static void writeRays(const fileName &fName, const pointField &compactCf, const labelListList &visibleFaceFaces)
Write ray geometry to file.