45 uniformValuePtr_(nullptr),
82 phiName_(
dict.getOrDefault<
word>(
"phi",
"phi")),
87 if (outletDict.empty())
90 <<
"outlets dictionary is empty."
94 outletNames_.
setSize(outletDict.size());
95 offsets_.setSize(outletDict.size());
96 fractions_.setSize(outletDict.size());
97 timeDelays_.setSize(outletDict.size());
98 mapFields_.setSize(outletDict.size());
99 mapTimes_.setSize(outletDict.size());
102 for (
const entry& dEntry : outletDict)
104 const word& key = dEntry.keyword();
106 if (!dEntry.isDict())
109 <<
"Entry " << key <<
" is not a dictionary." <<
nl
115 outletNames_[outleti] = key;
153 mapFields_[outleti] =
196 uniformValuePtr_(ptf.uniformValuePtr_.clone(
p.patch())),
197 outletNames_(ptf.outletNames_),
198 offsets_(ptf.offsets_),
199 fractions_(ptf.fractions_),
200 timeDelays_(ptf.timeDelays_),
201 mapFields_(ptf.mapFields_),
202 mapTimes_(ptf.mapTimes_),
203 phiName_(ptf.phiName_),
209 this->
map(ptf, mapper);
226 uniformValuePtr_(ptf.uniformValuePtr_.clone(this->patch().patch())),
227 outletNames_(ptf.outletNames_),
228 offsets_(ptf.offsets_),
229 fractions_(ptf.fractions_),
230 timeDelays_(ptf.timeDelays_),
231 mapFields_(ptf.mapFields_),
232 mapTimes_(ptf.mapTimes_),
233 phiName_(ptf.phiName_),
247 uniformValuePtr_(ptf.uniformValuePtr_.clone(this->patch().patch())),
248 outletNames_(ptf.outletNames_),
249 offsets_(ptf.offsets_),
250 fractions_(ptf.fractions_),
251 timeDelays_(ptf.timeDelays_),
252 mapFields_(ptf.mapFields_),
253 mapTimes_(ptf.mapTimes_),
254 phiName_(ptf.phiName_),
269 if (uniformValuePtr_)
271 uniformValuePtr_->autoMap(m);
286 refCast<const outletMappedUniformInletFvPatchField>(ptf);
288 if (uniformValuePtr_)
290 uniformValuePtr_->rmap(tiptf.uniformValuePtr_(), addr);
303 if (curTimeIndex_ != this->db().time().
timeIndex())
305 const scalar t = this->db().time().timeOutputValue();
311 this->internalField()
319 const word& outletName = outletNames_[i];
320 const label outletID =
321 p.patch().boundaryMesh().findPatchID(outletName);
326 <<
"Unable to find outlet patch " << outletName
333 scalar timeDelay = 0;
334 if (timeDelays_.set(i))
336 timeDelay =
max(timeDelays_[i].value(t), scalar(0));
338 mapTime.
append(t + timeDelay);
346 this->db().objectRegistry::template
347 lookupObject<surfaceScalarField>(phiName_);
349 const scalar sumOutletPhi =
gSum(outletPhi);
351 if (sumOutletPhi > SMALL)
356 offset = offsets_[i].value(t);
360 if (fractions_.set(i))
362 fraction = fractions_[i].value(t);
367 gSum(outletPhi*outletFld)/sumOutletPhi*fraction
373 const fvPatch& outlet =
p.boundaryMesh()[outletID];
390 if (!mapTime.
empty())
392 if (t >= mapTime.
first())
398 while (!mapTime.
empty() && t >= mapTime[i])
409 if (uniformValuePtr_)
411 this->
operator==(inletFld + uniformValuePtr_->value(t));
419 curTimeIndex_ = this->db().time().timeIndex();
432 if (uniformValuePtr_)
434 uniformValuePtr_->writeData(
os);
442 offsets_[i].writeData(
os);
444 if (fractions_.set(i))
446 fractions_[i].writeData(
os);
448 if (timeDelays_.set(i))
450 timeDelays_[i].writeData(
os);
452 if (!mapFields_.empty())
456 if (!mapTimes_.empty())
465 this->writeEntry(
"value",
os);
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
T remove()
Remove and return the last element. Fatal on an empty list.
void append(const T &val)
Copy append an element to the end of this list.
virtual bool direct() const =0
Is it a direct (non-interpolating) mapper?
virtual bool hasUnmapped() const =0
Any unmapped values?
Generic templated field type.
void map(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 map from the given field
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void setSize(const label n)
Alias for resize()
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & endBlock()
Write end block group.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
T & first()
Return the first element of the list.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
void size(const label n)
Older name for setAddressableSize.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
void rmap(const atmBoundaryLayer &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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 found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
A keyword and a list of tokens is an 'entry'.
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
const objectRegistry & db() const
Return local objectRegistry.
virtual void operator=(const UList< Type > &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
const scalarField & magSf() const
Return face area magnitudes.
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
Interpolates y values from one curve to another with a different x distribution.
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)
Field< Type > interpolateXY(const scalarField &xNew, const scalarField &xOld, const Field< Type > &yOld)
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.