createViewFactors.C
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 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 Application
27  createViewFactors
28 
29 Group
30  grpPreProcessingUtilities
31 
32 Description
33  Creates view factors to be used in the view-factor radiation model.
34 
35  Operands:
36  \table
37  Operand | Type | Location
38  input | dictionary | <constant>/viewFactorsDict
39  input | dictionary | <constant>/finalAgglom
40  output | scalarListList | <constant>/F
41  output | mapDistribute | <constant>/mapDist
42  output | labelListList | <constant>/globalFaceFaces
43  output | volScalarField | <time>/viewVectorField
44  output | OBJ | allVisibleFaces.obj
45  \endtable
46 
47  where the dictionaries mean:
48  \table
49  Dictionary | Description
50  viewFactorsDict | Main-control dictionary
51  finalAgglom | (Optional) Agglomeration addressing (from faceAgglomerate)
52  F | View factors (matrix)
53  mapDist | Map used for parallel running
54  globalFaceFaces | Face addressing
55  viewVectorField | View factors as a volume field
56  allVisibleFaces.obj | The visualisation of the rays
57  \endtable
58 
59 Usage
60  Minimal example in \c <constant>/viewFactorsDict:
61  \verbatim
62  // Inherited entries
63  raySearchEngine <word>;
64  agglomerate <bool>;
65  nRayPerFace <label>;
66  writeViewFactors <bool>;
67  writeRays <bool>;
68  ...
69  \endverbatim
70 
71  where the entries mean:
72  \table
73  Property | Description | Type | Reqd | Deflt
74  raySearchEngine | Ray search engine type | word | yes | -
75  agglomerate | Flag to agglomeration | bool | yes | -
76  nRayPerFace | Number of rays issued per face | label | yes | -
77  writeViewFactors | Flag to write the view factor field | bool | yes |-
78  writeRays | Flag to write the ray geometry | bool | no | false
79  \endtable
80 
81  Options for the \c raySearchEngine entry:
82  \verbatim
83  voxel | Ray search engine discretising space into uniform voxels
84  \endverbatim
85 
86  The inherited entries are elaborated in:
87  - \link viewFactorModel.H \endlink
88  - \link raySearchEngine.H \endlink
89 
90 Note
91 
92  - Participating patches must be in the \c vewFactorWall group, i.e. using the
93  \c inGroups entry of the "<case>/polyMesh/boundary" file.
94 
95  \verbatim
96  myPatch
97  {
98  type wall;
99  inGroups 2(wall viewFactorWall);
100  ...
101  }
102  \endverbatim
103 
104  Reads:
105 
106  - <constant>/viewFactorsDict : main controls
107  - <constant>/finalAgglom : agglomeration addressing (from faceAgglomerate)
108 
109 
110  Generates:
111 
112  - <constant>/F : view factors (matrix)
113  - <constant>/mapDist : map used for parallel running
114  - <constant>/globalFaceFaces : face addressing
115 
116 SeeAlso
117 - Foam::VF::raySearchEngine
118 - Foam::VE::viewFactorModel
119 
120 \*---------------------------------------------------------------------------*/
121 
122 #include "argList.H"
123 #include "Time.H"
124 #include "fvMesh.H"
125 #include "viewFactorModel.H"
126 
127 using namespace Foam;
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 int main(int argc, char *argv[])
132 {
133  #include "addRegionOption.H"
134  #include "setRootCase.H"
135  #include "createTime.H"
136  #include "createNamedMesh.H"
137 
139  (
140  IOobject
141  (
142  "viewFactorsDict",
143  runTime.constant(),
144  mesh,
146  )
147  );
148 
149 
150  // Calculate the view factors
151  auto modelPtr = VF::viewFactorModel::New(mesh, dict);
152 
153  modelPtr->calculate();
154 
155  Info<< nl;
156 
158 
159  Info<< "End\n" << endl;
160 
161  return 0;
162 }
163 
164 
165 // ************************************************************************* //
dictionary dict
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
Required Classes.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
Required Classes.
dynamicFvMesh & mesh
const word & constant() const noexcept
Return constant name.
Definition: TimePathsI.H:112
Ostream & printExecutionTime(OSstream &os) const
Print the elapsed ExecutionTime (cpu-time), ClockTime.
Definition: TimeIO.C:607
messageStream Info
Information stream (stdout output on master, null elsewhere)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:180
static autoPtr< viewFactorModel > New(const fvMesh &mesh, const dictionary &dict)
Selector.
Namespace for OpenFOAM.