49 { selectionModeType::smAll,
"all" },
50 { selectionModeType::smFaceSet,
"faceSet" },
51 { selectionModeType::smFaceZone,
"faceZone" },
53 { selectionModeType::smFaceZone,
"volFaceZone" }
104 <<
"Unknown selectionMode "
106 <<
". Valid selectionMode types : "
120 const auto& meshAreas = regionMesh().S();
122 for (
const label facei : faces_)
124 sumArea += meshAreas[facei];
127 reduce(sumArea, sumOp<scalar>());
129 const scalar old(A_);
141 <<
" face(s) with area " <<
A_ <<
endl;
148 switch (selectionMode_)
153 faces_ =
identity(regionMesh().nFaces());
161 <<
"- selecting face subset using volume-mesh faceSet "
164 const faceSet
subset(mesh_, zoneName());
175 if (
subset.test(meshFacei))
177 faces_[nUsed] = facei;
181 faces_.resize(nUsed);
188 <<
"- selecting face subset using volume-mesh faceZones "
191 const auto& zones = mesh_.faceZones();
199 <<
"No matching faceZones: "
220 if (
subset.test(meshFacei))
222 faces_[nUsed] = facei;
226 faces_.resize(nUsed);
233 <<
"- selecting face subset using volume-mesh patches "
236 const polyBoundaryMesh&
pbm = mesh_.boundaryMesh();
244 <<
"No matching patches: "
246 <<
"Valid patches : "
253 const List<labelPair>& patchFaces = regionMesh().whichPatchFaces();
260 const label patchi = patchFaces[facei].first();
264 faces_[nUsed] = facei;
268 faces_.resize(nUsed);
275 <<
"Unknown selectionMode "
276 << selectionModeTypeNames_[selectionMode_]
277 <<
". Valid selectionMode types are "
278 << selectionModeTypeNames_
286 <<
"No faces selected!" <<
endl;
296 const word& modelType,
299 const word& defaultAreaName
305 selectionMode_(selectionModeTypeNames_.get(
"selectionMode", coeffs_)),
328 if (mesh_.changing())
330 if (mesh_.topoChanging())
354 if (coeffs_.readIfPresent(
"timeStart", timeStart_))
356 coeffs_.readEntry(
"duration", duration_);
labelList faceLabels(nFaceLabels)
const polyBoundaryMesh & pbm
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
static unsigned int defaultPrecision() noexcept
Return the default precision.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
void clear()
Clear the list, i.e. set size to zero.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
const word & timeName() const noexcept
The current time name.
T & first()
Access first element of the list, position [0].
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Intermediate abstract class for handling face-set options for the derived faOptions.
labelList faces_
Set of faces to apply source to.
void setFaceSelection()
Set face selection based on user input selection mode.
wordRes selectionNames_
Face selection names (for set, zone or patch selections).
void setSelection(const dictionary &dict)
Set face selection name from dictionary input.
scalar A_
Sum of face area.
selectionModeType
Enumeration for selection mode types.
@ smPatch
"patch" : subset with (volume) patches
@ smFaceZone
"faceZone" : subset with (volume) zone faces
@ smAll
"all" finite-area faces
@ smFaceSet
"faceSet" : subset with (volume) face set
virtual bool read(const dictionary &dict)
Read source dictionary.
scalar duration_
Duration.
scalar timeStart_
Time start.
const wordRe & zoneName() const
Return const access to the first set/zone/patch name.
virtual bool isActive()
Is the source active?
faceSetOption(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh, const word &defaultAreaName=word())
Construct from components.
selectionModeType selectionMode_
Face selection mode.
static const Enum< selectionModeType > selectionModeTypeNames_
List of selection mode type names.
bool inTimeLimits(const scalar timeValue) const
Return true if within time limits.
void setArea()
Recalculate the area.
const fvMesh & mesh() const noexcept
Return const access to the volume mesh.
virtual bool read(const dictionary &dict)
Read source dictionary.
const fvMesh & mesh_
Reference to the mesh database.
virtual bool isActive()
Is the source active?
dictionary coeffs_
Dictionary containing source coefficients.
const word & name() const noexcept
The source name.
option(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh, const word &defaultAreaName=word())
Construct from components.
const faMesh & regionMesh() const
Return the region mesh database (demand-driven).
Mesh data needed to do the Finite Volume discretisation.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelIOList & zoneIDs
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for finite-area.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
Extract elements of the input list when select is true.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
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...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.