viewFactor.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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2018-2022 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::radiation::viewFactor
29 
30 Group
31  grpRadiationModels
32 
33 Description
34  View factor radiation model. The system solved is: C q = b
35  where:
36  Cij = deltaij/Ej - (1/Ej - 1)Fij
37  q = heat flux
38  b = A eb - Ho
39  and:
40  eb = sigma*T^4
41  Ej = emissivity
42  Aij = deltaij - Fij
43  Fij = view factor matrix
44 
45 
46 SourceFiles
47  viewFactor.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef radiation_viewFactor_H
52 #define radiation_viewFactor_H
53 
54 #include "radiationModel.H"
55 #include "singleCellFvMesh.H"
56 #include "scalarMatrices.H"
57 #include "globalIndex.H"
58 #include "scalarListIOList.H"
59 #include "volFields.H"
60 #include "IOmapDistribute.H"
61 #include "solarLoad.H"
62 
63 #include "lduPrimitiveMesh.H"
65 #include "lduMatrix.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace radiation
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class viewFactor Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class viewFactor
79 :
80  public radiationModel
81 {
82 private:
83 
84  // Private Member Functions
85 
86  //- No copy construct
87  viewFactor(const viewFactor&) = delete;
88 
89  //- No copy assignment
90  void operator=(const viewFactor&) = delete;
91 
92 
93 protected:
94 
95  // Static data
96 
97  //- Static name for view factor walls
98  static const word viewFactorWalls;
99 
100 
101  // Private data
102 
103  //- Agglomeration List
105 
106  //- Map distributed
108 
109  //- Coarse mesh
111 
112  //- Net radiative heat flux [W/m2]
114 
115  //- Coarse radiative heat flux
118  //- View factor matrix
120 
121  //- Inverse of C matrix
123 
124  //- Visible global faces
126 
127  //- Selected patches
129 
130  //- Total global coarse faces
131  label totalNCoarseFaces_;
133  //- Total local coarse faces
134  label nLocalCoarseFaces_;
135 
136  //- Constant emissivity
138 
139  //- Iterations Counter
140  label iterCounter_;
141 
142  //- Pivot Indices for LU decomposition
144 
145  //- Use Solar Load model
146  bool useSolarLoad_;
148  //- Solar load radiation model
150 
151  //-Number of bands
152  label nBands_;
153 
154  //- Primitive addressing for lduMatrix
156 
157  //- Matrix formed from view factors
159 
160  //- Boundary scalar field containing pseudo-matrix coeffs
161  //- for internal cells
163 
164  //- Boundary scalar field containing pseudo-matrix coeffs
165  //- for boundary cells
168  //- Rays on local proc
170 
171  //- Map local-ray to j-column for F
173 
174  //- Local view factors
176 
177  //- Map from proc to interafce
179 
180  //- Use direct or iterative solver
181  bool useDirect_;
183 
184  // Private Member Functions
185 
186  //- Initialise
187  void initialise();
188 
189  //- Insert view factors into main matrix
191  (
192  const globalIndex& index,
193  const label fromProci,
194  const labelListList& globalFaceFaces,
195  const scalarListList& viewFactors,
196  scalarSquareMatrix& matrix
197  );
198 
199 
200 public:
201 
202  //- Runtime type information
203  TypeName("viewFactor");
204 
205 
206  // Constructors
207 
208  //- Construct from components
210 
211  //- Construct from components
212  viewFactor(const dictionary& dict, const volScalarField& T);
213 
215  //- Destructor
216  virtual ~viewFactor() = default;
217 
218 
219  // Member functions
220 
221  // Edit
222 
223  //- Solve system of equation(s)
224  void calculate();
225 
226  //- Read radiation properties dictionary
227  bool read();
228 
229  //- Source term component (for power of T^4)
230  virtual tmp<volScalarField> Rp() const;
231 
232  //- Source term component (constant)
233  virtual tmp<volScalarField::Internal> Ru() const;
235 
236  // Access
237 
238  //- Const access to total radiative heat flux field
239  inline const volScalarField& qr() const;
240 
241  //- Use useSolarLoad
242  inline bool useSolarLoad() const;
243 
244  //- Number of bands
245  virtual label nBands() const;
246 };
247 
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #include "viewFactorI.H"
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 } // End namespace radiation
256 } // End namespace Foam
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 #endif
261 
262 // ************************************************************************* //
bool useDirect_
Use direct or iterative solver.
Definition: viewFactor.H:234
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
Definition: viewFactor.C:1127
virtual label nBands() const
Number of bands.
Definition: viewFactor.H:35
dictionary dict
volScalarField qr_
Net radiative heat flux [W/m2].
Definition: viewFactor.H:122
label iterCounter_
Iterations Counter.
Definition: viewFactor.H:167
autoPtr< solarLoad > solarLoad_
Solar load radiation model.
Definition: viewFactor.H:182
const volScalarField & qr() const
Const access to total radiative heat flux field.
Definition: viewFactor.H:23
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
autoPtr< scalarSquareMatrix > Fmatrix_
View factor matrix.
Definition: viewFactor.H:132
label totalNCoarseFaces_
Total global coarse faces.
Definition: viewFactor.H:152
autoPtr< lduPrimitiveMesh > lduPtr_
Primitive addressing for lduMatrix.
Definition: viewFactor.H:192
labelList procToInterface_
Map from proc to interafce.
Definition: viewFactor.H:229
FieldField< Field, scalar > boundaryCoeffs_
Boundary scalar field containing pseudo-matrix coeffs for boundary cells.
Definition: viewFactor.H:209
labelList selectedPatches_
Selected patches.
Definition: viewFactor.H:147
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:51
bool useSolarLoad() const
Use useSolarLoad.
Definition: viewFactor.H:29
label nBands_
Number of bands.
Definition: viewFactor.H:187
bool useSolarLoad_
Use Solar Load model.
Definition: viewFactor.H:177
autoPtr< scalarSquareMatrix > CLU_
Inverse of C matrix.
Definition: viewFactor.H:137
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:61
bool constEmissivity_
Constant emissivity.
Definition: viewFactor.H:162
labelListIOList finalAgglom_
Agglomeration List.
Definition: viewFactor.H:107
TypeName("viewFactor")
Runtime type information.
virtual tmp< volScalarField::Internal > Ru() const
Source term component (constant)
Definition: viewFactor.C:1150
A class for handling words, derived from Foam::string.
Definition: word.H:63
void insertMatrixElements(const globalIndex &index, const label fromProci, const labelListList &globalFaceFaces, const scalarListList &viewFactors, scalarSquareMatrix &matrix)
Insert view factors into main matrix.
Definition: viewFactor.C:665
autoPtr< singleCellFvMesh > coarseMesh_
Coarse mesh.
Definition: viewFactor.H:117
autoPtr< labelListIOList > globalFaceFaces_
Visible global faces.
Definition: viewFactor.H:142
Top level model for radiation modelling.
edgeHashSet rays_
Rays on local proc.
Definition: viewFactor.H:214
void initialise()
Initialise.
Definition: viewFactor.C:51
void calculate()
Solve system of equation(s)
Definition: viewFactor.C:687
FieldField< Field, scalar > internalCoeffs_
Boundary scalar field containing pseudo-matrix coeffs for internal cells.
Definition: viewFactor.H:203
label nLocalCoarseFaces_
Total local coarse faces.
Definition: viewFactor.H:157
static const word viewFactorWalls
Static name for view factor walls.
Definition: viewFactor.H:99
bool read()
Read radiation properties dictionary.
Definition: viewFactor.C:653
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual ~viewFactor()=default
Destructor.
List< scalarField > qrBandI_
Coarse radiative heat flux.
Definition: viewFactor.H:127
labelList pivotIndices_
Pivot Indices for LU decomposition.
Definition: viewFactor.H:172
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
List< label > mapRayToFmy_
Map local-ray to j-column for F.
Definition: viewFactor.H:219
A class for managing temporary objects.
Definition: HashPtrTable.H:50
autoPtr< IOmapDistribute > map_
Map distributed.
Definition: viewFactor.H:112
autoPtr< lduMatrix > matrixPtr_
Matrix formed from view factors.
Definition: viewFactor.H:197
View factor radiation model. The system solved is: C q = b where: Cij = deltaij/Ej - (1/Ej - 1)Fij q ...
Definition: viewFactor.H:73
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
Namespace for OpenFOAM.
autoPtr< scalarListIOList > FmyProc_
Local view factors.
Definition: viewFactor.H:224