42 fieldTableName_(iF.
name()),
48 startSampledValues_(0),
67 fieldTableName_(iF.name()),
68 setAverage_(dict.lookupOrDefault(
"setAverage",
false)),
69 perturb_(dict.lookupOrDefault(
"perturb", 1
e-5)),
72 dict.lookupOrDefault<
word>
81 startSampledValues_(0),
88 if (dict.found(
"offset"))
95 mapMethod_ !=
"planarInterpolation" 96 && mapMethod_ !=
"nearest" 102 ) <<
"mapMethod should be one of 'planarInterpolation'" 106 dict.readIfPresent(
"fieldTableName", fieldTableName_);
108 if (dict.found(
"value"))
137 fieldTableName_(ptf.fieldTableName_),
138 setAverage_(ptf.setAverage_),
139 perturb_(ptf.perturb_),
140 mapMethod_(ptf.mapMethod_),
143 startSampleTime_(-1),
144 startSampledValues_(0),
147 endSampledValues_(0),
149 offset_(ptf.offset_,
false)
162 fieldTableName_(ptf.fieldTableName_),
163 setAverage_(ptf.setAverage_),
164 perturb_(ptf.perturb_),
165 mapMethod_(ptf.mapMethod_),
166 mapperPtr_(ptf.mapperPtr_),
167 sampleTimes_(ptf.sampleTimes_),
168 startSampleTime_(ptf.startSampleTime_),
169 startSampledValues_(ptf.startSampledValues_),
170 startAverage_(ptf.startAverage_),
171 endSampleTime_(ptf.endSampleTime_),
172 endSampledValues_(ptf.endSampledValues_),
173 endAverage_(ptf.endAverage_),
174 offset_(ptf.offset_,
false)
187 if (startSampledValues_.size())
189 m(startSampledValues_, startSampledValues_);
190 m(endSampledValues_, endSampledValues_);
194 startSampleTime_ = -1;
209 refCast<const timeVaryingMappedFixedValuePointPatchField<Type>>(ptf);
211 startSampledValues_.
rmap(tiptf.startSampledValues_, addr);
212 endSampledValues_.rmap(tiptf.endSampledValues_, addr);
216 startSampleTime_ = -1;
230 refCast<const timeVaryingMappedFixedValuePointPatchField<Type>>(ptf);
232 startSampledValues_.
reset(tiptf.startSampledValues_);
233 endSampledValues_.reset(tiptf.endSampledValues_);
237 startSampleTime_ = -1;
246 if (startSampleTime_ == -1 && endSampleTime_ == -1)
272 polyMesh::meshSubDir,
279 meshPts =
pointField(points0, this->patch().meshPoints());
285 this->db().time().constant()
287 /this->patch().
name()
297 && mapMethod_ !=
"planarInterpolation" 314 const fileName samplePointsDir = samplePointsFile.
path();
315 sampleTimes_ = Time::findTimes(samplePointsDir);
319 Info<<
"timeVaryingMappedFixedValuePointPatchField : In directory " 320 << samplePointsDir <<
" found times " 321 << pointToPointPlanarInterpolation::timeNames(sampleTimes_)
330 bool foundTime = mapperPtr_().findTime
334 this->db().time().value(),
342 <<
"Cannot find starting sampling values for current time " 343 << this->db().time().value() <<
nl 344 <<
"Have sampling values for times " 345 << pointToPointPlanarInterpolation::timeNames(sampleTimes_) <<
nl 347 << this->db().time().constant()/
"boundaryData"/this->patch().name()
348 <<
"\n on patch " << this->patch().name()
349 <<
" of field " << fieldTableName_
356 if (lo != startSampleTime_)
358 startSampleTime_ = lo;
360 if (startSampleTime_ == endSampleTime_)
365 Pout<<
"checkTable : Setting startValues to (already read) " 367 /this->patch().
name()
368 /sampleTimes_[startSampleTime_].
name()
371 startSampledValues_ = endSampledValues_;
372 startAverage_ = endAverage_;
378 Pout<<
"checkTable : Reading startValues from " 380 /this->patch().
name()
381 /sampleTimes_[lo].
name()
388 this->db().time().constant()
390 /this->patch().
name()
391 /sampleTimes_[startSampleTime_].
name()
401 startAverage_ = avals.
average();
408 if (vals.
size() != mapperPtr_().sourceSize())
411 <<
"Number of values (" << vals.
size()
412 <<
") differs from the number of points (" 413 << mapperPtr_().sourceSize()
417 startSampledValues_ = mapperPtr_().interpolate(vals);
421 if (hi != endSampleTime_)
425 if (endSampleTime_ == -1)
430 Pout<<
"checkTable : Clearing endValues" <<
endl;
432 endSampledValues_.clear();
438 Pout<<
"checkTable : Reading endValues from " 440 /this->patch().
name()
441 /sampleTimes_[endSampleTime_].
name()
448 this->db().time().constant()
450 /this->patch().
name()
451 /sampleTimes_[endSampleTime_].
name()
468 if (vals.
size() != mapperPtr_().sourceSize())
471 <<
"Number of values (" << vals.
size()
472 <<
") differs from the number of points (" 473 << mapperPtr_().sourceSize()
477 endSampledValues_ = mapperPtr_().interpolate(vals);
497 if (endSampleTime_ == -1)
502 Pout<<
"updateCoeffs : Sampled, non-interpolated values" 503 <<
" from start time:" 504 << sampleTimes_[startSampleTime_].
name() <<
nl;
508 wantedAverage = startAverage_;
512 scalar start = sampleTimes_[startSampleTime_].value();
513 scalar end = sampleTimes_[endSampleTime_].value();
515 scalar
s = (this->db().time().value()-start)/(end-start);
519 Pout<<
"updateCoeffs : Sampled, interpolated values" 520 <<
" between start time:" 521 << sampleTimes_[startSampleTime_].
name()
522 <<
" and end time:" << sampleTimes_[endSampleTime_].
name()
523 <<
" with weight:" << s <<
endl;
526 this->
operator==((1-s)*startSampledValues_ + s*endSampledValues_);
527 wantedAverage = (1-
s)*startAverage_ + s*endAverage_;
540 Pout<<
"updateCoeffs :" 541 <<
" actual average:" << averagePsi
542 <<
" wanted average:" << wantedAverage
546 if (
mag(averagePsi) < vSmall)
549 const Type offset = wantedAverage - averagePsi;
552 Pout<<
"updateCoeffs :" 553 <<
" offsetting with:" << offset <<
endl;
559 const scalar scale =
mag(wantedAverage)/
mag(averagePsi);
563 Pout<<
"updateCoeffs :" 564 <<
" scaling with:" << scale <<
endl;
573 const scalar t = this->db().time().userTimeValue();
579 Pout<<
"updateCoeffs : set fixedValue to min:" <<
gMin(*
this)
580 <<
" max:" <<
gMax(*
this)
604 this->internalField().
name(),
612 word(
"planarInterpolation"),
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const fileName & name() const
Return the name of the stream.
const word & name() const
Return name.
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given pointPatchField onto this pointPatchField.
A class for handling file names.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
void checkTable()
Find boundary data in between current time and interpolate.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & facesInstance() const
Return the current instance directory for faces.
A time-varying form of a mapped fixed value boundary condition.
void evaluate(GeometricField< Type, PatchField, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, PatchField, GeoMesh > &x)
A list of keyword definitions, which are a keyword followed by any number of values (e...
A primitive field with a separate average value.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type gMin(const FieldField< Field, Type > &f)
A FixedValue boundary condition for pointField.
void size(const label)
Override size to be inconsistent with allocated storage.
void writeEntryIfDifferent(Ostream &os, const word &entryName, const EntryType &value1, const EntryType &value2)
Helper function to write the keyword and entry only if the.
Foam::pointPatchFieldMapper.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
label size() const
Return size.
timeVaryingMappedFixedValuePointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
virtual const pointField & points() const
Return raw points.
Abstract base class for point-mesh patch fields.
virtual void write(Ostream &) const
Write.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
vectorField pointField
pointField is a vectorField.
const fileName & pointsInstance() const
Return the current instance directory for points.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Pre-declare SubField and related Field type.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
A class for handling words, derived from string.
word name() const
Return file name (part beyond last /)
const polyMesh & mesh() const
Return the mesh reference.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Type gMax(const FieldField< Field, Type > &f)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
word name(const complex &)
Return a string representation of a complex.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Basic pointPatch represents a set of points from the mesh.
Type gAverage(const FieldField< Field, Type > &f)
prefixOSstream Pout(cout, "Pout")
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensioned< scalar > mag(const dimensioned< Type > &)
fileName path() const
Return directory path name (part before last /)
Mesh consisting of general polyhedral cells.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const Type & average() const
A primitive field of type <T> with automated input and output.
const dimensionedScalar e
Elementary charge.
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Interpolates between two sets of unstructured points using 2D Delaunay triangulation. Used in e.g. timeVaryingMapped bcs.
virtual void reset(const pointPatchField< Type > &)
Reset the pointPatchField to the given pointPatchField.