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] =
154 subDict.getOrDefault<DynamicList<Type>>
161 subDict.getOrDefault<DynamicList<scalar>>
164 DynamicList<scalar>()
183 const outletMappedUniformInletFvPatchField<Type>& ptf,
185 const DimensionedField<Type, volMesh>& iF,
186 const fvPatchFieldMapper& mapper
189 fixedValueFvPatchField<Type>(ptf,
p, iF, mapper),
190 uniformValuePtr_(ptf.uniformValuePtr_.clone(
p.
patch())),
191 outletNames_(ptf.outletNames_),
192 offsets_(ptf.offsets_),
193 fractions_(ptf.fractions_),
194 timeDelays_(ptf.timeDelays_),
195 mapFields_(ptf.mapFields_),
196 mapTimes_(ptf.mapTimes_),
197 phiName_(ptf.phiName_),
200 if (mapper.direct() && !mapper.hasUnmapped())
203 this->
map(ptf, mapper);
217 const outletMappedUniformInletFvPatchField<Type>& ptf
220 fixedValueFvPatchField<Type>(ptf),
221 uniformValuePtr_(ptf.uniformValuePtr_.clone(this->
patch().
patch())),
222 outletNames_(ptf.outletNames_),
223 offsets_(ptf.offsets_),
224 fractions_(ptf.fractions_),
225 timeDelays_(ptf.timeDelays_),
226 mapFields_(ptf.mapFields_),
227 mapTimes_(ptf.mapTimes_),
228 phiName_(ptf.phiName_),
242 uniformValuePtr_(ptf.uniformValuePtr_.clone(this->
patch().
patch())),
243 outletNames_(ptf.outletNames_),
244 offsets_(ptf.offsets_),
245 fractions_(ptf.fractions_),
246 timeDelays_(ptf.timeDelays_),
247 mapFields_(ptf.mapFields_),
248 mapTimes_(ptf.mapTimes_),
249 phiName_(ptf.phiName_),
264 if (uniformValuePtr_)
266 uniformValuePtr_->autoMap(m);
274 const fvPatchField<Type>& ptf,
281 refCast<const outletMappedUniformInletFvPatchField>(ptf);
283 if (uniformValuePtr_)
285 uniformValuePtr_->rmap(tiptf.uniformValuePtr_(), addr);
298 if (curTimeIndex_ != this->db().time().
timeIndex())
300 const scalar t = this->db().time().timeOutputValue();
302 const GeometricField<Type, fvPatchField, volMesh>&
f 304 dynamic_cast<const GeometricField<Type, fvPatchField, volMesh>&
> 306 this->internalField()
310 const fvPatch&
p = this->
patch();
314 const word& outletName = outletNames_[i];
315 const label outletID =
316 p.patch().boundaryMesh().findPatchID(outletName);
321 <<
"Unable to find outlet patch " << outletName
327 DynamicList<scalar>& mapTime = mapTimes_[i];
328 scalar timeDelay = 0;
329 if (timeDelays_.set(i))
331 timeDelay =
max(timeDelays_[i].value(t), scalar(0));
333 mapTime.append(t + timeDelay);
337 const fvPatchField<Type>& outletFld =
f.boundaryField()[outletID];
338 DynamicList<Type>& mapField = mapFields_[i];
341 this->db().objectRegistry::template
342 lookupObject<surfaceScalarField>(phiName_);
344 const scalar sumOutletPhi =
gSum(outletPhi);
346 if (sumOutletPhi > SMALL)
351 offset = offsets_[i].value(t);
355 if (fractions_.set(i))
357 fraction = fractions_[i].value(t);
362 gSum(outletPhi*outletFld)/sumOutletPhi*fraction
368 const fvPatch& outlet =
p.boundaryMesh()[outletID];
372 gSum(outlet.magSf()*outletFld)/
gSum(outlet.magSf())
382 DynamicList<scalar>& mapTime = mapTimes_[i];
383 DynamicList<Type>& mapField = mapFields_[i];
385 if (!mapTime.empty())
387 if (t >= mapTime.first())
393 while (!mapTime.empty() && t >= mapTime[i])
404 if (uniformValuePtr_)
406 this->
operator==(inletFld + uniformValuePtr_->value(t));
414 curTimeIndex_ = this->db().time().timeIndex();
427 if (uniformValuePtr_)
429 uniformValuePtr_->writeData(
os);
437 offsets_[i].writeData(
os);
439 if (fractions_.set(i))
441 fractions_[i].writeData(
os);
443 if (timeDelays_.set(i))
445 timeDelays_[i].writeData(
os);
447 if (!mapFields_.empty())
451 if (!mapTimes_.empty())
bool readValueEntry(const dictionary &dict, IOobjectOption::readOption readOpt=IOobjectOption::LAZY_READ)
Read the "value" entry into *this.
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
const objectRegistry & db() const
The associated objectRegistry.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
void extrapolateInternal()
Assign the patch field from the internal field.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
virtual void write(Ostream &) const
Write.
#define forAll(list, i)
Loop across all elements in list.
void setSize(const label n)
Alias for resize()
Type gSum(const FieldField< Field, Type > &f)
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Interpolates y values from one curve to another with a different x distribution.
A FieldMapper for finite-volume patch fields.
virtual Ostream & endBlock()
Write end block group.
static const word null
An empty word.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Field< Type > interpolateXY(const scalarField &xNew, const scalarField &xOld, const Field< Type > &yOld)
errorManip< error > abort(error &err)
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
void map(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 map from the given field
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
OBJstream os(runTime.globalPath()/outputName)
static autoPtr< Function1< Type > > NewIfPresent(const word &entryName, const dictionary &dict, const word &redirectType, const objectRegistry *obrPtr=nullptr)
An optional selector, with fallback redirection.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const std::string patch
OpenFOAM patch number as a std::string.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
List< label > labelList
A List of labels.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)