solarCalculator.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 | Copyright (C) 2015 OpenCFD Ltd
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::solarCalculator
26 
27 Description
28  The solar calculator model provides information about the Sun direction
29  and Sun load model. The available models are:
30 
31  For the Sun direction:
32  1) SunDirConstant : the direction is given in 'sunDirection'
33  2) SunDirTraking : the direction is calculated from the following
34  parameters:
35  localStandardMeridian : GMT (Local Zone Meridian) in hours
36  startDay : day from 1 to 365)
37  startTime: in hours
38  longitude: in degrees
39  latitude: in degrees
40  gridUp: grid orientation upwards
41  gridEast grid orientation eastwards
42 
43  This model should be use in transient calculations.
44  The keyword 'sunTrackingUpdateInterval' (in hours) specifies on which
45  interval is the Sun direction updated.
46 
47 
48  Solar Load models available:
49  1) SunLoadConstant: direct and diffusive heat fluxes are provided by the
50  entries 'directSolarRad' and 'diffuseSolarRad'
51 
52  2) SunLoadFairWeatherConditions: The solar fluxes are calculated following
53  the Fair Weather Conditions Method from the ASHRAE Handbook. The entries
54  are:
55  A : Apparent solar irradiation at air mass m = 0
56  B : Atmospheric extinction coefficient
57  beta: Solar altitude (in degrees) above the horizontal. This
58  can be read or calculated providing the respective parameters
59  for Sun position explained above.
60  groundReflectivity : ground reflectivity
61 
62  In this model the flux is calculated as:
63 
64  directSolarRad = A/exp(B/sin(beta));
65 
66  3) SunLoadTheoreticalMaximum: The entries are:
67  Setrn
68  SunPrime:
69  groundReflectivity : ground reflectivity
70 
71  In this model the flux is calculated as:
72 
73  directSolarRad = Setrn*SunPrime;
74 
75  The diffuse on vertical/horizontal walls and ground-reflected radiation are
76  calculated following the ASHRAE Handbook.
77 
78 
79 SourceFiles
80  solarCalculator.C
81 
82 \*---------------------------------------------------------------------------*/
83 
84 #ifndef solarCalculator_H
85 #define solarCalculator_H
86 
87 #include "fvMesh.H"
88 #include "meshTools.H"
89 #include "DynamicField.H"
90 #include "HashSet.H"
91 #include "coordinateSystem.H"
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 namespace Foam
96 {
97 
98 /*---------------------------------------------------------------------------*\
99  Class solarCalculator Declaration
100 \*---------------------------------------------------------------------------*/
101 
102 class solarCalculator
103 {
104 public:
105 
106  // Public enumeration
107 
108  //- Sun direction models
109  enum sunDirModel
110  {
113  };
114 
115  //- Direct sun load models
116  enum sunLModel
117  {
121  };
122 
123 
124 protected:
125 
126  //- Sun direction models
128 
129  //- Sun load models
131 
132 private:
133 
134  // Private data
135 
136 
137  //- Reference to mesh
138  const fvMesh& mesh_;
139 
140  //- Dictionary
142 
143  //- Direction
145 
146  //- Direct solar irradiation
147  scalar directSolarRad_;
148 
149  //- Diffuse solar irradiation on vertical surfaces
150  scalar diffuseSolarRad_;
151 
152  //- Ground reflectivity
153  scalar groundReflectivity_;
154 
155  //- Fair weather direct solar load model parameters
156  scalar A_;
157  scalar B_;
158  scalar beta_;
159  scalar tetha_;
160 
161 
162  //- Maximum theoretical direct solar load model parameters
163  scalar Setrn_;
164  scalar SunPrime_;
165 
166 
167  //- Diffusive solar load model parameters
168  scalar C_;
169 
170  //- Sun direction model
172 
173  //- Sun load model
175 
176  //- Grid coordinate system
178 
179  //- East grid orientation
181 
182  //- Up grid orientation
183  vector gridUp_;
184 
185  //- Interval in decimal hours to update Sun direction for SunDirTraking
187 
188  //- Start time for the Sun position (decimal hours)
189  scalar startTime_;
190 
191 
192  //- Disallow default bitwise copy construct
194 
195  //- Disallow default bitwise assignment
196  void operator=(const solarCalculator&);
197 
198 
199  // Private members
200 
201  //- Init
202  void init();
203 
204  //- Calculate beta and tetha angles
205  void calculateBetaTetha();
206 
207  //- Calculate Sun direction
208  void calculateSunDirection();
209 
210 
211 public:
212 
213  // Declare name of the class and its debug switch
214  ClassName("solarCalculator");
215 
216 
217  // Constructors
218 
219  //- Construct from dictionary
220  solarCalculator(const dictionary&, const fvMesh&);
221 
222 
223  //- Destructor
225 
226 
227  // Member Functions
228 
229  // Access
230 
231  //- const acess to direction
232  const vector direction() const
233  {
234  return direction_;
235  }
236 
237  //- Non-const access to direction
238  vector& direction()
239  {
240  return direction_;
241  }
242 
243  //- Return direct solar irradiation
244  scalar directSolarRad()
245  {
246  return directSolarRad_;
247  }
248 
249  //- Return diffuse solar irradiation
250  scalar diffuseSolarRad()
251  {
252  return diffuseSolarRad_;
253  }
254 
255  //- Return C consntant
256  scalar C()
257  {
258  return C_;
259  }
260 
261  //- Return beta
262  scalar beta()
263  {
264  return beta_;
265  }
266 
267  //- Return tetha
268  scalar tetha()
269  {
270  return tetha_;
271  }
272 
273  //- Return Sun direction model
275  {
276  return sunDirectionModel_;
277  }
278 
279  //- Return Sun load model
280  sunLModel sunLoadModel() const
281  {
282  return sunLoadModel_;
283  }
284 
285  //- Return groundReflectivity
286  scalar groundReflectivity()
287  {
288  return groundReflectivity_;
289  }
290 
291  //- Return coordinateSystem
292  const coordinateSystem& coord()
293  {
294  return coord_();
295  }
296 
297  //- Return sunTrackingUpdateInterval
299  {
301  }
302 
303  //- Return startTime
304  scalar startTime()
305  {
306  return startTime_;
307  }
308 
309 
310  //- Recalculate
311  void correctSunDirection();
312 };
313 
314 
315 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316 
317 } // End namespace Foam
318 
319 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
320 
321 #endif
322 
323 // ************************************************************************* //
Foam::solarCalculator::diffuseSolarRad_
scalar diffuseSolarRad_
Diffuse solar irradiation on vertical surfaces.
Definition: solarCalculator.H:149
Foam::solarCalculator::init
void init()
Init.
Definition: solarCalculator.C:173
Foam::solarCalculator::dict_
dictionary dict_
Dictionary.
Definition: solarCalculator.H:140
meshTools.H
Foam::solarCalculator::direction
const vector direction() const
const acess to direction
Definition: solarCalculator.H:231
Foam::solarCalculator::coord_
autoPtr< coordinateSystem > coord_
Grid coordinate system.
Definition: solarCalculator.H:176
Foam::solarCalculator::operator=
void operator=(const solarCalculator &)
Disallow default bitwise assignment.
Foam::solarCalculator::sunDirectionModelTypeNames_
static const NamedEnum< sunDirModel, 2 > sunDirectionModelTypeNames_
Sun direction models.
Definition: solarCalculator.H:126
Foam::solarCalculator::sunTrackingUpdateInterval
scalar sunTrackingUpdateInterval()
Return sunTrackingUpdateInterval.
Definition: solarCalculator.H:297
Foam::solarCalculator::mSunDirTraking
@ mSunDirTraking
Definition: solarCalculator.H:111
Foam::solarCalculator::coord
const coordinateSystem & coord()
Return coordinateSystem.
Definition: solarCalculator.H:291
Foam::solarCalculator::diffuseSolarRad
scalar diffuseSolarRad()
Return diffuse solar irradiation.
Definition: solarCalculator.H:249
Foam::solarCalculator::calculateBetaTetha
void calculateBetaTetha()
Calculate beta and tetha angles.
Definition: solarCalculator.C:68
Foam::solarCalculator::groundReflectivity_
scalar groundReflectivity_
Ground reflectivity.
Definition: solarCalculator.H:152
Foam::solarCalculator::calculateSunDirection
void calculateSunDirection()
Calculate Sun direction.
Definition: solarCalculator.C:139
Foam::solarCalculator::mSunLoadFairWeatherConditions
@ mSunLoadFairWeatherConditions
Definition: solarCalculator.H:118
Foam::solarCalculator::startTime
scalar startTime()
Return startTime.
Definition: solarCalculator.H:303
Foam::solarCalculator::SunPrime_
scalar SunPrime_
Definition: solarCalculator.H:163
Foam::solarCalculator::eastDir_
vector eastDir_
East grid orientation.
Definition: solarCalculator.H:179
coordinateSystem.H
Foam::solarCalculator::groundReflectivity
scalar groundReflectivity()
Return groundReflectivity.
Definition: solarCalculator.H:285
Foam::solarCalculator
The solar calculator model provides information about the Sun direction and Sun load model....
Definition: solarCalculator.H:101
Foam::solarCalculator::sunLModel
sunLModel
Direct sun load models.
Definition: solarCalculator.H:115
Foam::solarCalculator::mesh_
const fvMesh & mesh_
Reference to mesh.
Definition: solarCalculator.H:137
Foam::solarCalculator::C
scalar C()
Return C consntant.
Definition: solarCalculator.H:255
Foam::solarCalculator::Setrn_
scalar Setrn_
Maximum theoretical direct solar load model parameters.
Definition: solarCalculator.H:162
Foam::solarCalculator::sunDirectionModel_
sunDirModel sunDirectionModel_
Sun direction model.
Definition: solarCalculator.H:170
Foam::solarCalculator::sunDirectionModel
sunDirModel sunDirectionModel() const
Return Sun direction model.
Definition: solarCalculator.H:273
HashSet.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::solarCalculator::sunTrackingUpdateInterval_
scalar sunTrackingUpdateInterval_
Interval in decimal hours to update Sun direction for SunDirTraking.
Definition: solarCalculator.H:185
Foam::solarCalculator::A_
scalar A_
Fair weather direct solar load model parameters.
Definition: solarCalculator.H:155
Foam::solarCalculator::C_
scalar C_
Diffusive solar load model parameters.
Definition: solarCalculator.H:167
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::solarCalculator::mSunDirConstant
@ mSunDirConstant
Definition: solarCalculator.H:110
Foam::solarCalculator::~solarCalculator
~solarCalculator()
Destructor.
Definition: solarCalculator.C:292
Foam::solarCalculator::direction_
vector direction_
Direction.
Definition: solarCalculator.H:143
Foam::solarCalculator::gridUp_
vector gridUp_
Up grid orientation.
Definition: solarCalculator.H:182
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::solarCalculator::ClassName
ClassName("solarCalculator")
Foam::solarCalculator::correctSunDirection
void correctSunDirection()
Recalculate.
Definition: solarCalculator.C:298
DynamicField.H
Foam::solarCalculator::direction
vector & direction()
Non-const access to direction.
Definition: solarCalculator.H:237
Foam::solarCalculator::mSunLoadTheoreticalMaximum
@ mSunLoadTheoreticalMaximum
Definition: solarCalculator.H:119
Foam::Vector< scalar >
Foam::solarCalculator::tetha_
scalar tetha_
Definition: solarCalculator.H:158
Foam::solarCalculator::directSolarRad
scalar directSolarRad()
Return direct solar irradiation.
Definition: solarCalculator.H:243
Foam::solarCalculator::sunLoadModelTypeNames_
static const NamedEnum< sunLModel, 3 > sunLoadModelTypeNames_
Sun load models.
Definition: solarCalculator.H:129
Foam::solarCalculator::B_
scalar B_
Definition: solarCalculator.H:156
Foam::solarCalculator::beta_
scalar beta_
Definition: solarCalculator.H:157
Foam::solarCalculator::directSolarRad_
scalar directSolarRad_
Direct solar irradiation.
Definition: solarCalculator.H:146
Foam::solarCalculator::beta
scalar beta()
Return beta.
Definition: solarCalculator.H:261
Foam::solarCalculator::startTime_
scalar startTime_
Start time for the Sun position (decimal hours)
Definition: solarCalculator.H:188
Foam::solarCalculator::tetha
scalar tetha()
Return tetha.
Definition: solarCalculator.H:267
Foam::solarCalculator::sunLoadModel_
sunLModel sunLoadModel_
Sun load model.
Definition: solarCalculator.H:173
Foam::solarCalculator::solarCalculator
solarCalculator(const solarCalculator &)
Disallow default bitwise copy construct.
Foam::solarCalculator::sunDirModel
sunDirModel
Sun direction models.
Definition: solarCalculator.H:108
Foam::NamedEnum< sunDirModel, 2 >
Foam::coordinateSystem
Base class for other coordinate system specifications.
Definition: coordinateSystem.H:85
Foam::solarCalculator::sunLoadModel
sunLModel sunLoadModel() const
Return Sun load model.
Definition: solarCalculator.H:279
Foam::solarCalculator::mSunLoadConstant
@ mSunLoadConstant
Definition: solarCalculator.H:117