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 113 const dictionary& subDict = dEntry.dict();
115 outletNames_[outleti] =
key;
153 mapFields_[outleti] =
154 subDict.getOrDefault<DynamicList<Type>>
161 subDict.getOrDefault<DynamicList<scalar>>
164 DynamicList<scalar>()
171 if (
dict.found(
"value"))
175 Field<Type>(
"value",
dict,
p.size())
189 const outletMappedUniformInletFvPatchField<Type>& ptf,
191 const DimensionedField<Type, volMesh>& iF,
192 const fvPatchFieldMapper& mapper
195 fixedValueFvPatchField<Type>(ptf,
p, iF, mapper),
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_),
206 if (mapper.direct() && !mapper.hasUnmapped())
209 this->
map(ptf, mapper);
222 const outletMappedUniformInletFvPatchField<Type>& ptf
225 fixedValueFvPatchField<Type>(ptf),
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);
279 const fvPatchField<Type>& ptf,
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();
307 const GeometricField<Type, fvPatchField, volMesh>&
f 309 dynamic_cast<const GeometricField<Type, fvPatchField, volMesh>&
> 311 this->internalField()
315 const fvPatch&
p = this->
patch();
319 const word& outletName = outletNames_[i];
320 const label outletID =
321 p.patch().boundaryMesh().findPatchID(outletName);
326 <<
"Unable to find outlet patch " << outletName
332 DynamicList<scalar>& mapTime = mapTimes_[i];
333 scalar timeDelay = 0;
334 if (timeDelays_.set(i))
336 timeDelay =
max(timeDelays_[i].value(t), scalar(0));
338 mapTime.append(t + timeDelay);
342 const fvPatchField<Type>& outletFld =
f.boundaryField()[outletID];
343 DynamicList<Type>& mapField = mapFields_[i];
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];
377 gSum(outlet.magSf()*outletFld)/
gSum(outlet.magSf())
387 DynamicList<scalar>& mapTime = mapTimes_[i];
388 DynamicList<Type>& mapField = mapFields_[i];
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);
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
static autoPtr< Function1< Type > > NewIfPresent(const word &entryName, const dictionary &dict, const word &redirectType=word::null, const objectRegistry *obrPtr=nullptr)
An optional selector.
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.
friend Ostream & operator(Ostream &, const fvPatchField< Type > &)
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.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/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...
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
OBJstream os(runTime.globalPath()/outputName)
#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.
virtual void operator=(const UList< Type > &)
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)