42 fieldTableName_(iF.
name()),
48 startSampledValues_(0),
69 fieldTableName_(ptf.fieldTableName_),
70 setAverage_(ptf.setAverage_),
71 perturb_(ptf.perturb_),
72 mapMethod_(ptf.mapMethod_),
76 startSampledValues_(0),
84 ? ptf.offset_().
clone().ptr()
101 fieldTableName_(iF.
name()),
109 "planarInterpolation" 114 startSampleTime_(-1),
115 startSampledValues_(0),
118 endSampledValues_(0),
122 if (dict.
found(
"offset"))
129 if (dict.
found(
"value"))
156 fieldTableName_(ptf.fieldTableName_),
157 setAverage_(ptf.setAverage_),
158 perturb_(ptf.perturb_),
159 mapMethod_(ptf.mapMethod_),
160 mapperPtr_(ptf.mapperPtr_),
161 sampleTimes_(ptf.sampleTimes_),
162 startSampleTime_(ptf.startSampleTime_),
163 startSampledValues_(ptf.startSampledValues_),
164 startAverage_(ptf.startAverage_),
165 endSampleTime_(ptf.endSampleTime_),
166 endSampledValues_(ptf.endSampledValues_),
167 endAverage_(ptf.endAverage_),
171 ? ptf.offset_().clone().ptr()
187 fieldTableName_(ptf.fieldTableName_),
188 setAverage_(ptf.setAverage_),
189 perturb_(ptf.perturb_),
190 mapMethod_(ptf.mapMethod_),
191 mapperPtr_(ptf.mapperPtr_),
192 sampleTimes_(ptf.sampleTimes_),
193 startSampleTime_(ptf.startSampleTime_),
194 startSampledValues_(ptf.startSampledValues_),
195 startAverage_(ptf.startAverage_),
196 endSampleTime_(ptf.endSampleTime_),
197 endSampledValues_(ptf.endSampledValues_),
198 endAverage_(ptf.endAverage_),
202 ? ptf.offset_().
clone().ptr()
217 if (startSampledValues_.size())
219 startSampledValues_.autoMap(m);
220 endSampledValues_.autoMap(m);
224 startSampleTime_ = -1;
239 refCast<const timeVaryingMappedFixedValuePointPatchField<Type>>(ptf);
241 startSampledValues_.
rmap(tiptf.startSampledValues_, addr);
242 endSampledValues_.rmap(tiptf.endSampledValues_, addr);
246 startSampleTime_ = -1;
255 if (startSampleTime_ == -1 && endSampleTime_ == -1)
281 polyMesh::meshSubDir,
288 meshPts =
pointField(points0, this->patch().meshPoints());
297 "boundaryData"/this->patch().
name(),
300 IOobject::AUTO_WRITE,
309 && mapMethod_ !=
"planarInterpolation" 327 const fileName samplePointsDir = samplePointsFile.
path();
328 sampleTimes_ = Time::findTimes(samplePointsDir);
332 Info<<
"timeVaryingMappedFixedValuePointPatchField : In directory " 333 << samplePointsDir <<
" found times " 334 << pointToPointPlanarInterpolation::timeNames(sampleTimes_)
343 bool foundTime = mapperPtr_().findTime
347 this->db().time().value(),
355 <<
"Cannot find starting sampling values for current time " 356 << this->db().time().value() <<
nl 357 <<
"Have sampling values for times " 358 << pointToPointPlanarInterpolation::timeNames(sampleTimes_) <<
nl 360 << this->db().time().constant()/
"boundaryData"/this->patch().name()
361 <<
"\n on patch " << this->patch().name()
362 <<
" of field " << fieldTableName_
369 if (lo != startSampleTime_)
371 startSampleTime_ = lo;
373 if (startSampleTime_ == endSampleTime_)
378 Pout<<
"checkTable : Setting startValues to (already read) " 380 /this->patch().
name()
381 /sampleTimes_[startSampleTime_].
name()
384 startSampledValues_ = endSampledValues_;
385 startAverage_ = endAverage_;
391 Pout<<
"checkTable : Reading startValues from " 393 /this->patch().
name()
394 /sampleTimes_[lo].
name()
406 /this->patch().
name()
407 /sampleTimes_[startSampleTime_].
name(),
410 IOobject::AUTO_WRITE,
415 if (vals.
size() != mapperPtr_().sourceSize())
418 <<
"Number of values (" << vals.
size()
419 <<
") differs from the number of points (" 420 << mapperPtr_().sourceSize()
424 startAverage_ = vals.
average();
425 startSampledValues_ = mapperPtr_().interpolate(vals);
429 if (hi != endSampleTime_)
433 if (endSampleTime_ == -1)
438 Pout<<
"checkTable : Clearing endValues" <<
endl;
440 endSampledValues_.clear();
446 Pout<<
"checkTable : Reading endValues from " 448 /this->patch().
name()
449 /sampleTimes_[endSampleTime_].
name()
460 /this->patch().
name()
461 /sampleTimes_[endSampleTime_].
name(),
464 IOobject::AUTO_WRITE,
469 if (vals.
size() != mapperPtr_().sourceSize())
472 <<
"Number of values (" << vals.
size()
473 <<
") differs from the number of points (" 474 << mapperPtr_().sourceSize()
479 endSampledValues_ = mapperPtr_().interpolate(vals);
499 if (endSampleTime_ == -1)
504 Pout<<
"updateCoeffs : Sampled, non-interpolated values" 505 <<
" from start time:" 506 << sampleTimes_[startSampleTime_].
name() <<
nl;
510 wantedAverage = startAverage_;
514 scalar start = sampleTimes_[startSampleTime_].value();
515 scalar end = sampleTimes_[endSampleTime_].value();
517 scalar
s = (this->db().time().value()-start)/(end-start);
521 Pout<<
"updateCoeffs : Sampled, interpolated values" 522 <<
" between start time:" 523 << sampleTimes_[startSampleTime_].
name()
524 <<
" and end time:" << sampleTimes_[endSampleTime_].
name()
525 <<
" with weight:" << s <<
endl;
528 this->
operator==((1-s)*startSampledValues_ + s*endSampledValues_);
529 wantedAverage = (1-
s)*startAverage_ + s*endAverage_;
542 Pout<<
"updateCoeffs :" 543 <<
" actual average:" << averagePsi
544 <<
" wanted average:" << wantedAverage
548 if (
mag(averagePsi) < VSMALL)
551 const Type offset = wantedAverage - averagePsi;
554 Pout<<
"updateCoeffs :" 555 <<
" offsetting with:" << offset <<
endl;
561 const scalar scale =
mag(wantedAverage)/
mag(averagePsi);
565 Pout<<
"updateCoeffs :" 566 <<
" scaling with:" << scale <<
endl;
575 const scalar t = this->db().time().timeOutputValue();
581 Pout<<
"updateCoeffs : set fixedValue to min:" <<
gMin(*
this)
582 <<
" max:" <<
gMax(*
this)
597 os.
writeKeyword(
"setAverage") << setAverage_ << token::END_STATEMENT <<
nl;
598 if (perturb_ != 1
e-5)
600 os.
writeKeyword(
"perturb") << perturb_ << token::END_STATEMENT <<
nl;
603 if (fieldTableName_ != this->internalField().
name())
606 << token::END_STATEMENT <<
nl;
613 && mapMethod_ !=
"planarInterpolation" 618 << token::END_STATEMENT <<
nl;
623 offset_->writeData(os);
fileName objectPath() const
Return complete path + object name.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given PointPatchField onto.
A class for handling file names.
void checkTable()
Find boundary data inbetween current time and interpolate.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A time-varying form of a mapped fixed value boundary condition.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const fileName & facesInstance() const
Return the current instance directory for faces.
#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.
A primitive field + average with IO.
Foam::pointPatchFieldMapper.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const Type & average() const
timeVaryingMappedFixedValuePointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Abstract base class for point-mesh patch fields.
word name() const
Return file name (part beyond last /)
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 dimensionedScalar e
Elementary charge.
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))
fileName filePath() const
Return complete path + object name if the file exists.
Pre-declare SubField and related Field type.
virtual void write(Ostream &) const
Write.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
A class for handling words, derived from string.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
virtual const fileName & name() const
Return the name of the stream.
virtual autoPtr< pointPatchField< Type > > clone() const
Construct and return a clone.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
const polyMesh & mesh() const
Return the mesh reference.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
prefixOSstream Pout(cout,"Pout")
Type gMax(const FieldField< Field, Type > &f)
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
word name(const complex &)
Return a string representation of a complex.
Constant dispersed-phase particle diameter model.
Basic pointPatch represents a set of points from the mesh.
Type gAverage(const FieldField< Field, Type > &f)
const fileName & pointsInstance() const
Return the current instance directory for points.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
fileName path() const
Return directory path name (part before last /)
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
const word & name() const
Return name.
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.
label size() const
Return size.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.