Merge branch 'feature-reflectiveSolarLoad' into 'develop'

Feature reflective solar load

See merge request Development/OpenFOAM-plus!243
This commit is contained in:
Andrew Heather
2019-05-02 10:45:45 +01:00
committed by Andrew Heather
117 changed files with 28104 additions and 1376 deletions

View File

@ -533,6 +533,11 @@ bool Foam::radiation::laserDTRM::read()
return false;
}
Foam::label Foam::radiation::laserDTRM::nBands() const
{
return 1;
}
void Foam::radiation::laserDTRM::calculate()
{

View File

@ -250,6 +250,9 @@ public:
//- Read radiation properties dictionary
bool read();
//- Number of bands for this radiation model
virtual label nBands() const;
// Access

View File

@ -2191,16 +2191,36 @@ Foam::triSurface Foam::triSurfaceTools::triangulate
(
const polyBoundaryMesh& bMesh,
const labelHashSet& includePatches,
labelList& faceMap,
const bool verbose
)
{
const polyMesh& mesh = bMesh.mesh();
// Storage for surfaceMesh. Size estimate.
DynamicList<labelledTri> triangles(mesh.nBoundaryFaces());
List<labelledTri> triangles;
// Calculate number of faces and triangles
label nFaces = 0;
label nTris = 0;
for (const label patchi : includePatches)
{
const polyPatch& patch = bMesh[patchi];
const pointField& points = patch.points();
nFaces += patch.size();
for (const face& f : patch)
{
faceList triFaces(f.nTriangles(points));
nTris += triFaces.size();
}
}
triangles.setSize(nTris);
faceMap.setSize(nTris);
label newPatchi = 0;
nTris = 0;
for (const label patchi : includePatches)
{
const polyPatch& patch = bMesh[patchi];
@ -2208,6 +2228,7 @@ Foam::triSurface Foam::triSurfaceTools::triangulate
label nTriTotal = 0;
label faceI = 0;
for (const face& f : patch)
{
faceList triFaces(f.nTriangles(points));
@ -2218,10 +2239,13 @@ Foam::triSurface Foam::triSurfaceTools::triangulate
for (const face& f : triFaces)
{
triangles.append(labelledTri(f[0], f[1], f[2], newPatchi));
faceMap[nTris] = patch.start() + faceI;
triangles[nTris++] = labelledTri(f[0], f[1], f[2], newPatchi);
++nTriTotal;
}
faceI++;
}
if (verbose)
@ -2233,7 +2257,7 @@ Foam::triSurface Foam::triSurfaceTools::triangulate
newPatchi++;
}
triangles.shrink();
//triangles.shrink();
// Create globally numbered tri surface
triSurface rawSurface(triangles, mesh.points());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2018 OpenFOAM Foundation
@ -479,10 +479,12 @@ public:
//- Simple triangulation of (selected patches of) boundaryMesh. Needs
// polyMesh (or polyBoundaryMesh) since only at this level are the
// triangles on neighbouring patches connected.
// Return faceMap from triI to faceI
static triSurface triangulate
(
const polyBoundaryMesh& mBesh,
const labelHashSet& includePatches,
labelList& faceMap,
const bool verbose = false
);

View File

@ -3794,7 +3794,7 @@ void Foam::distributedTriSurfaceMesh::getRegion
labelList triangleIndex(info.size());
autoPtr<mapDistribute> mapPtr
(
calcLocalQueries
localQueries
(
info,
triangleIndex
@ -3859,7 +3859,7 @@ void Foam::distributedTriSurfaceMesh::getNormal
labelList triangleIndex(info.size());
autoPtr<mapDistribute> mapPtr
(
calcLocalQueries
localQueries
(
info,
triangleIndex
@ -4261,7 +4261,7 @@ void Foam::distributedTriSurfaceMesh::getField
labelList triangleIndex(info.size());
autoPtr<mapDistribute> mapPtr
(
calcLocalQueries
localQueries
(
info,
triangleIndex
@ -4352,6 +4352,128 @@ Foam::triSurface Foam::distributedTriSurfaceMesh::overlappingSurface
}
// Exchanges indices to the processor they come from.
// - calculates exchange map
// - uses map to calculate local triangle index
Foam::autoPtr<Foam::mapDistribute>
Foam::distributedTriSurfaceMesh::localQueries
(
const List<pointIndexHit>& info,
labelList& triangleIndex
) const
{
triangleIndex.setSize(info.size());
const globalIndex& triIndexer = globalTris();
// Determine send map
// ~~~~~~~~~~~~~~~~~~
// Since determining which processor the query should go to is
// cheap we do a multi-pass algorithm to save some memory temporarily.
// 1. Count
labelList nSend(Pstream::nProcs(), 0);
forAll(info, i)
{
if (info[i].hit())
{
label proci = triIndexer.whichProcID(info[i].index());
nSend[proci]++;
}
}
// 2. Size sendMap
labelListList sendMap(Pstream::nProcs());
forAll(nSend, proci)
{
sendMap[proci].setSize(nSend[proci]);
nSend[proci] = 0;
}
// 3. Fill sendMap
forAll(info, i)
{
if (info[i].hit())
{
label proci = triIndexer.whichProcID(info[i].index());
triangleIndex[i] = triIndexer.toLocal(proci, info[i].index());
sendMap[proci][nSend[proci]++] = i;
}
else
{
triangleIndex[i] = -1;
}
}
// Send over how many i need to receive
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelListList sendSizes(Pstream::nProcs());
sendSizes[Pstream::myProcNo()].setSize(Pstream::nProcs());
forAll(sendMap, proci)
{
sendSizes[Pstream::myProcNo()][proci] = sendMap[proci].size();
}
Pstream::gatherList(sendSizes);
Pstream::scatterList(sendSizes);
// Determine receive map
// ~~~~~~~~~~~~~~~~~~~~~
labelListList constructMap(Pstream::nProcs());
// My local segments first
constructMap[Pstream::myProcNo()] = identity
(
sendMap[Pstream::myProcNo()].size()
);
label segmenti = constructMap[Pstream::myProcNo()].size();
forAll(constructMap, proci)
{
if (proci != Pstream::myProcNo())
{
// What i need to receive is what other processor is sending to me.
label nRecv = sendSizes[proci][Pstream::myProcNo()];
constructMap[proci].setSize(nRecv);
for (label i = 0; i < nRecv; i++)
{
constructMap[proci][i] = segmenti++;
}
}
}
// Pack into distribution map
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
autoPtr<mapDistribute> mapPtr
(
new mapDistribute
(
segmenti, // size after construction
std::move(sendMap),
std::move(constructMap)
)
);
const mapDistribute& map = mapPtr();
// Send over queries
// ~~~~~~~~~~~~~~~~~
map.distribute(triangleIndex);
return mapPtr;
}
void Foam::distributedTriSurfaceMesh::distribute
(
const List<treeBoundBox>& bbs,

View File

@ -202,6 +202,7 @@ private:
// Triangle index
//- Helper: convert local triangle indices to global ones
void convertTriIndices(List<pointIndexHit>& info) const;
@ -559,6 +560,17 @@ public:
labelList& subFaceMap
);
//- Obtains global indices from pointIndexHit and swaps them back
// to their original processor. Used to calculate local region
// and normal.
virtual autoPtr<mapDistribute> localQueries
(
const List<pointIndexHit>&,
labelList& triangleIndex
) const;
//- Print some stats. Parallel aware version of
// triSurface::writeStats.
void writeStats(Ostream& os) const;

View File

@ -77,6 +77,8 @@ Foam::patchDistMethods::exact::patchSurface() const
Info<< "Triangulating local patch faces" << nl << endl;
labelList mapTriToGlobal;
patchSurfPtr_.reset
(
new distributedTriSurfaceMesh
@ -93,7 +95,8 @@ Foam::patchDistMethods::exact::patchSurface() const
triSurfaceTools::triangulate
(
pbm,
patchIDs_
patchIDs_,
mapTriToGlobal
),
dict
)

View File

@ -11,6 +11,7 @@ radiationModels/viewFactor/viewFactor.C
radiationModels/opaqueSolid/opaqueSolid.C
radiationModels/solarLoad/solarLoad.C
radiationModels/solarLoad/faceShading/faceShading.C
radiationModels/solarLoad/faceReflecting/faceReflecting.C
/* Scatter model */
submodels/scatterModel/scatterModel/scatterModel.C
@ -18,6 +19,18 @@ submodels/scatterModel/scatterModel/scatterModelNew.C
submodels/scatterModel/noScatter/noScatter.C
submodels/scatterModel/constantScatter/constantScatter.C
/* Wall sub-models */
submodels/wallTransmissivityModel/wallTransmissivityModel/wallTransmissivityModel.C
submodels/wallTransmissivityModel/wallTransmissivityModel/wallTransmissivityModelNew.C
submodels/wallTransmissivityModel/constantTransmissivity/constantTransmissivity.C
submodels/wallTransmissivityModel/multiBandTransmissivity/multiBandTransmissivity.C
submodels/wallAbsorptionEmissionModel/wallAbsorptionEmissionModel/wallAbsorptionEmissionModel.C
submodels/wallAbsorptionEmissionModel/wallAbsorptionEmissionModel/wallAbsorptionEmissionModelNew.C
submodels/wallAbsorptionEmissionModel/multiBandAbsorption/multiBandAbsorption.C
submodels/wallAbsorptionEmissionModel/constantAbsorption/constantAbsorption.C
submodels/wallAbsorptionEmissionModel/solidAbsorption/solidAbsorption.C
/* Absorption/Emission model */
submodels/absorptionEmissionModel/absorptionEmissionModel/absorptionEmissionModel.C
submodels/absorptionEmissionModel/absorptionEmissionModel/absorptionEmissionModelNew.C
@ -31,18 +44,19 @@ submodels/absorptionEmissionModel/multiBandSolidAbsorptionEmission/multiBandSoli
submodels/boundaryRadiationProperties/boundaryRadiationProperties.C
submodels/boundaryRadiationProperties/boundaryRadiationPropertiesPatch.C
/* Types of radiative walls */
submodels/boundaryRadiationProperties/transparent/transparent.C
submodels/boundaryRadiationProperties/lookup/lookup.C
submodels/boundaryRadiationProperties/opaqueDiffusive/opaqueDiffusive.C
submodels/boundaryRadiationProperties/opaqueReflective/opaqueReflective.C
/* Soot model */
submodels/sootModel/sootModel/sootModel.C
submodels/sootModel/sootModel/sootModelNew.C
submodels/sootModel/mixtureFractionSoot/mixtureFractionSoots.C
submodels/sootModel/noSoot/noSoot.C
/* Transmissivity model */
submodels/transmissivityModel/transmissivityModel/transmissivityModel.C
submodels/transmissivityModel/transmissivityModel/transmissivityModelNew.C
submodels/transmissivityModel/noTransmissivity/noTransmissivity.C
submodels/transmissivityModel/constantTransmissivity/constantTransmissivity.C
submodels/transmissivityModel/multiBandSolidTransmissivity/multiBandSolidTransmissivity.C
/* Solar calculator model */
submodels/solarCalculator/solarCalculator.C

View File

@ -47,8 +47,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
TName_("T"),
solarLoad_(false)
TName_("T")
{
refValue() = 0.0;
refGrad() = 0.0;
@ -66,8 +65,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
TName_(ptf.TName_),
solarLoad_(ptf.solarLoad_)
TName_(ptf.TName_)
{}
@ -80,8 +78,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
TName_(dict.lookupOrDefault<word>("T", "T")),
solarLoad_(dict.lookupOrDefault("solarLoad", false))
TName_(dict.lookupOrDefault<word>("T", "T"))
{
if (dict.found("refValue"))
{
@ -111,8 +108,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField
)
:
mixedFvPatchScalarField(ptf),
TName_(ptf.TName_),
solarLoad_(ptf.solarLoad_)
TName_(ptf.TName_)
{}
@ -124,8 +120,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField
)
:
mixedFvPatchScalarField(ptf, iF),
TName_(ptf.TName_),
solarLoad_(ptf.solarLoad_)
TName_(ptf.TName_)
{}
@ -197,12 +192,23 @@ updateCoeffs()
Ir += dom.IRay(rayI).qin().boundaryField()[patchi];
}
if (solarLoad_)
if (dom.useSolarLoad())
{
// Looking for primary heat flux single band
Ir += patch().lookupPatchField<volScalarField,scalar>
(
dom.externalRadHeatFieldName_
dom.primaryFluxName_ + "_0"
);
word qSecName = dom.relfectedFluxName_ + "_0";
if (this->db().foundObject<volScalarField>(qSecName))
{
const volScalarField& qSec =
this->db().lookupObject<volScalarField>(qSecName);
Ir += qSec.boundaryField()[patch().index()];
}
}
forAll(Iw, faceI)
@ -248,7 +254,6 @@ void Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::write
{
mixedFvPatchScalarField::write(os);
os.writeEntryIfDifferent<word>("T", "T", TName_);
os.writeEntry("solarLoad", solarLoad_);
}

View File

@ -86,10 +86,6 @@ class greyDiffusiveRadiationMixedFvPatchScalarField
//- Name of temperature field
word TName_;
//- Activate solar load
bool solarLoad_;
public:
//- Runtime type information

View File

@ -30,6 +30,7 @@ License
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "radiationModel.H"
#include "viewFactor.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -41,8 +42,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF),
qro_(),
solarLoad_(false)
qro_()
{}
@ -56,8 +56,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
qro_(ptf.qro_, mapper),
solarLoad_(ptf.solarLoad_)
qro_(ptf.qro_, mapper)
{}
@ -70,8 +69,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF, dict, false),
qro_("qro", dict, p.size()),
solarLoad_(dict.lookupOrDefault("solarLoad", false))
qro_("qro", dict, p.size())
{
if (dict.found("value"))
{
@ -95,8 +93,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField
)
:
fixedValueFvPatchScalarField(ptf),
qro_(ptf.qro_),
solarLoad_(ptf.solarLoad_)
qro_(ptf.qro_)
{}
@ -108,8 +105,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField
)
:
fixedValueFvPatchScalarField(ptf, iF),
qro_(ptf.qro_),
solarLoad_(ptf.solarLoad_)
qro_(ptf.qro_)
{}
@ -167,19 +163,29 @@ updateCoeffs()
Foam::tmp<Foam::scalarField> Foam::radiation::
greyDiffusiveViewFactorFixedValueFvPatchScalarField::qro() const
greyDiffusiveViewFactorFixedValueFvPatchScalarField::qro(label bandI) const
{
tmp<scalarField> tqrt(new scalarField(qro_));
if (solarLoad_)
{
const radiationModel& radiation =
db().lookupObject<radiationModel>("radiationProperties");
const viewFactor& radiation =
db().lookupObject<viewFactor>("radiationProperties");
if (radiation.useSolarLoad())
{
tqrt.ref() += patch().lookupPatchField<volScalarField, scalar>
(
radiation.externalRadHeatFieldName_
radiation.primaryFluxName_ + "_" + name(bandI)
);
word qSecName = radiation.relfectedFluxName_ + "_" + name(bandI);
if (this->db().foundObject<volScalarField>(qSecName))
{
const volScalarField& qSec =
this->db().lookupObject<volScalarField>(qSecName);
tqrt.ref() += qSec.boundaryField()[patch().index()];
}
}
return tqrt;
@ -194,7 +200,6 @@ write
{
fixedValueFvPatchScalarField::write(os);
qro_.writeEntry("qro", os);
os.writeEntry("solarLoad", solarLoad_);
}

View File

@ -37,7 +37,6 @@ Usage
\table
Property | Description | Required | Default value
qro | external radiative heat flux | yes |
emissivityMode | emissivity mode: solidRadiation or lookup | yes |
\endtable
Example of the boundary condition specification:
@ -46,8 +45,6 @@ Usage
{
type greyDiffusiveRadiationViewFactor;
qro uniform 0;
emissivityMode solidRadiation;
value uniform 0;
}
\endverbatim
@ -87,9 +84,6 @@ class greyDiffusiveViewFactorFixedValueFvPatchScalarField
//- External radiative heat flux
scalarField qro_;
//- Activate solar load
bool solarLoad_;
public:
@ -168,7 +162,7 @@ public:
// Access
//- Return external + solar load radiative heat flux
tmp<scalarField> qro() const;
tmp<scalarField> qro(label bandI = 0) const;
// Evaluation functions

View File

@ -213,6 +213,25 @@ updateCoeffs()
}
}
if (dom.useSolarLoad())
{
// Looking for primary heat flux single band
Ir += patch().lookupPatchField<volScalarField,scalar>
(
dom.primaryFluxName_ + "_" + name(lambdaId - 1)
);
word qSecName = dom.relfectedFluxName_ + "_" + name(lambdaId - 1);
if (this->db().foundObject<volScalarField>(qSecName))
{
const volScalarField& qSec =
this->db().lookupObject<volScalarField>(qSecName);
Ir += qSec.boundaryField()[patch().index()];
}
}
forAll(Iw, facei)
{
const vector& d = dom.IRay(rayId).d();

View File

@ -292,4 +292,9 @@ Foam::radiation::P1::Ru() const
}
Foam::label Foam::radiation::P1::nBands() const
{
return absorptionEmission_->nBands();
}
// ************************************************************************* //

View File

@ -128,6 +128,9 @@ public:
//- Source term component (constant)
virtual tmp<volScalarField::Internal> Ru() const;
//- Number of bands
label nBands() const;
};

View File

@ -193,10 +193,7 @@ void Foam::radiation::fvDOM::initialise()
if (useSolarLoad_)
{
const dictionary& solarDict = this->subDict("solarLoarCoeffs");
solarLoad_.reset
(
new solarLoad(solarDict, T_, externalRadHeatFieldName_)
);
solarLoad_.reset(new solarLoad(solarDict, T_));
if (solarLoad_->nBands() > 1)
{

View File

@ -244,6 +244,9 @@ public:
//- Number of wavelengths
inline label nLambda() const;
//- Number of bands
inline label nBands() const;
//- Const access to total absorption coefficient
inline const volScalarField& a() const;
@ -270,6 +273,9 @@ public:
//- Return meshOrientation
inline vector meshOrientation() const;
//- Use solar load
inline bool useSolarLoad() const;
};

View File

@ -67,6 +67,11 @@ inline Foam::label Foam::radiation::fvDOM::nLambda() const
}
inline Foam::label Foam::radiation::fvDOM::nBands() const
{
return nLambda_;
}
inline const Foam::volScalarField& Foam::radiation::fvDOM::a() const
{
return a_;
@ -124,4 +129,9 @@ inline Foam::vector Foam::radiation::fvDOM::meshOrientation() const
}
inline bool Foam::radiation::fvDOM::useSolarLoad() const
{
return useSolarLoad_;
}
// ************************************************************************* //

View File

@ -101,6 +101,12 @@ public:
//- Source term component (constant)
tmp<volScalarField::Internal> Ru() const;
//- Number of bands
label nBands() const
{
return 0;
}
};

View File

@ -121,4 +121,9 @@ Foam::radiation::opaqueSolid::Ru() const
}
Foam::label Foam::radiation::opaqueSolid::nBands() const
{
return absorptionEmission_->nBands();
}
// ************************************************************************* //

View File

@ -102,6 +102,9 @@ public:
//- Source term component (constant)
tmp<volScalarField::Internal> Ru() const;
//- Number of bands
label nBands() const;
};

View File

@ -47,6 +47,12 @@ namespace Foam
const Foam::word Foam::radiation::radiationModel::externalRadHeatFieldName_ =
"qrExt";
const Foam::word Foam::radiation::radiationModel::primaryFluxName_ =
"qprimaryRad";
const Foam::word Foam::radiation::radiationModel::relfectedFluxName_ =
"qreflective";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::IOobject Foam::radiation::radiationModel::createIOobject
@ -90,8 +96,6 @@ void Foam::radiation::radiationModel::initialise()
scatter_.reset(scatterModel::New(*this, mesh_).ptr());
soot_.reset(sootModel::New(*this, mesh_).ptr());
transmissivity_.reset(transmissivityModel::New(*this, mesh_).ptr());
}
}
@ -120,8 +124,7 @@ Foam::radiation::radiationModel::radiationModel(const volScalarField& T)
firstIter_(true),
absorptionEmission_(nullptr),
scatter_(nullptr),
soot_(nullptr),
transmissivity_(nullptr)
soot_(nullptr)
{}
@ -141,8 +144,7 @@ Foam::radiation::radiationModel::radiationModel
firstIter_(true),
absorptionEmission_(nullptr),
scatter_(nullptr),
soot_(nullptr),
transmissivity_(nullptr)
soot_(nullptr)
{
if (readOpt() == IOobject::NO_READ)
{
@ -181,8 +183,7 @@ Foam::radiation::radiationModel::radiationModel
firstIter_(true),
absorptionEmission_(nullptr),
scatter_(nullptr),
soot_(nullptr),
transmissivity_(nullptr)
soot_(nullptr)
{
initialise();
}
@ -319,7 +320,7 @@ Foam::radiation::radiationModel::soot() const
return *soot_;
}
/*
const Foam::radiation::transmissivityModel&
Foam::radiation::radiationModel::transmissivity() const
{
@ -332,6 +333,6 @@ Foam::radiation::radiationModel::transmissivity() const
return *transmissivity_;
}
*/
// ************************************************************************* //

View File

@ -50,7 +50,7 @@ SourceFiles
#include "volFields.H"
#include "fvMatricesFwd.H"
#include "Switch.H"
#include "transmissivityModel.H"
#include "absorptionEmissionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,7 +64,7 @@ namespace radiation
{
// Forward declaration of classes
class absorptionEmissionModel;
//class absorptionEmissionModel;
class scatterModel;
class sootModel;
@ -83,6 +83,13 @@ public:
//- Static name external radiative fluxes
static const word externalRadHeatFieldName_;
//- Static name for primary solar fluxes
static const word primaryFluxName_;
//- Static name for reflected solar fluxes
static const word relfectedFluxName_;
protected:
@ -124,7 +131,7 @@ protected:
autoPtr<sootModel> soot_;
//- Transmissivity model
autoPtr<transmissivityModel> transmissivity_;
//autoPtr<transmissivityModel> transmissivity_;
private:
@ -265,12 +272,11 @@ public:
volScalarField& T
) const;
virtual label nBands() const = 0;
//- Access to absorptionEmission model
const absorptionEmissionModel& absorptionEmission() const;
//- Access to transmissivity Model
const transmissivityModel& transmissivity() const;
//- Access to soot Model
const sootModel& soot() const;

View File

@ -0,0 +1,572 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "faceReflecting.H"
#include "boundaryRadiationProperties.H"
#include "cyclicAMIPolyPatch.H"
#include "volFields.H"
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(faceReflecting, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::faceReflecting::initialise(const dictionary& coeffs)
{
forAll(qreflective_, bandI)
{
qreflective_.set
(
bandI,
new volScalarField
(
IOobject
(
"qreflective_" + Foam::name(bandI) ,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(dimMass/pow3(dimTime), Zero)
)
);
}
label rayI = 0;
if (mesh_.nSolutionD() == 3)
{
nRay_ = 4*nPhi_*nTheta_;
refDiscAngles_.resize(nRay_);
const scalar deltaPhi = pi/(2.0*nPhi_);
const scalar deltaTheta = pi/nTheta_;
for (label n = 1; n <= nTheta_; n++)
{
for (label m = 1; m <= 4*nPhi_; m++)
{
const scalar thetai = (2*n - 1)*deltaTheta/2.0;
const scalar phii = (2*m - 1)*deltaPhi/2.0;
scalar sinTheta = Foam::sin(thetai);
scalar cosTheta = Foam::cos(thetai);
scalar sinPhi = Foam::sin(phii);
scalar cosPhi = Foam::cos(phii);
refDiscAngles_[rayI++] =
vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta);
}
}
}
else if (mesh_.nSolutionD() == 2)
{
nRay_ = 4*nPhi_;
refDiscAngles_.resize(nRay_);
const scalar thetai = piByTwo;
//const scalar deltaTheta = pi;
const scalar deltaPhi = pi/(2.0*nPhi_);
for (label m = 1; m <= 4*nPhi_; m++)
{
const scalar phii = (2*m - 1)*deltaPhi/2.0;
scalar sinTheta = Foam::sin(thetai);
scalar cosTheta = Foam::cos(thetai);
scalar sinPhi = Foam::sin(phii);
scalar cosPhi = Foam::cos(phii);
refDiscAngles_[rayI++] =
vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta);
}
}
else
{
FatalErrorInFunction
<< "The reflected rays are available in 2D or 3D "
<< abort(FatalError);
}
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
const radiation::boundaryRadiationProperties& boundaryRadiation =
radiation::boundaryRadiationProperties::New(mesh_);
// global face index
globalIndex globalNumbering(mesh_.nFaces());
// Collect faces with t = 0, r = 0 and a > 0 to shoot rays
// and patches to construct the triSurface
DynamicList<point> dynCf;
DynamicList<vector> dynNf;
DynamicList<label> dynFacesI;
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
const pointField& cf = pp.faceCentres();
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
{
const tmp<scalarField> tt =
boundaryRadiation.transmissivity(patchI);
const tmp<scalarField> tr =
boundaryRadiation.specReflectivity(patchI);
const tmp<scalarField> ta =
boundaryRadiation.absorptivity(patchI);
const scalarField& t = tt();
const scalarField& r = tr();
const scalarField& a = ta();
const vectorField& n = pp.faceNormals();
forAll(pp, faceI)
{
//const vector nf(n[faceI]);
// Opaque, non-reflective, absortived faces to shoot
if
(
t[faceI] == 0
&& r[faceI] == 0
&& a[faceI] > 0
)
{
dynFacesI.append(faceI + pp.start());
dynCf.append(cf[faceI]);
dynNf.append(n[faceI]);
}
// relfective opaque patches to build reflective surface
// plus opaque non-reflective
if
(
(r[faceI] > 0 && t[faceI] == 0) ||
(t[faceI] == 0 && a[faceI] > 0 && r[faceI] == 0)
)
{
includePatches_.insert(patchI);
}
}
}
}
shootFacesIds_.reset(new labelList(dynFacesI));
Cfs_.reset(new pointField(dynCf));
Nfs_.reset(new vectorField(dynNf));
// * * * * * * * * * * * * * * *
// Create distributedTriSurfaceMesh
Random rndGen(653213);
// Determine mesh bounding boxes:
List<treeBoundBox> meshBb
(
1,
treeBoundBox
(
boundBox(mesh_.points(), false)
).extend(rndGen, 1e-3)
);
// Dummy bounds dictionary
dictionary dict;
dict.add("bounds", meshBb);
dict.add
(
"distributionType",
distributedTriSurfaceMesh::distributionTypeNames_
[
distributedTriSurfaceMesh::FROZEN
]
);
dict.add("mergeDistance", SMALL);
triSurface localSurface = triSurfaceTools::triangulate
(
mesh_.boundaryMesh(),
includePatches_,
mapTriToGlobal_
);
surfacesMesh_.reset
(
new distributedTriSurfaceMesh
(
IOobject
(
"reflectiveSurface.stl",
mesh_.time().constant(),
"triSurface",
mesh_.time(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
localSurface,
dict
)
);
if (debug)
{
surfacesMesh_->searchableSurface::write();
}
}
void Foam::faceReflecting::calculate()
{
const radiation::boundaryRadiationProperties& boundaryRadiation =
radiation::boundaryRadiationProperties::New(mesh_);
label nFaces = 0;
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
const fvBoundaryMesh& fvPatches = mesh_.boundary();
label nBands = spectralDistribution_.size();
// Collect reflected directions from reflecting surfaces on direct hit
// faces
const vector sunDir = directHitFaces_.direction();
const labelList& directHits = directHitFaces_.rayStartFaces();
globalIndex globalNumbering(mesh_.nFaces());
Map<label> refFacesDirIndex;
labelList refDisDirsIndex(nRay_, -1);
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
{
const tmp<scalarField> tr =
boundaryRadiation.specReflectivity(patchI);
const scalarField& r = tr();
const vectorField n(fvPatches[patchI].nf());
forAll(pp, faceI)
{
label globalID = faceI + pp.start();
if (r[faceI] > 0.0 && directHits.found(globalID))
{
vector refDir =
sunDir + 2.0*(-sunDir & n[faceI]) * n[faceI];
// Look for the discrete direction
scalar dev(-GREAT);
label rayIndex = -1;
forAll(refDiscAngles_, iDisc)
{
scalar dotProd = refDir & refDiscAngles_[iDisc];
if (dev < dotProd)
{
dev = dotProd;
rayIndex = iDisc;
}
}
if (rayIndex >= 0)
{
if (refDisDirsIndex[rayIndex] == -1)
{
refDisDirsIndex[rayIndex] = 1;
}
}
refFacesDirIndex.insert
(
globalNumbering.toGlobal(globalID),
rayIndex
);
nFaces++;
}
}
}
}
// Distribute ray indexes to all proc's
Pstream::listCombineGather(refDisDirsIndex, maxEqOp<label>());
Pstream::listCombineScatter(refDisDirsIndex);
// Make sure all the processors have the same map
Pstream::mapCombineGather(refFacesDirIndex, minEqOp<label>());
Pstream::mapCombineScatter(refFacesDirIndex);
scalar maxBounding = 5.0*mag(mesh_.bounds().max() - mesh_.bounds().min());
reduce(maxBounding, maxOp<scalar>());
// Shoot Rays
// From faces t = 0, r = 0 and a > 0 to all 'used' discrete reflected
// directions
DynamicField<point> start(nFaces);
DynamicField<point> end(start.size());
DynamicList<label> startIndex(start.size());
DynamicField<label> dirStartIndex(start.size());
label i = 0;
do
{
for (; i < Cfs_->size(); i++)
{
const point& fc = Cfs_()[i];
const vector nf = Nfs_()[i];
const label myFaceId = shootFacesIds_()[i];
forAll(refDisDirsIndex, dirIndex)
{
if (refDisDirsIndex[dirIndex] > -1)
{
if ((nf & refDiscAngles_[dirIndex]) > 0)
{
const vector direction = -refDiscAngles_[dirIndex];
start.append(fc + 0.001*direction);
startIndex.append(myFaceId);
dirStartIndex.append(dirIndex);
end.append(fc + maxBounding*direction);
}
}
}
}
}while (returnReduce(i < Cfs_->size(), orOp<bool>()));
List<pointIndexHit> hitInfo(startIndex.size());
surfacesMesh_->findLine(start, end, hitInfo);
// Query the local trigId on hit faces
labelList triangleIndex;
autoPtr<mapDistribute> mapPtr
(
surfacesMesh_->localQueries
(
hitInfo,
triangleIndex
)
);
const mapDistribute& map = mapPtr();
PtrList<List<scalarField>> patchr(patches.size());
PtrList<List<scalarField>> patcha(patches.size());
forAll(patchr, patchi)
{
patchr.set
(
patchi,
new List<scalarField>(nBands)
);
patcha.set
(
patchi,
new List<scalarField>(nBands)
);
}
// Fill patchr
forAll(patchr, patchi)
{
for (label bandI = 0; bandI < nBands; bandI++)
{
patchr[patchi][bandI] =
boundaryRadiation.specReflectivity
(
patchi,
bandI,
new vectorField(patches[patchi].size(), sunDir)
);
patcha[patchi][bandI] =
boundaryRadiation.absorptivity
(
patchi,
bandI,
new vectorField(patches[patchi].size(), sunDir)
);
}
}
List<scalarField> r(nBands);
for (label bandI = 0; bandI < nBands; bandI++)
{
r[bandI].setSize(triangleIndex.size());
}
labelList refDirIndex(triangleIndex.size());
labelList refIndex(triangleIndex.size());
// triangleIndex includes hits on non-reflecting and reflecting faces
forAll(triangleIndex, i)
{
label trii = triangleIndex[i];
label facei = mapTriToGlobal_[trii];
label patchI = patches.whichPatch(facei);
const polyPatch& pp = patches[patchI];
label localFaceI = pp.whichFace(facei);
label globalFace = globalNumbering.toGlobal(Pstream::myProcNo(), facei);
if (refFacesDirIndex.found(globalFace))
{
refDirIndex[i] = refFacesDirIndex.find(globalFace)();
refIndex[i] = globalFace;
}
for (label bandI = 0; bandI < nBands; bandI++)
{
r[bandI][i] = patchr[patchI][bandI][localFaceI];
}
}
map.reverseDistribute(hitInfo.size(), refDirIndex);
map.reverseDistribute(hitInfo.size(), refIndex);
for (label bandI = 0; bandI < nBands; bandI++)
{
map.reverseDistribute(hitInfo.size(), r[bandI]);
}
for (label bandI = 0; bandI < nBands; bandI++)
{
volScalarField::Boundary& qrefBf =
qreflective_[bandI].boundaryFieldRef();
qrefBf = 0.0;
}
const vector qPrim(solarCalc_.directSolarRad()*solarCalc_.direction());
// Collect rays with a hit (hitting reflecting surfaces)
// and whose reflected direction are equal to the shot ray
forAll(hitInfo, rayI)
{
if (hitInfo[rayI].hit())
{
if
(
dirStartIndex[rayI] == refDirIndex[rayI]
&& refFacesDirIndex.found(refIndex[rayI])
)
{
for (label bandI = 0; bandI < nBands; bandI++)
{
volScalarField::Boundary& qrefBf =
qreflective_[bandI].boundaryFieldRef();
label startFaceId = startIndex[rayI];
label startPatchI = patches.whichPatch(startFaceId);
const polyPatch& ppStart = patches[startPatchI];
label localStartFaceI = ppStart.whichFace(startFaceId);
scalar a = patcha[startPatchI][bandI][localStartFaceI];
const vectorField& nStart = ppStart.faceNormals();
vector rayIn = refDiscAngles_[dirStartIndex[rayI]];
rayIn /= mag(rayIn);
qrefBf[startPatchI][localStartFaceI] +=
(
(
mag(qPrim)
*r[bandI][rayI]
*spectralDistribution_[bandI]
*a
*rayIn
)
& nStart[localStartFaceI]
);
}
}
}
}
start.clear();
startIndex.clear();
end.clear();
dirStartIndex.clear();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::faceReflecting::faceReflecting
(
const fvMesh& mesh,
const faceShading& directHiyFaces,
const solarCalculator& solar,
const scalarList& spectralDistribution,
const dictionary& dict
)
:
mesh_(mesh),
nTheta_(dict.subDict("reflecting").lookupOrDefault<label>("nTheta", 10)),
nPhi_(dict.subDict("reflecting").lookupOrDefault<label>("nPhi", 10)),
nRay_(0),
refDiscAngles_(0),
spectralDistribution_(spectralDistribution),
qreflective_(spectralDistribution_.size()),
directHitFaces_(directHiyFaces),
surfacesMesh_(),
shootFacesIds_(),
Cfs_(),
Nfs_(),
solarCalc_(solar),
includePatches_(),
mapTriToGlobal_()
{
initialise(dict);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::faceReflecting::correct()
{
calculate();
}
// ************************************************************************* //

View File

@ -0,0 +1,170 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::faceReflecting
Description
Calculates the reflecting faces from specular surfaces. It only
takes into account the first reflection coming from a surface hit
by the primary Sun hit faces.
SourceFiles
faceReflecting.C
\*---------------------------------------------------------------------------*/
#ifndef faceReflecting_H
#define faceReflecting_H
#include "fvMesh.H"
#include "wallPolyPatch.H"
#include "triSurfaceTools.H"
#include "vectorList.H"
#include "distributedTriSurfaceMesh.H"
#include "faceShading.H"
#include "solarCalculator.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class faceReflecting Declaration
\*---------------------------------------------------------------------------*/
class faceReflecting
{
// Private data
//- Reference to mesh
const fvMesh& mesh_;
//- Number of solid angles in theta
label nTheta_;
//- Number of solid angles in phi
label nPhi_ ;
//- Total number of rays (1 per direction)
label nRay_;
//- Discretised angles for reflected rays
vectorList refDiscAngles_;
//- Spectral distribution for the integrated solar heat flux
const scalarList& spectralDistribution_;
//- Net reflected radiative heat flux [W/m2]
PtrList<volScalarField> qreflective_;
//- Primary hits faces
const faceShading& directHitFaces_;
//- Distributed surface for ray tracing
autoPtr<distributedTriSurfaceMesh> surfacesMesh_;
//- Faces from which rays are shot
autoPtr<labelList> shootFacesIds_;
//- Face centres from which rays are shot
autoPtr<pointField> Cfs_;
//- Face normal from which rays are shot
autoPtr<vectorField> Nfs_;
//- Solar calculator
const solarCalculator& solarCalc_;
//- Shooting rays pacthes
labelHashSet includePatches_;
//- Map from triSurface Index to global
labelList mapTriToGlobal_;
// Private members
//- Calculate ray start faces
void calculate();
//- Initialise model
void initialise(const dictionary& dict);
//- No copy construct
faceReflecting(const faceReflecting&) = delete;
//- No copy assignment
void operator=(const faceReflecting&) = delete;
public:
// Declare name of the class and its debug switch
ClassName("faceReflecting");
// Constructors
//- Construct from components
faceReflecting
(
const fvMesh& mesh,
const faceShading& directHiyFaces,
const solarCalculator& ,
const scalarList& spectralDistribution,
const dictionary& dict
);
//- Destructor
~faceReflecting() = default;
// Member Functions
// Const access to qreflective
const volScalarField& qreflective(const label bandI) const
{
return qreflective_[bandI];
}
//- Correct reflected flux
void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -40,7 +40,6 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::faceShading::writeRays
(
const fileName& fName,
@ -91,10 +90,8 @@ Foam::triSurface Foam::faceShading::triangulate
f.triangles(points, nTri, triFaces);
forAll(triFaces, triFaceI)
for (const face& f : triFaces)
{
const face& f = triFaces[triFaceI];
triangles.append
(
labelledTri(f[0], f[1], f[2], newPatchI)
@ -235,10 +232,7 @@ void Foam::faceShading::calculate()
{
if (tau[faceI] == 0.0)
{
includeAllFacesPerPatch[patchI].insert
(
faceI
);
includeAllFacesPerPatch[patchI].insert(faceI);
}
}
}
@ -361,9 +355,8 @@ void Foam::faceShading::calculate()
volScalarField::Boundary& hitFacesBf = hitFaces.boundaryFieldRef();
hitFacesBf = 0.0;
forAll(rayStartFaces_, i)
for (const label faceI : rayStartFaces_)
{
const label faceI = rayStartFaces_[i];
label patchID = patches.whichPatch(faceI);
const polyPatch& pp = patches[patchID];
hitFacesBf[patchID][faceI - pp.start()] = 1.0;
@ -394,7 +387,6 @@ Foam::faceShading::faceShading
{}
Foam::faceShading::faceShading
(
const fvMesh& mesh,
@ -409,12 +401,6 @@ Foam::faceShading::faceShading
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faceShading::~faceShading()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::faceShading::correct()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2015 OpenFOAM Foundation
@ -125,7 +125,7 @@ public:
//- Destructor
~faceShading();
~faceShading() = default;
// Member Functions

View File

@ -34,6 +34,10 @@ License
#include "cyclicAMIPolyPatch.H"
#include "mappedPatchBase.H"
#include "wallPolyPatch.H"
#include "constants.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -46,11 +50,70 @@ namespace Foam
}
}
const Foam::word Foam::radiation::solarLoad::viewFactorWalls = "viewFactorWall";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::radiation::solarLoad::updateReflectedRays
(
const labelHashSet& includePatches
)
{
if (reflectedFaces_.empty() && !hitFaces_.empty())
{
reflectedFaces_.reset
(
new faceReflecting
(
mesh_,
hitFaces_(),
solarCalc_,
spectralDistribution_,
dict_
)
);
}
reflectedFaces_->correct();
volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
const scalarField& V = mesh_.V();
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
forAll(qrBf, patchID)
{
if (includePatches[patchID])
{
for (label bandI = 0; bandI < nBands_; bandI++)
{
qrBf[patchID] +=
reflectedFaces_->qreflective(bandI).boundaryField()[patchID];
}
}
else
{
const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
const labelUList& cellIs = patches[patchID].faceCells();
for (label bandI = 0; bandI < nBands_; bandI++)
{
forAll(cellIs, i)
{
const label cellI = cellIs[i];
Ru_[cellI] +=
(
reflectedFaces_->qreflective(bandI).
boundaryField()[patchID][i] * sf[i]
)/V[cellI];
}
}
}
}
}
bool Foam::radiation::solarLoad::updateHitFaces()
{
if (hitFaces_.empty())
@ -82,8 +145,8 @@ bool Foam::radiation::solarLoad::updateHitFaces()
hitFaces_->direction() = solarCalc_.direction();
hitFaces_->correct();
return true;
break;
}
break;
}
}
}
@ -122,33 +185,43 @@ void Foam::radiation::solarLoad::updateDirectHitRadiation
const scalarField& V = mesh_.V();
volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
// Reset qr and qrPrimary
qrBf = 0.0;
for (label bandI = 0; bandI < nBands_; bandI++)
{
volScalarField::Boundary& qprimaryBf =
qprimaryRad_[bandI].boundaryFieldRef();
qprimaryBf = 0.0;
forAll(hitFacesId, i)
{
const label faceI = hitFacesId[i];
label patchID = patches.whichPatch(faceI);
const polyPatch& pp = patches[patchID];
const label localFaceI = faceI - pp.start();
const vector qPrim = solarCalc_.directSolarRad()*solarCalc_.direction();
const vector qPrim =
solarCalc_.directSolarRad()*solarCalc_.direction();
if (includeMappedPatchBasePatches[patchID])
{
const vectorField n = pp.faceNormals();
const vectorField& n = pp.faceNormals();
for (label bandI = 0; bandI < nBands_; bandI++)
{
qrBf[patchID][localFaceI] +=
qprimaryBf[patchID][localFaceI] +=
(qPrim & n[localFaceI])
* spectralDistribution_[bandI]
* absorptivity_[patchID][bandI]()[localFaceI];
}
if (includeMappedPatchBasePatches[patchID])
{
qrBf[patchID][localFaceI] += qprimaryBf[patchID][localFaceI];
}
else
{
const vectorField& sf = mesh_.Sf().boundaryField()[patchID];
const label cellI = pp.faceCells()[localFaceI];
for (label bandI = 0; bandI < nBands_; bandI++)
{
Ru_[cellI] +=
(qPrim & sf[localFaceI])
* spectralDistribution_[bandI]
@ -296,6 +369,12 @@ void Foam::radiation::solarLoad::updateSkyDiffusiveRadiation
void Foam::radiation::solarLoad::initialise(const dictionary& coeffs)
{
coeffs.readEntry("spectralDistribution", spectralDistribution_);
nBands_ = spectralDistribution_.size();
qprimaryRad_.setSize(nBands_);
if (coeffs.readIfPresent("gridUp", verticalDir_))
{
verticalDir_.normalise();
@ -307,31 +386,28 @@ void Foam::radiation::solarLoad::initialise(const dictionary& coeffs)
verticalDir_ = (-g/mag(g)).value();
}
includePatches_ = mesh_.boundaryMesh().indices(viewFactorWalls);
coeffs.readEntry("useVFbeamToDiffuse", useVFbeamToDiffuse_);
coeffs.readEntry("spectralDistribution", spectralDistribution_);
coeffs.readEntry("useReflectedRays", useReflectedRays_);
spectralDistribution_ =
spectralDistribution_/sum(spectralDistribution_);
nBands_ = spectralDistribution_.size();
if (useVFbeamToDiffuse_)
forAll(qprimaryRad_, bandI)
{
map_.reset
qprimaryRad_.set
(
new IOmapDistribute
bandI,
new volScalarField
(
IOobject
(
"mapDist",
mesh_.facesInstance(),
"qprimaryRad_" + Foam::name(bandI) ,
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(dimMass/pow3(dimTime), Zero)
)
);
}
@ -341,7 +417,7 @@ void Foam::radiation::solarLoad::initialise(const dictionary& coeffs)
coeffs.readIfPresent("updateAbsorptivity", updateAbsorptivity_);
}
/*
void Foam::radiation::solarLoad::calculateQdiff
(
const labelHashSet& includePatches,
@ -393,12 +469,16 @@ void Foam::radiation::solarLoad::calculateQdiff
reduce(totalFVNCoarseFaces, sumOp<label>());
// Calculate weighted absorptivity on coarse patches
List<scalar> localCoarseRave(nLocalVFCoarseFaces);
List<scalar> localCoarseEave(nLocalVFCoarseFaces);
List<scalar> localTave(nLocalVFCoarseFaces);
List<scalar> localCoarsePartialArea(nLocalVFCoarseFaces);
List<vector> localCoarseNorm(nLocalVFCoarseFaces);
scalarField compactCoarseRave(map_->constructSize(), Zero);
scalarField compactCoarsePartialArea(map_->constructSize(), Zero);
scalarField compactCoarseEave(map_->constructSize(), 0.0);
scalarField compactCoarseTave(map_->constructSize(), 0.0);
scalarField compactCoarsePartialArea(map_->constructSize(), 0.0);
vectorList compactCoarseNorm(map_->constructSize(), Zero);
const boundaryRadiationProperties& boundaryRadiation =
@ -418,29 +498,31 @@ void Foam::radiation::solarLoad::calculateQdiff
const polyPatch& cpp = coarseMesh_->boundaryMesh()[patchID];
const labelList& agglom = finalAgglom_[patchID];
//if (pp.size() > 0)
if (agglom.size() > 0)
{
label nAgglom = max(agglom) + 1;
coarseToFine_[i] = invertOneToMany(nAgglom, agglom);
}
scalarField r(pp.size(), Zero);
// Weight emissivity by spectral distribution
scalarField e(pp.size(), 0.0);
for (label bandI = 0; bandI < nBands_; bandI++)
{
const tmp<scalarField> tr =
const tmp<scalarField> te =
spectralDistribution_[bandI]
*boundaryRadiation.reflectivity(patchID, bandI);
r += tr();
*boundaryRadiation.diffReflectivity(patchID, bandI);
e += te();
}
scalarList Rave(cpp.size(), Zero);
scalarList area(cpp.size(), Zero);
scalarList Eave(cpp.size(), 0.0);
scalarList Tave(cpp.size(), 0.0);
const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
const scalarField& Tf = T_.boundaryField()[patchID];
const labelList& coarsePatchFace =
coarseMesh_->patchFaceMap()[patchID];
const labelList& coarsePatchFace=coarseMesh_->patchFaceMap()[patchID];
forAll(cpp, coarseI)
{
@ -460,18 +542,25 @@ void Foam::radiation::solarLoad::calculateQdiff
{
fullArea += sf[faceI];
}
Rave[coarseI] += (r[faceI]*sf[faceI])/fineArea;
Eave[coarseI] += (e[faceI]*sf[faceI])/fineArea;
Tave[coarseI] += (pow4(Tf[faceI])*sf[faceI])/fineArea;
}
localCoarsePartialArea[compactI++] = fullArea/fineArea;
}
SubList<scalar>
(
localCoarseRave,
Rave.size(),
localCoarseEave,
Eave.size(),
startI
) = Rave;
) = Eave;
SubList<scalar>
(
localTave,
Tave.size(),
startI
) = Tave;
const vectorList coarseNSf = cpp.faceNormals();
SubList<vector>
@ -480,6 +569,7 @@ void Foam::radiation::solarLoad::calculateQdiff
cpp.size(),
startI
) = coarseNSf;
startI += cpp.size();
}
@ -487,14 +577,18 @@ void Foam::radiation::solarLoad::calculateQdiff
SubList<scalar>(compactCoarsePartialArea, nLocalVFCoarseFaces) =
localCoarsePartialArea;
SubList<scalar>(compactCoarseRave, nLocalVFCoarseFaces) =
localCoarseRave;
SubList<scalar>(compactCoarseEave, nLocalVFCoarseFaces) =
localCoarseEave;
SubList<scalar>(compactCoarseTave, nLocalVFCoarseFaces) =
localTave;
SubList<vector>(compactCoarseNorm, nLocalVFCoarseFaces) =
localCoarseNorm;
map_->distribute(compactCoarsePartialArea);
map_->distribute(compactCoarseRave);
map_->distribute(compactCoarseEave);
map_->distribute(compactCoarseTave);
map_->distribute(compactCoarseNorm);
@ -511,7 +605,9 @@ void Foam::radiation::solarLoad::calculateQdiff
const labelList& coarsePatchFace = coarseMesh_->patchFaceMap()[patchID];
const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
scalarField a(ppf.size(), Zero);
for (label bandI = 0; bandI < nBands_; bandI++)
{
const tmp<scalarField> ta =
@ -527,6 +623,7 @@ void Foam::radiation::solarLoad::calculateQdiff
UIndirectList<scalar> fineSf(sf, fineFaces);
scalar fineArea = sum(fineSf());
// // Weighting absorptivity per area on secondary diffussive flux
scalar aAve = 0.0;
forAll(fineFaces, j)
{
@ -541,14 +638,22 @@ void Foam::radiation::solarLoad::calculateQdiff
{
label compactI = compactFaces[j];
localqDiffusive[locaFaceI] +=
compactCoarsePartialArea[compactI]
* aAve
* (solarCalc_.directSolarRad()*solarCalc_.direction())
scalar qin =
(
solarCalc_.directSolarRad()*solarCalc_.direction()
& compactCoarseNorm[compactI]
* vf[j]
* compactCoarseRave[compactI];
)*compactCoarsePartialArea[compactI];
// q emission
scalar qem =
compactCoarseEave[compactI]
*physicoChemical::sigma.value()
*compactCoarseTave[compactI];
// compactCoarseEave is the diffussive reflected coeff
scalar qDiff = (compactCoarseEave[compactI])*qin;
localqDiffusive[locaFaceI] += (qDiff)*aAve*vf[j];
}
locaFaceI++;
}
@ -608,26 +713,14 @@ void Foam::radiation::solarLoad::calculateQdiff
}
}
}
*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::solarLoad::solarLoad(const volScalarField& T)
:
radiationModel(typeName, T),
finalAgglom_
(
IOobject
(
"finalAgglom",
mesh_.facesInstance(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
)
),
coarseMesh_(),
dict_(coeffs_),
qr_
(
IOobject
@ -641,20 +734,8 @@ Foam::radiation::solarLoad::solarLoad(const volScalarField& T)
mesh_,
dimensionedScalar(dimMass/pow3(dimTime), Zero)
),
qsecondRad_
(
IOobject
(
"qsecondRad",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(dimMass/pow3(dimTime), Zero)
),
hitFaces_(),
reflectedFaces_(),
Ru_
(
IOobject
@ -668,26 +749,12 @@ Foam::radiation::solarLoad::solarLoad(const volScalarField& T)
mesh_,
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
),
solarCalc_(this->subDict(typeName + "Coeffs"), mesh_),
solarCalc_(coeffs_, mesh_),
verticalDir_(Zero),
useVFbeamToDiffuse_(false),
includePatches_(mesh_.boundary().size(), -1),
coarseToFine_(),
nBands_(1),
spectralDistribution_(nBands_),
map_(),
visibleFaceFaces_
(
IOobject
(
"visibleFaceFaces",
mesh_.facesInstance(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
)
),
useReflectedRays_(false),
spectralDistribution_(),
nBands_(0),
qprimaryRad_(0),
solidCoupled_(true),
absorptivity_(mesh_.boundaryMesh().size()),
updateAbsorptivity_(false),
@ -705,19 +772,7 @@ Foam::radiation::solarLoad::solarLoad
)
:
radiationModel(typeName, dict, T),
finalAgglom_
(
IOobject
(
"finalAgglom",
mesh_.facesInstance(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
)
),
coarseMesh_(),
dict_(dict),
qr_
(
IOobject
@ -731,112 +786,8 @@ Foam::radiation::solarLoad::solarLoad
mesh_,
dimensionedScalar(dimMass/pow3(dimTime), Zero)
),
qsecondRad_
(
IOobject
(
"qsecondRad",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(dimMass/pow3(dimTime), Zero)
),
hitFaces_(),
Ru_
(
IOobject
(
"Ru",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
),
solarCalc_(coeffs_, mesh_),
verticalDir_(Zero),
useVFbeamToDiffuse_(false),
includePatches_(mesh_.boundary().size(), -1),
coarseToFine_(),
nBands_(1),
spectralDistribution_(nBands_),
map_(),
visibleFaceFaces_
(
IOobject
(
"visibleFaceFaces",
mesh_.facesInstance(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
)
),
solidCoupled_(true),
wallCoupled_(false),
absorptivity_(mesh_.boundaryMesh().size()),
updateAbsorptivity_(false),
firstIter_(true),
updateTimeIndex_(0)
{
initialise(coeffs_);
}
Foam::radiation::solarLoad::solarLoad
(
const dictionary& dict,
const volScalarField& T,
const word radWallFieldName
)
:
radiationModel("none", T),
finalAgglom_
(
IOobject
(
"finalAgglom",
mesh_.facesInstance(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
)
),
coarseMesh_(),
qr_
(
IOobject
(
radWallFieldName,
mesh_.time().timeName(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(dimMass/pow3(dimTime), Zero)
),
qsecondRad_
(
IOobject
(
"qsecondRad",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(dimMass/pow3(dimTime), Zero)
),
hitFaces_(),
reflectedFaces_(),
Ru_
(
IOobject
@ -852,40 +803,21 @@ Foam::radiation::solarLoad::solarLoad
),
solarCalc_(dict, mesh_),
verticalDir_(Zero),
useVFbeamToDiffuse_(false),
includePatches_(mesh_.boundary().size(), -1),
coarseToFine_(),
nBands_(1),
spectralDistribution_(nBands_),
map_(),
visibleFaceFaces_
(
IOobject
(
"visibleFaceFaces",
mesh_.facesInstance(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
)
),
useReflectedRays_(false),
spectralDistribution_(),
nBands_(0),
qprimaryRad_(0),
solidCoupled_(true),
wallCoupled_(false),
absorptivity_(mesh_.boundaryMesh().size()),
updateAbsorptivity_(false),
firstIter_(true)
firstIter_(true),
updateTimeIndex_(0)
{
initialise(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::solarLoad::~solarLoad()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::radiation::solarLoad::nBands() const
@ -938,13 +870,11 @@ void Foam::radiation::solarLoad::calculate()
}
bool facesChanged = updateHitFaces();
volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
if (facesChanged)
{
// Reset Ru and qr
// Reset Ru
Ru_ = dimensionedScalar("Ru", dimMass/dimLength/pow3(dimTime), Zero);
qrBf = 0.0;
// Add direct hit radiation
const labelList& hitFacesId = hitFaces_->rayStartFaces();
@ -957,10 +887,10 @@ void Foam::radiation::solarLoad::calculate()
includeMappedPatchBasePatches
);
// Add indirect diffusive radiation
if (useVFbeamToDiffuse_)
// Add specular reflected radiation
if (useReflectedRays_)
{
calculateQdiff(includePatches, includeMappedPatchBasePatches);
updateReflectedRays(includeMappedPatchBasePatches);
}
firstIter_ = false;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2015 OpenFOAM Foundation
@ -30,30 +30,25 @@ Group
grpRadiationModels
Description
The solar load radiation model includes Sun primary hits, their
reflective fluxes and diffusive sky radiative fluxes.
The primary hit rays are calculated using a face shading algorithm.
The reflected fluxes are considered diffusive and use a view factors method
to deposit the energy on "visible" walls. The sky diffusive radiation for
horizontal and vertical walls is calculated following the Fair Weather
Conditions Method from the ASHRAE Handbook.
The first reflected fluxes can be optionally included. A view factors
method is needed in order to include diffusive surface to surface fluxes.
The energy is included on "visible" walls by default. The sky diffusive
radiation for horizontal and vertical walls is calculated following the
Fair Weather Conditions Method from the ASHRAE Handbook.
By default the energy is included in cells adjacent to the patches into
the energy Equation (wallCoupled = false). On coupled patches the flux is
by default added to the wall and considered into the solid
(solidCoupled = true).
The reflected fluxes uses a grey absoprtion/emission model wich is weighted
by the spectral distribution. The flag useVFbeamToDiffuse should be
switched on and the view factors should be calculated using the
'viewFactorsGen' application.
The solarLoad model can be used in conjuntion with fvDOM and viewFactor
radiation models but only using a single band spectrum. On the
corresponding BC's for these models the flag "solarLoad" must be set to
true.
radiation models. The flag useSolarLoad must be true on the rediation
dictionary.
SourceFiles
@ -65,12 +60,10 @@ SourceFiles
#define radiation_solarLoad_H
#include "radiationModel.H"
#include "singleCellFvMesh.H"
#include "scalarListIOList.H"
#include "volFields.H"
#include "faceShading.H"
#include "faceReflecting.H"
#include "solarCalculator.H"
#include "IOmapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -87,35 +80,25 @@ class solarLoad
:
public radiationModel
{
protected:
// Static data
//- Static name for view factor walls
static const word viewFactorWalls;
private:
// Private data
//- Agglomeration List
labelListIOList finalAgglom_;
//- Coarse mesh
autoPtr<singleCellFvMesh> coarseMesh_;
//- Dictionary
dictionary dict_;
//- Net radiative heat flux [W/m2]
volScalarField qr_;
//- Secondary solar radiative heat flux [W/m2]
volScalarField qsecondRad_;
//- Direct hit faces Ids
autoPtr<faceShading> hitFaces_;
//- Constant source term
//- Reflected faces
autoPtr<faceReflecting> reflectedFaces_;
//- Source term for cells next to patches with flags solidCoupled
//- and wallCoupled false
DimensionedField<scalar, volMesh> Ru_;
//- Solar calculator
@ -124,26 +107,17 @@ private:
//- Vertical direction (Default is g vector)
vector verticalDir_;
//- Include diffuse reflected heat fluxes from direct heat flux
bool useVFbeamToDiffuse_;
//- Selected patches to apply solar load
labelList includePatches_;
//- Cached coarse to fine mapping for coarse mesh
List<labelListList> coarseToFine_;
//-Number of bands
label nBands_;
//- Include reflected rays from specular surfaces
bool useReflectedRays_;
//- Spectral distribution for the integrated solar heat flux
scalarList spectralDistribution_;
//- Map distribute
autoPtr<IOmapDistribute> map_;
//-Number of bands
label nBands_;
//- Face-compact map
labelListIOList visibleFaceFaces_;
//- Primary solar radiative heat flux per band [W/m2]
PtrList<volScalarField> qprimaryRad_;
//- Couple solids through mapped boundary patch using qr (default:true)
bool solidCoupled_;
@ -166,15 +140,17 @@ private:
// Private Member Functions
//- Initialise
void initialise(const dictionary&);
//- Update direct hit faces radiation
void updateDirectHitRadiation(const labelList&, const labelHashSet&);
//- Update reflected heat flux
void updateReflectedRays(const labelHashSet&);
//- Calculate diffusive heat flux
void calculateQdiff(const labelHashSet&, const labelHashSet&);
//void calculateQdiff(const labelHashSet&, const labelHashSet&);
//- Update Sky diffusive radiation
void updateSkyDiffusiveRadiation
@ -210,18 +186,9 @@ public:
//- Construct from dictionary and volScalarField
solarLoad(const dictionary& dict, const volScalarField& T);
//- Constructor from local components. Does not create a radiationModel.
// radWallFieldName is the solar heat field name
solarLoad
(
const dictionary& dict,
const volScalarField& T,
const word radWallFieldName
);
//- Destructor
virtual ~solarLoad();
virtual ~solarLoad() = default;
// Member functions
@ -245,6 +212,12 @@ public:
//- Number of bands
label nBands() const;
//- Primary solar heat flux
const volScalarField& qprimaryRad(const label bandI) const
{
return qprimaryRad_[bandI];
}
};

View File

@ -193,21 +193,18 @@ void Foam::radiation::viewFactor::initialise()
}
}
this->readIfPresent("useSolarLoad", useSolarLoad_);
coeffs_.readIfPresent("useSolarLoad", useSolarLoad_);
if (useSolarLoad_)
{
const dictionary& solarDict = this->subDict("solarLoarCoeffs");
solarLoad_.reset
(
new solarLoad(solarDict, T_, externalRadHeatFieldName_)
);
const dictionary& solarDict = this->subDict("solarLoadCoeffs");
solarLoad_.reset(new solarLoad(solarDict, T_));
if (solarLoad_->nBands() > 1)
if (solarLoad_->nBands() != nBands_)
{
FatalErrorInFunction
<< "Requested solar radiation with fvDOM. Using "
<< "more thant one band for the solar load is not allowed"
<< "Solar radiation and view factor band numbers "
<< "are different"
<< abort(FatalError);
}
@ -242,7 +239,8 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T)
mesh_.polyMesh::instance(),
mesh_.time(),
IOobject::NO_READ,
IOobject::NO_WRITE
IOobject::NO_WRITE,
false
),
mesh_,
finalAgglom_
@ -268,7 +266,8 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T)
iterCounter_(0),
pivotIndices_(0),
useSolarLoad_(false),
solarLoad_()
solarLoad_(),
nBands_(coeffs_.lookupOrDefault<label>("nBands", 1))
{
initialise();
}
@ -302,7 +301,8 @@ Foam::radiation::viewFactor::viewFactor
mesh_.polyMesh::instance(),
mesh_.time(),
IOobject::NO_READ,
IOobject::NO_WRITE
IOobject::NO_WRITE,
false
),
mesh_,
finalAgglom_
@ -328,18 +328,13 @@ Foam::radiation::viewFactor::viewFactor
iterCounter_(0),
pivotIndices_(0),
useSolarLoad_(false),
solarLoad_()
solarLoad_(),
nBands_(coeffs_.lookupOrDefault<label>("nBands", 1))
{
initialise();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::viewFactor::~viewFactor()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::radiation::viewFactor::read()
@ -386,22 +381,26 @@ void Foam::radiation::viewFactor::calculate()
solarLoad_->calculate();
}
scalarField compactCoarseT4(map_->constructSize(), Zero);
scalarField compactCoarseE(map_->constructSize(), Zero);
scalarField compactCoarseHo(map_->constructSize(), Zero);
// Net radiation
scalarField q(totalNCoarseFaces_, 0.0);
volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
globalIndex globalNumbering(nLocalCoarseFaces_);
const boundaryRadiationProperties& boundaryRadiation =
boundaryRadiationProperties::New(mesh_);
for (label bandI = 0; bandI < nBands_; bandI++)
{
scalarField compactCoarseT4(map_->constructSize(), 0.0);
scalarField compactCoarseE(map_->constructSize(), 0.0);
scalarField compactCoarseHo(map_->constructSize(), 0.0);
// Fill local averaged(T), emissivity(E) and external heatFlux(Ho)
DynamicList<scalar> localCoarseT4ave(nLocalCoarseFaces_);
DynamicList<scalar> localCoarseEave(nLocalCoarseFaces_);
DynamicList<scalar> localCoarseHoave(nLocalCoarseFaces_);
const boundaryRadiationProperties& boundaryRadiation =
boundaryRadiationProperties::New(mesh_);
volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
forAll(selectedPatches_, i)
{
label patchID = selectedPatches_[i];
@ -417,18 +416,22 @@ void Foam::radiation::viewFactor::calculate()
greyDiffusiveViewFactorFixedValueFvPatchScalarField
>(qrPatch);
const tmp<scalarField> teb = boundaryRadiation.emissivity(patchID);
const tmp<scalarField> teb =
boundaryRadiation.emissivity(patchID, bandI);
const scalarField& eb = teb();
const tmp<scalarField> tHoi = qrp.qro();
const tmp<scalarField> tHoi = qrp.qro(bandI);
const scalarField& Hoi = tHoi();
const polyPatch& pp = coarseMesh_.boundaryMesh()[patchID];
const labelList& coarsePatchFace = coarseMesh_.patchFaceMap()[patchID];
scalarList T4ave(pp.size(), Zero);
scalarList Eave(pp.size(), Zero);
scalarList Hoiave(pp.size(), Zero);
const labelList& coarsePatchFace =
coarseMesh_.patchFaceMap()[patchID];
scalarList T4ave(pp.size(), 0.0);
scalarList Eave(pp.size(), 0.0);
scalarList Hoiave(pp.size(), 0.0);
if (pp.size() > 0)
{
@ -463,12 +466,15 @@ void Foam::radiation::viewFactor::calculate()
localCoarseT4ave.append(T4ave);
localCoarseEave.append(Eave);
localCoarseHoave.append(Hoiave);
}
// Fill the local values to distribute
SubList<scalar>(compactCoarseT4, nLocalCoarseFaces_) = localCoarseT4ave;
SubList<scalar>(compactCoarseT4, nLocalCoarseFaces_) =
localCoarseT4ave;
SubList<scalar>(compactCoarseE, nLocalCoarseFaces_) = localCoarseEave;
SubList<scalar>(compactCoarseHo, nLocalCoarseFaces_) = localCoarseHoave;
SubList<scalar>(compactCoarseHo, nLocalCoarseFaces_) =
localCoarseHoave;
// Distribute data
map_->distribute(compactCoarseT4);
@ -482,14 +488,18 @@ void Foam::radiation::viewFactor::calculate()
(
compactGlobalIds,
nLocalCoarseFaces_
) = identity(globalNumbering.localSize(), globalNumbering.localStart());
) = identity
(
globalNumbering.localSize(),
globalNumbering.localStart()
);
map_->distribute(compactGlobalIds);
// Create global size vectors
scalarField T4(totalNCoarseFaces_, Zero);
scalarField E(totalNCoarseFaces_, Zero);
scalarField qrExt(totalNCoarseFaces_, Zero);
scalarField T4(totalNCoarseFaces_, 0.0);
scalarField E(totalNCoarseFaces_, 0.0);
scalarField qrExt(totalNCoarseFaces_, 0.0);
// Fill lists from compact to global indexes.
forAll(compactCoarseT4, i)
@ -507,27 +517,26 @@ void Foam::radiation::viewFactor::calculate()
Pstream::listCombineScatter(E);
Pstream::listCombineScatter(qrExt);
// Net radiation
scalarField q(totalNCoarseFaces_, Zero);
if (Pstream::master())
{
// Variable emissivity
if (!constEmissivity_)
{
scalarSquareMatrix C(totalNCoarseFaces_, Zero);
scalarSquareMatrix C(totalNCoarseFaces_, 0.0);
for (label i=0; i<totalNCoarseFaces_; i++)
{
for (label j=0; j<totalNCoarseFaces_; j++)
{
const scalar invEj = 1.0/E[j];
const scalar sigmaT4 = physicoChemical::sigma.value()*T4[j];
const scalar sigmaT4 =
physicoChemical::sigma.value()*T4[j];
if (i==j)
{
C(i, j) = invEj - (invEj - 1.0)*Fmatrix_()(i, j);
q[i] += (Fmatrix_()(i, j) - 1.0)*sigmaT4 - qrExt[j];
q[i] +=
(Fmatrix_()(i, j) - 1.0)*sigmaT4 + qrExt[j];
}
else
{
@ -538,7 +547,8 @@ void Foam::radiation::viewFactor::calculate()
}
}
Info<< "\nSolving view factor equations..." << endl;
Info<< "Solving view factor equations for band :"
<< bandI << endl;
// Negative coming into the fluid
LUsolve(C, q);
@ -555,7 +565,8 @@ void Foam::radiation::viewFactor::calculate()
const scalar invEj = 1.0/E[j];
if (i==j)
{
CLU_()(i, j) = invEj-(invEj-1.0)*Fmatrix_()(i, j);
CLU_()(i, j) =
invEj-(invEj-1.0)*Fmatrix_()(i, j);
}
else
{
@ -582,7 +593,8 @@ void Foam::radiation::viewFactor::calculate()
if (i==j)
{
q[i] += (Fmatrix_()(i, j) - 1.0)*sigmaT4 - qrExt[j];
q[i] +=
(Fmatrix_()(i, j) - 1.0)*sigmaT4 + qrExt[j];
}
else
{
@ -591,26 +603,26 @@ void Foam::radiation::viewFactor::calculate()
}
}
if (debug)
{
InfoInFunction
<< "\nLU Back substitute C matrix.." << endl;
}
Info<< "Solving view factor equations for band : "
<< bandI << endl;
LUBacksubstitute(CLU_(), pivotIndices_, q);
iterCounter_ ++;
}
}
}
// Scatter q and fill qr
Pstream::listCombineScatter(q);
Pstream::listCombineGather(q, maxEqOp<scalar>());
label globCoarseId = 0;
forAll(selectedPatches_, i)
for (const label patchID : selectedPatches_)
{
const label patchID = selectedPatches_[i];
const polyPatch& pp = mesh_.boundaryMesh()[patchID];
if (pp.size() > 0)
{
scalarField& qrp = qrBf[patchID];
@ -627,7 +639,9 @@ void Foam::radiation::viewFactor::calculate()
forAll(coarseToFine, coarseI)
{
label globalCoarse =
globalNumbering.toGlobal(Pstream::myProcNo(), globCoarseId);
globalNumbering.toGlobal
(Pstream::myProcNo(), globCoarseId);
const label coarseFaceID = coarsePatchFace[coarseI];
const labelList& fineFaces = coarseToFine[coarseFaceID];
forAll(fineFaces, k)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
@ -74,6 +74,17 @@ class viewFactor
:
public radiationModel
{
private:
// Private Member Functions
//- No copy construct
viewFactor(const viewFactor&) = delete;
//- No copy assignment
void operator=(const viewFactor&) = delete;
protected:
// Static data
@ -126,6 +137,9 @@ protected:
//- Solar load radiation model
autoPtr<solarLoad> solarLoad_;
//-Number of bands
label nBands_;
// Private Member Functions
@ -142,12 +156,6 @@ protected:
scalarSquareMatrix& matrix
);
//- No copy construct
viewFactor(const viewFactor&) = delete;
//- No copy assignment
void operator=(const viewFactor&) = delete;
public:
@ -165,7 +173,7 @@ public:
//- Destructor
virtual ~viewFactor();
virtual ~viewFactor() = default;
// Member functions
@ -189,6 +197,12 @@ public:
//- Const access to total radiative heat flux field
inline const volScalarField& qr() const;
//- Use useSolarLoad
inline bool useSolarLoad() const;
//- Number of bands
virtual label nBands() const;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
@ -31,4 +31,15 @@ inline const Foam::volScalarField& Foam::radiation::viewFactor::qr() const
}
inline bool Foam::radiation::viewFactor::useSolarLoad() const
{
return useSolarLoad_;
}
inline label Foam::radiation::viewFactor::nBands() const
{
return nBands_;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "boundaryRadiationProperties.H"
#include "radiationModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -63,6 +64,15 @@ Foam::radiation::boundaryRadiationProperties::boundaryRadiationProperties
if (boundaryIO.typeHeaderOk<IOdictionary>(true))
{
const radiationModel& radiation =
mesh.lookupObject<radiationModel>
(
"radiationProperties"
);
// Model number of bands
label nBands = radiation.nBands();
const IOdictionary radiationDict(boundaryIO);
forAll(mesh.boundary(), patchi)
@ -75,8 +85,17 @@ Foam::radiation::boundaryRadiationProperties::boundaryRadiationProperties
radBoundaryPropertiesPtrList_[patchi].reset
(
new boundaryRadiationPropertiesPatch(pp, dict)
boundaryRadiationPropertiesPatch::New(dict, pp)
);
if (nBands != radBoundaryPropertiesPtrList_[patchi]->nBands())
{
FatalErrorInFunction
<< "Radiation bands : " << nBands << nl
<< "Bands on patch : " << patchi << " is "
<< radBoundaryPropertiesPtrList_[patchi]->nBands()
<< abort(FatalError);
}
}
}
}
@ -89,12 +108,19 @@ Foam::tmp<Foam::scalarField>
Foam::radiation::boundaryRadiationProperties::emissivity
(
const label patchi,
const label bandi
const label bandi,
vectorField* incomingDirection,
scalarField* T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->emissivity(bandi);
return radBoundaryPropertiesPtrList_[patchi]->e
(
bandi,
incomingDirection,
T
);
}
FatalErrorInFunction
@ -107,16 +133,53 @@ Foam::radiation::boundaryRadiationProperties::emissivity
}
Foam::scalar Foam::radiation::boundaryRadiationProperties::faceEmissivity
(
const label patchi,
const label faceI,
const label bandi,
vector incomingDirection,
scalar T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->e
(
faceI,
bandi,
incomingDirection,
T
);
}
FatalErrorInFunction
<< "Patch : " << mesh().boundaryMesh()[patchi].name()
<< " is not found in the boundaryRadiationProperties. "
<< "Please add it"
<< exit(FatalError);
return Zero;
}
Foam::tmp<Foam::scalarField>
Foam::radiation::boundaryRadiationProperties::absorptivity
(
const label patchi,
const label bandi
const label bandi,
vectorField* incomingDirection,
scalarField* T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->absorptivity(bandi);
return radBoundaryPropertiesPtrList_[patchi]->a
(
bandi,
incomingDirection,
T
);
}
FatalErrorInFunction
@ -129,16 +192,53 @@ Foam::radiation::boundaryRadiationProperties::absorptivity
}
Foam::scalar Foam::radiation::boundaryRadiationProperties::faceAbsorptivity
(
const label patchi,
const label faceI,
const label bandi,
vector incomingDirection,
scalar T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->a
(
faceI,
bandi,
incomingDirection,
T
);
}
FatalErrorInFunction
<< "Patch : " << mesh().boundaryMesh()[patchi].name()
<< " is not found in the boundaryRadiationProperties. "
<< "Please add it"
<< exit(FatalError);
return Zero;
}
Foam::tmp<Foam::scalarField>
Foam::radiation::boundaryRadiationProperties::transmissivity
(
const label patchi,
const label bandi
const label bandi,
vectorField* incomingDirection,
scalarField* T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->transmissivity(bandi);
return radBoundaryPropertiesPtrList_[patchi]->t
(
bandi,
incomingDirection,
T
);
}
FatalErrorInFunction
@ -151,16 +251,53 @@ Foam::radiation::boundaryRadiationProperties::transmissivity
}
Foam::scalar Foam::radiation::boundaryRadiationProperties::faceTransmissivity
(
const label patchi,
const label faceI,
const label bandi,
vector incomingDirection,
scalar T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->t
(
faceI,
bandi,
incomingDirection,
T
);
}
FatalErrorInFunction
<< "Patch : " << mesh().boundaryMesh()[patchi].name()
<< " is not found in the boundaryRadiationProperties. "
<< "Please add it"
<< exit(FatalError);
return Zero;
}
Foam::tmp<Foam::scalarField>
Foam::radiation::boundaryRadiationProperties::reflectivity
Foam::radiation::boundaryRadiationProperties::diffReflectivity
(
const label patchi,
const label bandi
const label bandi,
vectorField* incomingDirection,
scalarField* T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->reflectivity(bandi);
return radBoundaryPropertiesPtrList_[patchi]->rDiff
(
bandi,
incomingDirection,
T
);
}
FatalErrorInFunction
@ -173,10 +310,93 @@ Foam::radiation::boundaryRadiationProperties::reflectivity
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::scalar Foam::radiation::boundaryRadiationProperties::faceDiffReflectivity
(
const label patchi,
const label faceI,
const label bandi,
vector incomingDirection,
scalar T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->rDiff
(
faceI,
bandi,
incomingDirection,
T
);
}
Foam::radiation::boundaryRadiationProperties::~boundaryRadiationProperties()
{}
FatalErrorInFunction
<< "Patch : " << mesh().boundaryMesh()[patchi].name()
<< " is not found in the boundaryRadiationProperties. "
<< "Please add it"
<< exit(FatalError);
return Zero;
}
Foam::tmp<Foam::scalarField>
Foam::radiation::boundaryRadiationProperties::specReflectivity
(
const label patchi,
const label bandi,
vectorField* incomingDirection,
scalarField* T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->rSpec
(
bandi,
incomingDirection,
T
);
}
FatalErrorInFunction
<< "Patch : " << mesh().boundaryMesh()[patchi].name()
<< " is not found in the boundaryRadiationProperties. "
<< "Please add it"
<< exit(FatalError);
return tmp<scalarField>::New();
}
Foam::scalar Foam::radiation::boundaryRadiationProperties::faceSpecReflectivity
(
const label patchi,
const label faceI,
const label bandi,
vector incomingDirection,
scalar T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->rSpec
(
faceI,
bandi,
incomingDirection,
T
);
}
FatalErrorInFunction
<< "Patch : " << mesh().boundaryMesh()[patchi].name()
<< " is not found in the boundaryRadiationProperties. "
<< "Please add it"
<< exit(FatalError);
return Zero;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -86,35 +86,100 @@ public:
tmp<scalarField> emissivity
(
const label patchI,
const label bandI = 0
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Access boundary emissivity on face
scalar faceEmissivity
(
const label patchI,
const label faceI,
const label bandI = 0,
vector incomingDirection = Zero,
scalar T = 0
) const;
//- Access boundary absorptivity on patch
tmp<scalarField> absorptivity
(
const label patchI,
const label bandI = 0
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Access boundary absorptivity on face
scalar faceAbsorptivity
(
const label patchI,
const label faceI,
const label bandI = 0,
vector incomingDirection = Zero,
scalar T = 0
) const;
//- Access boundary transmissivity on patch
tmp<scalarField> transmissivity
(
const label patchI,
const label bandI = 0
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Access boundary reflectivity on patch
tmp<scalarField> reflectivity
//- Access boundary transmissivity on face
scalar faceTransmissivity
(
const label patchI,
const label bandI = 0
const label faceI,
const label bandI = 0,
vector incomingDirection = Zero,
scalar T = 0
) const;
//- Access boundary diffuse reflectivity on patch
tmp<scalarField> diffReflectivity
(
const label patchI,
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Access boundary diffuse reflectivity on face
scalar faceDiffReflectivity
(
const label patchI,
const label faceI,
const label bandI = 0,
vector incomingDirection = Zero,
scalar T = 0
) const;
//- Access boundary specular reflectivity on patch
tmp<scalarField> specReflectivity
(
const label patchI,
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Access boundary specular reflectivity on face
scalar faceSpecReflectivity
(
const label patchI,
const label faceI,
const label bandI = 0,
vector incomingDirection = Zero,
scalar T = 0
) const;
//- Destructor
~boundaryRadiationProperties();
~boundaryRadiationProperties() = default;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,17 +29,47 @@ License
#include "absorptionEmissionModel.H"
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(boundaryRadiationPropertiesPatch, 0);
defineRunTimeSelectionTable
(
boundaryRadiationPropertiesPatch,
dictionary
);
}
}
const Foam::Enum
<
Foam::radiation::boundaryRadiationPropertiesPatch::methodType
>
Foam::radiation::boundaryRadiationPropertiesPatch::methodTypeNames_
({
{ methodType::SOLIDRADIATION, "solidRadiation" },
{ methodType::LOOKUP, "lookup" },
{ methodType::MODEL, "model" },
});
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::radiation::boundaryRadiationPropertiesPatch>
Foam::radiation::boundaryRadiationPropertiesPatch::New
(
const dictionary& dict,
const polyPatch& pp
)
{
word modelType(dict.lookupCompat("type", {{"mode", 1812}}));
Info<< "Selecting boundary radiation Model: "
<< modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown modelType type "
<< modelType << nl << nl
<< "Valid radiation types are : " << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return cstrIter()(dict, pp);
}
// * * * * * * * * * * * * * * * * Private functions * * * * * * * * * * * * //
@ -70,362 +100,36 @@ Foam::radiation::boundaryRadiationPropertiesPatch::nbrRegion() const
Foam::radiation::boundaryRadiationPropertiesPatch::
boundaryRadiationPropertiesPatch
(
const polyPatch& p,
const dictionary& dict
const dictionary& dict,
const polyPatch& p
)
:
method_(methodTypeNames_.get("mode", dict)),
dict_(dict),
patch_(p),
absorptionEmission_(nullptr),
transmissivity_(nullptr),
patch_(p)
{
switch (method_)
{
case SOLIDRADIATION:
{
if (!isA<mappedPatchBase>(p))
{
FatalErrorInFunction
<< "\n patch type '" << p.type()
<< "' not type '" << mappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< abort(FatalIOError);
}
}
break;
case MODEL:
{
const fvMesh& mesh =
refCast<const fvMesh>(p.boundaryMesh().mesh());
absorptionEmission_.reset
(
absorptionEmissionModel::New(dict, mesh).ptr()
);
transmissivity_.reset
(
transmissivityModel::New(dict, mesh).ptr()
);
}
break;
case LOOKUP:
{
//Do nothing
}
break;
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::boundaryRadiationPropertiesPatch::
~boundaryRadiationPropertiesPatch()
transmissivity_(nullptr)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::radiation::absorptionEmissionModel&
const Foam::radiation::wallAbsorptionEmissionModel&
Foam::radiation::boundaryRadiationPropertiesPatch::absorptionEmission() const
{
return *absorptionEmission_;
}
const Foam::radiation::transmissivityModel&
const Foam::radiation::wallTransmissivityModel&
Foam::radiation::boundaryRadiationPropertiesPatch::transmissiveModel() const
{
return *transmissivity_;
}
Foam::tmp<Foam::scalarField>
Foam::radiation::boundaryRadiationPropertiesPatch::emissivity
(
const label bandI
) const
void Foam::radiation::boundaryRadiationPropertiesPatch::write(Ostream& os) const
{
switch (method_)
{
case SOLIDRADIATION:
{
const fvMesh& nbrMesh = nbrRegion();
const radiation::radiationModel& radiation =
nbrMesh.lookupObject<radiation::radiationModel>
(
"radiationProperties"
);
scalarField emissivity
(
radiation.absorptionEmission().e(bandI)().boundaryField()
[
nbrPatchIndex()
]
);
const mappedPatchBase& mpp =
refCast<const mappedPatchBase>(patch_);
mpp.distribute(emissivity);
return tmp<scalarField>::New(std::move(emissivity));
}
break;
case LOOKUP:
{
return tmp<scalarField>::New
(
patch_.size(),
dict_.get<scalar>("emissivity")
);
}
break;
case MODEL:
{
const label index = patch_.index();
return tmp<scalarField>::New
(
absorptionEmission_->e(bandI)().boundaryField()[index]
);
}
break;
default:
{
FatalErrorInFunction
<< "Please set 'mode' to one of "
<< methodTypeNames_
<< exit(FatalError);
}
break;
}
return scalarField(0);
}
Foam::tmp<Foam::scalarField>
Foam::radiation::boundaryRadiationPropertiesPatch::absorptivity
(
const label bandI
) const
{
switch (method_)
{
case SOLIDRADIATION:
{
const fvMesh& nbrMesh = nbrRegion();
const radiation::radiationModel& radiation =
nbrMesh.lookupObject<radiation::radiationModel>
(
"radiationProperties"
);
scalarField absorp
(
radiation.absorptionEmission().a(bandI)().boundaryField()
[
nbrPatchIndex()
]
);
const mappedPatchBase& mpp =
refCast<const mappedPatchBase>(patch_);
mpp.distribute(absorp);
return tmp<scalarField>::New(std::move(absorp));
}
break;
case MODEL:
{
const label index = patch_.index();
return tmp<scalarField>::New
(
absorptionEmission_->a(bandI)().boundaryField()[index]
);
}
break;
case LOOKUP:
{
return tmp<scalarField>::New
(
patch_.size(),
dict_.get<scalar>("absorptivity")
);
}
break;
default:
{
FatalErrorInFunction
<< "Unimplemented method " << method_ << endl
<< "Please set 'mode' to one of "
<< methodTypeNames_
<< exit(FatalError);
}
break;
}
return scalarField(0);
}
Foam::tmp<Foam::scalarField>
Foam::radiation::boundaryRadiationPropertiesPatch::transmissivity
(
const label bandI
) const
{
switch (method_)
{
case SOLIDRADIATION:
{
const fvMesh& nbrMesh = nbrRegion();
const radiation::radiationModel& radiation =
nbrMesh.lookupObject<radiation::radiationModel>
(
"radiationProperties"
);
scalarField trans
(
radiation.transmissivity().tauEff(bandI)().boundaryField()
[
nbrPatchIndex()
]
);
const mappedPatchBase& mpp =
refCast<const mappedPatchBase>(patch_);
mpp.distribute(trans);
return tmp<scalarField>::New(std::move(trans));
}
break;
case MODEL:
{
const label index = patch_.index();
return tmp<scalarField>::New
(
transmissivity_->tauEff(bandI)().boundaryField()[index]
);
}
case LOOKUP:
{
return tmp<scalarField>::New
(
patch_.size(),
dict_.get<scalar>("transmissivity")
);
}
default:
{
FatalErrorInFunction
<< "Unimplemented method " << method_ << endl
<< "Please set 'mode' to one of "
<< methodTypeNames_
<< exit(FatalError);
}
break;
}
return scalarField(0);
}
Foam::tmp<Foam::scalarField>
Foam::radiation::boundaryRadiationPropertiesPatch::reflectivity
(
const label bandI
) const
{
const tmp<scalarField> tt = transmissivity(bandI);
const tmp<scalarField> ta = absorptivity(bandI);
return (1.0 - tt - ta);
}
void Foam::radiation::boundaryRadiationPropertiesPatch::write
(
Ostream& os
) const
{
os.writeEntry("mode", methodTypeNames_[method_]);
switch (method_)
{
case MODEL:
{
word modelType(dict_.get<word>("absorptionEmissionModel"));
os.writeEntry("absorptionEmissionModel", modelType);
word modelCoeffs(modelType + word("Coeffs"));
os.writeKeyword(modelCoeffs);
dict_.subDict(modelCoeffs).write(os);
modelType = dict_.get<word>("transmissivityModel");
os.writeEntry("transmissivityModel", modelType);
modelCoeffs = modelType + word("Coeffs");
os.writeKeyword(modelCoeffs);
dict_.subDict(modelCoeffs).write(os);
break;
}
case LOOKUP:
{
const scalarField emissivity("emissivity", dict_, patch_.size());
emissivity.writeEntry("emissivity", os);
const scalarField absorptivity
(
"absorptivity", dict_, patch_.size()
);
absorptivity.writeEntry("absorptivity", os);
const scalarField transmissivity
(
"transmissivity", dict_, patch_.size()
);
transmissivity.writeEntry("transmissivity", os);
break;
}
case SOLIDRADIATION:
{
}
}
NotImplemented;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,12 +25,6 @@ Class
Foam::boundaryRadiationPropertiesPatch
Description
Common functions to emissivity. It gets supplied from lookup into a
dictionary or calculated by the solidThermo:
- 'lookup' : lookup volScalarField with name
- 'solidThermo' : use solidThermo
- 'model' : use a model
SourceFiles
boundaryRadiationPropertiesPatch.C
@ -44,8 +38,9 @@ SourceFiles
#include "Enum.H"
#include "fvPatch.H"
#include "calculatedFvPatchFields.H"
#include "transmissivityModel.H"
#include "absorptionEmissionModel.H"
#include "runTimeSelectionTables.H"
#include "wallTransmissivityModel.H"
#include "wallAbsorptionEmissionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,35 +54,13 @@ namespace radiation
class boundaryRadiationPropertiesPatch
{
public:
// - Type of method
enum methodType
{
SOLIDRADIATION,
LOOKUP,
MODEL
};
private:
// Private data
static const Enum<methodType> methodTypeNames_;
//- How to get property
const methodType method_;
//- Dictionary
const dictionary dict_;
//- Absorption/emission model
autoPtr<absorptionEmissionModel> absorptionEmission_;
//- transmissivity model
autoPtr<transmissivityModel> transmissivity_;
//- reference to fvPatch
const polyPatch& patch_;
@ -101,52 +74,159 @@ private:
const fvMesh& nbrRegion() const;
protected:
// Protected Member Functions
//- Absorption/emission model
autoPtr<wallAbsorptionEmissionModel> absorptionEmission_;
//- Transmissivity model
autoPtr<wallTransmissivityModel> transmissivity_;
public:
//- Runtime type information
TypeName("boundaryRadiationPropertiesPatch");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
boundaryRadiationPropertiesPatch,
dictionary,
(
const dictionary& dict,
const polyPatch& pp
),
(dict, pp)
);
// Constructors
//- Construct from patch, internal field and dictionary
boundaryRadiationPropertiesPatch
(
const polyPatch&,
const dictionary&
const dictionary&,
const polyPatch&
);
//- Selector
static autoPtr<boundaryRadiationPropertiesPatch> New
(
const dictionary& dict,
const polyPatch& pp
);
//- Destructor
virtual ~boundaryRadiationPropertiesPatch();
virtual ~boundaryRadiationPropertiesPatch() = default;
// Member functions
//- Method to obtain properties
word method() const
{
return methodTypeNames_[method_];
}
//- Return absorptionEmissionModel
const absorptionEmissionModel& absorptionEmission() const;
const wallAbsorptionEmissionModel& absorptionEmission() const;
//- Return transmissivityModel
const transmissivityModel& transmissiveModel() const;
const wallTransmissivityModel& transmissiveModel() const;
//- Calculate corresponding emissivity field for bandI
tmp<scalarField> emissivity(const label bandI = 0) const;
//- Return emissivity on patch
virtual tmp<scalarField> e
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const = 0;
//- Calculate corresponding absorptivity field for bandI
tmp<scalarField> absorptivity(const label bandI = 0) const;
//- Return emissivity on face
virtual scalar e
(
const label faceI,
const label bandI = 0,
const vector& dir = Zero,
const scalar T = 0
) const = 0;
//- Calculate corresponding transmissivity field for bandI
tmp<scalarField> transmissivity(const label bandI = 0) const;
//- Return absorptivity on patch
virtual tmp<scalarField> a
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const = 0;
//- Calculate corresponding reflectivity field
tmp<scalarField> reflectivity(const label bandI = 0) const;
//- Return absorptivity on face
virtual scalar a
(
const label faceI,
const label bandI = 0,
const vector& dir = Zero,
const scalar T = 0
) const = 0;
//- Return transmissivity on patch
virtual tmp<scalarField> t
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const = 0;
//- Return transmissivity on face
virtual scalar t
(
const label faceI,
const label bandI = 0,
const vector& dir = Zero,
const scalar T = 0
) const = 0;
//- Return specular reflectivity on patch
virtual tmp<scalarField> rSpec
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const = 0;
//- Return specular reflectivity on face
virtual scalar rSpec
(
const label faceI,
const label bandI = 0,
const vector& dir = Zero,
const scalar T = 0
) const = 0;
//- Return diffusive reflectivity on patch
virtual tmp<scalarField> rDiff
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const = 0;
//- Return diffusive reflectivity on face
virtual scalar rDiff
(
const label faceI,
const label bandI = 0,
const vector& dir = Zero,
const scalar T = 0
) const = 0;
//- Is Grey
virtual bool isGrey() const = 0;
//- Number of bands
virtual label nBands() const = 0;
//- Write
void write(Ostream&) const;
virtual void write(Ostream&) const;
};

View File

@ -0,0 +1,204 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "lookup.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(lookup, 0);
addToRunTimeSelectionTable
(
boundaryRadiationPropertiesPatch,
lookup,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::lookup::lookup
(
const dictionary& dict,
const polyPatch& pp
)
:
boundaryRadiationPropertiesPatch(dict, pp),
pp_(pp),
dict_(dict)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::radiation::lookup::e
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New
(
pp_.size(),
dict_.get<scalar>("emissivity")
);
}
Foam::scalar Foam::radiation::lookup::e
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return(dict_.get<scalar>("emissivity"));
}
Foam::tmp<Foam::scalarField>
Foam::radiation::lookup::a
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New
(
pp_.size(),
dict_.get<scalar>("absorptivity")
);
}
Foam::scalar Foam::radiation::lookup::a
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return(dict_.get<scalar>("absorptivity"));
}
Foam::tmp<Foam::scalarField> Foam::radiation::lookup::t
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New
(
pp_.size(),
dict_.get<scalar>("transmissivity")
);
}
Foam::scalar Foam::radiation::lookup::t
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return(dict_.get<scalar>("transmissivity"));
}
Foam::tmp<Foam::scalarField>
Foam::radiation::lookup::rSpec
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), Zero);
}
Foam::scalar Foam::radiation::lookup::rSpec
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return Zero;
}
Foam::tmp<Foam::scalarField>
Foam::radiation::lookup::rDiff
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), Zero);
}
Foam::scalar Foam::radiation::lookup::rDiff
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return Zero;
}
bool Foam::radiation::lookup::isGrey() const
{
return true;
}
Foam::label Foam::radiation::lookup::nBands() const
{
return 1;
}
// ************************************************************************* //

View File

@ -0,0 +1,195 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::radiation::lookup
Description
Look up type of boundary radiation properties.
Usage
\verbatim
wallAbsorptionEmissionModel
{
type lookup;
absorptivity 0.1;
emissivity 0.1;
}
\endverbatim
\*---------------------------------------------------------------------------*/
#ifndef lookup_H
#define lookup_H
#include "boundaryRadiationPropertiesPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class lookup Declaration
\*---------------------------------------------------------------------------*/
class lookup
:
public boundaryRadiationPropertiesPatch
{
protected:
// Protected data
//- Reference to the polyPatch
const polyPatch& pp_;
//-Dictionary
const dictionary dict_;
public:
//- Runtime type information
TypeName("lookup");
// Constructors
//- Construct from components
lookup(const dictionary& dict, const polyPatch& pp);
//- Destructor
virtual ~lookup() = default;
// Member Functions
//- Return emissivity
virtual tmp<scalarField> e
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return emissivity on face
virtual scalar e
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return absorptivity on patch
virtual tmp<scalarField> a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return absorptivity on face
virtual scalar a
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return transmissivity on patch
virtual tmp<scalarField> t
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return transmissivity on face
virtual scalar t
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return specular reflectivity on patch
virtual tmp<scalarField> rSpec
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return specular reflectivity on face
virtual scalar rSpec
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return diffusive reflectivity on patch
virtual tmp<scalarField> rDiff
(
const label bandI,
vectorField* incomingDirection ,
scalarField* T
) const;
//- Return diffusive reflectivity on face
virtual scalar rDiff
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Is Grey
virtual bool isGrey() const;
//- Number of bands
virtual label nBands() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace radiation
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,198 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "opaqueDiffusive.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(opaqueDiffusive, 0);
addToRunTimeSelectionTable
(
boundaryRadiationPropertiesPatch,
opaqueDiffusive,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::opaqueDiffusive::opaqueDiffusive
(
const dictionary& dict,
const polyPatch& pp
)
:
boundaryRadiationPropertiesPatch(dict, pp),
pp_(pp)
{
const dictionary& absorptionDict =
dict.subDict("wallAbsorptionEmissionModel");
absorptionEmission_.reset
(
wallAbsorptionEmissionModel::New(absorptionDict, pp).ptr()
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::radiation::opaqueDiffusive::e
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return(absorptionEmission_->e(bandI, dir, T));
}
Foam::scalar Foam::radiation::opaqueDiffusive::e
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return(absorptionEmission_->e(faceI, bandI, dir, T));
}
Foam::tmp<Foam::scalarField>
Foam::radiation::opaqueDiffusive::a
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return(absorptionEmission_->a(bandI, dir, T));
}
Foam::scalar Foam::radiation::opaqueDiffusive::a
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return(absorptionEmission_->a(faceI, bandI, dir, T));
}
Foam::tmp<Foam::scalarField> Foam::radiation::opaqueDiffusive::t
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), 0.0);
}
Foam::scalar Foam::radiation::opaqueDiffusive::t
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return 0;
}
Foam::tmp<Foam::scalarField>
Foam::radiation::opaqueDiffusive::rSpec
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), Zero);
}
Foam::scalar Foam::radiation::opaqueDiffusive::rSpec
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return Zero;
}
Foam::tmp<Foam::scalarField> Foam::radiation::opaqueDiffusive::rDiff
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), Zero);
}
Foam::scalar Foam::radiation::opaqueDiffusive::rDiff
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return Zero;
}
bool Foam::radiation::opaqueDiffusive::isGrey() const
{
return absorptionEmission_->isGrey();
}
Foam::label Foam::radiation::opaqueDiffusive::nBands() const
{
return absorptionEmission_->nBands();
}
// ************************************************************************* //

View File

@ -0,0 +1,195 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::radiation::opaqueDiffusive
Description
Radiation boundary model for opaque diffusive walls. It requires to
specify a wallAbsorptionEmissionModel in boundaryRadiationProperties
file.
Usage
\verbatim
type opaqueDiffusive;
wallAbsorptionEmissionModel
{
type multiBandAbsorption;
absorptivity (0.3 0.7);
emissivity (0.3 0.7);
};
\endverbatim
\*---------------------------------------------------------------------------*/
#ifndef opaqueDiffusive_H
#define opaqueDiffusive_H
#include "boundaryRadiationPropertiesPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class opaqueDiffusive Declaration
\*---------------------------------------------------------------------------*/
class opaqueDiffusive
:
public boundaryRadiationPropertiesPatch
{
protected:
// Protected data
//- Reference to the polyPatch
const polyPatch& pp_;
public:
//- Runtime type information
TypeName("opaqueDiffusive");
// Constructors
//- Construct from components
opaqueDiffusive(const dictionary& dict, const polyPatch& pp);
//- Destructor
virtual ~opaqueDiffusive() = default;
// Member Functions
//- Return emissivity
virtual tmp<scalarField> e
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return emissivity on face
virtual scalar e
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return absorptivity on patch
virtual tmp<scalarField> a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return absorptivity on face
virtual scalar a
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return transmissivity on patch
virtual tmp<scalarField> t
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return transmissivity on face
virtual scalar t
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return specular reflectivity on patch
virtual tmp<scalarField> rSpec
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return specular reflectivity on face
virtual scalar rSpec
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return diffusive reflectivity on patch
virtual tmp<scalarField> rDiff
(
const label bandI,
vectorField* incomingDirection ,
scalarField* T
) const;
//- Return diffusive reflectivity on face
virtual scalar rDiff
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Is Grey
virtual bool isGrey() const;
//- Number of bands
virtual label nBands() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace radiation
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,200 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "opaqueReflective.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(opaqueReflective, 0);
addToRunTimeSelectionTable
(
boundaryRadiationPropertiesPatch,
opaqueReflective,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::opaqueReflective::opaqueReflective
(
const dictionary& dict,
const polyPatch& pp
)
:
boundaryRadiationPropertiesPatch(dict, pp),
pp_(pp),
fd_(dict.lookupOrDefault<scalar>("fd", 1))
{
const dictionary& absorptionDict =
dict.subDict("wallAbsorptionEmissionModel");
absorptionEmission_.reset
(
wallAbsorptionEmissionModel::New(absorptionDict, pp).ptr()
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::radiation::opaqueReflective::e
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return(absorptionEmission_->e(bandI, dir, T));
}
Foam::scalar Foam::radiation::opaqueReflective::e
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return(absorptionEmission_->e(faceI, bandI, dir, T));
}
Foam::tmp<Foam::scalarField>
Foam::radiation::opaqueReflective::a
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return(absorptionEmission_->a(bandI, dir, T));
}
Foam::scalar Foam::radiation::opaqueReflective::a
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return(absorptionEmission_->a(faceI, bandI, dir, T));
}
Foam::tmp<Foam::scalarField> Foam::radiation::opaqueReflective::t
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), Zero);
}
Foam::scalar Foam::radiation::opaqueReflective::t
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return Zero;
}
Foam::tmp<Foam::scalarField>
Foam::radiation::opaqueReflective::rSpec
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return (1.0 - fd_)*(1.0 - a(bandI, dir, T));
}
Foam::scalar Foam::radiation::opaqueReflective::rSpec
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return (1.0 - fd_)*(1.0 - a(faceI, bandI, dir, T));
}
Foam::tmp<Foam::scalarField>
Foam::radiation::opaqueReflective::rDiff
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return fd_*(1.0 - a(bandI, dir, T));
}
Foam::scalar Foam::radiation::opaqueReflective::rDiff
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return fd_*(1.0 - a(faceI, bandI, dir, T));
}
bool Foam::radiation::opaqueReflective::isGrey() const
{
return absorptionEmission_->isGrey();
}
Foam::label Foam::radiation::opaqueReflective::nBands() const
{
return absorptionEmission_->nBands();
}
// ************************************************************************* //

View File

@ -0,0 +1,205 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::radiation::opaqueReflective
Description
Radiation boundary model for opaque reflective walls. It requires to
specify a wallAbsorptionEmissionModel and the reflected fraction
in boundaryRadiationProperties file
fd is the diffusive reflected fraction. 0 all the incoming flux is
specularly reflected and 1 all is diffusive reflected. fd is used
in the calculation of the specular reflection (rSpec) and the
diffusive reflection (rDiff). Absorptivity and emissivity are
independent of fd.
Usage
\verbatim
type opaqueReflective;
fd 0.0;
wallAbsorptionEmissionModel
{
type multiBandAbsorption;
absorptivity (0.3 0.7);
emissivity (0.3 0.7);
};
\endverbatim
\*---------------------------------------------------------------------------*/
#ifndef opaqueReflective_H
#define opaqueReflective_H
#include "boundaryRadiationPropertiesPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class opaqueReflective Declaration
\*---------------------------------------------------------------------------*/
class opaqueReflective
:
public boundaryRadiationPropertiesPatch
{
protected:
// Protected data
//- Reference to the polyPatch
const polyPatch& pp_;
//- Diffuse fraction
const scalar fd_;
public:
//- Runtime type information
TypeName("opaqueReflective");
// Constructors
//- Construct from components
opaqueReflective(const dictionary& dict, const polyPatch& pp);
//- Destructor
virtual ~opaqueReflective() = default;
// Member Functions
//- Return emissivity
virtual tmp<scalarField> e
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return emissivity on face
virtual scalar e
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return absorptivity on patch
virtual tmp<scalarField> a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return absorptivity on face
virtual scalar a
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return transmissivity on patch
virtual tmp<scalarField> t
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return transmissivity on face
virtual scalar t
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return specular reflectivity on patch
virtual tmp<scalarField> rSpec
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return specular reflectivity on face
virtual scalar rSpec
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return diffusive reflectivity on patch
virtual tmp<scalarField> rDiff
(
const label bandI,
vectorField* incomingDirection ,
scalarField* T
) const;
//- Return diffusive reflectivity on face
virtual scalar rDiff
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Is Grey
virtual bool isGrey() const;
//- Number of bands
virtual label nBands() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace radiation
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,200 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "transparent.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(transparent, 0);
addToRunTimeSelectionTable
(
boundaryRadiationPropertiesPatch,
transparent,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::transparent::transparent
(
const dictionary& dict,
const polyPatch& pp
)
:
boundaryRadiationPropertiesPatch(dict, pp),
pp_(pp)
{
const dictionary& absorptionDict =
dict.subDict("wallAbsorptionEmissionModel");
absorptionEmission_.reset
(
wallAbsorptionEmissionModel::New(absorptionDict, pp).ptr()
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::radiation::transparent::e
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return(absorptionEmission_->e(bandI, dir, T));
}
Foam::scalar Foam::radiation::transparent::e
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return(absorptionEmission_->e(faceI, bandI, dir, T));
}
Foam::tmp<Foam::scalarField>
Foam::radiation::transparent::a
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return(absorptionEmission_->a(bandI, dir, T));
}
Foam::scalar Foam::radiation::transparent::a
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return(absorptionEmission_->a(faceI, bandI, dir, T));
}
Foam::tmp<Foam::scalarField> Foam::radiation::transparent::t
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), 1.0);
}
Foam::scalar Foam::radiation::transparent::t
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return 1;
}
Foam::tmp<Foam::scalarField>
Foam::radiation::transparent::rSpec
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), Zero);
}
Foam::scalar Foam::radiation::transparent::rSpec
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return Zero;
}
Foam::tmp<Foam::scalarField>
Foam::radiation::transparent::rDiff
(
const label bandI,
vectorField* dir,
scalarField* T
) const
{
return tmp<scalarField>::New(pp_.size(), Zero);
}
Foam::scalar Foam::radiation::transparent::rDiff
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const
{
return Zero;
}
bool Foam::radiation::transparent::isGrey() const
{
return absorptionEmission_->isGrey();
}
Foam::label Foam::radiation::transparent::nBands() const
{
return absorptionEmission_->nBands();
}
// ************************************************************************* //

View File

@ -0,0 +1,195 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::radiation::transparent
Description
Radiation boundary model for transparent walls. It requires to
specify a wallAbsorptionEmissionModel in boundaryRadiationProperties
file.
Usage
\verbatim
type transparent;
wallAbsorptionEmissionModel
{
type multiBandAbsorption;
absorptivity (0.3 0.7);
emissivity (0.3 0.7);
};
\endverbatim
\*---------------------------------------------------------------------------*/
#ifndef transparent_H
#define transparent_H
#include "boundaryRadiationPropertiesPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class transparent Declaration
\*---------------------------------------------------------------------------*/
class transparent
:
public boundaryRadiationPropertiesPatch
{
protected:
// Protected data
//- Reference to the polyPatch
const polyPatch& pp_;
public:
//- Runtime type information
TypeName("transparent");
// Constructors
//- Construct from components
transparent(const dictionary& dict, const polyPatch& pp);
//- Destructor
virtual ~transparent() = default;
// Member Functions
//- Return emissivity
virtual tmp<scalarField> e
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return emissivity on face
virtual scalar e
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return absorptivity on patch
virtual tmp<scalarField> a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return absorptivity on face
virtual scalar a
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return transmissivity on patch
virtual tmp<scalarField> t
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return transmissivity on face
virtual scalar t
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return specular reflectivity on patch
virtual tmp<scalarField> rSpec
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return specular reflectivity on face
virtual scalar rSpec
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Return diffusive reflectivity on patch
virtual tmp<scalarField> rDiff
(
const label bandI,
vectorField* incomingDirection ,
scalarField* T
) const;
//- Return diffusive reflectivity on face
virtual scalar rDiff
(
const label faceI,
const label bandI,
const vector& dir,
const scalar T
) const;
//- Is Grey
virtual bool isGrey() const;
//- Number of bands
virtual label nBands() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace radiation
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -66,7 +66,7 @@ Foam::solarCalculator::sunLoadModelTypeNames_
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::solarCalculator::calculateBetaTetha()
void Foam::solarCalculator::calculateBetaTheta()
{
scalar runTime = 0.0;
switch (sunDirectionModel_)
@ -104,20 +104,20 @@ void Foam::solarCalculator::calculateBetaTetha()
scalar deltaRad = degToRad(delta);
beta_ = max(asin(cos(L)*cos(deltaRad)*cos(H) + sin(L)*sin(deltaRad)), 1e-3);
tetha_ = acos((sin(beta_)*sin(L) - sin(deltaRad))/(cos(beta_)*cos(L)));
theta_ = acos((sin(beta_)*sin(L) - sin(deltaRad))/(cos(beta_)*cos(L)));
// theta is the angle between the SOUTH axis and the Sun
// If the hour angle is lower than zero (morning) the Sun is positioned
// on the East side.
if (H < 0)
{
tetha_ += 2*(constant::mathematical::pi - tetha_);
theta_ += 2*(constant::mathematical::pi - theta_);
}
if (debug)
{
Info << tab << "altitude : " << radToDeg(beta_) << endl;
Info << tab << "azimuth : " << radToDeg(tetha_) << endl;
Info << tab << "azimuth : " << radToDeg(theta_) << endl;
}
}
@ -134,8 +134,8 @@ void Foam::solarCalculator::calculateSunDirection()
// Assuming 'z' vertical, 'y' North and 'x' East
direction_.z() = -sin(beta_);
direction_.y() = cos(beta_)*cos(tetha_); // South axis
direction_.x() = cos(beta_)*sin(tetha_); // West axis
direction_.y() = cos(beta_)*cos(theta_); // South axis
direction_.x() = cos(beta_)*sin(theta_); // West axis
direction_.normalise();
@ -166,7 +166,7 @@ void Foam::solarCalculator::init()
}
else
{
calculateBetaTetha();
calculateBetaTheta();
calculateSunDirection();
}
@ -187,7 +187,7 @@ void Foam::solarCalculator::init()
sunTrackingUpdateInterval_
);
calculateBetaTetha();
calculateBetaTheta();
calculateSunDirection();
break;
}
@ -214,7 +214,7 @@ void Foam::solarCalculator::init()
if (!dict_.readIfPresent("beta", beta_))
{
calculateBetaTetha();
calculateBetaTheta();
}
directSolarRad_ =
@ -254,7 +254,7 @@ Foam::solarCalculator::solarCalculator
A_(0.0),
B_(0.0),
beta_(0.0),
tetha_(0.0),
theta_(0.0),
skyCloudCoverFraction_(0.0),
Setrn_(0.0),
SunPrime_(0.0),
@ -270,12 +270,6 @@ Foam::solarCalculator::solarCalculator
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::solarCalculator::~solarCalculator()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::solarCalculator::correctSunDirection()
@ -288,7 +282,7 @@ void Foam::solarCalculator::correctSunDirection()
}
case mSunDirTracking:
{
calculateBetaTetha();
calculateBetaTheta();
calculateSunDirection();
directSolarRad_ = A_/exp(B_/sin(max(beta_, ROOTVSMALL)));
break;

View File

@ -131,6 +131,7 @@ protected:
//- Sun load models
static const Enum<sunLModel> sunLoadModelTypeNames_;
private:
// Private data
@ -158,7 +159,7 @@ private:
scalar A_;
scalar B_;
scalar beta_;
scalar tetha_;
scalar theta_;
//- Sky cloud cover fraction [0-1]
scalar skyCloudCoverFraction_;
@ -206,8 +207,8 @@ private:
//- Init
void init();
//- Calculate beta and tetha angles
void calculateBetaTetha();
//- Calculate beta and theta angles
void calculateBetaTheta();
//- Calculate Sun direction
void calculateSunDirection();
@ -226,15 +227,15 @@ public:
//- Destructor
~solarCalculator();
~solarCalculator() = default;
// Member Functions
// Access
//- const acess to direction
const vector direction() const
//- const access to direction
const vector& direction() const
{
return direction_;
}
@ -246,13 +247,19 @@ public:
}
//- Return direct solar irradiation
scalar directSolarRad()
scalar& directSolarRad()
{
return directSolarRad_;
}
//- Return const access to direct solar irradiation
const scalar& directSolarRad() const
{
return directSolarRad_;
}
//- Return diffuse solar irradiation
scalar diffuseSolarRad()
scalar& diffuseSolarRad()
{
return diffuseSolarRad_;
}
@ -269,10 +276,10 @@ public:
return beta_;
}
//- Return tetha
scalar tetha()
//- Return theta
scalar theta()
{
return tetha_;
return theta_;
}
//- Return Sun direction model

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "multiBandSolidTransmissivity.H"
#include "constantAbsorption.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -32,12 +32,12 @@ namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(multiBandSolidTransmissivity, 0);
defineTypeNameAndDebug(constantAbsorption, 0);
addToRunTimeSelectionTable
(
transmissivityModel,
multiBandSolidTransmissivity,
wallAbsorptionEmissionModel,
constantAbsorption,
dictionary
);
}
@ -46,51 +46,65 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::multiBandSolidTransmissivity::multiBandSolidTransmissivity
Foam::radiation::constantAbsorption::constantAbsorption
(
const dictionary& dict,
const fvMesh& mesh
const polyPatch& pp
)
:
transmissivityModel(dict, mesh),
coeffsDict_(dict.subDict(typeName + "Coeffs")),
tauCoeffs_(),
nBands_(0)
{
coeffsDict_.readEntry("transmissivity", tauCoeffs_);
nBands_ = tauCoeffs_.size();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::multiBandSolidTransmissivity::~multiBandSolidTransmissivity()
wallAbsorptionEmissionModel(dict, pp),
coeffsDict_(dict),
a_(coeffsDict_.get<scalar>("absorptivity")),
e_(coeffsDict_.get<scalar>("emissivity"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::radiation::multiBandSolidTransmissivity::tauEff(const label bandI) const
Foam::tmp<Foam::scalarField> Foam::radiation::constantAbsorption::a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const
{
tmp<volScalarField> tt
(
new volScalarField
(
IOobject
(
"t",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("t", dimless/dimLength, tauCoeffs_[bandI])
)
);
return tt;
return tmp<scalarField>(new scalarField(pp_.size(), a_));
}
Foam::scalar Foam::radiation::constantAbsorption::a
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const
{
return a_;
}
Foam::tmp<Foam::scalarField> Foam::radiation::constantAbsorption::e
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const
{
return tmp<scalarField>(new scalarField(pp_.size(), e_));
}
Foam::scalar Foam::radiation::constantAbsorption::e
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const
{
return e_;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,23 +22,23 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::radiation::noTransmissivity
Foam::radiation::constantAbsorption
Group
grpRadiationTransmissivitySubModels
Description
Dummy transmissivity model for 'none'
Constant radiation transmissivity coefficient
SourceFiles
noTransmissivity.C
constantAbsorption.C
\*---------------------------------------------------------------------------*/
#ifndef radiation_noTransmissivity_H
#define radiation_noTransmissivity_H
#ifndef radiation_constantAbsorption_H
#define radiation_constantAbsorption_H
#include "transmissivityModel.H"
#include "wallAbsorptionEmissionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,34 +48,77 @@ namespace radiation
{
/*---------------------------------------------------------------------------*\
Class noTransmissivity Declaration
Class constantAbsorption Declaration
\*---------------------------------------------------------------------------*/
class noTransmissivity
class constantAbsorption
:
public transmissivityModel
public wallAbsorptionEmissionModel
{
// Private data
//- Coefficients dictionary
dictionary coeffsDict_;
//- Absorptivity coefficient
scalar a_;
//- Emissivity coefficient
scalar e_;
public:
//- Runtime type information
TypeName("none");
TypeName("constantAbsorption");
// Constructors
//- Construct from components
noTransmissivity(const dictionary& dict, const fvMesh& mesh);
constantAbsorption(const dictionary& dict, const polyPatch& pp);
//- Destructor
virtual ~noTransmissivity();
virtual ~constantAbsorption() = default;
// Member Functions
//- Return scatter coefficient
tmp<volScalarField> tauEff(const label bandI = 0) const;
//- absorptivity coefficient
tmp<scalarField> a
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Return absorptivity on face
scalar a
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const;
//- Return emission coefficient
tmp<scalarField> e
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Return emission coefficient
scalar e
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const;
//- Is Grey
inline bool isGrey() const
@ -83,7 +126,6 @@ public:
return true;
}
//- Number of bands
inline label nBands() const
{

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "multiBandAbsorption.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(multiBandAbsorption, 0);
addToRunTimeSelectionTable
(
wallAbsorptionEmissionModel,
multiBandAbsorption,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::multiBandAbsorption::multiBandAbsorption
(
const dictionary& dict,
const polyPatch& pp
)
:
wallAbsorptionEmissionModel(dict, pp),
coeffsDict_(dict),
aCoeffs_(),
eCoeffs_(),
nBands_(0)
{
coeffsDict_.readEntry("absorptivity", aCoeffs_);
coeffsDict_.readEntry("emissivity", eCoeffs_);
nBands_ = aCoeffs_.size();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::multiBandAbsorption::~multiBandAbsorption()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::radiation::multiBandAbsorption::a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const
{
return tmp<scalarField>(new scalarField(pp_.size(), aCoeffs_[bandI]));
}
Foam::scalar Foam::radiation::multiBandAbsorption::a
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const
{
return aCoeffs_[bandI];
}
Foam::tmp<Foam::scalarField> Foam::radiation::multiBandAbsorption::e
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const
{
return tmp<scalarField>(new scalarField(pp_.size(), eCoeffs_[bandI]));
}
Foam::scalar Foam::radiation::multiBandAbsorption::e
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const
{
return eCoeffs_[bandI];
}
// ************************************************************************* //

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::radiation::multiBandAbsorption
Group
wallAbsorptionEmissionModel
Description
multiBandAbsorption radiation transmissivity for solids.
Usage
\verbatim
wallAbsorptionEmissionModel
{
type multiBandAbsorption;
absorptivity (0.3 0.7);
emissivity (0.3 0.7);
};
\endverbatim
SourceFiles
multiBandAbsorption.C
\*---------------------------------------------------------------------------*/
#ifndef multiBandAbsorption_H
#define multiBandAbsorption_H
#include "wallAbsorptionEmissionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class multiBandAbsorption Declaration
\*---------------------------------------------------------------------------*/
class multiBandAbsorption
:
public wallAbsorptionEmissionModel
{
public:
// Public data
//- Maximum number of bands
static const label maxBands_ = 5;
private:
// Private data
//- Absorption model dictionary
dictionary coeffsDict_;
//- Absorption coefficients
scalarList aCoeffs_;
//- Emission coefficients
scalarList eCoeffs_;
//- Bands
label nBands_;
public:
//- Runtime type information
TypeName("multiBandAbsorption");
// Constructors
//- Construct from components
multiBandAbsorption
(
const dictionary& dict,
const polyPatch& pp
);
//- Destructor
virtual ~multiBandAbsorption();
// Member Functions
// Access
//- absorptivity coefficient
tmp<scalarField> a
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Return absorptivity on face
scalar a
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const;
//- Return emission coefficient
tmp<scalarField> e
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Return emission coefficient
scalar e
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const;
//- Is Grey
inline bool isGrey() const
{
return false;
}
//- Number of bands
inline label nBands() const
{
return nBands_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace radiation
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,215 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "solidAbsorption.H"
#include "addToRunTimeSelectionTable.H"
#include "mappedPatchBase.H"
#include "radiationModel.H"
#include "absorptionEmissionModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(solidAbsorption, 0);
addToRunTimeSelectionTable
(
wallAbsorptionEmissionModel,
solidAbsorption,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Private members * * * * * * * * * * * * * //
const Foam::fvMesh& Foam::radiation::solidAbsorption::nbrRegion() const
{
const mappedPatchBase& mpp = refCast<const mappedPatchBase>(pp_);
return (refCast<const fvMesh>(mpp.sampleMesh()));
}
Foam::label Foam::radiation::solidAbsorption::nbrPatchIndex() const
{
const mappedPatchBase& mpp = refCast<const mappedPatchBase>(pp_);
return (mpp.samplePolyPatch().index());
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::solidAbsorption::solidAbsorption
(
const dictionary& dict,
const polyPatch& pp
)
:
wallAbsorptionEmissionModel(dict, pp)
{
if (!isA<mappedPatchBase>(pp))
{
FatalErrorInFunction
<< "\n patch type '" << pp.type()
<< "' not type '" << mappedPatchBase::typeName << "'"
<< "\n for patch " << pp.name()
<< abort(FatalIOError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::solidAbsorption::~solidAbsorption()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::radiation::solidAbsorption::a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const
{
// Since we're inside initEvaluate/evaluate there might be processor
// comms underway. Change the tag we use.
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
const fvMesh& nbrMesh = nbrRegion();
const radiation::radiationModel& radiation =
nbrMesh.lookupObject<radiation::radiationModel>
(
"radiationProperties"
);
scalarField absorptivity
(
radiation.absorptionEmission().a
(
bandI
)().boundaryField()
[
nbrPatchIndex()
]
);
const mappedPatchBase& mpp = refCast<const mappedPatchBase>(pp_);
mpp.distribute(absorptivity);
// Restore tag
UPstream::msgType() = oldTag;
return tmp<scalarField>::New(std::move(absorptivity));
}
Foam::scalar Foam::radiation::solidAbsorption::a
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const
{
return a(bandI, nullptr, nullptr)()[faceI];
}
Foam::tmp<Foam::scalarField> Foam::radiation::solidAbsorption::e
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const
{
// Since we're inside initEvaluate/evaluate there might be processor
// comms underway. Change the tag we use.
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
const fvMesh& nbrMesh = nbrRegion();
const radiation::radiationModel& radiation =
nbrMesh.lookupObject<radiation::radiationModel>
(
"radiationProperties"
);
scalarField emissivity
(
radiation.absorptionEmission().e
(
bandI
)().boundaryField()
[
nbrPatchIndex()
]
);
const mappedPatchBase& mpp = refCast<const mappedPatchBase>(pp_);
mpp.distribute(emissivity);
// Restore tag
UPstream::msgType() = oldTag;
return tmp<scalarField>::New(std::move(emissivity));
}
Foam::scalar Foam::radiation::solidAbsorption::e
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const
{
return e(bandI, nullptr, nullptr)()[faceI];
}
Foam::label Foam::radiation::solidAbsorption::nBands() const
{
const fvMesh& nbrMesh = nbrRegion();
const radiation::radiationModel& radiation =
nbrMesh.lookupObject<radiation::radiationModel>
(
"radiationProperties"
);
return (radiation.absorptionEmission().nBands());
}
// ************************************************************************* //

View File

@ -0,0 +1,151 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::radiation::solidAbsorption
Description
Radiation absorptivity-emissivity model to be used on walls on
inter-regions patches when the solid opaque radiation model is used
in the solid and the wall emissivity and absorptivity are taken from
the solid radiation properties
Usage
\verbatim
wallAbsorptionEmissionModel
{
type solidAbsorption;
};
SourceFiles
solidAbsorption.C
\*---------------------------------------------------------------------------*/
#ifndef radiation_solidAbsorption_H
#define radiation_solidAbsorption_H
#include "wallAbsorptionEmissionModel.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class solidAbsorption Declaration
\*---------------------------------------------------------------------------*/
class solidAbsorption
:
public wallAbsorptionEmissionModel
{
// Private members
//- Nbr region
const fvMesh& nbrRegion() const;
//- Nbr index patch
label nbrPatchIndex() const;
public:
//- Runtime type information
TypeName("solidAbsorption");
// Constructors
//- Construct from components
solidAbsorption(const dictionary& dict, const polyPatch& pp);
//- Destructor
virtual ~solidAbsorption();
// Member Functions
//- absorptivity coefficient
tmp<scalarField> a
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Return absorptivity on face
scalar a
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const;
//- Return emission coefficient
tmp<scalarField> e
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Return emission coefficient
scalar e
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const;
//- Is Grey
inline bool isGrey() const
{
return true;
}
//- Number of bands
inline label nBands() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace radiation
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "transmissivityModel.H"
#include "wallAbsorptionEmissionModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -32,27 +32,27 @@ namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(transmissivityModel, 0);
defineRunTimeSelectionTable(transmissivityModel, dictionary);
defineTypeNameAndDebug(wallAbsorptionEmissionModel, 0);
defineRunTimeSelectionTable(wallAbsorptionEmissionModel, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::transmissivityModel::transmissivityModel
Foam::radiation::wallAbsorptionEmissionModel::wallAbsorptionEmissionModel
(
const dictionary&,
const fvMesh& mesh
const polyPatch& pp
)
:
mesh_(mesh)
pp_(pp)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::radiation::transmissivityModel::~transmissivityModel()
Foam::radiation::wallAbsorptionEmissionModel::~wallAbsorptionEmissionModel()
{}

View File

@ -0,0 +1,160 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::radiation::wallAbsorptionEmissionModel
Description
Based class for wall absorption emission models
\*---------------------------------------------------------------------------*/
#ifndef wallAbsorptionEmissionModel_H
#define wallAbsorptionEmissionModel_H
#include "dictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "polyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class wallAbsorptionEmissionModel Declaration
\*---------------------------------------------------------------------------*/
class wallAbsorptionEmissionModel
{
protected:
// Protected data
//- Reference to the polyPatch
const polyPatch& pp_;
public:
//- Runtime type information
TypeName("wallAbsorptionEmissionModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
wallAbsorptionEmissionModel,
dictionary,
(
const dictionary& dict,
const polyPatch& pp
),
(dict, pp)
);
// Constructors
//- Construct from components
wallAbsorptionEmissionModel
(
const dictionary& dict, const polyPatch& pp
);
// Selector
static autoPtr<wallAbsorptionEmissionModel> New
(
const dictionary& dict,
const polyPatch& pp
);
//- Destructor
virtual ~wallAbsorptionEmissionModel();
// Member Functions
//- Return emissivity on patch
virtual tmp<scalarField> e
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const = 0;
//- Return emissivity on face
virtual scalar e
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const = 0;
//- Return absorptivity on patch
virtual tmp<scalarField> a
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const = 0;
//- Return absorptivity on face
virtual scalar a
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const = 0;
//- Is Grey
virtual bool isGrey() const = 0;
//- Number of bands
virtual label nBands() const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace radiation
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "wallAbsorptionEmissionModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::radiation::wallAbsorptionEmissionModel> Foam::radiation::
wallAbsorptionEmissionModel::New
(
const dictionary& dict,
const polyPatch& pp
)
{
const word modelType(dict.get<word>("type"));
auto cstrIter = dictionaryConstructorTablePtr_->find(modelType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown wallAbsorptionEmissionModel type "
<< modelType << nl << nl
<< "Valid wallAbsorptionEmissionModel types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<wallAbsorptionEmissionModel>(cstrIter()(dict, pp));
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,7 @@ namespace Foam
addToRunTimeSelectionTable
(
transmissivityModel,
wallTransmissivityModel,
constantTransmissivity,
dictionary
);
@ -49,45 +49,38 @@ namespace Foam
Foam::radiation::constantTransmissivity::constantTransmissivity
(
const dictionary& dict,
const fvMesh& mesh
const polyPatch& pp
)
:
transmissivityModel(dict, mesh),
coeffsDict_(dict.subDict(typeName + "Coeffs")),
wallTransmissivityModel(dict, pp),
coeffsDict_(dict),
tau_(coeffsDict_.get<scalar>("transmissivity"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::constantTransmissivity::~constantTransmissivity()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::radiation::constantTransmissivity::tauEff(const label bandI) const
Foam::tmp<Foam::scalarField>
Foam::radiation::constantTransmissivity::t
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const
{
tmp<volScalarField> tt
(
new volScalarField
(
IOobject
(
"tau",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("tau", dimless/dimLength, tau_)
)
);
return tmp<scalarField>::New(pp_.size(), tau_);
}
return tt;
Foam::scalar Foam::radiation::constantTransmissivity::t
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const
{
return tau_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,7 +38,7 @@ SourceFiles
#ifndef radiation_constantTransmissivity_H
#define radiation_constantTransmissivity_H
#include "transmissivityModel.H"
#include "wallTransmissivityModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,7 +53,7 @@ namespace radiation
class constantTransmissivity
:
public transmissivityModel
public wallTransmissivityModel
{
// Private data
@ -61,7 +61,7 @@ class constantTransmissivity
//- Coefficients dictionary
dictionary coeffsDict_;
//- Transmissivity coefficient / []
//- Transmissivity coefficient
scalar tau_;
@ -74,18 +74,31 @@ public:
// Constructors
//- Construct from components
constantTransmissivity(const dictionary& dict, const fvMesh& mesh);
constantTransmissivity(const dictionary& dict, const polyPatch& pp);
//- Destructor
virtual ~constantTransmissivity();
virtual ~constantTransmissivity() = default;
// Member Functions
//- Return scatter coefficient
tmp<volScalarField> tauEff(const label bandI = 0) const;
//- Return transmissivity coefficient
tmp<scalarField> t
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Return transmissivity on facw
scalar t
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const;
//- Is Grey
inline bool isGrey() const
@ -93,7 +106,6 @@ public:
return true;
}
//- Number of bands
inline label nBands() const
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "noTransmissivity.H"
#include "multiBandTransmissivity.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -32,11 +32,12 @@ namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(noTransmissivity, 0);
defineTypeNameAndDebug(multiBandTransmissivity, 0);
addToRunTimeSelectionTable
(
transmissivityModel,
noTransmissivity,
wallTransmissivityModel,
multiBandTransmissivity,
dictionary
);
}
@ -45,46 +46,45 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::noTransmissivity::noTransmissivity
Foam::radiation::multiBandTransmissivity::multiBandTransmissivity
(
const dictionary& dict,
const fvMesh& mesh
const polyPatch& pp
)
:
transmissivityModel(dict, mesh)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::noTransmissivity::~noTransmissivity()
{}
wallTransmissivityModel(dict, pp),
coeffsDict_(dict),
tauCoeffs_(),
nBands_(0)
{
coeffsDict_.readEntry("transmissivity", tauCoeffs_);
nBands_ = tauCoeffs_.size();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::radiation::noTransmissivity::tauEff
Foam::tmp<Foam::scalarField>
Foam::radiation::multiBandTransmissivity::t
(
const label bandI
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const
{
return tmp<volScalarField>
return tmp<scalarField>::New(pp_.size(), tauCoeffs_[bandI]);
}
Foam::scalar Foam::radiation::multiBandTransmissivity::t
(
new volScalarField
(
IOobject
(
"tau",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar(dimless, Zero)
)
);
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const
{
return tauCoeffs_[bandI];
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,23 +22,34 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::radiation::multiBandSolidTransmissivity
Foam::radiation::multiBandTransmissivity
Group
grpRadiationTransmissivitySubModels
grpwallTransmissivityModel
Description
multiBandSolidTransmissivity radiation transmissivity for solids.
multiBandTransmissivity radiation transmissivity for solids.
Usage
\verbatim
wallTransmissivityModel
{
type multiBandTransmissivity;
transmissivity (0.3 0.7);
};
\endverbatim
SourceFiles
multiBandSolidTransmissivity.C
multiBandTransmissivity.C
\*---------------------------------------------------------------------------*/
#ifndef multiBandSolidTransmissivity_H
#define multiBandSolidTransmissivity_H
#ifndef multiBandTransmissivity_H
#define multiBandTransmissivity_H
#include "transmissivityModel.H"
#include "wallTransmissivityModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,12 +59,12 @@ namespace radiation
{
/*---------------------------------------------------------------------------*\
Class multiBandSolidTransmissivity Declaration
Class multiBandTransmissivity Declaration
\*---------------------------------------------------------------------------*/
class multiBandSolidTransmissivity
class multiBandTransmissivity
:
public transmissivityModel
public wallTransmissivityModel
{
public:
@ -80,30 +91,43 @@ private:
public:
//- Runtime type information
TypeName("multiBandSolidTransmissivity");
TypeName("multiBandTransmissivity");
// Constructors
//- Construct from components
multiBandSolidTransmissivity
multiBandTransmissivity
(
const dictionary& dict,
const fvMesh& mesh
const polyPatch& p
);
//- Destructor
virtual ~multiBandSolidTransmissivity();
virtual ~multiBandTransmissivity() = default;
// Member Functions
// Access
//- Transmissivity coefficient
tmp<volScalarField> tauEff(const label bandI) const;
//- Return transmissivity
tmp<scalarField> t
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Return transmissivity on face
scalar t
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const;
//- Is Grey
inline bool isGrey() const
@ -111,13 +135,11 @@ public:
return false;
}
//- Number of bands
inline label nBands() const
{
return nBands_;
}
};

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "wallTransmissivityModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(wallTransmissivityModel, 0);
defineRunTimeSelectionTable(wallTransmissivityModel, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::wallTransmissivityModel::wallTransmissivityModel
(
const dictionary&,
const polyPatch& pp
)
:
pp_(pp)
{}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,20 +22,20 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::radiation::transmissivityModel
Foam::radiation::wallTransmissivityModel
Description
Base class for radiation scattering
Base class for wall transmissivity models
\*---------------------------------------------------------------------------*/
#ifndef transmissivityModel_H
#define transmissivityModel_H
#ifndef wallTransmissivityModel_H
#define wallTransmissivityModel_H
#include "IOdictionary.H"
#include "dictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "volFields.H"
#include "polyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,69 +45,83 @@ namespace radiation
{
/*---------------------------------------------------------------------------*\
Class transmissivityModel Declaration
Class wallTransmissivityModel Declaration
\*---------------------------------------------------------------------------*/
class transmissivityModel
class wallTransmissivityModel
{
protected:
// Protected data
//- Reference to the fvMesh
const fvMesh& mesh_;
//- Reference to the polyPatch
const polyPatch& pp_;
public:
//- Runtime type information
TypeName("transmissivityModel");
TypeName("wallTransmissivityModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
transmissivityModel,
wallTransmissivityModel,
dictionary,
(
const dictionary& dict,
const fvMesh& mesh
const polyPatch& pp
),
(dict, mesh)
(dict, pp)
);
// Constructors
//- Construct from components
transmissivityModel(const dictionary& dict, const fvMesh& mesh);
wallTransmissivityModel(const dictionary& dict, const polyPatch& pp);
// Selector
static autoPtr<transmissivityModel> New
static autoPtr<wallTransmissivityModel> New
(
const dictionary& dict,
const fvMesh& mesh
const polyPatch& pp
);
//- Destructor
virtual ~transmissivityModel();
virtual ~wallTransmissivityModel() = default;
// Member Functions
//- Return scatter coefficient
virtual tmp<volScalarField> tauEff(const label bandI = 0) const = 0;
//- Return transmissivity
virtual tmp<scalarField> t
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const = 0;
//- Return transmissivity on face
virtual scalar t
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const = 0;
//- Is Grey
virtual bool isGrey() const = 0;
//- Number of bands
virtual label nBands() const = 0;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,34 +24,32 @@ License
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "transmissivityModel.H"
#include "wallTransmissivityModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::radiation::transmissivityModel> Foam::radiation::
transmissivityModel::New
Foam::autoPtr<Foam::radiation::wallTransmissivityModel> Foam::radiation::
wallTransmissivityModel::New
(
const dictionary& dict,
const fvMesh& mesh
const polyPatch& pp
)
{
const word modelType(dict.get<word>("transmissivityModel"));
Info<< "Selecting transmissivityModel " << modelType << endl;
const word modelType(dict.get<word>("wallTransmissivityModel"));
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown transmissivityModel type "
<< "Unknown wallTransmissivityModel type "
<< modelType << nl << nl
<< "Valid transmissivityModel types :" << nl
<< "Valid wallTransmissivityModel types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<transmissivityModel>(cstrIter()(dict, mesh));
return autoPtr<wallTransmissivityModel>(cstrIter()(dict, pp));
}

View File

@ -0,0 +1,55 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
down
{
type symmetryPlane;
}
right
{
type zeroGradient;
}
up
{
type symmetryPlane;
}
left
{
type uniformFixedValue;
uniformValue constant (1 0 0);
}
cylinder
{
type symmetry;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,55 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
down
{
type symmetryPlane;
}
right
{
type fixedValue;
value uniform 0;
}
up
{
type symmetryPlane;
}
left
{
type zeroGradient;
}
cylinder
{
type symmetry;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //

View File

@ -17,16 +17,16 @@ FoamFile
".*"
{
mode lookup;
type lookup;
emissivity 0.8;
absorptivity 0.0;
absorptivity 0.8;
}
inlet
{
mode lookup;
type lookup;
emissivity 0.9;
absorptivity 0.0;
absorptivity 0.9;
}

View File

@ -22,8 +22,6 @@ radiationModel opaqueSolid;
absorptionEmissionModel none;
transmissivityModel none;
scatterModel none;
sootModel none;

View File

@ -187,6 +187,4 @@ scatterModel none;
sootModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -18,12 +18,16 @@ FoamFile
region0_to_pyrolysisRegion_coupledWall
{
mode solidRadiation;
type opaqueDiffusive;
wallAbsorptionEmissionModel
{
type solidAbsorption;
}
}
".*"
{
mode lookup;
type lookup;
emissivity 1.0;
absorptivity 1.0;
transmissivity 0.0;

View File

@ -37,6 +37,5 @@ greyMeanSolidAbsorptionEmissionCoeffs
scatterModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -52,7 +52,5 @@ scatterModel none;
sootModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -18,15 +18,17 @@ FoamFile
".*"
{
type boundaryRadiation;
mode lookup;
type lookup;
emissivity 1.0;
}
"(region0_to.*)"
{
type boundaryRadiation;
mode solidRadiation;
type opaqueDiffusive;
wallAbsorptionEmissionModel
{
type solidAbsorption;
}
}

View File

@ -39,6 +39,4 @@ greyMeanSolidAbsorptionEmissionCoeffs
scatterModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -189,6 +189,4 @@ scatterModel none;
sootModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -17,7 +17,7 @@ FoamFile
".*"
{
mode lookup;
type lookup;
emissivity 1.0;
}

View File

@ -30,6 +30,5 @@ greyMeanSolidAbsorptionEmissionCoeffs
}
scatterModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -30,6 +30,5 @@ P1Coeffs
scatterModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -17,25 +17,25 @@ FoamFile
base
{
mode lookup;
type lookup;
emissivity 1.0;
}
outlet
{
mode lookup;
type lookup;
emissivity 1.0;
}
sides
{
mode lookup;
type lookup;
emissivity 1.0;
}
inlet
{
mode lookup;
type lookup;
emissivity 1.0;
}

View File

@ -194,7 +194,5 @@ mixtureFractionSootCoeffs
Wsoot 12;
}
transmissivityModel none;
// ************************************************************************* //

View File

@ -17,9 +17,8 @@ FoamFile
".*"
{
mode lookup;
type lookup;
emissivity 1.0;
absorptivity 0.0;
}

View File

@ -188,7 +188,5 @@ scatterModel none;
sootModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -17,7 +17,7 @@ FoamFile
".*"
{
mode lookup;
type lookup;
emissivity 1.0;
absorptivity 1.0;
}

View File

@ -43,6 +43,4 @@ scatterModel none;
sootModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -17,7 +17,7 @@ FoamFile
".*"
{
mode lookup;
type lookup;
emissivity 1.0;
absorptivity 1.0;
}

View File

@ -35,6 +35,4 @@ scatterModel none;
sootModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -17,7 +17,7 @@ FoamFile
".*"
{
mode lookup;
type lookup;
emissivity 1.0;
absorptivity 1.0;
}

View File

@ -21,10 +21,10 @@ radiationModel fvDOM;
fvDOMCoeffs
{
nPhi 3; // azimuthal angles in PI/2 on X-Y.(from Y to X)
nTheta 5; // polar angles in PI (from Z to X-Y plane)
maxIter 10; // maximum number of iterations
tolerance 1e-3; // convergence criteria for radiation iteration
nPhi 3;
nTheta 5;
tolerance 1e-3;
maxIter 10;
}
// Number of flow iterations per radiation iteration
@ -43,6 +43,5 @@ scatterModel none;
sootModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 300;
boundaryField
{
"(solarpanel.*|ref_wall|ZMin)"
{
type zeroGradient;
value $internalField;
}
"(YMax|YMin|XMax|XMin|ZMax)"
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0.1 0 0);
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(solarpanel.*|ref_wall|YMax|YMin|XMax|XMin|ZMin)"
{
type fixedValue;
value $internalField;
}
ZMax
{
type pressureInletOutletVelocity;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 101325;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
".*"
{
type calculated;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 101325;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(solarpanel.*|ref_wall|YMax|YMin|XMax|XMin|ZMin)"
{
type fixedFluxPressure;
value $internalField;
}
ZMax
{
type prghTotalPressure;
p0 $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
cleanCase0
rm -rf constant/extendedFeatureEdgeMesh
#------------------------------------------------------------------------------

View File

@ -0,0 +1,15 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
runApplication blockMesh
restore0Dir
runApplication surfaceFeatureExtract
runApplication snappyHexMesh -overwrite
runApplication $(getApplication)
#------------------------------------------------------------------------------

View File

@ -0,0 +1,75 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object boundaryRadiationProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
".*"
{
type transparent;
wallAbsorptionEmissionModel
{
type multiBandAbsorption;
emissivity (1 1);
absorptivity (0 0);
};
}
body_bottom
{
type opaqueDiffusive;
wallAbsorptionEmissionModel
{
type multiBandAbsorption;
absorptivity (0.3 0.7);
emissivity (0.3 0.7);
};
}
"(solarpanel.*)"
{
type opaqueDiffusive;
wallAbsorptionEmissionModel
{
type multiBandAbsorption;
absorptivity (0.3 0.7);
emissivity (0.3 0.7);
};
}
ref_wall
{
type opaqueReflective;
// Fraction of the reflected is diffussive
fd 0.0; // 0: all specular 1: all diffusive
wallAbsorptionEmissionModel
{
type multiBandAbsorption;
absorptivity (0.03 0.07);
emissivity (0.03 0.07);
};
}
ZMin
{
type opaqueDiffusive;
wallAbsorptionEmissionModel
{
type multiBandAbsorption;
absorptivity (0.3 0.7);
emissivity (0.3 0.7);
};
}

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 0 -9.81);

View File

@ -0,0 +1,97 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object radiationProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
radiation on;
radiationModel solarLoad;
solarLoadCoeffs
{
sunDirectionModel sunDirConstant;
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)
// Grid orientation
gridUp (0 0 1);
gridEast (0 1 0);
// Energy spectrum
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
solidCoupled false; // Couple through Qr the solid regions (default true)
wallCoupled true; // Couple through Qr wall patches (default false)
// Reflecting rays
useReflectedRays true;
reflecting
{
nPhi 10;
nTheta 10;
}
absorptionEmissionModel none;
scatterModel none;
sootModel none;
}
// Number of flow iterations per radiation iteration
solverFreq 1;
absorptionEmissionModel none;
scatterModel none;
sootModel none;
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType
{
type heRhoThermo;
mixture pureMixture;
transport const;
thermo hConst;
equationOfState perfectGas;
specie specie;
energy sensibleEnthalpy;
}
mixture
{
specie
{
molWeight 28.966;
}
thermodynamics
{
Cp 1006.43;
Hf 0;
}
transport
{
mu 1.846e-05;
Pr 0.706414;
}
}

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,105 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
X_MIN_TUNNEL -1.84;
Y_MIN_TUNNEL -2.1;
Z_MIN_TUNNEL -3.0616171e-17;
X_MAX_TUNNEL 1.085;
Y_MAX_TUNNEL 2.4;
Z_MAX_TUNNEL 3.25;
NCELLS_X 11;
NCELLS_Y 17;
NCELLS_Z 12;
vertices
(
( $X_MIN_TUNNEL $Y_MIN_TUNNEL $Z_MIN_TUNNEL ) //Node 0
( $X_MAX_TUNNEL $Y_MIN_TUNNEL $Z_MIN_TUNNEL ) //Node 1
( $X_MAX_TUNNEL $Y_MAX_TUNNEL $Z_MIN_TUNNEL ) //Node 2
( $X_MIN_TUNNEL $Y_MAX_TUNNEL $Z_MIN_TUNNEL ) //Node 3
( $X_MIN_TUNNEL $Y_MIN_TUNNEL $Z_MAX_TUNNEL ) //Node 4
( $X_MAX_TUNNEL $Y_MIN_TUNNEL $Z_MAX_TUNNEL ) //Node 5
( $X_MAX_TUNNEL $Y_MAX_TUNNEL $Z_MAX_TUNNEL ) //Node 6
( $X_MIN_TUNNEL $Y_MAX_TUNNEL $Z_MAX_TUNNEL ) //Node 7
);
blocks
(
hex (0 1 2 3 4 5 6 7) ( $NCELLS_X $NCELLS_Y $NCELLS_Z)
simpleGrading (1 1 1)
);
edges
(
);
boundary
(
XMin
{
type patch;
faces
(
(0 4 7 3)
);
}
XMax
{
type patch;
faces
(
(1 2 6 5)
);
}
YMin
{
type patch;
faces
(
(0 1 5 4)
);
}
YMax
{
type patch;
faces
(
(3 7 6 2)
);
}
ZMin
{
type wall;
faces
(
(0 3 2 1)
);
}
ZMax
{
type patch;
faces
(
(4 5 6 7)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,45 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1806 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application buoyantSimpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 50;
deltaT 1;
writeControl timeStep;
writeInterval 5;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //

Some files were not shown because too many files have changed in this diff Show More