Go to the documentation of this file.
56 selectedPatches_ = mesh_.boundaryMesh().
findIndices(viewFactorWalls);
57 forAll(selectedPatches_, i)
59 const label patchI = selectedPatches_[i];
60 nLocalCoarseFaces_ += coarsePatches[patchI].
size();
65 Pout<<
"radiation::viewFactor::initialise() Selected patches:"
66 << selectedPatches_ <<
endl;
67 Pout<<
"radiation::viewFactor::initialise() Number of coarse faces:"
68 << nLocalCoarseFaces_ <<
endl;
71 totalNCoarseFaces_ = nLocalCoarseFaces_;
77 <<
"Total number of clusters : " << totalNCoarseFaces_ <<
endl;
87 mesh_.facesInstance(),
101 mesh_.facesInstance(),
114 mesh_.facesInstance(),
142 <<
"Insert elements in the matrix..." <<
endl;
151 globalFaceFacesProc[procI],
158 bool smoothing =
readBool(coeffs_.lookup(
"smoothing"));
164 <<
"Smoothing the matrix..." <<
endl;
167 for (
label i=0; i<totalNCoarseFaces_; i++)
170 for (
label j=0; j<totalNCoarseFaces_; j++)
172 sumF += Fmatrix_()[i][j];
174 scalar
delta = sumF - 1.0;
175 for (
label j=0; j<totalNCoarseFaces_; j++)
177 Fmatrix_()[i][j] *= (1.0 -
delta/(sumF + 0.001));
182 constEmissivity_ =
readBool(coeffs_.lookup(
"constantEmissivity"));
183 if (constEmissivity_)
195 pivotIndices_.setSize(CLU_().
n());
199 if (this->
found(
"useSolarLoad"))
201 this->
lookup(
"useSolarLoad") >> useSolarLoad_;
206 const dictionary& solarDict = this->subDict(
"solarLoarCoeffs");
209 new solarLoad(solarDict, T_, externalRadHeatFieldName_)
212 if (solarLoad_->nBands() > 1)
215 <<
"Requested solar radiation with fvDOM. Using "
216 <<
"more thant one band for the solar load is not allowed"
220 Info<<
"Creating Solar Load Model " <<
nl;
235 mesh_.facesInstance(),
247 "coarse:" + mesh_.
name(),
270 selectedPatches_(mesh_.
boundary().size(), -1),
271 totalNCoarseFaces_(0),
272 nLocalCoarseFaces_(0),
273 constEmissivity_(false),
276 useSolarLoad_(false),
295 mesh_.facesInstance(),
307 "coarse:" + mesh_.name(),
308 mesh_.polyMesh::instance(),
321 mesh_.time().timeName(),
330 selectedPatches_(mesh_.boundary().size(), -1),
331 totalNCoarseFaces_(0),
332 nLocalCoarseFaces_(0),
333 constEmissivity_(
false),
336 useSolarLoad_(
false),
373 forAll(viewFactors, faceI)
376 const labelList& globalFaces = globalFaceFaces[faceI];
381 Fmatrix[globalI][globalFaces[i]] = vf[i];
394 solarLoad_->calculate();
397 scalarField compactCoarseT(map_->constructSize(), 0.0);
398 scalarField compactCoarseE(map_->constructSize(), 0.0);
399 scalarField compactCoarseHo(map_->constructSize(), 0.0);
411 forAll(selectedPatches_, i)
413 label patchID = selectedPatches_[i];
415 const scalarField& Tp = T_.boundaryField()[patchID];
416 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
433 const labelList& coarsePatchFace = coarseMesh_.patchFaceMap()[patchID];
441 const labelList& agglom = finalAgglom_[patchID];
446 forAll(coarseToFine, coarseI)
448 const label coarseFaceID = coarsePatchFace[coarseI];
449 const labelList& fineFaces = coarseToFine[coarseFaceID];
455 scalar area =
sum(fineSf());
459 label faceI = fineFaces[j];
460 Tave[coarseI] += (Tp[faceI]*
sf[faceI])/area;
461 Eave[coarseI] += (eb[faceI]*
sf[faceI])/area;
462 Hoiave[coarseI] += (Hoi[faceI]*
sf[faceI])/area;
467 localCoarseTave.
append(Tave);
468 localCoarseEave.
append(Eave);
469 localCoarseHoave.
append(Hoiave);
476 (compactCoarseHo,nLocalCoarseFaces_).
assign(localCoarseHoave);
479 map_->distribute(compactCoarseT);
480 map_->distribute(compactCoarseE);
481 map_->distribute(compactCoarseHo);
484 labelList compactGlobalIds(map_->constructSize(), 0.0);
486 labelList localGlobalIds(nLocalCoarseFaces_);
488 for(
label k = 0;
k < nLocalCoarseFaces_;
k++)
499 map_->distribute(compactGlobalIds);
509 T[compactGlobalIds[i]] = compactCoarseT[i];
510 E[compactGlobalIds[i]] = compactCoarseE[i];
511 QrExt[compactGlobalIds[i]] = compactCoarseHo[i];
528 if (!constEmissivity_)
532 for (
label i=0; i<totalNCoarseFaces_; i++)
534 for (
label j=0; j<totalNCoarseFaces_; j++)
536 scalar invEj = 1.0/E[j];
542 C[i][j] = invEj - (invEj - 1.0)*Fmatrix_()[i][j];
543 q[i] += (Fmatrix_()[i][j] - 1.0)*sigmaT4 - QrExt[j];
547 C[i][j] = (1.0 - invEj)*Fmatrix_()[i][j];
548 q[i] += Fmatrix_()[i][j]*sigmaT4;
554 Info<<
"\nSolving view factor equations..." <<
endl;
562 if (iterCounter_ == 0)
564 for (
label i=0; i<totalNCoarseFaces_; i++)
566 for (
label j=0; j<totalNCoarseFaces_; j++)
568 scalar invEj = 1.0/E[j];
571 CLU_()[i][j] = invEj-(invEj-1.0)*Fmatrix_()[i][j];
575 CLU_()[i][j] = (1.0 - invEj)*Fmatrix_()[i][j];
583 <<
"\nDecomposing C matrix..." <<
endl;
589 for (
label i=0; i<totalNCoarseFaces_; i++)
591 for (
label j=0; j<totalNCoarseFaces_; j++)
599 q[i] += (Fmatrix_()[i][j] - 1.0)*sigmaT4 - QrExt[j];
603 q[i] += Fmatrix_()[i][j]*sigmaT4;
611 <<
"\nLU Back substitute C matrix.." <<
endl;
624 label globCoarseId = 0;
625 forAll(selectedPatches_, i)
627 const label patchID = selectedPatches_[i];
632 const scalarField&
sf = mesh_.magSf().boundaryField()[patchID];
633 const labelList& agglom = finalAgglom_[patchID];
639 coarseMesh_.patchFaceMap()[patchID];
641 scalar heatFlux = 0.0;
642 forAll(coarseToFine, coarseI)
646 const label coarseFaceID = coarsePatchFace[coarseI];
647 const labelList& fineFaces = coarseToFine[coarseFaceID];
650 label faceI = fineFaces[
k];
652 Qrp[faceI] = q[globalCoarse];
653 heatFlux += Qrp[faceI]*
sf[faceI];
662 forAll(Qr_.boundaryField(), patchID)
664 const scalarField& Qrp = Qr_.boundaryField()[patchID];
665 const scalarField& magSf = mesh_.magSf().boundaryField()[patchID];
666 scalar heatFlux =
gSum(Qrp*magSf);
669 <<
"Total heat transfer rate at patch: "
689 mesh_.time().timeName(),
717 mesh_.time().timeName(),
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
tmp< scalarField > emissivity(const label patchId, const label bandI=0) const
Access boundary emissivity on patch.
void LUsolve(scalarSquareMatrix &matrix, List< Type > &source)
Solve the matrix using LU decomposition with pivoting.
void insertMatrixElements(const globalIndex &index, const label fromProcI, const labelListList &globalFaceFaces, const scalarListList &viewFactors, scalarSquareMatrix &matrix)
Insert view factors into main matrix.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
#define InfoInFunction
Report a information message using Foam::Info.
A class for handling words, derived from string.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
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.
faceListList boundary(nPatches)
viewFactor(const viewFactor &)
Disallow default bitwise copy construct.
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
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)
virtual ~viewFactor()
Destructor.
Mesh consisting of general polyhedral cells.
static const boundaryRadiationProperties & New(const fvMesh &mesh)
const dimensionedScalar F
Faraday constant: default SI units: [C/mol].
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.
labelList findIndices(const keyType &, const bool usePatchGroups=true) const
Return patch indices for all matches. Optionally matches patchGroups.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
dimensionedScalar pow3(const dimensionedScalar &ds)
A patch is a list of labels that address the faces in the global face list.
tmp< scalarField > Qro() const
Return external + solar load radiative heat flux.
void assign(const UList< T > &)
Assign elements to those from UList.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
SquareMatrix< scalar > scalarSquareMatrix
A list of keyword definitions, which are a keyword followed by any number of values (e....
Macros for easy insertion into run-time selection tables.
Generic dimensioned Type class.
void calculate()
Solve system of equation(s)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
errorManip< error > abort(error &err)
volScalarField sf(fieldObject, mesh)
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)
LU back-substitution with given source, returning the solution.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
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.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#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,...
prefixOSstream Pout(cout, "Pout")
Top level model for radiation modelling.
label k
Boltzmann constant.
A List of objects of type <T> with automated input and output.
label size() const
Return the number of elements in the PtrList.
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.
A List with indirect addressing.
virtual tmp< DimensionedField< scalar, volMesh > > Ru() const
Source term component (constant)
bool read()
Read radiation properties dictionary.
#define addToRadiationRunTimeSelectionTables(model)
void size(const label)
Override size to be inconsistent with allocated storage.
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
Graphite solid properties.
Generic GeometricField class.
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
label toGlobal(const label i) const
From local to global.
stressControl lookup("compactNormalStress") >> compactNormalStress