69 Pout<<
"radiation::viewFactor::initialise() Selected patches:"
71 Pout<<
"radiation::viewFactor::initialise() Number of coarse faces:"
154 label gFacej = visFaces[j];
155 label proci = globalNumbering.whichProcID(gFacej);
156 label faceJ = globalNumbering.
toLocal(proci, gFacej);
160 edge e(iFace, faceJ);
171 label proci = globalNumbering.whichProcID(gFacej);
176 label remoteFacei = globalNumbering.
toLocal(proci, gFacej);
178 procOwner[proci].
append(facei);
179 dynProcNeighbour[proci].
append(remoteFacei);
191 for (
const auto&
e : raysLst)
193 label faceI =
e.start();
194 label faceJ =
e.
end();
195 upper[rayI] =
max(faceI, faceJ);
196 lower[rayI] =
min(faceI, faceJ);
203 procNeighbour[i] = std::move(dynProcNeighbour[i]);
206 Pstream::exchange<labelList, label>(procNeighbour, mySendCells);
211 if (procOwner[proci].size())
215 if (mySendCells[proci].size())
225 primitiveInterfaces.
setSize(nbri);
239 Pout<<
"Adding interface " << nbri
240 <<
" to receive my " << procOwner[proci].
size()
241 <<
" from " << proci <<
endl;
244 primitiveInterfaces.
set
261 Pout<<
"Adding interface " << nbri
262 <<
" to send my " << mySendCells[proci].
size()
263 <<
" to " << proci <<
endl;
265 primitiveInterfaces.
set
285 Pout<<
"Adding interface " << nbri
286 <<
" to receive my " << procOwner[proci].
size()
287 <<
" from " << proci <<
endl;
290 primitiveInterfaces.
set
307 Pout<<
"Adding interface " << nbri
308 <<
" to send my " << mySendCells[proci].
size()
309 <<
" to " << proci <<
endl;
311 primitiveInterfaces.
set
333 primitiveInterfaces[proci].
faceCells().size(),
342 forAll(primitiveInterfaces, i)
346 allInterfaces.
set(i, &pp);
356 forAll (allInterfacesPtr, i)
388 scalar totalDelta = 0;
397 const scalar
delta = sumF - 1.0;
400 myFij[j] *= (1.0 -
delta/(sumF + 0.001));
403 if (
delta > maxDelta)
408 totalDelta /= myF.
size();
411 Info <<
"Smoothng average delta : " << totalDelta <<
endl;
412 Info <<
"Smoothng maximum delta : " << maxDelta <<
nl <<
endl;
434 <<
"Insert elements in the matrix..." <<
endl;
442 globalFaceFacesProc[procI],
460 const scalar
delta = sumF - 1.0;
491 <<
"Solar radiation and view factor band numbers "
496 Info<<
"Creating Solar Load Model " <<
nl;
511 mesh_.facesInstance(),
523 "coarse:" + mesh_.
name(),
547 selectedPatches_(mesh_.
boundary().size(), -1),
548 totalNCoarseFaces_(0),
549 nLocalCoarseFaces_(0),
550 constEmissivity_(false),
553 useSolarLoad_(false),
555 nBands_(coeffs_.getOrDefault<label>(
"nBands", 1)),
574 mesh_.facesInstance(),
586 "coarse:" + mesh_.
name(),
610 selectedPatches_(mesh_.
boundary().size(), -1),
611 totalNCoarseFaces_(0),
612 nLocalCoarseFaces_(0),
613 constEmissivity_(false),
616 useSolarLoad_(false),
618 nBands_(coeffs_.getOrDefault<label>(
"nBands", 1)),
647 forAll(viewFactors, faceI)
650 const labelList& globalFaces = globalFaceFaces[faceI];
652 label globalI = globalNumbering.
toGlobal(procI, faceI);
655 Fmatrix[globalI][globalFaces[i]] = vf[i];
668 solarLoad_->calculate();
685 for (label bandI = 0; bandI < nBands_; bandI++)
690 scalarField compactCoarseT4(map_->constructSize(), 0.0);
691 scalarField compactCoarseE(map_->constructSize(), 0.0);
692 scalarField compactCoarseHo(map_->constructSize(), 0.0);
699 forAll(selectedPatches_, i)
701 label
patchID = selectedPatches_[i];
725 coarseMesh_.patchFaceMap()[
patchID];
734 label nAgglom =
max(agglom) + 1;
738 forAll(coarseToFine, coarseI)
740 const label coarseFaceID = coarsePatchFace[coarseI];
741 const labelList& fineFaces = coarseToFine[coarseFaceID];
748 const scalar area =
sum(fineSf());
753 label facei = fineFaces[j];
754 T4ave[coarseI] += (
pow4(Tp[facei])*sf[facei])/area;
755 Eave[coarseI] += (eb[facei]*sf[facei])/area;
756 Hoiave[coarseI] += (Hoi[facei]*sf[facei])/area;
761 localCoarseT4ave.
append(T4ave);
762 localCoarseEave.
append(Eave);
763 localCoarseHoave.
append(Hoiave);
776 map_->distribute(compactCoarseT4);
777 map_->distribute(compactCoarseE);
778 map_->distribute(compactCoarseHo);
793 map_->distribute(compactGlobalIds);
799 invert(totalNCoarseFaces_, compactGlobalIds)
803 scalarField& upper = matrixPtr_->upper(rays_.size());
804 scalarField& lower = matrixPtr_->lower(rays_.size());
812 const scalar sigmaT4 =
815 diag[i] = 1/localCoarseEave[i];
817 source[i] += -sigmaT4 + localCoarseHoave[i];
821 if (!constEmissivity_ || iterCounter_ == 0)
823 const edgeList& raysLst = rays_.sortedToc();
826 for (
const auto&
e : raysLst)
828 label facelJ =
e.end();
829 label faceI =
e.start();
831 label faceJ = mapRayToFmy_[rayI];
834 (1-1/localCoarseEave[faceI])*FmyProc_()[faceI][faceJ];
837 (1-1/localCoarseEave[facelJ])*FmyProc_()[faceI][faceJ];
846 label nInterfaces = lduPtr_().interfaces().size();
848 forAll (globalFaceFaces_(), iFace)
850 const labelList& visFaces = globalFaceFaces_()[iFace];
853 label gFacej = visFaces[jFace];
854 label proci = globalNumbering.whichProcID(gFacej);
864 const scalar sigmaT4 =
866 *localCoarseT4ave[lFacej];
868 source[iFace] += FmyProc_()[iFace][jFace]*sigmaT4;
872 label compactFaceJ = globalToCompact[gFacej];
873 const scalar sigmaT4 =
875 *compactCoarseT4[compactFaceJ];
877 source[iFace] += FmyProc_()[iFace][jFace]*sigmaT4;
879 label interfaceI = procToInterface_[proci];
882 [interfaceI][boundCoeffI[interfaceI]++] =
883 -(1-1/compactCoarseE[compactFaceJ])
884 *FmyProc_()[iFace][jFace];
890 for(label i = 0; i < interfaces.
size(); i++)
897 lduPtr_().interfaces()[i],
904 qr_.mesh().solverDict
908 qr_.mesh().data::template getOrDefault<bool>
909 (
"finalIteration",
false)
922 )->solve(qrBandI_[bandI], source);
926 qTotalCoarse += qrBandI_[bandI];
937 forAll(compactCoarseT4, i)
939 T4[compactGlobalIds[i]] = compactCoarseT4[i];
940 E[compactGlobalIds[i]] = compactCoarseE[i];
941 qrExt[compactGlobalIds[i]] = compactCoarseHo[i];
955 if (!constEmissivity_)
959 for (label i=0; i<totalNCoarseFaces_; i++)
961 for (label j=0; j<totalNCoarseFaces_; j++)
963 const scalar invEj = 1.0/E[j];
964 const scalar sigmaT4 =
970 qBandI[i] += -sigmaT4 + qrExt[j];
974 C(i, j) = (1.0 - invEj)*Fmatrix_()(i, j);
975 qBandI[i] += Fmatrix_()(i, j)*sigmaT4;
980 Info<<
"Solving view factor equations for band :"
989 if (iterCounter_ == 0)
991 for (label i=0; i<totalNCoarseFaces_; i++)
993 for (label j=0; j<totalNCoarseFaces_; j++)
995 const scalar invEj = 1.0/E[j];
998 CLU_()(i, j) = invEj;
1003 (1.0-invEj)*Fmatrix_()(i, j);
1013 for (label i=0; i<totalNCoarseFaces_; i++)
1015 for (label j=0; j<totalNCoarseFaces_; j++)
1017 const scalar sigmaT4 =
1022 qBandI[i] += -sigmaT4 + qrExt[j];
1026 qBandI[i] += Fmatrix_()(i, j)*sigmaT4;
1031 Info<<
"Solving view factor equations for band : "
1045 label globCoarseId = 0;
1046 for (
const label
patchID : selectedPatches_)
1055 label nAgglom =
max(agglom)+1;
1060 coarseMesh_.patchFaceMap()[
patchID];
1063 forAll(coarseToFine, coarseI)
1065 label globalCoarse = globalNumbering.
toGlobal
1071 const label coarseFaceID = coarsePatchFace[coarseI];
1072 const labelList& fineFaces = coarseToFine[coarseFaceID];
1074 for (
const label facei : fineFaces)
1078 qrp[facei] = qNet[globalCoarse];
1082 qrp[facei] = qTotalCoarse[globCoarseId];
1097 const scalar heatFlux =
gSum(qrp*magSf);
1099 Info<<
"Total heat transfer rate at patch: "
1101 << heatFlux <<
endl;
1117 mesh_.time().timeName(),
1140 mesh_.time().timeName(),
Macros for easy insertion into run-time selection tables.
Graphite solid properties.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
Generic templated field type.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
label size() const noexcept
The number of elements in table.
A List of objects of type <T> with automated input and output.
IOmapDistribute is derived from mapDistribute and IOobject to give the mapDistribute automatic IO fun...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
void setSize(const label n)
Alias for resize()
void append(const T &val)
Append an element at the end of the list.
UPstream::rangeType allProcs() const noexcept
Range of ranks indices associated with PstreamBuffers.
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
static void gatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &value, const int tag, const label comm)
Broadcast data: Distribute without modification.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
void setSize(const label newLen)
Same as resize()
A List obtained as a section of another List.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
A List with indirect addressing. Like IndirectList but does not store addressing.
iterator end() noexcept
Return an iterator to end traversing the UList.
void size(const label n)
Older name for setAddressableSize.
static int & msgType() noexcept
Message tag of standard messages.
static label worldComm
Default communicator (all processors)
const T * set(const label i) const
void setSize(const label n)
Alias for resize()
label size() const noexcept
The number of elements in the list.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
const Type & value() const
Return const reference to value.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Smooth ATC in cells next to a set of patches supplied by type.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label localSize() const
My local size.
label localStart() const
My local start.
label toGlobal(const label i) const
From local to global index.
label toLocal(const label i) const
From global to local on current processor.
A lduProcessorField type bypassing coupledFvPatchField and holding a reference to the Field<Type>.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Simplest concrete lduMesh that stores the addressing needed by lduMatrix.
static lduSchedule nonBlockingSchedule(const lduInterfacePtrsList &)
Get non-scheduled send/receive schedule.
Concrete implementation of processor interface. Used to temporarily store settings.
OSstream & masterStream(const label communicator)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
labelList indices(const wordRe &matcher, const bool useGroups=true) const
Return (sorted) patch indices for all matches.
Mesh consisting of general polyhedral cells.
const fileName & facesInstance() const
Return the current instance directory for faces.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
int myProcNo() const noexcept
Return processor number.
Boundary radiation properties holder.
tmp< scalarField > emissivity(const label patchI, const label bandI=0, vectorField *incomingDirection=nullptr, scalarField *T=nullptr) const
Access boundary emissivity on patch.
This boundary condition provides a grey-diffuse condition for radiative heat flux,...
tmp< scalarField > qro(label bandI=0) const
Return external + solar load radiative heat flux.
Top level model for radiation modelling.
const fvMesh & mesh_
Reference to the mesh database.
virtual bool read()=0
Read radiationProperties dictionary.
dictionary coeffs_
Radiation model dictionary.
const volScalarField & T_
Reference to the temperature field.
The solarLoad radiation model includes Sun primary hits, their reflective fluxes and diffusive sky ra...
View factor radiation model. The system solved is: C q = b where: Cij = deltaij/Ej - (1/Ej - 1)Fij q ...
void initialise()
Initialise.
autoPtr< scalarSquareMatrix > Fmatrix_
View factor matrix.
autoPtr< lduMatrix > matrixPtr_
Matrix formed from view factors.
virtual tmp< volScalarField::Internal > Ru() const
Source term component (constant)
singleCellFvMesh coarseMesh_
Coarse mesh.
autoPtr< scalarSquareMatrix > CLU_
Inverse of C matrix.
label nLocalCoarseFaces_
Total local coarse faces.
static const word viewFactorWalls
Static name for view factor walls.
label nBands_
Number of bands.
virtual tmp< volScalarField > Rp() const
Source term component (for power of T^4)
autoPtr< solarLoad > solarLoad_
Solar load radiation model.
autoPtr< scalarListIOList > FmyProc_
Local view factors.
autoPtr< IOmapDistribute > map_
Map distributed.
FieldField< Field, scalar > boundaryCoeffs_
labelList procToInterface_
Map from proc to interafce.
List< label > mapRayToFmy_
Map local-ray to j-column for F.
FieldField< Field, scalar > internalCoeffs_
labelList pivotIndices_
Pivot Indices for LU decomposition.
bool useDirect_
Use direct or iterative solver.
autoPtr< labelListIOList > globalFaceFaces_
Visible global faces.
List< scalarField > qrBandI_
Coarse radiative heat flux.
label totalNCoarseFaces_
Total global coarse faces.
edgeHashSet rays_
Rays on local proc.
bool constEmissivity_
Constant emissivity.
autoPtr< lduPrimitiveMesh > lduPtr_
Primitive addressing for lduMatrix.
labelList selectedPatches_
Selected patches.
bool useSolarLoad_
Use Solar Load model.
void insertMatrixElements(const globalIndex &index, const label fromProci, const labelListList &globalFaceFaces, const scalarListList &viewFactors, scalarSquareMatrix &matrix)
Insert view factors into main matrix.
bool read()
Read radiation properties dictionary.
void calculate()
Solve system of equation(s)
splitCell * master() const
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
autoPtr< radiation::radiationModel > radiation(radiation::radiationModel::New(T))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInFunction
Report an information message using Foam::Info.
volVectorField F(fluid.F())
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m2/K4].
Different types of constants.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Type gSum(const FieldField< Field, Type > &f)
To & refCast(From &r)
Reference type cast template function.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
void LUBacksubstitute(const scalarSquareMatrix &luMmatrix, const labelList &pivotIndices, List< Type > &source)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
void LUDecompose(scalarSquareMatrix &matrix, labelList &pivotIndices)
LU decompose the matrix with pivoting.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
dimensionedScalar pow4(const dimensionedScalar &ds)
errorManip< error > abort(error &err)
SquareMatrix< scalar > scalarSquareMatrix
static constexpr const zero Zero
Global zero (0)
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
void LUsolve(scalarSquareMatrix &matrix, List< Type > &source)
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
constexpr char nl
The newline '\n' character (0x0a)
#define addToRadiationRunTimeSelectionTables(model)
#define forAll(list, i)
Loop across all elements in list.