Go to the documentation of this file.
59 selectedPatches_ = mesh_.boundaryMesh().
indices(viewFactorWalls);
61 for (
const label patchi : selectedPatches_)
63 nLocalCoarseFaces_ += coarsePatches[patchi].size();
68 Pout<<
"radiation::viewFactor::initialise() Selected patches:"
69 << selectedPatches_ <<
endl;
70 Pout<<
"radiation::viewFactor::initialise() Number of coarse faces:"
71 << nLocalCoarseFaces_ <<
endl;
74 totalNCoarseFaces_ = nLocalCoarseFaces_;
78 <<
"Total number of clusters : " << totalNCoarseFaces_ <<
endl;
87 mesh_.facesInstance(),
101 mesh_.facesInstance(),
114 mesh_.facesInstance(),
140 <<
"Insert elements in the matrix..." <<
endl;
148 globalFaceFacesProc[procI],
155 if (coeffs_.get<
bool>(
"smoothing"))
159 for (label i=0; i<totalNCoarseFaces_; i++)
162 for (label j=0; j<totalNCoarseFaces_; j++)
164 sumF += Fmatrix_()(i, j);
167 const scalar
delta = sumF - 1.0;
168 for (label j=0; j<totalNCoarseFaces_; j++)
170 Fmatrix_()(i, j) *= (1.0 -
delta/(sumF + 0.001));
175 coeffs_.readEntry(
"constantEmissivity", constEmissivity_);
176 if (constEmissivity_)
183 pivotIndices_.setSize(CLU_().m());
187 coeffs_.readIfPresent(
"useSolarLoad", useSolarLoad_);
191 const dictionary& solarDict = this->subDict(
"solarLoadCoeffs");
192 solarLoad_.reset(
new solarLoad(solarDict, T_));
194 if (solarLoad_->nBands() != nBands_)
197 <<
"Solar radiation and view factor band numbers "
202 Info<<
"Creating Solar Load Model " <<
nl;
217 mesh_.facesInstance(),
229 "coarse:" + mesh_.
name(),
253 selectedPatches_(mesh_.
boundary().size(), -1),
254 totalNCoarseFaces_(0),
255 nLocalCoarseFaces_(0),
256 constEmissivity_(false),
259 useSolarLoad_(false),
261 nBands_(coeffs_.getOrDefault<label>(
"nBands", 1))
267 Foam::radiation::viewFactor::viewFactor
279 mesh_.facesInstance(),
291 "coarse:" + mesh_.name(),
292 mesh_.polyMesh::instance(),
306 mesh_.time().timeName(),
315 selectedPatches_(mesh_.boundary().size(), -1),
316 totalNCoarseFaces_(0),
317 nLocalCoarseFaces_(0),
318 constEmissivity_(
false),
321 useSolarLoad_(
false),
323 nBands_(coeffs_.getOrDefault<label>(
"nBands", 1))
351 forAll(viewFactors, faceI)
354 const labelList& globalFaces = globalFaceFaces[faceI];
356 label globalI = globalNumbering.
toGlobal(procI, faceI);
359 Fmatrix[globalI][globalFaces[i]] = vf[i];
372 solarLoad_->calculate();
377 volScalarField::Boundary& qrBf = qr_.boundaryFieldRef();
384 for (label bandI = 0; bandI < nBands_; bandI++)
386 scalarField compactCoarseT4(map_->constructSize(), 0.0);
387 scalarField compactCoarseE(map_->constructSize(), 0.0);
388 scalarField compactCoarseHo(map_->constructSize(), 0.0);
395 forAll(selectedPatches_, i)
397 label
patchID = selectedPatches_[i];
421 coarseMesh_.patchFaceMap()[
patchID];
430 label nAgglom =
max(agglom) + 1;
434 forAll(coarseToFine, coarseI)
436 const label coarseFaceID = coarsePatchFace[coarseI];
437 const labelList& fineFaces = coarseToFine[coarseFaceID];
444 const scalar
area =
sum(fineSf());
449 label facei = fineFaces[j];
450 T4ave[coarseI] += (
pow4(Tp[facei])*sf[facei])/
area;
451 Eave[coarseI] += (eb[facei]*sf[facei])/
area;
452 Hoiave[coarseI] += (Hoi[facei]*sf[facei])/
area;
457 localCoarseT4ave.
append(T4ave);
458 localCoarseEave.
append(Eave);
459 localCoarseHoave.
append(Hoiave);
471 map_->distribute(compactCoarseT4);
472 map_->distribute(compactCoarseE);
473 map_->distribute(compactCoarseHo);
488 map_->distribute(compactGlobalIds);
496 forAll(compactCoarseT4, i)
498 T4[compactGlobalIds[i]] = compactCoarseT4[i];
499 E[compactGlobalIds[i]] = compactCoarseE[i];
500 qrExt[compactGlobalIds[i]] = compactCoarseHo[i];
514 if (!constEmissivity_)
518 for (label i=0; i<totalNCoarseFaces_; i++)
520 for (label j=0; j<totalNCoarseFaces_; j++)
522 const scalar invEj = 1.0/E[j];
523 const scalar sigmaT4 =
528 C(i, j) = invEj - (invEj - 1.0)*Fmatrix_()(i, j);
530 (Fmatrix_()(i, j) - 1.0)*sigmaT4 + qrExt[j];
534 C(i, j) = (1.0 - invEj)*Fmatrix_()(i, j);
535 q[i] += Fmatrix_()(i, j)*sigmaT4;
541 Info<<
"Solving view factor equations for band :"
550 if (iterCounter_ == 0)
552 for (label i=0; i<totalNCoarseFaces_; i++)
554 for (label j=0; j<totalNCoarseFaces_; j++)
556 const scalar invEj = 1.0/E[j];
560 invEj-(invEj-1.0)*Fmatrix_()(i, j);
564 CLU_()(i, j) = (1.0 - invEj)*Fmatrix_()(i, j);
574 for (label i=0; i<totalNCoarseFaces_; i++)
576 for (label j=0; j<totalNCoarseFaces_; j++)
578 const scalar sigmaT4 =
584 (Fmatrix_()(i, j) - 1.0)*sigmaT4 + qrExt[j];
588 q[i] += Fmatrix_()(i, j)*sigmaT4;
594 Info<<
"Solving view factor equations for band : "
608 label globCoarseId = 0;
609 for (
const label
patchID : selectedPatches_)
618 label nAgglom =
max(agglom)+1;
623 coarseMesh_.patchFaceMap()[
patchID];
625 scalar heatFlux = 0.0;
626 forAll(coarseToFine, coarseI)
632 const label coarseFaceID = coarsePatchFace[coarseI];
633 const labelList& fineFaces = coarseToFine[coarseFaceID];
636 label faceI = fineFaces[
k];
638 qrp[faceI] = q[globalCoarse];
639 heatFlux += qrp[faceI]*sf[faceI];
652 const scalar heatFlux =
gSum(qrp*magSf);
655 <<
"Total heat transfer rate at patch: "
673 mesh_.time().timeName(),
696 mesh_.time().timeName(),
int debug
Static debugging option.
void LUsolve(scalarSquareMatrix &matrix, List< Type > &source)
Defines the attributes of an object for which implicit objectRegistry management is supported,...
#define InfoInFunction
Report an information message using Foam::Info.
A class for handling words, derived from Foam::string.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
label localStart() const
My local start.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
Different types of constants.
IOmapDistribute is derived from mapDistribute and IOobject to give the mapDistribute automatic IO fun...
A List obtained as a section of another List.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static const boundaryRadiationProperties & New(const fvMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
volVectorField F(fluid.F())
label localSize() const
My local size.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type & value() const
Return const reference to value.
Type gSum(const FieldField< Field, Type > &f)
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
void insertMatrixElements(const globalIndex &index, const label fromProci, const labelListList &globalFaceFaces, const scalarListList &viewFactors, scalarSquareMatrix &matrix)
Insert view factors into main matrix.
Mesh consisting of general polyhedral cells.
tmp< scalarField > qro(label bandI=0) const
Return external + solar load radiative heat flux.
#define forAll(list, i)
Loop across all elements in list.
tmp< scalarField > emissivity(const label patchI, const label bandI=0, vectorField *incomingDirection=nullptr, scalarField *T=nullptr) const
Access boundary emissivity on patch.
void initialise()
Initialise.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
dimensionedScalar pow4(const dimensionedScalar &ds)
virtual bool read()=0
Read radiationProperties dictionary.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
dimensionedScalar pow3(const dimensionedScalar &ds)
messageStream Info
Information stream (uses stdout - output is on the master only)
#define DebugInFunction
Report an information message using Foam::Info.
A patch is a list of labels that address the faces in the global face list.
word name(const complex &c)
Return string representation of complex.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
Boundary radiation properties holder.
SquareMatrix< scalar > scalarSquareMatrix
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
void calculate()
Solve system of equation(s)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
errorManip< error > abort(error &err)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
To & refCast(From &r)
Reference type cast template function.
void LUBacksubstitute(const scalarSquareMatrix &luMmatrix, const labelList &pivotIndices, List< Type > &source)
labelList indices(const keyType &key, const bool useGroups=true) const
Return patch indices for all matches.
void LUDecompose(scalarSquareMatrix &matrix, labelList &pivotIndices)
LU decompose the matrix with pivoting.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static bool master(const label communicator=0)
Am I the master process.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
The solar load radiation model includes Sun primary hits, their reflective fluxes and diffusive sky r...
This boundary condition provides a grey-diffuse condition for radiative heat flux,...
Top level model for radiation modelling.
label k
Boltzmann constant.
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
A List of objects of type <T> with automated input and output.
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m2/K4].
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
static const word viewFactorWalls
Static name for view factor walls.
const wordList area
Standard area field types (scalar, vector, tensor, etc)
A List with indirect addressing.
virtual tmp< volScalarField::Internal > Ru() const
Source term component (constant)
bool read()
Read radiation properties dictionary.
#define addToRadiationRunTimeSelectionTables(model)
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
Graphite solid properties.
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
defineTypeNameAndDebug(combustionModel, 0)
label toGlobal(const label i) const
From local to global index.