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;
225 if (startSampleTime_ == -1 && endSampleTime_ == -1)
251 polyMesh::meshSubDir,
258 meshPts =
pointField(points0, this->patch().meshPoints());
264 this->db().time().constant()
266 /this->patch().
name()
276 && mapMethod_ !=
"planarInterpolation" 293 const fileName samplePointsDir = samplePointsFile.
path();
294 sampleTimes_ = Time::findTimes(samplePointsDir);
298 Info<<
"timeVaryingMappedFixedValuePointPatchField : In directory " 299 << samplePointsDir <<
" found times " 300 << pointToPointPlanarInterpolation::timeNames(sampleTimes_)
309 bool foundTime = mapperPtr_().findTime
313 this->db().time().value(),
321 <<
"Cannot find starting sampling values for current time " 322 << this->db().time().value() <<
nl 323 <<
"Have sampling values for times " 324 << pointToPointPlanarInterpolation::timeNames(sampleTimes_) <<
nl 326 << this->db().time().constant()/
"boundaryData"/this->patch().name()
327 <<
"\n on patch " << this->patch().name()
328 <<
" of field " << fieldTableName_
335 if (lo != startSampleTime_)
337 startSampleTime_ = lo;
339 if (startSampleTime_ == endSampleTime_)
344 Pout<<
"checkTable : Setting startValues to (already read) " 346 /this->patch().
name()
347 /sampleTimes_[startSampleTime_].
name()
350 startSampledValues_ = endSampledValues_;
351 startAverage_ = endAverage_;
357 Pout<<
"checkTable : Reading startValues from " 359 /this->patch().
name()
360 /sampleTimes_[lo].
name()
367 this->db().time().constant()
369 /this->patch().
name()
370 /sampleTimes_[startSampleTime_].
name()
380 startAverage_ = avals.
average();
387 if (vals.
size() != mapperPtr_().sourceSize())
390 <<
"Number of values (" << vals.
size()
391 <<
") differs from the number of points (" 392 << mapperPtr_().sourceSize()
396 startSampledValues_ = mapperPtr_().interpolate(vals);
400 if (hi != endSampleTime_)
404 if (endSampleTime_ == -1)
409 Pout<<
"checkTable : Clearing endValues" <<
endl;
411 endSampledValues_.clear();
417 Pout<<
"checkTable : Reading endValues from " 419 /this->patch().
name()
420 /sampleTimes_[endSampleTime_].
name()
427 this->db().time().constant()
429 /this->patch().
name()
430 /sampleTimes_[endSampleTime_].
name()
447 if (vals.
size() != mapperPtr_().sourceSize())
450 <<
"Number of values (" << vals.
size()
451 <<
") differs from the number of points (" 452 << mapperPtr_().sourceSize()
456 endSampledValues_ = mapperPtr_().interpolate(vals);
476 if (endSampleTime_ == -1)
481 Pout<<
"updateCoeffs : Sampled, non-interpolated values" 482 <<
" from start time:" 483 << sampleTimes_[startSampleTime_].
name() <<
nl;
487 wantedAverage = startAverage_;
491 scalar start = sampleTimes_[startSampleTime_].value();
492 scalar end = sampleTimes_[endSampleTime_].value();
494 scalar
s = (this->db().time().value()-start)/(end-start);
498 Pout<<
"updateCoeffs : Sampled, interpolated values" 499 <<
" between start time:" 500 << sampleTimes_[startSampleTime_].
name()
501 <<
" and end time:" << sampleTimes_[endSampleTime_].
name()
502 <<
" with weight:" << s <<
endl;
505 this->
operator==((1-s)*startSampledValues_ + s*endSampledValues_);
506 wantedAverage = (1-
s)*startAverage_ + s*endAverage_;
519 Pout<<
"updateCoeffs :" 520 <<
" actual average:" << averagePsi
521 <<
" wanted average:" << wantedAverage
525 if (
mag(averagePsi) < vSmall)
528 const Type offset = wantedAverage - averagePsi;
531 Pout<<
"updateCoeffs :" 532 <<
" offsetting with:" << offset <<
endl;
538 const scalar scale =
mag(wantedAverage)/
mag(averagePsi);
542 Pout<<
"updateCoeffs :" 543 <<
" scaling with:" << scale <<
endl;
552 const scalar t = this->db().time().timeOutputValue();
558 Pout<<
"updateCoeffs : set fixedValue to min:" <<
gMin(*
this)
559 <<
" max:" <<
gMax(*
this)
583 this->internalField().
name(),
591 word(
"planarInterpolation"),
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const fileName & name() const
Return the name of the stream.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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.
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.
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
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.