Commit fe91e842 authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: timeVaryingMappedFixedValue - added option to use an alternate points file name

parent d95e2120
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -42,6 +42,8 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(iF.name()),
setAverage_(false),
perturb_(0),
pointsName_("points"),
mapMethod_("planarInterpolation"),
mapperPtr_(nullptr),
sampleTimes_(0),
startSampleTime_(-1),
......@@ -67,6 +69,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(iF.name()),
setAverage_(dict.lookupOrDefault("setAverage", false)),
perturb_(dict.lookupOrDefault("perturb", 1e-5)),
pointsName_(dict.lookupOrDefault("points", "points")),
mapMethod_
(
dict.lookupOrDefault<word>
......@@ -132,6 +135,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(ptf.fieldTableName_),
setAverage_(ptf.setAverage_),
perturb_(ptf.perturb_),
pointsName_(ptf.pointsName_),
mapMethod_(ptf.mapMethod_),
mapperPtr_(nullptr),
sampleTimes_(0),
......@@ -156,6 +160,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(ptf.fieldTableName_),
setAverage_(ptf.setAverage_),
perturb_(ptf.perturb_),
pointsName_(ptf.pointsName_),
mapMethod_(ptf.mapMethod_),
mapperPtr_(nullptr),
sampleTimes_(ptf.sampleTimes_),
......@@ -181,6 +186,7 @@ timeVaryingMappedFixedValueFvPatchField
fieldTableName_(ptf.fieldTableName_),
setAverage_(ptf.setAverage_),
perturb_(ptf.perturb_),
pointsName_(ptf.pointsName_),
mapMethod_(ptf.mapMethod_),
mapperPtr_(nullptr),
sampleTimes_(ptf.sampleTimes_),
......@@ -250,13 +256,12 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
/this->db().time().caseConstant()
/"boundaryData"
/this->patch().name()
/"points"
/pointsName_
);
pointField samplePoints((IFstream(samplePointsFile)()));
DebugInfo
<< "timeVaryingMappedFixedValueFvPatchField :"
<< " Read " << samplePoints.size() << " sample points from "
<< samplePointsFile << endl;
......@@ -285,7 +290,7 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
sampleTimes_ = Time::findTimes(samplePointsDir);
DebugInfo
<< "timeVaryingMappedFixedValueFvPatchField : In directory "
<< "In directory "
<< samplePointsDir << " found times "
<< pointToPointPlanarInterpolation::timeNames(sampleTimes_)
<< endl;
......@@ -332,9 +337,9 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
if (debug)
{
Pout<< "checkTable : Setting startValues to (already read) "
<< "boundaryData"
/this->patch().name()
/sampleTimes_[startSampleTime_].name()
<< "boundaryData"
/this->patch().name()
/sampleTimes_[startSampleTime_].name()
<< endl;
}
startSampledValues_ = endSampledValues_;
......@@ -345,9 +350,9 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
if (debug)
{
Pout<< "checkTable : Reading startValues from "
<< "boundaryData"
/this->patch().name()
/sampleTimes_[lo].name()
<< "boundaryData"
/this->patch().name()
/sampleTimes_[lo].name()
<< endl;
}
......@@ -407,9 +412,9 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
if (debug)
{
Pout<< "checkTable : Reading endValues from "
<< "boundaryData"
/this->patch().name()
/sampleTimes_[endSampleTime_].name()
<< "boundaryData"
/this->patch().name()
/sampleTimes_[endSampleTime_].name()
<< endl;
}
......@@ -568,9 +573,6 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::write
{
fvPatchField<Type>::write(os);
os.writeEntryIfDifferent("setAverage", Switch(false), setAverage_);
os.writeEntryIfDifferent<scalar>("perturb", 1e-5, perturb_);
os.writeEntryIfDifferent
(
"fieldTable",
......@@ -578,6 +580,12 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::write
fieldTableName_
);
os.writeEntryIfDifferent("setAverage", Switch(false), setAverage_);
os.writeEntryIfDifferent<scalar>("perturb", 1e-5, perturb_);
os.writeEntryIfDifferent<word>("points", "points", pointsName_);
os.writeEntryIfDifferent<word>
(
"mapMethod",
......
......@@ -49,8 +49,9 @@ Usage
\table
Property | Description | Required | Default value
setAverage | Switch to activate setting of average value | no | false
perturb | Perturb points for regular geometries | no | 1e-5
fieldTableName | Alternative field name to sample | no| this field name
perturb | Perturb points for regular geometries | no | 1e-5
points | Name of points file | no | points
fieldTableName | Alternative field name to sample | no | this field name
mapMethod | Type of mapping | no | planarInterpolation
offset | Offset to mapped values | no | Zero
\endtable
......@@ -105,6 +106,9 @@ class timeVaryingMappedFixedValueFvPatchField
//- Fraction of perturbation (fraction of bounding box) to add
scalar perturb_;
//- Name of points file; default = "points"
word pointsName_;
//- Interpolation scheme to use
word mapMethod_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment