Go to the documentation of this file.
44 fieldTableName_(iF.name()),
50 startSampledValues_(0),
69 fieldTableName_(iF.name()),
70 setAverage_(
dict.lookupOrDefault(
"setAverage",
false)),
71 perturb_(
dict.lookupOrDefault(
"perturb", 1
e-5)),
83 startSampledValues_(0),
90 if (
dict.found(
"offset"))
97 mapMethod_ !=
"planarInterpolation"
98 && 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_.clone())
161 fieldTableName_(ptf.fieldTableName_),
162 setAverage_(ptf.setAverage_),
163 perturb_(ptf.perturb_),
164 mapMethod_(ptf.mapMethod_),
165 mapperPtr_(ptf.mapperPtr_),
166 sampleTimes_(ptf.sampleTimes_),
167 startSampleTime_(ptf.startSampleTime_),
168 startSampledValues_(ptf.startSampledValues_),
169 startAverage_(ptf.startAverage_),
170 endSampleTime_(ptf.endSampleTime_),
171 endSampledValues_(ptf.endSampledValues_),
172 endAverage_(ptf.endAverage_),
173 offset_(ptf.offset_.clone())
186 fieldTableName_(ptf.fieldTableName_),
187 setAverage_(ptf.setAverage_),
188 perturb_(ptf.perturb_),
189 mapMethod_(ptf.mapMethod_),
190 mapperPtr_(ptf.mapperPtr_),
191 sampleTimes_(ptf.sampleTimes_),
192 startSampleTime_(ptf.startSampleTime_),
193 startSampledValues_(ptf.startSampledValues_),
194 startAverage_(ptf.startAverage_),
195 endSampleTime_(ptf.endSampleTime_),
196 endSampledValues_(ptf.endSampledValues_),
197 endAverage_(ptf.endAverage_),
198 offset_(ptf.offset_.clone())
211 if (startSampledValues_.size())
213 startSampledValues_.autoMap(m);
214 endSampledValues_.autoMap(m);
218 startSampleTime_ = -1;
233 refCast<const timeVaryingMappedFixedValuePointPatchField<Type>>(ptf);
235 startSampledValues_.
rmap(tiptf.startSampledValues_, addr);
236 endSampledValues_.rmap(tiptf.endSampledValues_, addr);
240 startSampleTime_ = -1;
249 if (startSampleTime_ == -1 && endSampleTime_ == -1)
251 const polyMesh& pMesh = this->
patch().boundaryMesh().mesh()();
275 polyMesh::meshSubDir,
288 this->db().time().caseConstant()
300 && mapMethod_ !=
"planarInterpolation"
317 const fileName samplePointsDir = samplePointsFile.
path();
318 sampleTimes_ = Time::findTimes(samplePointsDir);
322 Info<<
"timeVaryingMappedFixedValuePointPatchField : In directory "
323 << samplePointsDir <<
" found times "
324 << pointToPointPlanarInterpolation::timeNames(sampleTimes_)
333 bool foundTime = mapperPtr_().findTime
337 this->db().time().value(),
345 <<
"Cannot find starting sampling values for current time "
346 << this->db().time().value() <<
nl
347 <<
"Have sampling values for times "
348 << pointToPointPlanarInterpolation::timeNames(sampleTimes_) <<
nl
350 << this->db().time().constant()/
"boundaryData"/this->
patch().name()
351 <<
"\n on patch " << this->
patch().name()
352 <<
" of field " << fieldTableName_
359 if (lo != startSampleTime_)
361 startSampleTime_ = lo;
363 if (startSampleTime_ == endSampleTime_)
368 Pout<<
"checkTable : Setting startValues to (already read) "
370 /this->
patch().name()
371 /sampleTimes_[startSampleTime_].name()
374 startSampledValues_ = endSampledValues_;
375 startAverage_ = endAverage_;
381 Pout<<
"checkTable : Reading startValues from "
383 /this->
patch().name()
384 /sampleTimes_[lo].name()
391 this->db().time().caseConstant()
394 /sampleTimes_[startSampleTime_].
name()
404 startAverage_ = avals.
average();
411 if (vals.size() != mapperPtr_().sourceSize())
414 <<
"Number of values (" << vals.size()
415 <<
") differs from the number of points ("
416 << mapperPtr_().sourceSize()
420 startSampledValues_ = mapperPtr_().interpolate(vals);
424 if (hi != endSampleTime_)
428 if (endSampleTime_ == -1)
433 Pout<<
"checkTable : Clearing endValues" <<
endl;
435 endSampledValues_.clear();
441 Pout<<
"checkTable : Reading endValues from "
443 /this->
patch().name()
444 /sampleTimes_[endSampleTime_].name()
451 this->db().time().caseConstant()
454 /sampleTimes_[endSampleTime_].
name()
471 if (vals.size() != mapperPtr_().sourceSize())
474 <<
"Number of values (" << vals.size()
475 <<
") differs from the number of points ("
476 << mapperPtr_().sourceSize()
480 endSampledValues_ = mapperPtr_().interpolate(vals);
500 if (endSampleTime_ == -1)
505 Pout<<
"updateCoeffs : Sampled, non-interpolated values"
506 <<
" from start time:"
507 << sampleTimes_[startSampleTime_].
name() <<
nl;
511 wantedAverage = startAverage_;
515 scalar
start = sampleTimes_[startSampleTime_].value();
516 scalar
end = sampleTimes_[endSampleTime_].value();
522 Pout<<
"updateCoeffs : Sampled, interpolated values"
523 <<
" between start time:"
524 << sampleTimes_[startSampleTime_].
name()
525 <<
" and end time:" << sampleTimes_[endSampleTime_].
name()
526 <<
" with weight:" <<
s <<
endl;
529 this->
operator==((1-s)*startSampledValues_ +
s*endSampledValues_);
530 wantedAverage = (1-
s)*startAverage_ +
s*endAverage_;
543 Pout<<
"updateCoeffs :"
544 <<
" actual average:" << averagePsi
545 <<
" wanted average:" << wantedAverage
549 if (
mag(averagePsi) < VSMALL)
552 const Type offset = wantedAverage - averagePsi;
555 Pout<<
"updateCoeffs :"
556 <<
" offsetting with:" << offset <<
endl;
562 const scalar scale =
mag(wantedAverage)/
mag(averagePsi);
566 Pout<<
"updateCoeffs :"
567 <<
" scaling with:" << scale <<
endl;
576 const scalar t = this->db().time().timeOutputValue();
582 Pout<<
"updateCoeffs : set fixedValue to min:" <<
gMin(*
this)
583 <<
" max:" <<
gMax(*
this)
605 this->internalField().
name(),
612 "planarInterpolation",
618 offset_->writeData(os);
int debug
Static debugging option.
vectorField pointField
pointField is a vectorField.
virtual const pointField & points() const
Return raw points.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
A class for handling words, derived from Foam::string.
A class for handling file names.
A primitive field of type <T> with automated input and output.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
static std::string path(const std::string &str)
Return directory path name (part before last /)
static constexpr const zero Zero
Global zero.
Input from file stream, using an ISstream.
Type gAverage(const FieldField< Field, Type > &f)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
const fileName & facesInstance() const
Return the current instance directory for faces.
Interpolates between two sets of unstructured points using 2D Delaunay triangulation....
const Type & average() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
Basic pointPatch represents a set of points from the mesh.
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
Abstract base class for point-mesh patch fields.
Mesh consisting of general polyhedral cells.
Foam::pointPatchFieldMapper.
const fileName & pointsInstance() const
Return the current instance directory for points.
A FixedValue boundary condition for pointField.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Generic templated field type.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
messageStream Info
Information stream (uses stdout - output is on the master only)
A time-varying form of a mapped fixed value boundary condition.
word name(const complex &c)
Return string representation of complex.
virtual const fileName & name() const
Return the name of the stream.
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given PointPatchField onto.
virtual void write(Ostream &) const
Write.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
A primitive field with a separate average value.
timeVaryingMappedFixedValuePointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false)))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const std::string patch
OpenFOAM patch number as a std::string.
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label ListType::const_reference const label start
const dimensionedScalar e
Elementary charge.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Type gMin(const FieldField< Field, Type > &f)
void checkTable()
Find boundary data inbetween current time and interpolate.
Type gMax(const FieldField< Field, Type > &f)
string evaluate(const std::string &s, size_t pos=0, size_t len=std::string::npos)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...