Adding reflecting fluxes to Solar load radiation model.
Adding functionality to the boundary radiation models and new
place holder for basic wall types such as transparent, opaqueDiffusive,
opaqueReflective,etc.
Changing radiation wall models to run time selectable.
Adding multi-band capabilities to VF model and improving the set up
for using solar loads in VF and fvDOM radiation models.
This commit is contained in:
sergio
2018-12-03 13:51:40 -08:00
committed by Andrew Heather
parent 36112db110
commit 9893e62386
93 changed files with 5062 additions and 1228 deletions

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

@ -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

@ -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,536 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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<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();
forAll(pp, 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]);
}
// relfective opaque patches to build reflective surface
if (r[faceI] > 0 && t[faceI] == 0)
{
includePatches_.insert(patchI);
}
}
}
}
shootFacesIds_.reset(new labelList(dynFacesI));
Cfs_.reset(new pointField(dynCf));
// * * * * * * * * * * * * * * *
// 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 label myFaceId = shootFacesIds_()[i];
forAll (refDisDirsIndex, dirIndex)
{
if (refDisDirsIndex[dirIndex] > -1)
{
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();
List<scalarField> r(nBands);
labelList refDirIndex(triangleIndex.size());
for (label bandI = 0; bandI < nBands; bandI++)
{
r[bandI].setSize(triangleIndex.size());
}
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)
);
}
}
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)();
}
for (label bandI = 0; bandI < nBands; bandI++)
{
r[bandI][i] = patchr[patchI][bandI][localFaceI];
}
}
map.reverseDistribute(hitInfo.size(), refDirIndex);
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])
{
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();
qrefBf[startPatchI][localStartFaceI] +=
(qPrim*r[bandI][rayI]*spectralDistribution_[bandI]*a)
& 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_(),
solarCalc_(solar),
includePatches_(),
mapTriToGlobal_()
{
initialise(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faceReflecting::~faceReflecting()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::faceReflecting::correct()
{
calculate();
}
// ************************************************************************* //

View File

@ -0,0 +1,166 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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_;
//- 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();
// 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

@ -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

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,36 @@ namespace Foam
}
}
const Foam::word Foam::radiation::solarLoad::viewFactorWalls = "viewFactorWall";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::radiation::solarLoad::updateReflectedRays()
{
if (reflectedFaces_.empty() && !hitFaces_.empty())
{
reflectedFaces_.reset
(
new faceReflecting
(
mesh_,
hitFaces_(),
solarCalc_,
spectralDistribution_,
dict_
)
);
}
reflectedFaces_->correct();
volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
for (label bandI = 0; bandI < nBands_; bandI++)
{
qrBf += reflectedFaces_->qreflective(bandI).boundaryField();
}
}
bool Foam::radiation::solarLoad::updateHitFaces()
{
if (hitFaces_.empty())
@ -122,38 +151,50 @@ void Foam::radiation::solarLoad::updateDirectHitRadiation
const scalarField& V = mesh_.V();
volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
forAll(hitFacesId, i)
// Reset qr and qrPrimary
qrBf = 0.0;
for (label bandI = 0; bandI < nBands_; bandI++)
{
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();
volScalarField::Boundary& qprimaryBf =
qprimaryRad_[bandI].boundaryFieldRef();
if (includeMappedPatchBasePatches[patchID])
qprimaryBf = 0.0;
forAll(hitFacesId, i)
{
const vectorField n = pp.faceNormals();
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 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];
* spectralDistribution_[bandI]
* absorptivity_[patchID][bandI]()[localFaceI];
}
}
else
{
const vectorField& sf = mesh_.Sf().boundaryField()[patchID];
const label cellI = pp.faceCells()[localFaceI];
for (label bandI = 0; bandI < nBands_; bandI++)
if (includeMappedPatchBasePatches[patchID])
{
Ru_[cellI] +=
(qPrim & sf[localFaceI])
* spectralDistribution_[bandI]
* absorptivity_[patchID][bandI]()[localFaceI]
/ V[cellI];
qrBf[patchID][localFaceI] += qprimaryBf[patchID][localFaceI];
}
else
{
const vectorField& sf = mesh_.Sf().boundaryField()[patchID];
const label cellI = pp.faceCells()[localFaceI];
{
Ru_[cellI] +=
(qPrim & sf[localFaceI])
* spectralDistribution_[bandI]
* absorptivity_[patchID][bandI]()[localFaceI]
/ V[cellI];
}
}
}
}
@ -296,6 +337,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 +354,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 +385,7 @@ void Foam::radiation::solarLoad::initialise(const dictionary& coeffs)
coeffs.readIfPresent("updateAbsorptivity", updateAbsorptivity_);
}
/*
void Foam::radiation::solarLoad::calculateQdiff
(
const labelHashSet& includePatches,
@ -393,12 +437,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 +466,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 +510,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 +537,7 @@ void Foam::radiation::solarLoad::calculateQdiff
cpp.size(),
startI
) = coarseNSf;
startI += cpp.size();
}
@ -487,14 +545,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 +573,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 +591,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 +606,22 @@ void Foam::radiation::solarLoad::calculateQdiff
{
label compactI = compactFaces[j];
localqDiffusive[locaFaceI] +=
compactCoarsePartialArea[compactI]
* aAve
* (solarCalc_.directSolarRad()*solarCalc_.direction())
& compactCoarseNorm[compactI]
* vf[j]
* compactCoarseRave[compactI];
scalar qin =
(
solarCalc_.directSolarRad()*solarCalc_.direction()
& compactCoarseNorm[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 +681,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 +702,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 +717,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 +740,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 +754,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,34 +771,20 @@ 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()
@ -938,13 +843,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 +860,10 @@ void Foam::radiation::solarLoad::calculate()
includeMappedPatchBasePatches
);
// Add indirect diffusive radiation
if (useVFbeamToDiffuse_)
// Add specular reflected radiation
if (useReflectedRays_)
{
calculateQdiff(includePatches, includeMappedPatchBasePatches);
updateReflectedRays();
}
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
@ -35,25 +35,20 @@ Description
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_;
@ -173,8 +147,11 @@ private:
//- Update direct hit faces radiation
void updateDirectHitRadiation(const labelList&, const labelHashSet&);
//- Update reflected heat flux
void updateReflectedRays();
//- Calculate diffusive heat flux
void calculateQdiff(const labelHashSet&, const labelHashSet&);
//void calculateQdiff(const labelHashSet&, const labelHashSet&);
//- Update Sky diffusive radiation
void updateSkyDiffusiveRadiation
@ -210,15 +187,6 @@ 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();
@ -245,6 +213,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);
}
@ -268,7 +265,8 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T)
iterCounter_(0),
pivotIndices_(0),
useSolarLoad_(false),
solarLoad_()
solarLoad_(),
nBands_(coeffs_.lookupOrDefault<label>("nBands", 1))
{
initialise();
}
@ -328,7 +326,8 @@ Foam::radiation::viewFactor::viewFactor
iterCounter_(0),
pivotIndices_(0),
useSolarLoad_(false),
solarLoad_()
solarLoad_(),
nBands_(coeffs_.lookupOrDefault<label>("nBands", 1))
{
initialise();
}
@ -386,135 +385,154 @@ void Foam::radiation::viewFactor::calculate()
solarLoad_->calculate();
}
<<<<<<< HEAD
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();
>>>>>>> ENH:
globalIndex globalNumbering(nLocalCoarseFaces_);
// 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)
for (label bandI = 0; bandI < nBands_; bandI++)
{
label patchID = selectedPatches_[i];
scalarField compactCoarseT4(map_->constructSize(), 0.0);
scalarField compactCoarseE(map_->constructSize(), 0.0);
scalarField compactCoarseHo(map_->constructSize(), 0.0);
const scalarField& Tp = T_.boundaryField()[patchID];
const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
// Fill local averaged(T), emissivity(E) and external heatFlux(Ho)
DynamicList<scalar> localCoarseT4ave(nLocalCoarseFaces_);
DynamicList<scalar> localCoarseEave(nLocalCoarseFaces_);
DynamicList<scalar> localCoarseHoave(nLocalCoarseFaces_);
fvPatchScalarField& qrPatch = qrBf[patchID];
forAll(selectedPatches_, i)
{
label patchID = selectedPatches_[i];
greyDiffusiveViewFactorFixedValueFvPatchScalarField& qrp =
refCast
<
greyDiffusiveViewFactorFixedValueFvPatchScalarField
>(qrPatch);
const scalarField& Tp = T_.boundaryField()[patchID];
const scalarField& sf = mesh_.magSf().boundaryField()[patchID];
const tmp<scalarField> teb = boundaryRadiation.emissivity(patchID);
const scalarField& eb = teb();
fvPatchScalarField& qrPatch = qrBf[patchID];
const tmp<scalarField> tHoi = qrp.qro();
const scalarField& Hoi = tHoi();
greyDiffusiveViewFactorFixedValueFvPatchScalarField& qrp =
refCast
<
greyDiffusiveViewFactorFixedValueFvPatchScalarField
>(qrPatch);
const polyPatch& pp = coarseMesh_.boundaryMesh()[patchID];
const labelList& coarsePatchFace = coarseMesh_.patchFaceMap()[patchID];
const tmp<scalarField> teb =
boundaryRadiation.emissivity(patchID, bandI);
<<<<<<< HEAD
scalarList T4ave(pp.size(), Zero);
scalarList Eave(pp.size(), Zero);
scalarList Hoiave(pp.size(), Zero);
=======
const scalarField& eb = teb();
>>>>>>> ENH:
if (pp.size() > 0)
{
const labelList& agglom = finalAgglom_[patchID];
label nAgglom = max(agglom) + 1;
const tmp<scalarField> tHoi = qrp.qro(bandI);
const scalarField& Hoi = tHoi();
labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
const polyPatch& pp = coarseMesh_.boundaryMesh()[patchID];
forAll(coarseToFine, coarseI)
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)
{
const label coarseFaceID = coarsePatchFace[coarseI];
const labelList& fineFaces = coarseToFine[coarseFaceID];
UIndirectList<scalar> fineSf
(
sf,
fineFaces
);
const labelList& agglom = finalAgglom_[patchID];
label nAgglom = max(agglom) + 1;
const scalar area = sum(fineSf());
labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
// Temperature, emissivity and external flux area weighting
forAll(fineFaces, j)
forAll(coarseToFine, coarseI)
{
label facei = fineFaces[j];
T4ave[coarseI] += (pow4(Tp[facei])*sf[facei])/area;
Eave[coarseI] += (eb[facei]*sf[facei])/area;
Hoiave[coarseI] += (Hoi[facei]*sf[facei])/area;
const label coarseFaceID = coarsePatchFace[coarseI];
const labelList& fineFaces = coarseToFine[coarseFaceID];
UIndirectList<scalar> fineSf
(
sf,
fineFaces
);
const scalar area = sum(fineSf());
// Temperature, emissivity and external flux area weighting
forAll(fineFaces, j)
{
label facei = fineFaces[j];
T4ave[coarseI] += (pow4(Tp[facei])*sf[facei])/area;
Eave[coarseI] += (eb[facei]*sf[facei])/area;
Hoiave[coarseI] += (Hoi[facei]*sf[facei])/area;
}
}
}
localCoarseT4ave.append(T4ave);
localCoarseEave.append(Eave);
localCoarseHoave.append(Hoiave);
}
localCoarseT4ave.append(T4ave);
localCoarseEave.append(Eave);
localCoarseHoave.append(Hoiave);
}
// Fill the local values to distribute
SubList<scalar>(compactCoarseT4, nLocalCoarseFaces_) = localCoarseT4ave;
SubList<scalar>(compactCoarseE, nLocalCoarseFaces_) = localCoarseEave;
SubList<scalar>(compactCoarseHo, nLocalCoarseFaces_) = localCoarseHoave;
// Distribute data
map_->distribute(compactCoarseT4);
map_->distribute(compactCoarseE);
map_->distribute(compactCoarseHo);
// Distribute local global ID
labelList compactGlobalIds(map_->constructSize(), Zero);
SubList<label>
(
compactGlobalIds,
nLocalCoarseFaces_
) = identity(globalNumbering.localSize(), globalNumbering.localStart());
map_->distribute(compactGlobalIds);
// Fill the local values to distribute
SubList<scalar>(compactCoarseT4, nLocalCoarseFaces_) =
localCoarseT4ave;
SubList<scalar>(compactCoarseE, nLocalCoarseFaces_) = localCoarseEave;
SubList<scalar>(compactCoarseHo, nLocalCoarseFaces_) =
localCoarseHoave;
<<<<<<< HEAD
// Create global size vectors
scalarField T4(totalNCoarseFaces_, Zero);
scalarField E(totalNCoarseFaces_, Zero);
scalarField qrExt(totalNCoarseFaces_, Zero);
=======
// Distribute data
map_->distribute(compactCoarseT4);
map_->distribute(compactCoarseE);
map_->distribute(compactCoarseHo);
>>>>>>> ENH:
// Fill lists from compact to global indexes.
forAll(compactCoarseT4, i)
{
T4[compactGlobalIds[i]] = compactCoarseT4[i];
E[compactGlobalIds[i]] = compactCoarseE[i];
qrExt[compactGlobalIds[i]] = compactCoarseHo[i];
}
// Distribute local global ID
labelList compactGlobalIds(map_->constructSize(), Zero);
Pstream::listCombineGather(T4, maxEqOp<scalar>());
Pstream::listCombineGather(E, maxEqOp<scalar>());
Pstream::listCombineGather(qrExt, maxEqOp<scalar>());
SubList<label>
(
compactGlobalIds,
nLocalCoarseFaces_
) = identity
(
globalNumbering.localSize(),
globalNumbering.localStart()
);
Pstream::listCombineScatter(T4);
Pstream::listCombineScatter(E);
Pstream::listCombineScatter(qrExt);
map_->distribute(compactGlobalIds);
<<<<<<< HEAD
// Net radiation
scalarField q(totalNCoarseFaces_, Zero);
=======
// Create global size vectors
scalarField T4(totalNCoarseFaces_, 0.0);
scalarField E(totalNCoarseFaces_, 0.0);
scalarField qrExt(totalNCoarseFaces_, 0.0);
>>>>>>> ENH:
if (Pstream::master())
{
// Variable emissivity
if (!constEmissivity_)
// Fill lists from compact to global indexes.
forAll(compactCoarseT4, i)
{
<<<<<<< HEAD
scalarSquareMatrix C(totalNCoarseFaces_, Zero);
for (label i=0; i<totalNCoarseFaces_; i++)
@ -534,74 +552,118 @@ void Foam::radiation::viewFactor::calculate()
C(i, j) = (1.0 - invEj)*Fmatrix_()(i, j);
q[i] += Fmatrix_()(i, j)*sigmaT4;
}
}
}
Info<< "\nSolving view factor equations..." << endl;
// Negative coming into the fluid
LUsolve(C, q);
=======
T4[compactGlobalIds[i]] = compactCoarseT4[i];
E[compactGlobalIds[i]] = compactCoarseE[i];
qrExt[compactGlobalIds[i]] = compactCoarseHo[i];
}
else //Constant emissivity
>>>>>>> ENH:
Pstream::listCombineGather(T4, maxEqOp<scalar>());
Pstream::listCombineGather(E, maxEqOp<scalar>());
Pstream::listCombineGather(qrExt, maxEqOp<scalar>());
Pstream::listCombineScatter(T4);
Pstream::listCombineScatter(E);
Pstream::listCombineScatter(qrExt);
if (Pstream::master())
{
// Initial iter calculates CLU and caches it
if (iterCounter_ == 0)
// Variable emissivity
if (!constEmissivity_)
{
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];
if (i==j)
{
CLU_()(i, j) = invEj-(invEj-1.0)*Fmatrix_()(i, j);
C(i, j) = invEj - (invEj - 1.0)*Fmatrix_()(i, j);
q[i] +=
(Fmatrix_()(i, j) - 1.0)*sigmaT4 + qrExt[j];
}
else
{
CLU_()(i, j) = (1.0 - invEj)*Fmatrix_()(i, j);
C(i, j) = (1.0 - invEj)*Fmatrix_()(i, j);
q[i] += Fmatrix_()(i, j)*sigmaT4;
}
}
}
Info<< "Solving view factor equations for band :"
<< bandI << endl;
// Negative coming into the fluid
LUsolve(C, q);
}
else //Constant emissivity
{
// Initial iter calculates CLU and caches it
if (iterCounter_ == 0)
{
for (label i=0; i<totalNCoarseFaces_; i++)
{
for (label j=0; j<totalNCoarseFaces_; j++)
{
const scalar invEj = 1.0/E[j];
if (i==j)
{
CLU_()(i, j) =
invEj-(invEj-1.0)*Fmatrix_()(i, j);
}
else
{
CLU_()(i, j) = (1.0 - invEj)*Fmatrix_()(i, j);
}
}
}
if (debug)
{
InfoInFunction
<< "\nDecomposing C matrix..." << endl;
}
LUDecompose(CLU_(), pivotIndices_);
}
for (label i=0; i<totalNCoarseFaces_; i++)
{
for (label j=0; j<totalNCoarseFaces_; j++)
{
const scalar sigmaT4 =
constant::physicoChemical::sigma.value()*T4[j];
if (i==j)
{
q[i] +=
(Fmatrix_()(i, j) - 1.0)*sigmaT4 + qrExt[j];
}
else
{
q[i] += Fmatrix_()(i, j)*sigmaT4;
}
}
}
if (debug)
{
InfoInFunction
<< "\nDecomposing C matrix..." << endl;
}
LUDecompose(CLU_(), pivotIndices_);
Info<< "Solving view factor equations for band : "
<< bandI << endl;
LUBacksubstitute(CLU_(), pivotIndices_, q);
iterCounter_ ++;
}
for (label i=0; i<totalNCoarseFaces_; i++)
{
for (label j=0; j<totalNCoarseFaces_; j++)
{
const scalar sigmaT4 =
constant::physicoChemical::sigma.value()*T4[j];
if (i==j)
{
q[i] += (Fmatrix_()(i, j) - 1.0)*sigmaT4 - qrExt[j];
}
else
{
q[i] += Fmatrix_()(i, j)*sigmaT4;
}
}
}
if (debug)
{
InfoInFunction
<< "\nLU Back substitute C matrix.." << endl;
}
LUBacksubstitute(CLU_(), pivotIndices_, q);
iterCounter_ ++;
}
}
}
// Scatter q and fill qr
Pstream::listCombineScatter(q);
Pstream::listCombineGather(q, maxEqOp<scalar>());
@ -627,7 +689,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
@ -126,6 +126,9 @@ protected:
//- Solar load radiation model
autoPtr<solarLoad> solarLoad_;
//-Number of bands
label nBands_;
// Private Member Functions
@ -189,6 +192,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
@ -30,5 +30,14 @@ inline const Foam::volScalarField& Foam::radiation::viewFactor::qr() const
return qr_;
}
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,9 +85,20 @@ 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 +110,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 +135,53 @@ Foam::radiation::boundaryRadiationProperties::emissivity
}
Foam::tmp<Foam::scalarField>
Foam::radiation::boundaryRadiationProperties::absorptivity
Foam::scalar Foam::radiation::boundaryRadiationProperties::faceEmissivity
(
const label patchi,
const label bandi
const label faceI,
const label bandi,
vector incomingDirection,
scalar T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->absorptivity(bandi);
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,
vectorField* incomingDirection,
scalarField* T
) const
{
if (!radBoundaryPropertiesPtrList_[patchi].empty())
{
return radBoundaryPropertiesPtrList_[patchi]->a
(
bandi,
incomingDirection,
T
);
}
FatalErrorInFunction
@ -129,16 +194,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 +253,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,6 +312,93 @@ Foam::radiation::boundaryRadiationProperties::reflectivity
}
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
);
}
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;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::boundaryRadiationProperties::~boundaryRadiationProperties()

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,7 +86,19 @@ 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;
@ -94,7 +106,20 @@ public:
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;
@ -102,14 +127,61 @@ public:
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;

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,18 +29,48 @@ 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.lookup("type"));
Info<< "Selecting boundary radiation Model: "
<< modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown modelType type "
<< modelType << endl << endl
<< "Valid radiation types are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return cstrIter()(dict, pp);
}
// * * * * * * * * * * * * * * * * Private functions * * * * * * * * * * * * //
@ -70,56 +100,15 @@ 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;
}
}
transmissivity_(nullptr)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
@ -130,303 +119,17 @@ Foam::radiation::boundaryRadiationPropertiesPatch::
// * * * * * * * * * * * * * * * 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
{
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:
{
}
}
}
// ************************************************************************* //

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,8 +74,35 @@ private:
const fvMesh& nbrRegion() const;
protected:
//- 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
@ -110,8 +110,16 @@ public:
//- 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
@ -120,30 +128,114 @@ public:
// 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;
//- Calculate corresponding transmissivity field for bandI
tmp<scalarField> transmissivity(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;
//- 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;
//- 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;
//- Calculate corresponding reflectivity field
tmp<scalarField> reflectivity(const label bandI = 0) const;
//- Write
void write(Ostream&) const;

View File

@ -0,0 +1,208 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::radiation::lookup::~lookup()
{}
// * * * * * * * * * * * * * * * 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 scalarField(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 scalarField(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,209 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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();
// Member Functions
//- Return emissivity
tmp<scalarField> e
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return emissivity on face
scalar e
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return absorptivity on patch
tmp<scalarField> a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return absorptivity on face
scalar a
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return transmissivity on patch
tmp<scalarField> t
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return transmissivity on face
scalar t
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return specular reflectivity on patch
tmp<scalarField> rSpec
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return specular reflectivity on face
scalar rSpec
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return diffusive reflectivity on patch
tmp<scalarField> rDiff
(
const label bandI,
vectorField* incomingDirection ,
scalarField* T
) const;
//- Return diffusive reflectivity on face
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,203 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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()
);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::radiation::opaqueDiffusive::~opaqueDiffusive()
{}
// * * * * * * * * * * * * * * * 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 scalarField(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 scalarField(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 scalarField(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,206 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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();
// Member Functions
//- Return emissivity
tmp<scalarField> e
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return emissivity on face
scalar e
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return absorptivity on patch
tmp<scalarField> a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return absorptivity on face
scalar a
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return transmissivity on patch
tmp<scalarField> t
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return transmissivity on face
scalar t
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return specular reflectivity on patch
tmp<scalarField> rSpec
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return specular reflectivity on face
scalar rSpec
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return diffusive reflectivity on patch
tmp<scalarField> rDiff
(
const label bandI,
vectorField* incomingDirection ,
scalarField* T
) const;
//- Return diffusive reflectivity on face
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,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/>.
\*---------------------------------------------------------------------------*/
#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()
);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::radiation::opaqueReflective::~opaqueReflective()
{}
// * * * * * * * * * * * * * * * 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 scalarField(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,217 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 diffussive reflected fraction. 0 all the incoming flux is
specularly reflected and 1 all is diffussive 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();
// Member Functions
//- Return emissivity
tmp<scalarField> e
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return emissivity on face
scalar e
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return absorptivity on patch
tmp<scalarField> a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return absorptivity on face
scalar a
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return transmissivity on patch
tmp<scalarField> t
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return transmissivity on face
scalar t
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return specular reflectivity on patch
tmp<scalarField> rSpec
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return specular reflectivity on face
scalar rSpec
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return diffusive reflectivity on patch
tmp<scalarField> rDiff
(
const label bandI,
vectorField* incomingDirection ,
scalarField* T
) const;
//- Return diffusive reflectivity on face
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,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 "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()
);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::radiation::transparent::~transparent()
{}
// * * * * * * * * * * * * * * * 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 scalarField(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 scalarField(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 scalarField(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,206 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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();
// Member Functions
//- Return emissivity
tmp<scalarField> e
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return emissivity on face
scalar e
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return absorptivity on patch
tmp<scalarField> a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return absorptivity on face
scalar a
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return transmissivity on patch
tmp<scalarField> t
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return transmissivity on face
scalar t
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return specular reflectivity on patch
tmp<scalarField> rSpec
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const;
//- Return specular reflectivity on face
scalar rSpec
(
const label faceI,
const label bandI,
const vector dir,
const scalar T
) const;
//- Return diffusive reflectivity on patch
tmp<scalarField> rDiff
(
const label bandI,
vectorField* incomingDirection ,
scalarField* T
) const;
//- Return diffusive reflectivity on face
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

@ -234,7 +234,7 @@ public:
// Access
//- const acess to direction
const vector direction() const
const vector& direction() const
{
return direction_;
}
@ -245,14 +245,20 @@ public:
return direction_;
}
//- Return direct solar irradiation
scalar directSolarRad()
//- Return direct solar irradiation
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_;
}

View File

@ -0,0 +1,115 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "constantAbsorption.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(constantAbsorption, 0);
addToRunTimeSelectionTable
(
wallAbsorptionEmissionModel,
constantAbsorption,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::constantAbsorption::constantAbsorption
(
const dictionary& dict,
const polyPatch& pp
)
:
wallAbsorptionEmissionModel(dict, pp),
coeffsDict_(dict),
a_(coeffsDict_.get<scalar>("absorptivity")),
e_(coeffsDict_.get<scalar>("emissivity"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::constantAbsorption::~constantAbsorption()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::radiation::constantAbsorption::a
(
const label bandI,
vectorField* incomingDirection,
scalarField* T
) const
{
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,36 +48,80 @@ 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();
// 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;
//- Is Grey
//- 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;

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

@ -23,8 +23,8 @@ License
\*---------------------------------------------------------------------------*/
#include "noTransmissivity.H"
#include "addToRunTimeSelectionTable.H"
#include "error.H"
#include "wallAbsorptionEmissionModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -32,60 +32,28 @@ namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(noTransmissivity, 0);
addToRunTimeSelectionTable
(
transmissivityModel,
noTransmissivity,
dictionary
);
defineTypeNameAndDebug(wallAbsorptionEmissionModel, 0);
defineRunTimeSelectionTable(wallAbsorptionEmissionModel, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::noTransmissivity::noTransmissivity
Foam::radiation::wallAbsorptionEmissionModel::wallAbsorptionEmissionModel
(
const dictionary& dict,
const fvMesh& mesh
const dictionary&,
const polyPatch& pp
)
:
transmissivityModel(dict, mesh)
pp_(pp)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::radiation::noTransmissivity::~noTransmissivity()
Foam::radiation::wallAbsorptionEmissionModel::~wallAbsorptionEmissionModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::radiation::noTransmissivity::tauEff
(
const label bandI
) const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"tau",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar(dimless, Zero)
)
);
}
// ************************************************************************* //

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

@ -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 "wallAbsorptionEmissionModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::radiation::transmissivityModel> Foam::radiation::
transmissivityModel::New
Foam::autoPtr<Foam::radiation::wallAbsorptionEmissionModel> Foam::radiation::
wallAbsorptionEmissionModel::New
(
const dictionary& dict,
const fvMesh& mesh
const polyPatch& pp
)
{
const word modelType(dict.get<word>("transmissivityModel"));
const word modelType(dict.get<word>("type"));
Info<< "Selecting transmissivityModel " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto cstrIter = dictionaryConstructorTablePtr_->find(modelType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown transmissivityModel type "
<< "Unknown wallAbsorptionEmissionModel type "
<< modelType << nl << nl
<< "Valid transmissivityModel types :" << nl
<< "Valid wallAbsorptionEmissionModel types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<transmissivityModel>(cstrIter()(dict, mesh));
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,11 +49,11 @@ 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"))
{}
@ -66,29 +66,27 @@ 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 tt;
return tmp<scalarField>(new scalarField(pp_.size(), tau_));
}
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,7 +74,7 @@ public:
// Constructors
//- Construct from components
constantTransmissivity(const dictionary& dict, const fvMesh& mesh);
constantTransmissivity(const dictionary& dict, const polyPatch& pp);
//- Destructor
@ -83,8 +83,23 @@ public:
// 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 tranmissivity on facw
scalar t
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const;
//- Is Grey

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 "multiBandTransmissivity.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -32,12 +32,12 @@ namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(multiBandSolidTransmissivity, 0);
defineTypeNameAndDebug(multiBandTransmissivity, 0);
addToRunTimeSelectionTable
(
transmissivityModel,
multiBandSolidTransmissivity,
wallTransmissivityModel,
multiBandTransmissivity,
dictionary
);
}
@ -46,14 +46,14 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::multiBandSolidTransmissivity::multiBandSolidTransmissivity
Foam::radiation::multiBandTransmissivity::multiBandTransmissivity
(
const dictionary& dict,
const fvMesh& mesh
const polyPatch& pp
)
:
transmissivityModel(dict, mesh),
coeffsDict_(dict.subDict(typeName + "Coeffs")),
wallTransmissivityModel(dict, pp),
coeffsDict_(dict),
tauCoeffs_(),
nBands_(0)
{
@ -64,33 +64,35 @@ Foam::radiation::multiBandSolidTransmissivity::multiBandSolidTransmissivity
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::multiBandSolidTransmissivity::~multiBandSolidTransmissivity()
Foam::radiation::multiBandTransmissivity::~multiBandTransmissivity()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::radiation::multiBandSolidTransmissivity::tauEff(const label bandI) const
Foam::tmp<Foam::scalarField>
Foam::radiation::multiBandTransmissivity::t
(
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(), tauCoeffs_[bandI]));
}
Foam::scalar Foam::radiation::multiBandTransmissivity::t
(
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,29 +91,44 @@ 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();
// Member Functions
// Access
//- Transmissivity coefficient
tmp<volScalarField> tauEff(const label bandI) const;
//- Return tranmissivity
tmp<scalarField> t
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const;
//- Return tranmissivity on face
scalar t
(
const label faceI,
const label bandI = 0,
const vector dir = Zero,
const scalar T = 0
) const;
//- Is Grey
@ -111,7 +137,6 @@ public:
return false;
}
//- Number of bands
inline label nBands() const
{

View File

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

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,62 +45,78 @@ 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();
// Member Functions
//- Return scatter coefficient
virtual tmp<volScalarField> tauEff(const label bandI = 0) const = 0;
//- Return tranmissivity
virtual tmp<scalarField> t
(
const label bandI = 0,
vectorField* incomingDirection = nullptr,
scalarField* T = nullptr
) const = 0;
//- Return tranmissivity 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;

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 "wallTransmissivityModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::radiation::wallTransmissivityModel> Foam::radiation::
wallTransmissivityModel::New
(
const dictionary& dict,
const polyPatch& pp
)
{
const word modelType(dict.get<word>("wallTransmissivityModel"));
auto cstrIter = dictionaryConstructorTablePtr_->find(modelType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown wallTransmissivityModel type "
<< modelType << nl << nl
<< "Valid wallTransmissivityModel types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
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

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

View File

@ -54,8 +54,7 @@ boundaryField
air_to_floor
{
type compressible::turbulentTemperatureRadCoupledMixed;
value uniform 300;
inletValue uniform 300;
value uniform 350;
Tnbr T;
kappaMethod fluidThermo;
qrNbr none;
@ -65,8 +64,7 @@ boundaryField
air_to_solid
{
type compressible::turbulentTemperatureRadCoupledMixed;
value uniform 300;
inletValue uniform 300;
value uniform 350;
Tnbr T;
kappaMethod fluidThermo;
qrNbr none;

View File

@ -48,12 +48,14 @@ boundaryField
}
air_to_floor
{
type calculated;
type greyDiffusiveRadiationViewFactor;
qro uniform 0;
value uniform 0;
}
air_to_solid
{
type calculated;
type greyDiffusiveRadiationViewFactor;
qro uniform 0;
value uniform 0;
}
}

View File

@ -17,7 +17,7 @@ FoamFile
dimensions [ 0 0 0 1 0 0 0 ];
internalField uniform 300;
internalField uniform 350;
boundaryField
{
@ -29,7 +29,7 @@ boundaryField
solid_to_air
{
type compressible::turbulentTemperatureRadCoupledMixed;
value uniform 300;
value uniform 350;
Tnbr T;
kappaMethod solidThermo;
qrNbr qr;

View File

@ -15,4 +15,6 @@ rm -f constant/air/globalFaceFaces
rm -f constant/air/mapDist
rm -f constant/air/visibleFaceFaces
rm -rf constant/triSurface
#------------------------------------------------------------------------------

View File

@ -17,20 +17,41 @@ FoamFile
".*"
{
mode lookup;
emissivity 1.0;
absorptivity 0.0;
transmissivity 1.0;
type transparent;
wallAbsorptionEmissionModel
{
type multiBandAbsorption;
emissivity (1 1);
absorptivity (0 0);
}
}
air_to_solid
{
mode solidRadiation;
type opaqueReflective;
// Fraction of the reflected is diffussive
fd 0.0; // 0: all specular 1: all diffusive
wallAbsorptionEmissionModel
{
type solidAbsorption;
//multiBandAbsorption;
//absorptivity (0.1 0.1);
//emissivity (0.1 0.1);
};
}
air_to_floor
{
mode solidRadiation;
type opaqueDiffusive;
wallAbsorptionEmissionModel
{
type multiBandAbsorption;
absorptivity (0.3 0.7);
emissivity (0.3 0.7);
};
}
// ************************************************************************* //

View File

@ -17,21 +17,19 @@ FoamFile
radiation on;
radiationModel solarLoad;
radiationModel viewFactor;//solarLoad;
solarLoadCoeffs
{
// Calculate reflected/secondary heat fluxes
useVFbeamToDiffuse true;
// Sun direction ray model. Give the sunDirection or calculated using the
// (solar calculator)
sunDirectionModel sunDirTracking;//sunDirConstant;
sunDirectionModel sunDirTracking; //sunDirConstant
// Time interval to update Sun position (sec)
sunTrackingUpdateInterval 800;
//sunDirection (-1 1 -1);
//sunDirection (1 0 -1);
localStandardMeridian 9; // GMT offset (hours)
startDay 204; // day of the year
@ -39,12 +37,13 @@ solarLoadCoeffs
longitude 139.74; // longitude (degrees)
latitude 35.658; // latitude (degrees)
// Grid orientation
gridUp (0 0 1);
gridEast (1 0 0);
// Energy spectrum
spectralDistribution (1 1);
spectralDistribution (2 1);
// Solar model:
@ -52,14 +51,14 @@ solarLoadCoeffs
sunLoadModel sunLoadFairWeatherConditions;
// Sun load constant model
directSolarRad 500; // [w/m2]
diffuseSolarRad 40; // [w/m2]
//directSolarRad 500; // [w/m2]
//diffuseSolarRad 40; // [w/m2]
// Fair Weather Conditions Model Constants.
// Calculate beta from the Solar calculator or input
A 300; // Apparent solar irradiation at air mass m = 0
A 500; // Apparent solar irradiation at air mass m = 0
B 0.142; // Atmospheric extinction coefficient
//beta 45; // Solar altitude (in degrees) above the horizontal
//beta 45; // Solar altitude (in degrees) above the horizontal
// Theoretical maximum model constants
Setrn 10;
@ -74,6 +73,19 @@ solarLoadCoeffs
// Radiative flux coupling flags
solidCoupled true; //Couple through qr the solid regions (default true)
wallCoupled false; //Couple through qr wall patches (default false)
// Reflecting rays
useReflectedRays true;
reflecting
{
nPhi 10;
nTheta 10;
}
absorptionEmissionModel none;
scatterModel none;
sootModel none;
}
@ -82,6 +94,10 @@ viewFactorCoeffs
smoothing true; //Smooth view factor matrix (use when in a close surface
//to force Sum(Fij = 1)
constantEmissivity true; //constant emissivity on surfaces.
nBands 2;
useSolarLoad true;
}
// Number of flow iterations per radiation iteration
@ -93,6 +109,4 @@ scatterModel none;
sootModel none;
transmissivityModel none;
// ************************************************************************* //

View File

@ -24,15 +24,8 @@ absorptionEmissionModel multiBandSolidAbsorptionEmission;
multiBandSolidAbsorptionEmissionCoeffs
{
absorptivity (0.7 0.7);
emissivity (0.7 0.7);
}
transmissivityModel multiBandSolidTransmissivity;
multiBandSolidTransmissivityCoeffs
{
transmissivity (0 0);
absorptivity (0.3 0.7);
emissivity (0.3 0.7);
}
scatterModel none;

View File

@ -24,15 +24,8 @@ absorptionEmissionModel multiBandSolidAbsorptionEmission;
multiBandSolidAbsorptionEmissionCoeffs
{
absorptivity (0.7 0.7);
emissivity (0.7 0.7);
}
transmissivityModel multiBandSolidTransmissivity;
multiBandSolidTransmissivityCoeffs
{
transmissivity (0 0);
absorptivity (0.1 0.1);
emissivity (0.1 0.1);
}
scatterModel none;

View File

@ -18,15 +18,18 @@ FoamFile
".*"
{
mode lookup;
type lookup;
emissivity 1.0;
absorptivity 1.0;
}
"bottomAir_to_.*"
{
type boundaryRadiation;
mode solidRadiation;
type opaqueDiffusive;
wallAbsorptionEmissionModel
{
type solidAbsorption;
}
}

View File

@ -42,7 +42,4 @@ scatterModel none;
sootModel none;
transmissivityModel none;
// ************************************************************************* //

View File

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

View File

@ -17,13 +17,17 @@ FoamFile
".*"
{
mode lookup;
type lookup;
emissivity 1.0;
}
"topAir_to_.*"
{
mode solidRadiation;
type opaqueDiffusive;
wallAbsorptionEmissionModel
{
type solidAbsorption;
}
}
// ************************************************************************* //