diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index 2d31d3802f..fbfc5eb96a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -52,7 +52,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(pTraits::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits::zero) + endAverage_(pTraits::zero), + offSet_() {} @@ -77,7 +78,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(pTraits::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits::zero) + endAverage_(pTraits::zero), + offSet_() {} @@ -101,7 +103,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(pTraits::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits::zero) + endAverage_(pTraits::zero), + offSet_(DataEntry::New("offSet", dict)) { dict.readIfPresent("fieldTableName", fieldTableName_); @@ -134,7 +137,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(ptf.startAverage_), endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), - endAverage_(ptf.endAverage_) + endAverage_(ptf.endAverage_), + offSet_(ptf.offSet_().clone().ptr()) {} @@ -158,7 +162,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(ptf.startAverage_), endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), - endAverage_(ptf.endAverage_) + endAverage_(ptf.endAverage_), + offSet_(ptf.offSet_().clone().ptr()) {} @@ -276,7 +281,7 @@ void timeVaryingMappedFixedValueFvPatchField::checkTable() { FatalErrorIn ( - "timeVaryingMappedFixedValueFvPatchField::checkTable" + "timeVaryingMappedFixedValueFvPatchField::checkTable()" ) << "Cannot find starting sampling values for current time " << this->db().time().value() << nl << "Have sampling values for times " @@ -366,6 +371,7 @@ void timeVaryingMappedFixedValueFvPatchField::checkTable() /sampleTimes_[endSampleTime_].name() << endl; } + // Reread values and interpolate AverageIOField vals ( @@ -392,7 +398,6 @@ void timeVaryingMappedFixedValueFvPatchField::checkTable() template void timeVaryingMappedFixedValueFvPatchField::updateCoeffs() { - if (this->updated()) { return; @@ -423,7 +428,7 @@ void timeVaryingMappedFixedValueFvPatchField::updateCoeffs() scalar start = sampleTimes_[startSampleTime_].value(); scalar end = sampleTimes_[endSampleTime_].value(); - scalar s = (this->db().time().value()-start)/(end-start); + scalar s = (this->db().time().value() - start)/(end - start); if (debug) { @@ -434,8 +439,8 @@ void timeVaryingMappedFixedValueFvPatchField::updateCoeffs() << " with weight:" << s << endl; } - this->operator==((1-s)*startSampledValues_ + s*endSampledValues_); - wantedAverage = (1-s)*startAverage_ + s*endAverage_; + this->operator==((1 - s)*startSampledValues_ + s*endSampledValues_); + wantedAverage = (1 - s)*startAverage_ + s*endAverage_; } // Enforce average. Either by scaling (if scaling factor > 0.5) or by @@ -465,7 +470,7 @@ void timeVaryingMappedFixedValueFvPatchField::updateCoeffs() Pout<< "updateCoeffs :" << " offsetting with:" << offset << endl; } - this->operator==(fld+offset); + this->operator==(fld + offset); } else { @@ -480,6 +485,10 @@ void timeVaryingMappedFixedValueFvPatchField::updateCoeffs() } } + // apply offset to mapped values + const scalar t = this->db().time().timeOutputValue(); + this->operator==(*this + offSet_->value(t)); + if (debug) { Pout<< "updateCoeffs : set fixedValue to min:" << gMin(*this) @@ -503,6 +512,8 @@ void timeVaryingMappedFixedValueFvPatchField::write(Ostream& os) const << token::END_STATEMENT << nl; } + offSet_->writeData(os); + this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H index 61228fe07c..01e61301eb 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H @@ -80,6 +80,7 @@ SourceFiles #include "FixedList.H" #include "instantList.H" #include "pointToPointPlanarInterpolation.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -130,6 +131,9 @@ class timeVaryingMappedFixedValueFvPatchField //- If setAverage: end average value Type endAverage_; + //- Time varying offset values to interpolated data + autoPtr > offSet_; + public: