Go to the documentation of this file.
42 fieldTableName_(iF.name()),
48 startSampledValues_(0),
76 startSampledValues_(0),
101 fieldTableName_(iF.name()),
103 perturb_(
dict.lookupOrDefault(
"perturb", 1
e-5)),
109 "planarInterpolation"
114 startSampleTime_(-1),
115 startSampledValues_(0),
118 endSampledValues_(0),
122 if (
dict.found(
"offset"))
127 dict.readIfPresent(
"fieldTableName", fieldTableName_);
129 if (
dict.found(
"value"))
217 if (startSampledValues_.size())
219 startSampledValues_.autoMap(m);
220 endSampledValues_.autoMap(m);
224 startSampleTime_ = -1;
239 refCast<const timeVaryingMappedFixedValuePointPatchField<Type> >(ptf);
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;
606 << token::END_STATEMENT <<
nl;
613 && mapMethod_ !=
"planarInterpolation"
618 << token::END_STATEMENT <<
nl;
623 offset_->writeData(os);
Type endAverage_
If setAverage: end average value.
autoPtr< DataEntry< Type > > offset_
Time varying offset values to interpolated data.
Field< Type > startSampledValues_
Interpolated values from startSampleTime.
vectorField pointField
pointField is a vectorField.
virtual const pointField & points() const
Return raw points.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
fileName filePath() const
Return complete path + object name if the file exists.
word mapMethod_
Interpolation scheme to use.
A class for handling words, derived from string.
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
A class for handling file names.
Type gAverage(const FieldField< Field, Type > &f)
rDeltaT dimensionedInternalField()
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
fileName path() const
Return directory path name (part before last /)
const fileName & facesInstance() const
Return the current instance directory for faces.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Interpolates between two sets of unstructured points using 2D Delaunay triangulation....
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Basic pointPatch represents a set of points from the mesh.
dimensioned< scalar > mag(const dimensioned< Type > &)
label endSampleTime_
Current end index in sampleTimes.
Abstract base class for point-mesh patch fields.
Mesh consisting of general polyhedral cells.
Foam::pointPatchFieldMapper.
word name() const
Return file name (part beyond last /)
Constant dispersed-phase particle diameter model.
Field< Type > endSampledValues_
Interpolated values from endSampleTime.
instantList sampleTimes_
List of boundaryData time directories.
fileName objectPath() const
Return complete path + object name.
const fileName & pointsInstance() const
Return the current instance directory for points.
bool setAverage_
If true adjust the mapped field to maintain average value.
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.
A time-varying form of a mapped fixed value boundary condition.
virtual const fileName & name() const
Return the name of the stream.
label startSampleTime_
Current starting index in sampleTimes.
virtual void rmap(const pointPatchField< Type > &, const labelList &)
Reverse map the given PointPatchField onto.
virtual void write(Ostream &) const
Write.
const polyMesh & mesh() const
Return the mesh reference.
autoPtr< pointToPointPlanarInterpolation > mapperPtr_
2D interpolation (for 'planarInterpolation' mapMethod)
A list of keyword definitions, which are a keyword followed by any number of values (e....
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))
const Type & average() const
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))
timeVaryingMappedFixedValuePointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
scalar perturb_
Fraction of perturbation (fraction of bounding box) to add.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
prefixOSstream Pout(cout, "Pout")
word fieldTableName_
Name of the field data table, defaults to the name of the field.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Traits class for primitives.
virtual void autoMap(const pointPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
A primitive field + average with IO.
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
const dimensionedScalar e
Elementary charge.
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)
word name(const complex &)
Return a string representation of a complex.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Type startAverage_
If setAverage: starting average value.