50 const fileName& fName,
59 forAll(visibleFaceFaces, facei)
61 const labelList& visibleSlots = visibleFaceFaces[facei];
63 for (
const label sloti : visibleSlots)
65 str.write(
linePointRef(compactCf[facei], compactCf[sloti]));
78 const dictionary&
dict 83 writeViewFactors_(
dict.
get<bool>(
"writeViewFactors")),
84 writeRays_(
dict.getOrDefault<bool>(
"writeRays", false))
98 const auto& searchEngine = *searchEnginePtr_;
101 searchEngine.correct(visibleFaceFaces);
102 const auto& map = searchEngine.map();
109 List<List<vector>> compactFineSf;
110 List<List<point>> compactFineCf;
111 DynamicList<List<point>> compactPoints;
112 DynamicList<label> compactPatchId;
114 searchEngine.compactAddressing
131 mesh_.time().path()/
"allVisibleFaces.obj",
137 (void)mesh_.time().cpuTimeIncrement();
139 Info<<
"\nCalculating view factors" <<
endl;
146 mesh_.facesInstance(),
162 const label totalPatches = mesh_.boundaryMesh().nNonProcessor();
168 forAll(visibleFaceFaces, startFacei)
170 const scalar magAi =
mag(compactSf[startFacei]);
172 const labelList& visibleSlots = visibleFaceFaces[startFacei];
173 const label patchi = compactPatchId[startFacei];
175 forAll(visibleSlots, visSloti)
177 const label sloti = visibleSlots[visSloti];
178 const label patchj = compactPatchId[sloti];
180 viewFactorPatch[patchi][patchj] += Fij[startFacei][visSloti]*magAi;
184 reduce(viewFactorPatch, sumOp<scalarSquareMatrix>());
186 const scalarList patchArea = searchEngine.patchAreas();
191 Info<<
"\nPatch view factor contributions:" <<
nl <<
endl;
195 const auto&
patchIDs = searchEngine.patchIDs();
196 const auto&
patches = mesh_.boundaryMesh();
200 Info<<
" Patch " << patchi <<
": " <<
patches[patchi].name()
206 scalar vf = viewFactorPatch[patchi][patchj]/patchArea[patchi];
209 Info<<
" F" << patchi << patchj <<
": " << vf <<
endl;
217 Info<<
"Sum(all patches) = " << vfSum <<
endl;
221 Info<<
"\nWriting view factor matrix" <<
endl;
224 if (writeViewFactors_)
226 Info<<
"\nWriting view factor field" <<
endl;
228 auto tviewFactorField =
236 auto& viewFactorField = tviewFactorField.ref();
238 searchEngine.interpolate(viewFactorField, Fij);
240 viewFactorField.write();
252 mesh_.facesInstance(),
256 visibleFaceFaces.size()
259 forAll(IOglobalFaceFaces, facei)
263 searchEngine.compactToGlobal(),
264 visibleFaceFaces[facei]
268 IOglobalFaceFaces.write();
273 IOmapDistribute IOmapDist
278 mesh_.facesInstance(),
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
List< scalar > scalarList
List of scalar.
const labelList patchIDs(pbm.indices(polyPatchNames, true))
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
const dimensionSet dimless
Dimensionless.
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
List< labelList > labelListList
List of labelList.
virtual ~viewFactorModel()
Destructor.
#define forAll(list, i)
Loop across all elements in list.
vectorField pointField
pointField is a vectorField.
line< point, const point & > linePointRef
A line using referred points.
virtual void calculate()
Calculate the view factors.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
IOList< scalarList > scalarListIOList
IO for a List of scalarList.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
const polyBoundaryMesh & patches
viewFactorModel(const viewFactorModel &)=delete
No copy construct.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< label > labelList
A List of labels.
SquareMatrix< scalar > scalarSquareMatrix
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
static void writeRays(const fileName &fName, const pointField &compactCf, const labelListList &visibleFaceFaces)
Write ray geometry to file.
static constexpr const zero Zero
Global zero (0)
IOList< labelList > labelListIOList
IO for a List of labelList.