ENH: solarLoad: enable time-dependent direct/diffuse irradiance

ENH: solarLoad, fvDOM: enable time-dependent spectralDistribution
DOC: solarLoad, fvDOM, solarCalculator: improve header documentation
TUT: solarLoadModel, solarDirectionModel: use new shorter entries
This commit is contained in:
Kutalmis Bercin
2021-03-16 16:34:13 +00:00
committed by Andrew Heather
parent 4ad4783e5f
commit 82a24a39b0
9 changed files with 658 additions and 448 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2018 OpenFOAM Foundation Copyright (C) 2011-2018 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd. Copyright (C) 2019-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -120,7 +120,16 @@ void Foam::radiation::fvDOM::initialise()
if (useExternalBeam_) if (useExternalBeam_)
{ {
coeffs_.readEntry("spectralDistribution", spectralDistribution_); spectralDistributions_.reset
(
new TimeFunction1<scalarField>
(
mesh_.time(), "spectralDistribution", coeffs_
)
);
spectralDistribution_ =
spectralDistributions_->value(mesh_.time().value());
spectralDistribution_ = spectralDistribution_ =
spectralDistribution_/sum(spectralDistribution_); spectralDistribution_/sum(spectralDistribution_);
@ -428,6 +437,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
), ),
useExternalBeam_(false), useExternalBeam_(false),
spectralDistribution_(), spectralDistribution_(),
spectralDistributions_(),
solarCalculator_(), solarCalculator_(),
updateTimeIndex_(0) updateTimeIndex_(0)
{ {
@ -533,6 +543,7 @@ Foam::radiation::fvDOM::fvDOM
), ),
useExternalBeam_(false), useExternalBeam_(false),
spectralDistribution_(), spectralDistribution_(),
spectralDistributions_(),
solarCalculator_(), solarCalculator_(),
updateTimeIndex_(0) updateTimeIndex_(0)
{ {
@ -540,12 +551,6 @@ Foam::radiation::fvDOM::fvDOM
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::fvDOM::~fvDOM()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::radiation::fvDOM::read() bool Foam::radiation::fvDOM::read()

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,7 +92,6 @@ Usage
spectralDistribution is the energy spectral distribution of the collimated spectralDistribution is the energy spectral distribution of the collimated
external beam. external beam.
SourceFiles SourceFiles
fvDOM.C fvDOM.C
@ -121,8 +120,7 @@ class fvDOM
: :
public radiationModel public radiationModel
{ {
// Private data // Private Data
//- Incident radiation [W/m2] //- Incident radiation [W/m2]
volScalarField G_; volScalarField G_;
@ -184,6 +182,9 @@ class fvDOM
//- Spectral energy distribution for the external beam //- Spectral energy distribution for the external beam
scalarList spectralDistribution_; scalarList spectralDistribution_;
//- Time-dependent spectral distributions
autoPtr<TimeFunction1<scalarField>> spectralDistributions_;
//- Solar calculator //- Solar calculator
autoPtr<solarCalculator> solarCalculator_; autoPtr<solarCalculator> solarCalculator_;
@ -222,10 +223,10 @@ public:
//- Destructor //- Destructor
virtual ~fvDOM(); virtual ~fvDOM() = default;
// Member functions // Member Functions
// Edit // Edit

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd. Copyright (C) 2016-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -37,7 +37,6 @@ License
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
#include "constants.H" #include "constants.H"
using namespace Foam::constant; using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -83,7 +82,7 @@ void Foam::radiation::solarLoad::updateReflectedRays
{ {
if (includePatches[patchID]) if (includePatches[patchID])
{ {
for (label bandI = 0; bandI < nBands_; bandI++) for (label bandI = 0; bandI < nBands_; ++bandI)
{ {
qrBf[patchID] += qrBf[patchID] +=
reflectedFaces_->qreflective(bandI).boundaryField()[patchID]; reflectedFaces_->qreflective(bandI).boundaryField()[patchID];
@ -94,7 +93,7 @@ void Foam::radiation::solarLoad::updateReflectedRays
const scalarField& sf = mesh_.magSf().boundaryField()[patchID]; const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
const labelUList& cellIs = patches[patchID].faceCells(); const labelUList& cellIs = patches[patchID].faceCells();
for (label bandI = 0; bandI < nBands_; bandI++) for (label bandI = 0; bandI < nBands_; ++bandI)
{ {
forAll(cellIs, i) forAll(cellIs, i)
{ {
@ -109,9 +108,6 @@ void Foam::radiation::solarLoad::updateReflectedRays
} }
} }
} }
} }
@ -133,7 +129,7 @@ bool Foam::radiation::solarLoad::updateHitFaces()
} }
case solarCalculator::mSunDirTracking: case solarCalculator::mSunDirTracking:
{ {
label updateIndex = label const label updateIndex = label
( (
mesh_.time().value()/solarCalc_.sunTrackingUpdateInterval() mesh_.time().value()/solarCalc_.sunTrackingUpdateInterval()
); );
@ -167,7 +163,7 @@ void Foam::radiation::solarLoad::updateAbsorptivity
for (const label patchID : includePatches) for (const label patchID : includePatches)
{ {
absorptivity_[patchID].setSize(nBands_); absorptivity_[patchID].setSize(nBands_);
for (label bandI = 0; bandI < nBands_; bandI++) for (label bandI = 0; bandI < nBands_; ++bandI)
{ {
absorptivity_[patchID][bandI] = absorptivity_[patchID][bandI] =
boundaryRadiation.absorptivity(patchID, bandI); boundaryRadiation.absorptivity(patchID, bandI);
@ -189,7 +185,7 @@ void Foam::radiation::solarLoad::updateDirectHitRadiation
// Reset qr and qrPrimary // Reset qr and qrPrimary
qrBf = 0.0; qrBf = 0.0;
for (label bandI = 0; bandI < nBands_; bandI++) for (label bandI = 0; bandI < nBands_; ++bandI)
{ {
volScalarField::Boundary& qprimaryBf = volScalarField::Boundary& qprimaryBf =
qprimaryRad_[bandI].boundaryFieldRef(); qprimaryRad_[bandI].boundaryFieldRef();
@ -199,7 +195,7 @@ void Foam::radiation::solarLoad::updateDirectHitRadiation
forAll(hitFacesId, i) forAll(hitFacesId, i)
{ {
const label faceI = hitFacesId[i]; const label faceI = hitFacesId[i];
label patchID = patches.whichPatch(faceI); const label patchID = patches.whichPatch(faceI);
const polyPatch& pp = patches[patchID]; const polyPatch& pp = patches[patchID];
const label localFaceI = faceI - pp.start(); const label localFaceI = faceI - pp.start();
const vector qPrim = const vector qPrim =
@ -303,7 +299,7 @@ void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
const label cellI = cellIds[faceI]; const label cellI = cellIds[faceI];
if (includeMappedPatchBasePatches[patchID]) if (includeMappedPatchBasePatches[patchID])
{ {
for (label bandI = 0; bandI < nBands_; bandI++) for (label bandI = 0; bandI < nBands_; ++bandI)
{ {
qrBf[patchID][faceI] += qrBf[patchID][faceI] +=
(Ed + Er) (Ed + Er)
@ -313,7 +309,7 @@ void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
} }
else else
{ {
for (label bandI = 0; bandI < nBands_; bandI++) for (label bandI = 0; bandI < nBands_; ++bandI)
{ {
Ru_[cellI] += Ru_[cellI] +=
(Ed + Er) (Ed + Er)
@ -328,6 +324,7 @@ void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
break; break;
case solarCalculator::mSunLoadConstant: case solarCalculator::mSunLoadConstant:
case solarCalculator::mSunLoadTimeDependent:
{ {
for (const label patchID : includePatches) for (const label patchID : includePatches)
{ {
@ -340,7 +337,7 @@ void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
const label cellI = cellIds[faceI]; const label cellI = cellIds[faceI];
if (includeMappedPatchBasePatches[patchID]) if (includeMappedPatchBasePatches[patchID])
{ {
for (label bandI = 0; bandI < nBands_; bandI++) for (label bandI = 0; bandI < nBands_; ++bandI)
{ {
qrBf[patchID][faceI] += qrBf[patchID][faceI] +=
solarCalc_.diffuseSolarRad() solarCalc_.diffuseSolarRad()
@ -350,7 +347,7 @@ void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
} }
else else
{ {
for (label bandI = 0; bandI < nBands_; bandI++) for (label bandI = 0; bandI < nBands_; ++bandI)
{ {
Ru_[cellI] += Ru_[cellI] +=
( (
@ -370,28 +367,24 @@ void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
void Foam::radiation::solarLoad::initialise(const dictionary& coeffs) void Foam::radiation::solarLoad::initialise(const dictionary& coeffs)
{ {
coeffs.readEntry("spectralDistribution", spectralDistribution_); spectralDistributions_.reset
(
new TimeFunction1<scalarField>
(
mesh_.time(), "spectralDistribution", coeffs
)
);
spectralDistribution_ =
spectralDistributions_->value(mesh_.time().value());
nBands_ = spectralDistribution_.size(); nBands_ = spectralDistribution_.size();
qprimaryRad_.setSize(nBands_);
if (coeffs.readIfPresent("gridUp", verticalDir_))
{
verticalDir_.normalise();
}
else
{
const uniformDimensionedVectorField& g =
meshObjects::gravity::New(mesh_.time());
verticalDir_ = (-g/mag(g)).value();
}
coeffs.readEntry("useReflectedRays", useReflectedRays_);
spectralDistribution_ = spectralDistribution_ =
spectralDistribution_/sum(spectralDistribution_); spectralDistribution_/sum(spectralDistribution_);
qprimaryRad_.setSize(nBands_);
forAll(qprimaryRad_, bandI) forAll(qprimaryRad_, bandI)
{ {
qprimaryRad_.set qprimaryRad_.set
@ -413,9 +406,21 @@ void Foam::radiation::solarLoad::initialise(const dictionary& coeffs)
); );
} }
if (coeffs.readIfPresent("gridUp", verticalDir_))
{
verticalDir_.normalise();
}
else
{
const uniformDimensionedVectorField& g =
meshObjects::gravity::New(mesh_.time());
verticalDir_ = (-g/mag(g)).value();
}
coeffs.readIfPresent("solidCoupled", solidCoupled_); coeffs.readIfPresent("solidCoupled", solidCoupled_);
coeffs.readIfPresent("wallCoupled", wallCoupled_); coeffs.readIfPresent("wallCoupled", wallCoupled_);
coeffs.readIfPresent("updateAbsorptivity", updateAbsorptivity_); coeffs.readIfPresent("updateAbsorptivity", updateAbsorptivity_);
coeffs.readEntry("useReflectedRays", useReflectedRays_);
} }
/* /*
@ -721,6 +726,7 @@ void Foam::radiation::solarLoad::calculateQdiff
Foam::radiation::solarLoad::solarLoad(const volScalarField& T) Foam::radiation::solarLoad::solarLoad(const volScalarField& T)
: :
radiationModel(typeName, T), radiationModel(typeName, T),
solarCalc_(coeffs_, mesh_),
dict_(coeffs_), dict_(coeffs_),
qr_ qr_
( (
@ -750,17 +756,18 @@ Foam::radiation::solarLoad::solarLoad(const volScalarField& T)
mesh_, mesh_,
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
), ),
solarCalc_(coeffs_, mesh_),
verticalDir_(Zero),
useReflectedRays_(false),
spectralDistribution_(),
nBands_(0),
qprimaryRad_(0),
solidCoupled_(true),
absorptivity_(mesh_.boundaryMesh().size()), absorptivity_(mesh_.boundaryMesh().size()),
spectralDistribution_(),
spectralDistributions_(),
qprimaryRad_(0),
verticalDir_(Zero),
nBands_(0),
updateTimeIndex_(0),
solidCoupled_(true),
wallCoupled_(false),
updateAbsorptivity_(false), updateAbsorptivity_(false),
firstIter_(true), useReflectedRays_(false),
updateTimeIndex_(0) firstIter_(true)
{ {
initialise(coeffs_); initialise(coeffs_);
} }
@ -773,6 +780,7 @@ Foam::radiation::solarLoad::solarLoad
) )
: :
radiationModel(typeName, dict, T), radiationModel(typeName, dict, T),
solarCalc_(dict, mesh_),
dict_(dict), dict_(dict),
qr_ qr_
( (
@ -802,18 +810,18 @@ Foam::radiation::solarLoad::solarLoad
mesh_, mesh_,
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
), ),
solarCalc_(dict, mesh_), absorptivity_(mesh_.boundaryMesh().size()),
verticalDir_(Zero),
useReflectedRays_(false),
spectralDistribution_(), spectralDistribution_(),
nBands_(0), spectralDistributions_(),
qprimaryRad_(0), qprimaryRad_(0),
verticalDir_(Zero),
nBands_(0),
updateTimeIndex_(0),
solidCoupled_(true), solidCoupled_(true),
wallCoupled_(false), wallCoupled_(false),
absorptivity_(mesh_.boundaryMesh().size()),
updateAbsorptivity_(false), updateAbsorptivity_(false),
firstIter_(true), useReflectedRays_(false),
updateTimeIndex_(0) firstIter_(true)
{ {
initialise(dict); initialise(dict);
} }
@ -821,12 +829,6 @@ Foam::radiation::solarLoad::solarLoad
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::radiation::solarLoad::nBands() const
{
return nBands_;
}
bool Foam::radiation::solarLoad::read() bool Foam::radiation::solarLoad::read()
{ {
if (radiationModel::read()) if (radiationModel::read())
@ -870,13 +872,25 @@ void Foam::radiation::solarLoad::calculate()
updateAbsorptivity(includePatches); updateAbsorptivity(includePatches);
} }
bool facesChanged = updateHitFaces(); const bool facesChanged = updateHitFaces();
if (facesChanged) const bool timeDependentLoad =
solarCalc_.sunLoadModel() == solarCalculator::mSunLoadTimeDependent;
if (facesChanged || timeDependentLoad)
{ {
// Reset Ru // Reset Ru
Ru_ = dimensionedScalar("Ru", dimMass/dimLength/pow3(dimTime), Zero); Ru_ = dimensionedScalar("Ru", dimMass/dimLength/pow3(dimTime), Zero);
solarCalc_.correctDirectSolarRad();
solarCalc_.correctDiffuseSolarRad();
spectralDistribution_ =
spectralDistributions_->value(mesh_.time().value());
spectralDistribution_ =
spectralDistribution_/sum(spectralDistribution_);
// Add direct hit radiation // Add direct hit radiation
const labelList& hitFacesId = hitFaces_->rayStartFaces(); const labelList& hitFacesId = hitFaces_->rayStartFaces();
updateDirectHitRadiation(hitFacesId, includeMappedPatchBasePatches); updateDirectHitRadiation(hitFacesId, includeMappedPatchBasePatches);

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,7 +31,7 @@ Group
grpRadiationModels grpRadiationModels
Description Description
The solar load radiation model includes Sun primary hits, their The \c solarLoad radiation model includes Sun primary hits, their
reflective fluxes and diffusive sky radiative fluxes. reflective fluxes and diffusive sky radiative fluxes.
The primary hit rays are calculated using a face shading algorithm. The primary hit rays are calculated using a face shading algorithm.
@ -43,14 +43,52 @@ Description
Fair Weather Conditions Method from the ASHRAE Handbook. Fair Weather Conditions Method from the ASHRAE Handbook.
By default the energy is included in cells adjacent to the patches into By default the energy is included in cells adjacent to the patches into
the energy Equation (wallCoupled = false). On coupled patches the flux is the energy equation (\c wallCoupled=false). On coupled patches the flux is
by default added to the wall and considered into the solid by default added to the wall and considered into the solid
(solidCoupled = true). (\c solidCoupled=true).
The solarLoad model can be used in conjuntion with fvDOM and viewFactor The \c solarLoad model can be used in conjuntion with \c fvDOM and
radiation models. The flag useSolarLoad must be true on the rediation \c viewFactor radiation models. The flag \c useSolarLoad must be
dictionary. \c true on the \c radiationProperties dictionary.
Usage
Minimal examples by using \c constant/radiationProperties:
\verbatim
solarLoadCoeffs
{
// Mandatory entries
useReflectedRays true;
spectralDistribution (1 5 1 2);
// Optional entries
solidCoupled true;
wallCoupled false;
updateAbsorptivity true;
// Mandatory/Optional (inherited) entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Reqd | Deflt
useReflectedRays | Flag to use reflected rays | bool | yes | -
spectralDistribution | Spectral distribution for the integrated <!--
--> solar heat flux | TimeFunction1\<scalarField\> | yes | -
solidCoupled | Flag to couple solids through mapped <!--
--> boundary patch using qr | bool | no | true
wallCoupled | Flag to couple wall patches using qr <!--
--> | bool | no | false
updateAbsorptivity | Flag to enable absorptivity updates <!--
--> | bool | no | false
\endtable
The inherited entries are elaborated in:
- \link radiationModel.H \endlink
- \link solarCalculator.H \endlink
- \link TimeFunction1.H \endlink
SourceFiles SourceFiles
solarLoad.C solarLoad.C
@ -65,6 +103,7 @@ SourceFiles
#include "faceShading.H" #include "faceShading.H"
#include "faceReflecting.H" #include "faceReflecting.H"
#include "solarCalculator.H" #include "solarCalculator.H"
#include "TimeFunction1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -81,10 +120,10 @@ class solarLoad
: :
public radiationModel public radiationModel
{ {
// Private Data
private: //- Solar calculator
solarCalculator solarCalc_;
// Private data
//- Dictionary //- Dictionary
dictionary dict_; dictionary dict_;
@ -102,46 +141,46 @@ private:
//- and wallCoupled false //- and wallCoupled false
DimensionedField<scalar, volMesh> Ru_; DimensionedField<scalar, volMesh> Ru_;
//- Solar calculator //- Absorptivity list
solarCalculator solarCalc_; List<List<tmp<scalarField>>> absorptivity_;
//- Vertical direction (Default is g vector)
vector verticalDir_;
//- Include reflected rays from specular surfaces
bool useReflectedRays_;
//- Spectral distribution for the integrated solar heat flux //- Spectral distribution for the integrated solar heat flux
scalarList spectralDistribution_; scalarList spectralDistribution_;
//-Number of bands //- Time-dependent spectral distributions
label nBands_; autoPtr<TimeFunction1<scalarField>> spectralDistributions_;
//- Primary solar radiative heat flux per band [W/m2] //- Primary solar radiative heat flux per band [W/m2]
PtrList<volScalarField> qprimaryRad_; PtrList<volScalarField> qprimaryRad_;
//- Couple solids through mapped boundary patch using qr (default:true) //- Vertical direction (default is g vector)
bool solidCoupled_; vector verticalDir_;
//- Couple wall patches using qr (default:false) //- Number of bands
bool wallCoupled_; label nBands_;
//- Absorptivity list
List<List<tmp<scalarField>>> absorptivity_;
//- Update absorptivity
bool updateAbsorptivity_;
//- First iteration
bool firstIter_;
//- Update Sun position index //- Update Sun position index
label updateTimeIndex_; label updateTimeIndex_;
//- Couple solids through mapped boundary patch using qr
bool solidCoupled_;
//- Couple wall patches using qr
bool wallCoupled_;
//- Update absorptivity
bool updateAbsorptivity_;
//- Include reflected rays from specular surfaces
bool useReflectedRays_;
//- First iteration
bool firstIter_;
// Private Member Functions // Private Member Functions
//- Initialise //- Initialise model parameters
void initialise(const dictionary&); void initialise(const dictionary&);
//- Update direct hit faces radiation //- Update direct hit faces radiation
@ -166,6 +205,7 @@ private:
//- Update absorptivity //- Update absorptivity
void updateAbsorptivity(const labelHashSet& includePatches); void updateAbsorptivity(const labelHashSet& includePatches);
//- No copy construct //- No copy construct
solarLoad(const solarLoad&) = delete; solarLoad(const solarLoad&) = delete;
@ -192,15 +232,18 @@ public:
virtual ~solarLoad() = default; virtual ~solarLoad() = default;
// Member functions // Member Functions
// Edit // Evaluation
//- Solve //- Read radiationProperties dictionary
bool read();
//- Solve radiation equations
void calculate(); void calculate();
//- Read radiation properties dictionary
bool read(); // Access
//- Source term component (for power of T^4) //- Source term component (for power of T^4)
virtual tmp<volScalarField> Rp() const; virtual tmp<volScalarField> Rp() const;
@ -208,17 +251,17 @@ public:
//- Source term component (constant) //- Source term component (constant)
virtual tmp<DimensionedField<scalar, volMesh>> Ru() const; virtual tmp<DimensionedField<scalar, volMesh>> Ru() const;
//- Return const access to the number of bands
label nBands() const noexcept
{
return nBands_;
}
// Access //- Return const access to the primary solar heat flux
const volScalarField& qprimaryRad(const label bandI) const
//- Number of bands {
label nBands() const; return qprimaryRad_[bandI];
}
//- Primary solar heat flux
const volScalarField& qprimaryRad(const label bandI) const
{
return qprimaryRad_[bandI];
}
}; };

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2020 OpenCFD Ltd. Copyright (C) 2015-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -46,8 +46,12 @@ const Foam::Enum
> >
Foam::solarCalculator::sunDirectionModelTypeNames_ Foam::solarCalculator::sunDirectionModelTypeNames_
({ ({
{ sunDirModel::mSunDirConstant, "constant" },
{ sunDirModel::mSunDirTracking, "tracking" },
// old long names (v2012 and earlier)
{ sunDirModel::mSunDirConstant, "sunDirConstant" }, { sunDirModel::mSunDirConstant, "sunDirConstant" },
{ sunDirModel::mSunDirTracking, "sunDirTracking" }, { sunDirModel::mSunDirTracking, "sunDirTracking" }
}); });
@ -55,14 +59,20 @@ const Foam::Enum
< <
Foam::solarCalculator::sunLModel Foam::solarCalculator::sunLModel
> >
Foam::solarCalculator::sunLoadModelTypeNames_ Foam::solarCalculator::sunLModelTypeNames_
({ ({
{ sunLModel::mSunLoadConstant, "constant" },
{ sunLModel::mSunLoadTimeDependent, "timeDependent" },
{ sunLModel::mSunLoadFairWeatherConditions, "fairWeather" },
{ sunLModel::mSunLoadTheoreticalMaximum, "theoreticalMaximum" },
// old long names (v2012 and earlier)
{ sunLModel::mSunLoadConstant, "sunLoadConstant" }, { sunLModel::mSunLoadConstant, "sunLoadConstant" },
{ {
sunLModel::mSunLoadFairWeatherConditions, sunLModel::mSunLoadFairWeatherConditions,
"sunLoadFairWeatherConditions" "sunLoadFairWeatherConditions"
}, },
{ sunLModel::mSunLoadTheoreticalMaximum, "sunLoadTheoreticalMaximum" }, { sunLModel::mSunLoadTheoreticalMaximum, "sunLoadTheoreticalMaximum" }
}); });
@ -70,41 +80,34 @@ Foam::solarCalculator::sunLoadModelTypeNames_
void Foam::solarCalculator::calculateBetaTheta() void Foam::solarCalculator::calculateBetaTheta()
{ {
scalar runTime = 0.0; scalar runTime = 0;
switch (sunDirectionModel_)
if (sunDirectionModel_ == mSunDirTracking)
{ {
case mSunDirTracking: runTime = mesh_.time().value();
{
runTime = mesh_.time().value();
break;
}
case mSunDirConstant:
{
break;
}
} }
scalar LSM = 15.0*(dict_.get<scalar>("localStandardMeridian")); const scalar LSM = 15.0*(dict_.get<scalar>("localStandardMeridian"));
scalar D = dict_.get<scalar>("startDay") + runTime/86400.0; const scalar D = dict_.get<scalar>("startDay") + runTime/86400.0;
scalar M = 6.24004 + 0.0172*D; const scalar M = 6.24004 + 0.0172*D;
scalar EOT = -7.659*sin(M) + 9.863*sin(2*M + 3.5932); const scalar EOT = -7.659*sin(M) + 9.863*sin(2*M + 3.5932);
dict_.readEntry("startTime", startTime_); dict_.readEntry("startTime", startTime_);
scalar LST = startTime_ + runTime/3600.0; const scalar LST = startTime_ + runTime/3600.0;
scalar LON = dict_.get<scalar>("longitude"); const scalar LON = dict_.get<scalar>("longitude");
scalar AST = LST + EOT/60.0 + (LON - LSM)/15; const scalar AST = LST + EOT/60.0 + (LON - LSM)/15;
scalar delta = 23.45*sin(degToRad((360*(284 + D))/365)); const scalar delta = 23.45*sin(degToRad((360*(284 + D))/365));
scalar H = degToRad(15*(AST - 12)); const scalar H = degToRad(15*(AST - 12));
scalar L = degToRad(dict_.get<scalar>("latitude")); const scalar L = degToRad(dict_.get<scalar>("latitude"));
scalar deltaRad = degToRad(delta); const scalar deltaRad = degToRad(delta);
beta_ = max(asin(cos(L)*cos(deltaRad)*cos(H) + sin(L)*sin(deltaRad)), 1e-3); beta_ = max(asin(cos(L)*cos(deltaRad)*cos(H) + sin(L)*sin(deltaRad)), 1e-3);
theta_ = acos((sin(beta_)*sin(L) - sin(deltaRad))/(cos(beta_)*cos(L))); theta_ = acos((sin(beta_)*sin(L) - sin(deltaRad))/(cos(beta_)*cos(L)));
@ -150,7 +153,7 @@ void Foam::solarCalculator::calculateSunDirection()
} }
void Foam::solarCalculator::init() void Foam::solarCalculator::initialise()
{ {
switch (sunDirectionModel_) switch (sunDirectionModel_)
{ {
@ -165,7 +168,6 @@ void Foam::solarCalculator::init()
calculateBetaTheta(); calculateBetaTheta();
calculateSunDirection(); calculateSunDirection();
} }
break; break;
} }
case mSunDirTracking: case mSunDirTracking:
@ -197,6 +199,32 @@ void Foam::solarCalculator::init()
dict_.readEntry("diffuseSolarRad", diffuseSolarRad_); dict_.readEntry("diffuseSolarRad", diffuseSolarRad_);
break; break;
} }
case mSunLoadTimeDependent:
{
directSolarRads_.reset
(
new TimeFunction1<scalar>
(
mesh_.time(),
"directSolarRad",
dict_
)
);
diffuseSolarRads_.reset
(
new TimeFunction1<scalar>
(
mesh_.time(),
"diffuseSolarRad",
dict_
)
);
directSolarRad_ = directSolarRads_->value(mesh_.time().value());
diffuseSolarRad_ = diffuseSolarRads_->value(mesh_.time().value());
break;
}
case mSunLoadFairWeatherConditions: case mSunLoadFairWeatherConditions:
{ {
dict_.readIfPresent dict_.readIfPresent
@ -207,7 +235,8 @@ void Foam::solarCalculator::init()
dict_.readEntry("A", A_); dict_.readEntry("A", A_);
dict_.readEntry("B", B_); dict_.readEntry("B", B_);
dict_.readEntry("C", C_);
dict_.readEntry("groundReflectivity", groundReflectivity_);
if (!dict_.readIfPresent("beta", beta_)) if (!dict_.readIfPresent("beta", beta_))
{ {
calculateBetaTheta(); calculateBetaTheta();
@ -216,17 +245,16 @@ void Foam::solarCalculator::init()
directSolarRad_ = directSolarRad_ =
(1.0 - 0.75*pow(skyCloudCoverFraction_, 3.0)) (1.0 - 0.75*pow(skyCloudCoverFraction_, 3.0))
* A_/exp(B_/sin(beta_)); * A_/exp(B_/sin(beta_));
dict_.readEntry("groundReflectivity", groundReflectivity_);
break; break;
} }
case mSunLoadTheoreticalMaximum: case mSunLoadTheoreticalMaximum:
{ {
dict_.readEntry("Setrn", Setrn_); dict_.readEntry("Setrn", Setrn_);
dict_.readEntry("SunPrime", SunPrime_); dict_.readEntry("SunPrime", SunPrime_);
directSolarRad_ = Setrn_*SunPrime_;
dict_.readEntry("groundReflectivity", groundReflectivity_); dict_.readEntry("groundReflectivity", groundReflectivity_);
dict_.readEntry("C", C_);
directSolarRad_ = Setrn_*SunPrime_;
break; break;
} }
} }
@ -243,26 +271,32 @@ Foam::solarCalculator::solarCalculator
: :
mesh_(mesh), mesh_(mesh),
dict_(dict), dict_(dict),
direction_(Zero),
directSolarRad_(0.0),
diffuseSolarRad_(0.0),
groundReflectivity_(0.0),
A_(0.0),
B_(0.0),
beta_(0.0),
theta_(0.0),
skyCloudCoverFraction_(0.0),
Setrn_(0.0),
SunPrime_(0.0),
C_(dict.get<scalar>("C")),
sunDirectionModel_ sunDirectionModel_
( (
sunDirectionModelTypeNames_.get("sunDirectionModel", dict) sunDirectionModelTypeNames_.get("sunDirectionModel", dict)
), ),
sunLoadModel_(sunLoadModelTypeNames_.get("sunLoadModel", dict)), sunLoadModel_(sunLModelTypeNames_.get("sunLoadModel", dict)),
coord_() direction_(Zero),
sunTrackingUpdateInterval_(0),
startTime_(0),
gridUp_(Zero),
eastDir_(Zero),
coord_(),
directSolarRad_(0),
diffuseSolarRad_(0),
directSolarRads_(),
diffuseSolarRads_(),
skyCloudCoverFraction_(0),
groundReflectivity_(0),
A_(0),
B_(0),
beta_(0),
theta_(0),
C_(0.058),
Setrn_(0),
SunPrime_(0)
{ {
init(); initialise();
} }
@ -270,19 +304,29 @@ Foam::solarCalculator::solarCalculator
void Foam::solarCalculator::correctSunDirection() void Foam::solarCalculator::correctSunDirection()
{ {
switch (sunDirectionModel_) if (sunDirectionModel_ == mSunDirTracking)
{ {
case mSunDirConstant: calculateBetaTheta();
{ calculateSunDirection();
break; directSolarRad_ = A_/exp(B_/sin(max(beta_, ROOTVSMALL)));
} }
case mSunDirTracking: }
{
calculateBetaTheta();
calculateSunDirection(); void Foam::solarCalculator::correctDirectSolarRad()
directSolarRad_ = A_/exp(B_/sin(max(beta_, ROOTVSMALL))); {
break; if (sunLoadModel_ == mSunLoadTimeDependent)
} {
directSolarRad_ = directSolarRads_->value(mesh_.time().value());
}
}
void Foam::solarCalculator::correctDiffuseSolarRad()
{
if (sunLoadModel_ == mSunLoadTimeDependent)
{
diffuseSolarRad_ = diffuseSolarRads_->value(mesh_.time().value());
} }
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2017 OpenCFD Ltd. Copyright (C) 2015-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -27,58 +27,188 @@ Class
Foam::solarCalculator Foam::solarCalculator
Description Description
The solar calculator model provides information about the Sun direction A solar calculator model providing models
and Sun load model. The available models are: for the solar direction and solar loads.
For the Sun direction: Available models for the solar direction:
1) SunDirConstant : the direction is given in 'sunDirection' - \c constant: Constant sunbeam direction.
2) SunDirTracking : the direction is calculated from the following - \c tracking: Transient model calculating sunbeam direction
parameters: based on a given set of parameters.
localStandardMeridian : GMT (Local Zone Meridian) in hours
startDay : day from 1 to 365)
startTime: in hours
longitude: in degrees
latitude: in degrees
gridUp: grid orientation upwards
gridEast grid orientation eastwards
This model should be use in transient calculations. Available models for the solar load:
The keyword 'sunTrackingUpdateInterval' (in hours) specifies on which - \c constant: Constant solar load.
interval is the Sun direction updated. - \c timeDependent: Time-dependent solar load.
- \c fairWeather: Solar fluxes are calculated following
the "Fair Weather Conditions Method from the ASHRAE Handbook".
- \c theoreticalMaximum: Theoretically maximum solar load.
Usage
Minimal examples by using \c constant/radiationProperties:
\c sunDirectionModel - Option-1:
\verbatim
solarLoadCoeffs
{
sunDirectionModel constant;
sunDirection (1 0 -1);
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Reqd | Deflt
sunDirection | Sunbeam direction | vector | no | calculated
\endtable
Solar Load models available: \c sunDirectionModel - Option-2:
1) SunLoadConstant: direct and diffusive heat fluxes are provided by the \verbatim
entries 'directSolarRad' and 'diffuseSolarRad' solarLoadCoeffs
{
sunDirectionModel tracking;
sunTrackingUpdateInterval 800;
localStandardMeridian 9;
startDay 204;
startTime 15;
longitude 139.74;
latitude 35.658;
gridUp (0 0 1);
gridEast (1 0 0);
}
\endverbatim
2) SunLoadFairWeatherConditions: The solar fluxes are calculated following where the entries mean:
the Fair Weather Conditions Method from the ASHRAE Handbook. The entries \table
are: Property | Description | Type | Reqd | Deflt
skyCloudCoverFraction: Fraction of sky covered by clouds (0-1) sunTrackingUpdateInterval | Interval to update the Sun direction <!--
A : Apparent solar irradiation at air mass m = 0 --> [decimal hours] | scalar | yes | -
B : Atmospheric extinction coefficient localStandardMeridian | GMT (Local Zone Meridian) [decimal hours]<!--
beta: Solar altitude (in degrees) above the horizontal. This --> | scalar | yes | -
can be read or calculated providing the respective parameters startDay | Day from 1 to 365 | scalar | yes | -
for Sun position explained above. startTime | Start time for the Sun position [decimal hours] <!--
groundReflectivity : ground reflectivity --> | scalar | yes | -
longitude | Geographic coordinate specifying the eastwest <!--
--> position of a point on the surface of a planetary <!--
--> body [degree] | scalar | yes | -
latitude | Geographic coordinate specifying the northsouth <!--
--> position of a point on the surface of a planetary <!--
--> body [degree] | scalar | yes | -
gridUp | Grid orientation upwards | vector | yes | -
gridEast | Grid orientation eastwards | vector | yes | -
\endtable
In this model the flux is calculated as:
directSolarRad = \c sunLoadModel - Option-1:
(1 - 0.75*skyCloudCoverFraction^3)*A/exp(B/sin(beta)); \verbatim
solarLoadCoeffs
{
sunLoadModel constant;
directSolarRad 100;
diffuseSolarRad 0;
}
\endverbatim
3) SunLoadTheoreticalMaximum: The entries are: where the entries mean:
Setrn \table
SunPrime: Property | Description | Type | Reqd | Deflt
groundReflectivity : ground reflectivity directSolarRad | Direct solar irradiation [W/m2] | scalar | yes | -
diffuseSolarRad | Diffuse solar irradiation on vertical surfaces <!--
--> [W/m2] | scalar | yes | -
\endtable
In this model the flux is calculated as:
directSolarRad = Setrn*SunPrime; \c sunLoadModel - Option-2:
\verbatim
solarLoadCoeffs
{
sunLoadModel timeDependent;
directSolarRad <TimeFunction1<scalar>>;
diffuseSolarRad <TimeFunction1<scalar>>;
}
\endverbatim
The diffuse on vertical/horizontal walls and ground-reflected radiation are where the entries mean:
\table
Property | Description | Type | Reqd | Deflt
directSolarRad | Time-series of direct solar irradiation <!--
--> [W/m2] | TimeFunction1\<scalar\> | yes | -
diffuseSolarRad | Time-series of diffuse solar irradiation on <!--
--> vertical surfaces [W/m2] <!--
--> | TimeFunction1\<scalar\> | yes | -
\endtable
\c sunLoadModel - Option-3:
\verbatim
solarLoadCoeffs
{
sunLoadModel fairWeather;
skyCloudCoverFraction 0.25;
groundReflectivity 1.0;
A 0.1;
B 0.2;
C 0.058;
beta 0.15;
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Reqd | Deflt
A | Apparent solar irradiation at air mass m = 0 <!--
--> | scalar | yes | -
B | Atmospheric extinction coefficient <!--
--> | scalar | yes | -
C | Solar diffusivity constant | scalar | yes | -
groundReflectivity | Ground reflectivity | scalar | yes | -
skyCloudCoverFraction | Fraction of sky covered by clouds [0,1] <!--
--> | scalar | no | 0
beta | Solar altitude (in degrees) above the horizontal <!--
--> | scalar | no | calculated
\endtable
In this model the flux is calculated as:
\verbatim
directSolarRad = (1 - 0.75*skyCloudCoverFraction^3)*A/exp(B/sin(beta));
\endverbatim
\c sunLoadModel - Option-4:
\verbatim
solarLoadCoeffs
{
sunLoadModel theoreticalMaximum;
Setrn 1.0;
SunPrime 4.0;
groundReflectivity 1.0;
C 0.058;
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Reqd | Deflt
Setrn | Parameter in maximum theoretical direct solar <!--
--> model | scalar | yes | -
SunPrime | Parameter in maximum theoretical direct solar <!--
--> model | scalar | yes | -
groundReflectivity | Ground reflectivity | scalar | yes | -
C | Solar diffusivity constant | scalar | yes | -
\endtable
In this model the flux is calculated as:
\verbatim
directSolarRad = Setrn*SunPrime;
\endverbatim
Note
- The \c sunDirectionModel:tracking can only be used
in transient calculations.
- The keyword \c sunTrackingUpdateInterval (in hours) specifies on which
interval is the Sun direction updated.
- The diffuse on vertical/horizontal walls and ground-reflected radiation are
calculated following the ASHRAE Handbook. calculated following the ASHRAE Handbook.
- The range of \c skyCloudCoverFraction is [0,1].
SourceFiles SourceFiles
solarCalculator.C solarCalculator.C
@ -93,6 +223,7 @@ SourceFiles
#include "DynamicField.H" #include "DynamicField.H"
#include "HashSet.H" #include "HashSet.H"
#include "coordinateSystem.H" #include "coordinateSystem.H"
#include "TimeFunction1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -107,37 +238,34 @@ class solarCalculator
{ {
public: public:
// Public enumeration // Public Enumeration
//- Sun direction models //- Options for the Sun direction models
enum sunDirModel enum sunDirModel
{ {
mSunDirConstant, mSunDirConstant,
mSunDirTracking mSunDirTracking
}; };
//- Direct sun load models //- Names for sunDirModel
static const Enum<sunDirModel> sunDirectionModelTypeNames_;
//- Options for the Sun load models
enum sunLModel enum sunLModel
{ {
mSunLoadConstant, mSunLoadConstant,
mSunLoadTimeDependent,
mSunLoadFairWeatherConditions, mSunLoadFairWeatherConditions,
mSunLoadTheoreticalMaximum mSunLoadTheoreticalMaximum
}; };
//- Names for sunLModel
protected: static const Enum<sunLModel> sunLModelTypeNames_;
//- Sun direction models
static const Enum<sunDirModel> sunDirectionModelTypeNames_;
//- Sun load models
static const Enum<sunLModel> sunLoadModelTypeNames_;
private: private:
// Private data // Private Data
//- Reference to mesh //- Reference to mesh
const fvMesh& mesh_; const fvMesh& mesh_;
@ -145,56 +273,78 @@ private:
//- Dictionary //- Dictionary
dictionary dict_; dictionary dict_;
//- Direction
vector direction_;
//- Direct solar irradiation
scalar directSolarRad_;
//- Diffuse solar irradiation on vertical surfaces
scalar diffuseSolarRad_;
//- Ground reflectivity
scalar groundReflectivity_;
//- Fair weather direct solar load model parameters
scalar A_;
scalar B_;
scalar beta_;
scalar theta_;
//- Sky cloud cover fraction [0-1]
scalar skyCloudCoverFraction_;
//- Maximum theoretical direct solar load model parameters
scalar Setrn_;
scalar SunPrime_;
//- Diffusive solar load model parameters
scalar C_;
//- Sun direction model //- Sun direction model
sunDirModel sunDirectionModel_; sunDirModel sunDirectionModel_;
//- Sun load model //- Sun load model
sunLModel sunLoadModel_; sunLModel sunLoadModel_;
//- Grid coordinate system
autoPtr<coordinateSystem> coord_;
//- East grid orientation // sunDirectionModel = constant
vector eastDir_;
//- Up grid orientation //- Sunbeam direction
vector gridUp_; vector direction_;
//- Interval in decimal hours to update Sun direction for SunDirTracking
scalar sunTrackingUpdateInterval_;
//- Start time for the Sun position (decimal hours) // sunDirectionModel = tracking
scalar startTime_;
//- Interval to update the Sun direction [decimal hours]
scalar sunTrackingUpdateInterval_;
//- Start time for the Sun position [decimal hours]
scalar startTime_;
//- Up grid orientation
vector gridUp_;
//- East grid orientation
vector eastDir_;
//- Grid coordinate system
autoPtr<coordinateSystem> coord_;
// sunLoadModel = constant
//- Direct solar irradiation
scalar directSolarRad_;
//- Diffuse solar irradiation on vertical surfaces
scalar diffuseSolarRad_;
// sunLoadModel = timeDependent
//- Time-series of direct solar irradiation
autoPtr<TimeFunction1<scalar>> directSolarRads_;
//- Time-series of diffuse solar irradiation on vertical surfaces
autoPtr<TimeFunction1<scalar>> diffuseSolarRads_;
// sunLoadModel = fairWeather
//- Sky cloud cover fraction [0-1]
scalar skyCloudCoverFraction_;
//- Ground reflectivity
scalar groundReflectivity_;
//- Fair weather direct solar load model parameters
scalar A_;
scalar B_;
scalar beta_;
scalar theta_;
//- Diffusive solar load model parameter
scalar C_;
// sunLoadModel = theoreticalMaximum
//- Maximum theoretical direct solar load model parameters
scalar Setrn_;
scalar SunPrime_;
//- No copy construct //- No copy construct
@ -204,15 +354,15 @@ private:
void operator=(const solarCalculator&) = delete; void operator=(const solarCalculator&) = delete;
// Private members // Private Member Functions
//- Init //- Initialise model parameters
void init(); void initialise();
//- Calculate beta and theta angles //- Calculate beta and theta angles
void calculateBetaTheta(); void calculateBetaTheta();
//- Calculate Sun direction //- Calculate the Sun direction
void calculateSunDirection(); void calculateSunDirection();
@ -234,101 +384,109 @@ public:
// Member Functions // Member Functions
// Evaluation
//- Correct the Sun direction
void correctSunDirection();
//- Correct direct solar irradiation
void correctDirectSolarRad();
//- Correct diffuse solar irradiation
void correctDiffuseSolarRad();
// Access // Access
//- const access to direction //- Return const access to the Sun direction model
const vector& direction() const const sunDirModel& sunDirectionModel() const noexcept
{ {
return direction_; return sunDirectionModel_;
} }
//- Non-const access to direction //- Return const access to the Sun load model
const sunLModel& sunLoadModel() const noexcept
{
return sunLoadModel_;
}
//- Return non-const access to the Sun direction
vector& direction() vector& direction()
{ {
return direction_; return direction_;
} }
//- Return direct solar irradiation //- Return const access to the Sun direction
const vector& direction() const noexcept
{
return direction_;
}
//- Return non-const access to the direct solar irradiation
scalar& directSolarRad() scalar& directSolarRad()
{ {
return directSolarRad_; return directSolarRad_;
} }
//- Return const access to direct solar irradiation //- Return const access to the direct solar irradiation
const scalar& directSolarRad() const const scalar& directSolarRad() const noexcept
{ {
return directSolarRad_; return directSolarRad_;
} }
//- Return diffuse solar irradiation //- Return non-const access to the diffuse solar irradiation
scalar& diffuseSolarRad() scalar& diffuseSolarRad()
{ {
return diffuseSolarRad_; return diffuseSolarRad_;
} }
//- Return diffuse solar irradiation //- Return const access to the diffuse solar irradiation
const scalar& diffuseSolarRad() const const scalar& diffuseSolarRad() const noexcept
{ {
return diffuseSolarRad_; return diffuseSolarRad_;
} }
//- Return C constant //- Return const access to the C constant
scalar C() scalar C() const noexcept
{ {
return C_; return C_;
} }
//- Return beta //- Return const access to beta
scalar beta() scalar beta() const noexcept
{ {
return beta_; return beta_;
} }
//- Return theta //- Return const access to theta
scalar theta() scalar theta() const noexcept
{ {
return theta_; return theta_;
} }
//- Return Sun direction model //- Return const access to the ground reflectivity
sunDirModel sunDirectionModel() const scalar groundReflectivity() const noexcept
{
return sunDirectionModel_;
}
//- Return Sun load model
sunLModel sunLoadModel() const
{
return sunLoadModel_;
}
//- Return groundReflectivity
scalar groundReflectivity()
{ {
return groundReflectivity_; return groundReflectivity_;
} }
//- Return coordinateSystem //- Return const access to the coordinate system
const coordinateSystem& coord() const coordinateSystem& coord() const noexcept
{ {
return *coord_; return *coord_;
} }
//- Return sunTrackingUpdateInterval //- Return const access to sunTrackingUpdateInterval
scalar sunTrackingUpdateInterval() scalar sunTrackingUpdateInterval() const noexcept
{ {
return sunTrackingUpdateInterval_; return sunTrackingUpdateInterval_;
} }
//- Return startTime //- Return const access to startTime
scalar startTime() scalar startTime() const noexcept
{ {
return startTime_; return startTime_;
} }
//- Recalculate
void correctSunDirection();
}; };

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "constant";
object radiationProperties; object radiationProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -21,67 +20,52 @@ radiationModel solarLoad;
solarLoadCoeffs solarLoadCoeffs
{ {
sunDirectionModel sunDirConstant; sunDirectionModel constant;
skyCloudCoverFraction 0; sunDirection (-1 0.7 -1.5);
localStandardMeridian -8; // GMT offset (hours)
startDay 22; // day of the year
startTime 10; // time of the day (hours decimal)
longitude -118.243683; // longitude (degrees)
latitude 34.052235; // latitude (degrees)
gridUp (0 0 1); // grid orientation
gridEast (0 1 0);
sunDirection (-1 0.7 -1.5);
localStandardMeridian -8; // GMT offset (hours) sunLoadModel fairWeather;
startDay 22; // day of the year
startTime 10; // time of the day (hours decimal)
longitude -118.243683; // longitude (degrees) // Fair Weather Conditions Model Constants.
latitude 34.052235; // latitude (degrees) // Calculate beta from the Solar calculator or input
skyCloudCoverFraction 0;
groundReflectivity 0.2;
A 2229.78119355; // Apparent solar irradiation at air mass m = 0
B 0.142064516129; // Atmospheric extinction coefficient
C 0.058064516129; // Solar diffusivity constant
//beta 45; // Solar altitude (in degrees) above the horizontal
// see solarCalculator.H for other model examples and details
// Grid orientation
gridUp (0 0 1);
gridEast (0 1 0);
// Energy spectrum // Energy spectrum
spectralDistribution (2 1); spectralDistribution (2 1);
// Solar model:
// sunLoadConstant-sunLoadFairWeatherConditions-SunLoadTheoreticalMaximum;
sunLoadModel sunLoadFairWeatherConditions;
// Sun load constant model
//directSolarRad 500;
//diffuseSolarRad 40;
// Fair Weather Conditions Model Constants.
// Calculate beta from the Solar calculator or input
A 2229.78119355; // Apparent solar irradiation at air mass m = 0
B 0.142064516129; // Atmospheric extinction coefficient
//beta 45; // Solar altitude (in degrees) above the horizontal
// Theoretical maximum model constants
//Setrn 10;
//SunPrime 1;
// Ground reflectivity
groundReflectivity 0.2;
// Solar diffusivity constants
C 0.058064516129; // Model constant
// Radiative flux coupling flags // Radiative flux coupling flags
solidCoupled false; // Couple through Qr the solid regions (default true) solidCoupled false; // Couple through Qr the solid regions (default true)
wallCoupled true; // Couple through Qr wall patches (default false) wallCoupled true; // Couple through Qr wall patches (default false)
// Reflecting rays // Reflecting rays
useReflectedRays true; useReflectedRays true;
reflecting reflecting
{ {
nPhi 10; nPhi 10;
nTheta 10; nTheta 10;
} }
absorptionEmissionModel none; absorptionEmissionModel none;
scatterModel none; scatterModel none;
sootModel none; sootModel none;
} }
// Number of flow iterations per radiation iteration // Number of flow iterations per radiation iteration

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "constant";
object radiationProperties; object radiationProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -21,71 +20,51 @@ radiationModel viewFactor;
solarLoadCoeffs solarLoadCoeffs
{ {
sunDirectionModel tracking;
// Sun direction ray model. Give the sunDirection or calculated using the sunTrackingUpdateInterval 800; // Time interval to update Sun position
// (solar calculator) localStandardMeridian 9; // GMT offset (hours)
sunDirectionModel sunDirTracking; //sunDirConstant startDay 204; // day of the year
startTime 15; // time of the day (hours decimal)
// Time interval to update Sun position (sec) longitude 139.74; // longitude (degrees)
sunTrackingUpdateInterval 800; latitude 35.658; // latitude (degrees)
gridUp (0 0 1); // grid orientation
//sunDirection (1 0 -1); gridEast (1 0 0);
localStandardMeridian 9; // GMT offset (hours)
startDay 204; // day of the year
startTime 15; // time of the day (hours decimal)
longitude 139.74; // longitude (degrees)
latitude 35.658; // latitude (degrees)
// Grid orientation sunLoadModel fairWeather;
gridUp (0 0 1);
gridEast (1 0 0); // Fair weather conditions model constants
// Calculate beta from the Solar calculator or input
groundReflectivity 0.2;
A 500; // Apparent solar irradiation at air mass m = 0
B 0.142; // Atmospheric extinction coefficient
C 0.058; // Solar diffusivity constant
//beta 45; // Solar altitude (in degrees) above the horizontal
// see solarCalculator.H for other model examples and details
// Energy spectrum // Energy spectrum
spectralDistribution (2 1); spectralDistribution (2 1);
// Solar model:
// sunLoadConstant-sunLoadFairWeatherConditions-SunLoadTheoreticalMaximum;
sunLoadModel sunLoadFairWeatherConditions;
// Sun load constant model
//directSolarRad 500; // [w/m2]
//diffuseSolarRad 40; // [w/m2]
// Fair Weather Conditions Model Constants.
// Calculate beta from the Solar calculator or input
A 500; // Apparent solar irradiation at air mass m = 0
B 0.142; // Atmospheric extinction coefficient
//beta 45; // Solar altitude (in degrees) above the horizontal
// Theoretical maximum model constants
Setrn 10;
SunPrime 1;
// Ground reflectivity
groundReflectivity 0.2;
// Solar diffusivity constants
C 0.058; // Model constant
// Radiative flux coupling flags // Radiative flux coupling flags
solidCoupled true; //Couple through qr the solid regions (default true) solidCoupled true; //Couple through qr the solid regions (default true)
wallCoupled false; //Couple through qr wall patches (default false) wallCoupled false; //Couple through qr wall patches (default false)
// Reflecting rays // Reflecting rays
useReflectedRays true; useReflectedRays true;
reflecting reflecting
{ {
nPhi 10; nPhi 10;
nTheta 10; nTheta 10;
} }
absorptionEmissionModel none; absorptionEmissionModel none;
scatterModel none; scatterModel none;
sootModel none; sootModel none;
} }
@ -109,4 +88,5 @@ scatterModel none;
sootModel none; sootModel none;
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,7 +10,6 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
location "constant";
object radiationProperties; object radiationProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -36,48 +35,30 @@ fvDOMCoeffs
solarCalculatorCoeffs solarCalculatorCoeffs
{ {
// (solar calculator) sunDirectionModel tracking;
sunDirectionModel sunDirTracking; //sunDirConstant
// Time interval to update Sun position (sec) sunTrackingUpdateInterval 800; // Time interval to update Sun position
sunTrackingUpdateInterval 800; localStandardMeridian 9; // GMT offset (hours)
startDay 204; // day of the year
//sunDirection (1 0 -1); startTime 15; // time of the day (hours decimal)
longitude 139.74; // longitude (degrees)
localStandardMeridian 9; // GMT offset (hours) latitude 35.658; // latitude (degrees)
startDay 204; // day of the year gridUp (0 0 1); // Grid orientation
startTime 15; // time of the day (hours decimal) gridEast (1 0 0);
longitude 139.74; // longitude (degrees)
latitude 35.658; // latitude (degrees)
// Grid orientation sunLoadModel fairWeather;
gridUp (0 0 1);
gridEast (1 0 0);
// sunLoadConstant-sunLoadFairWeatherConditions-SunLoadTheoreticalMaximum; // Fair weather conditions model constants
sunLoadModel sunLoadFairWeatherConditions;//sunLoadConstant;//; // Calculate beta from the Solar calculator or input
groundReflectivity 0.2;
A 500; // Apparent solar irradiation at air mass m = 0
B 0.142; // Atmospheric extinction coefficient
C 0.058; // Solar diffusivity constant
//beta 45; // Solar altitude (in degrees) above the horizontal
// Sun load constant model
//directSolarRad 500; // [w/m2]
//diffuseSolarRad 0; // [w/m2]
// Fair Weather Conditions Model Constants.
// Calculate beta from the Solar calculator or input
A 500; // Apparent solar irradiation at air mass m = 0
B 0.142; // Atmospheric extinction coefficient
//beta 45; // Solar altitude (in degrees) above the horizontal
// Theoretical maximum model constants
Setrn 10;
SunPrime 1;
// Ground reflectivity
groundReflectivity 0.2;
// Solar diffusivity constants
C 0.058; // Model constant
// see solarCalculator.H for other model examples and details
} }
// Number of flow iterations per radiation iteration // Number of flow iterations per radiation iteration