41 fieldTableName_(iF.
name()),
47 startSampledValues_(0),
66 fieldTableName_(iF.
name()),
80 startSampledValues_(0),
89 mapMethod_ !=
"planarInterpolation" 90 && mapMethod_ !=
"nearest" 96 ) <<
"mapMethod should be one of 'planarInterpolation'" 103 if (dict.
found(
"value"))
113 this->evaluate(Pstream::blocking);
129 fieldTableName_(ptf.fieldTableName_),
130 setAverage_(ptf.setAverage_),
131 perturb_(ptf.perturb_),
132 mapMethod_(ptf.mapMethod_),
135 startSampleTime_(-1),
136 startSampledValues_(0),
139 endSampledValues_(0),
141 offset_(ptf.offset_,
false)
153 fieldTableName_(ptf.fieldTableName_),
154 setAverage_(ptf.setAverage_),
155 perturb_(ptf.perturb_),
156 mapMethod_(ptf.mapMethod_),
158 sampleTimes_(ptf.sampleTimes_),
159 startSampleTime_(ptf.startSampleTime_),
160 startSampledValues_(ptf.startSampledValues_),
161 startAverage_(ptf.startAverage_),
162 endSampleTime_(ptf.endSampleTime_),
163 endSampledValues_(ptf.endSampledValues_),
164 endAverage_(ptf.endAverage_),
165 offset_(ptf.offset_,
false)
178 fieldTableName_(ptf.fieldTableName_),
179 setAverage_(ptf.setAverage_),
180 perturb_(ptf.perturb_),
181 mapMethod_(ptf.mapMethod_),
183 sampleTimes_(ptf.sampleTimes_),
184 startSampleTime_(ptf.startSampleTime_),
185 startSampledValues_(ptf.startSampledValues_),
186 startAverage_(ptf.startAverage_),
187 endSampleTime_(ptf.endSampleTime_),
188 endSampledValues_(ptf.endSampledValues_),
189 endAverage_(ptf.endAverage_),
190 offset_(ptf.offset_,
false)
203 if (startSampledValues_.size())
205 startSampledValues_.autoMap(m);
206 endSampledValues_.autoMap(m);
210 startSampleTime_ = -1;
225 refCast<const timeVaryingMappedFixedValueFvPatchField<Type>>(ptf);
227 startSampledValues_.
rmap(tiptf.startSampledValues_, addr);
228 endSampledValues_.rmap(tiptf.endSampledValues_, addr);
232 startSampleTime_ = -1;
241 if (mapperPtr_.empty())
249 "boundaryData"/this->patch().
name(),
252 IOobject::AUTO_WRITE,
261 Info<<
"timeVaryingMappedFixedValueFvPatchField :" 262 <<
" Read " << samplePoints.
size() <<
" sample points from " 263 << samplePointsFile <<
endl;
271 && mapMethod_ !=
"planarInterpolation" 280 this->patch().patch().faceCentres(),
287 const fileName samplePointsDir = samplePointsFile.
path();
288 sampleTimes_ = Time::findTimes(samplePointsDir);
292 Info<<
"timeVaryingMappedFixedValueFvPatchField : In directory " 293 << samplePointsDir <<
" found times " 294 << pointToPointPlanarInterpolation::timeNames(sampleTimes_)
304 bool foundTime = mapperPtr_().findTime
308 this->db().time().value(),
316 <<
"Cannot find starting sampling values for current time " 317 << this->db().time().value() <<
nl 318 <<
"Have sampling values for times " 319 << pointToPointPlanarInterpolation::timeNames(sampleTimes_) <<
nl 321 << this->db().time().constant()/
"boundaryData"/this->patch().name()
322 <<
"\n on patch " << this->patch().name()
323 <<
" of field " << fieldTableName_
330 if (lo != startSampleTime_)
332 startSampleTime_ = lo;
334 if (startSampleTime_ == endSampleTime_)
339 Pout<<
"checkTable : Setting startValues to (already read) " 341 /this->patch().
name()
342 /sampleTimes_[startSampleTime_].
name()
345 startSampledValues_ = endSampledValues_;
346 startAverage_ = endAverage_;
352 Pout<<
"checkTable : Reading startValues from " 354 /this->patch().
name()
355 /sampleTimes_[lo].
name()
368 /this->patch().
name()
369 /sampleTimes_[startSampleTime_].
name(),
372 IOobject::AUTO_WRITE,
377 if (vals.
size() != mapperPtr_().sourceSize())
380 <<
"Number of values (" << vals.
size()
381 <<
") differs from the number of points (" 382 << mapperPtr_().sourceSize()
386 startAverage_ = vals.
average();
387 startSampledValues_ = mapperPtr_().interpolate(vals);
391 if (hi != endSampleTime_)
395 if (endSampleTime_ == -1)
400 Pout<<
"checkTable : Clearing endValues" <<
endl;
402 endSampledValues_.clear();
408 Pout<<
"checkTable : Reading endValues from " 410 /this->patch().
name()
411 /sampleTimes_[endSampleTime_].
name()
423 /this->patch().
name()
424 /sampleTimes_[endSampleTime_].
name(),
427 IOobject::AUTO_WRITE,
432 if (vals.
size() != mapperPtr_().sourceSize())
435 <<
"Number of values (" << vals.
size()
436 <<
") differs from the number of points (" 437 << mapperPtr_().sourceSize()
442 endSampledValues_ = mapperPtr_().interpolate(vals);
463 if (endSampleTime_ == -1)
468 Pout<<
"updateCoeffs : Sampled, non-interpolated values" 469 <<
" from start time:" 470 << sampleTimes_[startSampleTime_].
name() <<
nl;
474 wantedAverage = startAverage_;
478 scalar start = sampleTimes_[startSampleTime_].value();
479 scalar end = sampleTimes_[endSampleTime_].value();
481 scalar
s = (this->db().time().value() - start)/(end - start);
485 Pout<<
"updateCoeffs : Sampled, interpolated values" 486 <<
" between start time:" 487 << sampleTimes_[startSampleTime_].
name()
488 <<
" and end time:" << sampleTimes_[endSampleTime_].
name()
489 <<
" with weight:" << s <<
endl;
492 this->
operator==((1 - s)*startSampledValues_ + s*endSampledValues_);
493 wantedAverage = (1 -
s)*startAverage_ + s*endAverage_;
503 gSum(this->patch().magSf()*fld)
504 /
gSum(this->patch().magSf());
508 Pout<<
"updateCoeffs :" 509 <<
" actual average:" << averagePsi
510 <<
" wanted average:" << wantedAverage
514 if (
mag(averagePsi) < VSMALL)
517 const Type offset = wantedAverage - averagePsi;
520 Pout<<
"updateCoeffs :" 521 <<
" offsetting with:" << offset <<
endl;
527 const scalar scale =
mag(wantedAverage)/
mag(averagePsi);
531 Pout<<
"updateCoeffs :" 532 <<
" scaling with:" << scale <<
endl;
539 const scalar t = this->db().time().timeOutputValue();
544 Pout<<
"updateCoeffs : set fixedValue to min:" <<
gMin(*
this)
545 <<
" max:" <<
gMax(*
this)
560 os.
writeKeyword(
"setAverage") << setAverage_ << token::END_STATEMENT <<
nl;
561 if (perturb_ != 1
e-5)
563 os.
writeKeyword(
"perturb") << perturb_ << token::END_STATEMENT <<
nl;
566 if (fieldTableName_ != this->internalField().
name())
569 << token::END_STATEMENT <<
nl;
576 && mapMethod_ !=
"planarInterpolation" 581 << token::END_STATEMENT <<
nl;
584 offset_->writeData(os);
586 this->writeEntry(
"value", os);
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
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.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type gMin(const FieldField< Field, Type > &f)
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
void size(const label)
Override size to be inconsistent with allocated storage.
A primitive field + average with IO.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
const Type & average() const
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
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))
const dimensionedScalar e
Elementary charge.
This boundary conditions interpolates the values from a set of supplied points in space and time...
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.
Type gSum(const FieldField< Field, Type > &f)
Pre-declare SubField and related Field type.
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.
Foam::fvPatchFieldMapper.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
void checkTable()
Find boundary data inbetween current time and interpolate.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
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.
timeVaryingMappedFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
virtual void write(Ostream &) const
Write.
Constant dispersed-phase particle diameter model.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Type gAverage(const FieldField< Field, Type > &f)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensioned< scalar > mag(const dimensioned< Type > &)
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.
Interpolates between two sets of unstructured points using 2D Delaunay triangulation. Used in e.g. timeVaryingMapped bcs.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.