Go to the documentation of this file.
46 fieldTableName_(iF.name()),
52 startSampledValues_(0),
71 fieldTableName_(iF.name()),
85 startSampledValues_(0),
94 mapMethod_ !=
"planarInterpolation"
95 && mapMethod_ !=
"nearest"
101 ) <<
"mapMethod should be one of 'planarInterpolation'"
140 startSampleTime_(-1),
141 startSampledValues_(0),
144 endSampledValues_(0),
208 if (startSampledValues_.size())
210 startSampledValues_.autoMap(m);
211 endSampledValues_.autoMap(m);
215 startSampleTime_ = -1;
230 refCast<const timeVaryingMappedFixedValueFvPatchField<Type> >(ptf);
237 startSampleTime_ = -1;
246 if (mapperPtr_.empty())
253 this->db().time().caseConstant(),
254 "boundaryData"/this->patch().
name(),
266 Info<<
"timeVaryingMappedFixedValueFvPatchField :"
267 <<
" Read " << samplePoints.size() <<
" sample points from "
268 << samplePointsFile <<
endl;
276 && mapMethod_ !=
"planarInterpolation"
285 this->patch().patch().faceCentres(),
292 const fileName samplePointsDir = samplePointsFile.
path();
297 Info<<
"timeVaryingMappedFixedValueFvPatchField : In directory "
298 << samplePointsDir <<
" found times "
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 "
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()
371 this->db().time().caseConstant(),
373 /this->patch().
name()
374 /sampleTimes_[startSampleTime_].
name(),
382 if (vals.size() != mapperPtr_().sourceSize())
385 <<
"Number of values (" << vals.size()
386 <<
") differs from the number of points ("
387 << mapperPtr_().sourceSize()
391 startAverage_ = vals.
average();
392 startSampledValues_ = mapperPtr_().interpolate(vals);
396 if (hi != endSampleTime_)
400 if (endSampleTime_ == -1)
405 Pout<<
"checkTable : Clearing endValues" <<
endl;
407 endSampledValues_.clear();
413 Pout<<
"checkTable : Reading endValues from "
415 /this->patch().
name()
416 /sampleTimes_[endSampleTime_].
name()
426 this->db().time().caseConstant(),
428 /this->patch().
name()
429 /sampleTimes_[endSampleTime_].
name(),
437 if (vals.size() != mapperPtr_().sourceSize())
440 <<
"Number of values (" << vals.size()
441 <<
") differs from the number of points ("
442 << mapperPtr_().sourceSize()
447 endSampledValues_ = mapperPtr_().interpolate(vals);
468 if (endSampleTime_ == -1)
473 Pout<<
"updateCoeffs : Sampled, non-interpolated values"
474 <<
" from start time:"
475 << sampleTimes_[startSampleTime_].
name() <<
nl;
479 wantedAverage = startAverage_;
483 scalar start = sampleTimes_[startSampleTime_].value();
484 scalar end = sampleTimes_[endSampleTime_].value();
486 scalar
s = (this->db().time().value() - start)/(end - start);
490 Pout<<
"updateCoeffs : Sampled, interpolated values"
491 <<
" between start time:"
492 << sampleTimes_[startSampleTime_].
name()
493 <<
" and end time:" << sampleTimes_[endSampleTime_].
name()
494 <<
" with weight:" <<
s <<
endl;
497 this->
operator==((1 - s)*startSampledValues_ +
s*endSampledValues_);
498 wantedAverage = (1 -
s)*startAverage_ +
s*endAverage_;
508 gSum(this->patch().magSf()*
fld)
509 /
gSum(this->patch().magSf());
513 Pout<<
"updateCoeffs :"
514 <<
" actual average:" << averagePsi
515 <<
" wanted average:" << wantedAverage
519 if (
mag(averagePsi) < VSMALL)
522 const Type offset = wantedAverage - averagePsi;
525 Pout<<
"updateCoeffs :"
526 <<
" offsetting with:" << offset <<
endl;
532 const scalar scale =
mag(wantedAverage)/
mag(averagePsi);
536 Pout<<
"updateCoeffs :"
537 <<
" scaling with:" << scale <<
endl;
544 const scalar t = this->db().time().timeOutputValue();
549 Pout<<
"updateCoeffs : set fixedValue to min:" <<
gMin(*
this)
550 <<
" max:" <<
gMax(*
this)
563 if (perturb_ != 1
e-5)
578 && mapMethod_ !=
"planarInterpolation"
586 offset_->writeData(os);
588 this->writeEntry(
"value", os);
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void write(Ostream &) const
Write.
virtual void operator==(const fvPatchField< Type > &)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Type startAverage_
If setAverage: starting average value.
fileName filePath() const
Return complete path + object name if the file exists.
A class for handling words, derived from string.
A class for handling file names.
scalar perturb_
Fraction of perturbation (fraction of bounding box) to add.
Type gAverage(const FieldField< Field, Type > &f)
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
label endSampleTime_
Current end index in sampleTimes.
This boundary conditions interpolates the values from a set of supplied points in space and time....
virtual void write(Ostream &) const
Write.
rDeltaT dimensionedInternalField()
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
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,.
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Type endAverage_
If setAverage: end average value.
Interpolates between two sets of unstructured points using 2D Delaunay triangulation....
label startSampleTime_
Current starting index in sampleTimes.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Type gSum(const FieldField< Field, Type > &f)
dimensioned< scalar > mag(const dimensioned< Type > &)
word fieldTableName_
Name of the field data table, defaults to the name of the field.
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
word name() const
Return file name (part beyond last /)
fileName objectPath() const
Return complete path + object name.
void checkTable()
Find boundary data inbetween current time and interpolate.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
timeVaryingMappedFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual const fileName & name() const
Return the name of the stream.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
autoPtr< DataEntry< Type > > offset_
Time varying offset values to interpolated data.
bool setAverage_
If true adjust the mapped field to maintain average value.
instantList sampleTimes_
List of boundaryData time directories.
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
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
const double 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){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
prefixOSstream Pout(cout, "Pout")
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
word mapMethod_
Interpolation scheme to use.
Traits class for primitives.
static instantList findTimes(const fileName &, const word &constantName="constant")
Search a given directory for valid time directories.
A primitive field + average with IO.
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Type gMin(const FieldField< Field, Type > &f)
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Type gMax(const FieldField< Field, Type > &f)
word name(const complex &)
Return a string representation of a complex.
static wordList timeNames(const instantList &)
Helper: extract words of times.
Field< Type > startSampledValues_
Interpolated values from startSampleTime.
Field< Type > endSampledValues_
Interpolated values from endSampleTime.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...