49 void Foam::radiation::viewFactor::initialise()
51 const polyBoundaryMesh& coarsePatches = coarseMesh_.boundaryMesh();
52 const volScalarField::GeometricBoundaryField& Qrp = Qr_.boundaryField();
60 if ((isA<fixedValueFvPatchScalarField>(QrPatchI)))
62 selectedPatches_[count] = QrPatchI.patch().index();
63 nLocalCoarseFaces_ += coarsePatches[patchI].size();
68 selectedPatches_.resize(count--);
72 Pout<<
"radiation::viewFactor::initialise() Selected patches:" 73 << selectedPatches_ <<
endl;
74 Pout<<
"radiation::viewFactor::initialise() Number of coarse faces:" 75 << nLocalCoarseFaces_ <<
endl;
78 totalNCoarseFaces_ = nLocalCoarseFaces_;
79 reduce(totalNCoarseFaces_, sumOp<label>());
83 InfoIn(
"radiation::viewFactor::initialise()")
84 <<
"Total number of clusters : " << totalNCoarseFaces_ <<
endl;
92 mesh_.facesInstance(),
105 mesh_.facesInstance(),
113 IOList<label> consMapDim
118 mesh_.facesInstance(),
131 Xfer<labelListList>(subMap),
132 Xfer<labelListList>(constructMap)
141 mesh_.facesInstance(),
154 mesh_.facesInstance(),
170 globalIndex globalNumbering(nLocalCoarseFaces_);
181 InfoIn(
"radiation::viewFactor::initialise()")
182 <<
"Insert elements in the matrix..." <<
endl;
191 globalFaceFacesProc[procI],
198 bool smoothing =
readBool(coeffs_.lookup(
"smoothing"));
203 InfoIn(
"radiation::viewFactor::initialise()")
204 <<
"Smoothing the matrix..." <<
endl;
207 for (
label i=0; i<totalNCoarseFaces_; i++)
210 for (
label j=0; j<totalNCoarseFaces_; j++)
212 sumF += Fmatrix_()[i][j];
214 scalar
delta = sumF - 1.0;
215 for (
label j=0; j<totalNCoarseFaces_; j++)
217 Fmatrix_()[i][j] *= (1.0 - delta/(sumF + 0.001));
222 constEmissivity_ =
readBool(coeffs_.lookup(
"constantEmissivity"));
223 if (constEmissivity_)
235 pivotIndices_.setSize(CLU_().
n());
251 mesh_.facesInstance(),
286 selectedPatches_(mesh_.
boundary().size(), -1),
287 totalNCoarseFaces_(0),
288 nLocalCoarseFaces_(0),
289 constEmissivity_(false),
297 Foam::radiation::viewFactor::viewFactor
322 mesh_.polyMesh::instance(),
345 totalNCoarseFaces_(0),
346 nLocalCoarseFaces_(0),
347 constEmissivity_(
false),
376 void Foam::radiation::viewFactor::insertMatrixElements
385 forAll(viewFactors, faceI)
388 const labelList& globalFaces = globalFaceFaces[faceI];
393 Fmatrix[globalI][globalFaces[i]] = vf[i];
404 scalarField compactCoarseT(map_->constructSize(), 0.0);
405 scalarField compactCoarseE(map_->constructSize(), 0.0);
406 scalarField compactCoarseHo(map_->constructSize(), 0.0);
415 forAll(selectedPatches_, i)
417 label patchID = selectedPatches_[i];
443 const labelList& agglom = finalAgglom_[patchID];
448 forAll(coarseToFine, coarseI)
450 const label coarseFaceID = coarsePatchFace[coarseI];
451 const labelList& fineFaces = coarseToFine[coarseFaceID];
457 scalar area =
sum(fineSf());
461 label faceI = fineFaces[j];
462 Tave[coarseI] += (Tp[faceI]*sf[faceI])/area;
463 Eave[coarseI] += (eb[faceI]*sf[faceI])/area;
464 Hoiave[coarseI] += (Hoi[faceI]*sf[faceI])/area;
469 localCoarseTave.
append(Tave);
470 localCoarseEave.
append(Eave);
471 localCoarseHoave.
append(Hoiave);
475 SubList<scalar>(compactCoarseT,nLocalCoarseFaces_).assign(localCoarseTave);
476 SubList<scalar>(compactCoarseE,nLocalCoarseFaces_).assign(localCoarseEave);
478 (compactCoarseHo,nLocalCoarseFaces_).assign(localCoarseHoave);
481 map_->distribute(compactCoarseT);
482 map_->distribute(compactCoarseE);
483 map_->distribute(compactCoarseHo);
486 labelList compactGlobalIds(map_->constructSize(), 0.0);
488 labelList localGlobalIds(nLocalCoarseFaces_);
490 for(
label k = 0;
k < nLocalCoarseFaces_;
k++)
499 ).assign(localGlobalIds);
501 map_->distribute(compactGlobalIds);
511 T[compactGlobalIds[i]] = compactCoarseT[i];
512 E[compactGlobalIds[i]] = compactCoarseE[i];
513 QrExt[compactGlobalIds[i]] = compactCoarseHo[i];
530 if (!constEmissivity_)
534 for (
label i=0; i<totalNCoarseFaces_; i++)
536 for (
label j=0; j<totalNCoarseFaces_; j++)
538 scalar invEj = 1.0/E[j];
544 C[i][j] = invEj - (invEj - 1.0)*Fmatrix_()[i][j];
545 q[i] += (Fmatrix_()[i][j] - 1.0)*sigmaT4 - QrExt[j];
549 C[i][j] = (1.0 - invEj)*Fmatrix_()[i][j];
550 q[i] += Fmatrix_()[i][j]*sigmaT4;
556 Info<<
"\nSolving view factor equations..." <<
endl;
564 if (iterCounter_ == 0)
566 for (
label i=0; i<totalNCoarseFaces_; i++)
568 for (
label j=0; j<totalNCoarseFaces_; j++)
570 scalar invEj = 1.0/E[j];
573 CLU_()[i][j] = invEj-(invEj-1.0)*Fmatrix_()[i][j];
577 CLU_()[i][j] = (1.0 - invEj)*Fmatrix_()[i][j];
584 InfoIn(
"radiation::viewFactor::initialise()")
585 <<
"\nDecomposing C matrix..." <<
endl;
591 for (
label i=0; i<totalNCoarseFaces_; i++)
593 for (
label j=0; j<totalNCoarseFaces_; j++)
601 q[i] += (Fmatrix_()[i][j] - 1.0)*sigmaT4 - QrExt[j];
605 q[i] += Fmatrix_()[i][j]*sigmaT4;
612 InfoIn(
"radiation::viewFactor::initialise()")
613 <<
"\nLU Back substitute C matrix.." <<
endl;
626 label globCoarseId = 0;
627 forAll(selectedPatches_, i)
629 const label patchID = selectedPatches_[i];
635 const labelList& agglom = finalAgglom_[patchID];
643 scalar heatFlux = 0.0;
644 forAll(coarseToFine, coarseI)
648 const label coarseFaceID = coarsePatchFace[coarseI];
649 const labelList& fineFaces = coarseToFine[coarseFaceID];
652 label faceI = fineFaces[
k];
654 Qrp[faceI] = q[globalCoarse];
655 heatFlux += Qrp[faceI]*sf[faceI];
668 scalar heatFlux =
gSum(Qrp*magSf);
670 InfoIn(
"radiation::viewFactor::initialise()")
671 <<
"Total heat transfer rate at patch: " void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
dimensionedScalar pow3(const dimensionedScalar &ds)
faceListList boundary(nPatches)
void LUBacksubstitute(const scalarSquareMatrix &luMmatrix, const labelList &pivotIndices, List< Type > &source)
LU back-substitution with given source, returning the solution.
const word & name() const
Return reference to name.
label size() const
Return the number of elements in the PtrList.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
IOList< labelList > labelListIOList
Label container classes.
Top level model for radiation modelling.
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
word name(const complex &)
Return a string representation of a complex.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
const scalarList & Qro()
Return external radiative heat flux.
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m2/K4].
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
This boundary condition provides a grey-diffuse condition for radiative heat flux, Qr, for use with the view factor model.
scalarField emissivity() const
Calculate corresponding emissivity field.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
const volScalarField & T_
Reference to the temperature field.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
void size(const label)
Override size to be inconsistent with allocated storage.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
volScalarField sf(fieldObject, mesh)
virtual bool read()=0
Read radiationProperties dictionary.
A patch is a list of labels that address the faces in the global face list.
const Time & time() const
Return the top-level database.
Type gSum(const FieldField< Field, Type > &f)
static label nProcs(const label communicator=0)
Number of processes in parallel run.
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A List with indirect addressing.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
bool read()
Read radiation properties dictionary.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
label k
Boltzmann constant.
#define addToRadiationRunTimeSelectionTables(model)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
#define InfoIn(functionName)
Report a information message using Foam::Info.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
fvPatchField< scalar > fvPatchScalarField
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
const fileName & facesInstance() const
Return the current instance directory for faces.
Mesh consisting of general polyhedral cells.
label toGlobal(const label i) const
From local to global.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
IOobject(const word &name, const fileName &instance, const objectRegistry ®istry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
Construct from name, instance, registry, io options.
SquareMatrix< scalar > scalarSquareMatrix
virtual tmp< DimensionedField< scalar, volMesh > > Ru() const
Source term component (constant)
IOList< scalarList > scalarListIOList
Scalar container classes.
dimensionedScalar pow4(const dimensionedScalar &ds)
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
virtual ~viewFactor()
Destructor.
static bool master(const label communicator=0)
Am I the master process.
A List obtained as a section of another List.
void LUDecompose(scalarSquareMatrix &matrix, labelList &pivotIndices)
LU decompose the matrix with pivoting.
void calculate()
Solve system of equation(s)
To & refCast(From &r)
Reference type cast template function.
void LUsolve(scalarSquareMatrix &matrix, List< Type > &source)
Solve the matrix using LU decomposition with pivoting.
const dimensionedScalar F
Faraday constant: default SI units: [C/mol].
void storePrevIter() const
Store the field as the previous iteration value.
const fvMesh & mesh_
Reference to the mesh database.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
const labelListList & patchFaceMap() const
From patchFace on this back to original mesh or agglomeration.
void relax(const scalar alpha)
Relax field (for steady-state solution).
const Type & value() const
Return const reference to value.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.