36 namespace functionObjects
46 void Foam::functionObjects::viewFactorHeatFlux::initialise()
49 const labelList selectedPatches =
pbm.indices(
"viewFactorWall");
59 for (
const label patchi : selectedPatches)
72 const label patchi = selectedPatches[i];
73 auto slice = compactPatchID_.
slice(nFace,
pbm[patchi].size());
75 nFace += slice.size();
97 auto& mapDist = mapDistPtr_();
99 mapDist.distribute(compactPatchID_);
106 globalIndex gi(nFace);
108 SubList<label>(compactGlobalIds, nFace) =
identity(gi.range());
110 mapDist.distribute(compactGlobalIds);
112 const label nTotalFaces =
returnReduce(nFace, sumOp<label>());
114 const labelList globalToCompact(
invert(nTotalFaces, compactGlobalIds));
116 for (
labelList& visibleFaces : faceFaces_)
118 for (label& globalFacei : visibleFaces)
120 globalFacei = globalToCompact[globalFacei];
138 writeFile(mesh_,
name, typeName,
dict),
139 qrName_(
dict.getOrDefault<
word>(
"qr",
"qr")),
140 mapDistPtr_(nullptr),
146 mesh_.facesInstance(),
158 mesh_.facesInstance(),
165 compactPatchID_(faceFaces_.size(),
Zero)
181 qrName_(
dict.getOrDefault<
word>(
"qr",
"qr")),
182 mapDistPtr_(nullptr),
188 mesh_.facesInstance(),
200 mesh_.facesInstance(),
207 compactPatchID_(faceFaces_.size(),
Zero)
219 dict.readIfPresent(
"qr", qrName_);
244 const auto& qr = *qrPtr;
252 mesh_.boundaryMesh().indices(
"viewFactorWall");
254 const auto&
pbm = mesh_.boundaryMesh();
255 const label nPatch = selectedPatches.
size();
263 forAll(selectedPatches, i)
265 const label patchi = selectedPatches[i];
266 const auto& qrp = qr.boundaryField()[patchi];
269 compactQr[compacti] = qrp[facei];
270 qrPatch[i] += qrp[facei];
275 reduce(qrPatch, sumOp<scalarList>());
280 mapDistPtr_->distribute(compactQr);
288 const scalar qr = compactQr[startFacei];
289 const labelList& visibleSlots = faceFaces_[startFacei];
290 const label i = compactPatchID_[startFacei];
292 forAll(visibleSlots, visSloti)
294 const label sloti = visibleSlots[visSloti];
295 const label j = compactPatchID_[sloti];
297 qrVf[i][j] += Fij_[startFacei][visSloti]*qr;
301 reduce(qrVf, sumOp<scalarSquareMatrix>());
305 Log <<
" Writing patch totals to " << file().name()
309 writeCurrentTime(file());
311 for (
const auto& qrp : qrPatch)
313 file() <<
tab << qrp;
320 auto osPtr = newFileAtTime(
"viewFactorQr", mesh_.time().value());
323 Log <<
" Writing view factor breakdown to " <<
os.name()
327 forAll(selectedPatches, i)
331 for (
const label patchj : selectedPatches)
338 const label patchi = selectedPatches[i];
340 os <<
pbm[patchi].name();;
342 forAll(selectedPatches, j)
344 os <<
tab << qrVf[i][j];
const polyBoundaryMesh & pbm
virtual OFstream & file()
Return access to the file (if only 1)
void size(const label n)
Older name for setAddressableSize.
defineTypeNameAndDebug(ObukhovLength, 0)
virtual bool write()
Write the viewFactorHeatFlux per patch.
virtual void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.
const fileName & facesInstance() const
Return the current instance directory for faces.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
virtual bool read(const dictionary &)
Read the viewFactorHeatFlux data.
constexpr char nl
The newline '\n' character (0x0a)
viewFactorHeatFlux(const word &name, const Time &runTime, const dictionary &dict, const bool readFields=true)
Construct from Time and dictionary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
constexpr char tab
The tab '\t' character(0x09)
Ignore writing from objectRegistry::writeObject()
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
const word & name() const noexcept
Return the name of this functionObject.
#define forAll(list, i)
Loop across all elements in list.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
Reads fields from the time directories and adds them to the mesh database for further post-processing...
OBJstream os(runTime.globalPath()/outputName)
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
virtual bool execute()
No-op - all operations performed during the call to write()
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
virtual bool read(const dictionary &dict)
Read optional controls.
Mesh consisting of general polyhedral cells.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
List< label > labelList
A List of labels.
Registry of regIOobjects.
Base class for writing single files from the function objects.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Defines the attributes of an object for which implicit objectRegistry management is supported...
SquareMatrix< scalar > scalarSquareMatrix
const fvMesh & mesh_
Reference to the fvMesh.
Do not request registration (bool: false)
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 constexpr const zero Zero
Global zero (0)
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.