mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: timeVaryingMapped: added option to disable interpolation
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -72,6 +72,7 @@ timeVaryingMappedFixedValueFvPatchField
|
|||||||
fieldTableName_(ptf.fieldTableName_),
|
fieldTableName_(ptf.fieldTableName_),
|
||||||
setAverage_(ptf.setAverage_),
|
setAverage_(ptf.setAverage_),
|
||||||
perturb_(ptf.perturb_),
|
perturb_(ptf.perturb_),
|
||||||
|
mapMethod_(ptf.mapMethod_),
|
||||||
mapperPtr_(NULL),
|
mapperPtr_(NULL),
|
||||||
sampleTimes_(0),
|
sampleTimes_(0),
|
||||||
startSampleTime_(-1),
|
startSampleTime_(-1),
|
||||||
@ -102,6 +103,14 @@ timeVaryingMappedFixedValueFvPatchField
|
|||||||
fieldTableName_(iF.name()),
|
fieldTableName_(iF.name()),
|
||||||
setAverage_(readBool(dict.lookup("setAverage"))),
|
setAverage_(readBool(dict.lookup("setAverage"))),
|
||||||
perturb_(dict.lookupOrDefault("perturb", 1e-5)),
|
perturb_(dict.lookupOrDefault("perturb", 1e-5)),
|
||||||
|
mapMethod_
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault<word>
|
||||||
|
(
|
||||||
|
"mapMethod",
|
||||||
|
"planarInterpolation"
|
||||||
|
)
|
||||||
|
),
|
||||||
mapperPtr_(NULL),
|
mapperPtr_(NULL),
|
||||||
sampleTimes_(0),
|
sampleTimes_(0),
|
||||||
startSampleTime_(-1),
|
startSampleTime_(-1),
|
||||||
@ -112,6 +121,27 @@ timeVaryingMappedFixedValueFvPatchField
|
|||||||
endAverage_(pTraits<Type>::zero),
|
endAverage_(pTraits<Type>::zero),
|
||||||
offset_(DataEntry<Type>::New("offset", dict))
|
offset_(DataEntry<Type>::New("offset", dict))
|
||||||
{
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
mapMethod_ != "planarInterpolation"
|
||||||
|
&& mapMethod_ != "nearest"
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
"timeVaryingMappedFixedValueFvPatchField<Type>::\n"
|
||||||
|
"timeVaryingMappedFixedValueFvPatchField\n"
|
||||||
|
"(\n"
|
||||||
|
" const fvPatch&\n"
|
||||||
|
" const DimensionedField<Type, volMesh>&\n"
|
||||||
|
" const dictionary&\n"
|
||||||
|
")\n",
|
||||||
|
dict
|
||||||
|
) << "mapMethod should be one of 'planarInterpolation'"
|
||||||
|
<< ", 'nearest'" << exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
dict.readIfPresent("fieldTableName", fieldTableName_);
|
dict.readIfPresent("fieldTableName", fieldTableName_);
|
||||||
|
|
||||||
if (dict.found("value"))
|
if (dict.found("value"))
|
||||||
@ -140,6 +170,7 @@ timeVaryingMappedFixedValueFvPatchField
|
|||||||
fieldTableName_(ptf.fieldTableName_),
|
fieldTableName_(ptf.fieldTableName_),
|
||||||
setAverage_(ptf.setAverage_),
|
setAverage_(ptf.setAverage_),
|
||||||
perturb_(ptf.perturb_),
|
perturb_(ptf.perturb_),
|
||||||
|
mapMethod_(ptf.mapMethod_),
|
||||||
mapperPtr_(NULL),
|
mapperPtr_(NULL),
|
||||||
sampleTimes_(ptf.sampleTimes_),
|
sampleTimes_(ptf.sampleTimes_),
|
||||||
startSampleTime_(ptf.startSampleTime_),
|
startSampleTime_(ptf.startSampleTime_),
|
||||||
@ -169,6 +200,7 @@ timeVaryingMappedFixedValueFvPatchField
|
|||||||
fieldTableName_(ptf.fieldTableName_),
|
fieldTableName_(ptf.fieldTableName_),
|
||||||
setAverage_(ptf.setAverage_),
|
setAverage_(ptf.setAverage_),
|
||||||
perturb_(ptf.perturb_),
|
perturb_(ptf.perturb_),
|
||||||
|
mapMethod_(ptf.mapMethod_),
|
||||||
mapperPtr_(NULL),
|
mapperPtr_(NULL),
|
||||||
sampleTimes_(ptf.sampleTimes_),
|
sampleTimes_(ptf.sampleTimes_),
|
||||||
startSampleTime_(ptf.startSampleTime_),
|
startSampleTime_(ptf.startSampleTime_),
|
||||||
@ -258,6 +290,14 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
|
|||||||
<< samplePointsFile << endl;
|
<< samplePointsFile << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// tbd: run-time selection
|
||||||
|
bool nearestOnly =
|
||||||
|
(
|
||||||
|
!mapMethod_.empty()
|
||||||
|
&& mapMethod_ != "planarInterpolation"
|
||||||
|
);
|
||||||
|
|
||||||
// Allocate the interpolator
|
// Allocate the interpolator
|
||||||
mapperPtr_.reset
|
mapperPtr_.reset
|
||||||
(
|
(
|
||||||
@ -265,7 +305,8 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
|
|||||||
(
|
(
|
||||||
samplePoints,
|
samplePoints,
|
||||||
this->patch().patch().faceCentres(),
|
this->patch().patch().faceCentres(),
|
||||||
perturb_
|
perturb_,
|
||||||
|
nearestOnly
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -560,6 +601,18 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::write(Ostream& os) const
|
|||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(
|
||||||
|
!mapMethod_.empty()
|
||||||
|
&& mapMethod_ != "planarInterpolation"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os.writeKeyword("mapMethod") << mapMethod_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
offset_->writeData(os);
|
offset_->writeData(os);
|
||||||
|
|
||||||
this->writeEntry("value", os);
|
this->writeEntry("value", os);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -33,12 +33,13 @@ Description
|
|||||||
constant/boundaryData/\<patchname\> where:
|
constant/boundaryData/\<patchname\> where:
|
||||||
- points : pointField with locations
|
- points : pointField with locations
|
||||||
- ddd : supplied values at time ddd
|
- ddd : supplied values at time ddd
|
||||||
The points should be more or less on a plane since they get triangulated
|
The default mode of operation (mapMethod planarInterpolation) is
|
||||||
in 2-D.
|
to project the points onto a plane (constructed from the first threee
|
||||||
|
points) and construct a 2D triangulation and finds for the face centres
|
||||||
|
the triangle it is in and the weights to the 3 vertices.
|
||||||
|
|
||||||
At startup, this condition generates the triangulation and performs a
|
The optional mapMethod nearest will avoid all projection and
|
||||||
linear interpolation (triangle it is in and weights to the 3 vertices)
|
triangulation and just use the value at the nearest vertex.
|
||||||
for every face centre.
|
|
||||||
|
|
||||||
Values are interpolated linearly between times.
|
Values are interpolated linearly between times.
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ Description
|
|||||||
setAverage | flag to activate setting of average value | yes |
|
setAverage | flag to activate setting of average value | yes |
|
||||||
perturb | perturb points for regular geometries | no | 1e-5
|
perturb | perturb points for regular geometries | no | 1e-5
|
||||||
fieldTableName | alternative field name to sample | no| this field name
|
fieldTableName | alternative field name to sample | no| this field name
|
||||||
|
mapMethod | type of mapping | no | planarInterpolation
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
/verbatim
|
/verbatim
|
||||||
@ -61,10 +63,6 @@ Description
|
|||||||
}
|
}
|
||||||
/endverbatim
|
/endverbatim
|
||||||
|
|
||||||
Note
|
|
||||||
Switch on debug flag to have it dump the triangulation (in transformed
|
|
||||||
space) and transform face centres.
|
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::fixedValueFvPatchField
|
Foam::fixedValueFvPatchField
|
||||||
|
|
||||||
@ -107,7 +105,10 @@ class timeVaryingMappedFixedValueFvPatchField
|
|||||||
//- Fraction of perturbation (fraction of bounding box) to add
|
//- Fraction of perturbation (fraction of bounding box) to add
|
||||||
scalar perturb_;
|
scalar perturb_;
|
||||||
|
|
||||||
//- 2D interpolation
|
//- Interpolation scheme to use
|
||||||
|
word mapMethod_;
|
||||||
|
|
||||||
|
//- 2D interpolation (for 'planarInterpolation' mapMethod)
|
||||||
autoPtr<pointToPointPlanarInterpolation> mapperPtr_;
|
autoPtr<pointToPointPlanarInterpolation> mapperPtr_;
|
||||||
|
|
||||||
//- List of boundaryData time directories
|
//- List of boundaryData time directories
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -42,6 +42,7 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
fieldTableName_(iF.name()),
|
fieldTableName_(iF.name()),
|
||||||
setAverage_(false),
|
setAverage_(false),
|
||||||
perturb_(0),
|
perturb_(0),
|
||||||
|
mapperPtr_(NULL),
|
||||||
sampleTimes_(0),
|
sampleTimes_(0),
|
||||||
startSampleTime_(-1),
|
startSampleTime_(-1),
|
||||||
startSampledValues_(0),
|
startSampledValues_(0),
|
||||||
@ -68,7 +69,8 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
fieldTableName_(ptf.fieldTableName_),
|
fieldTableName_(ptf.fieldTableName_),
|
||||||
setAverage_(ptf.setAverage_),
|
setAverage_(ptf.setAverage_),
|
||||||
perturb_(ptf.perturb_),
|
perturb_(ptf.perturb_),
|
||||||
mapperPtr_(ptf.mapperPtr_),
|
mapMethod_(ptf.mapMethod_),
|
||||||
|
mapperPtr_(NULL),
|
||||||
sampleTimes_(0),
|
sampleTimes_(0),
|
||||||
startSampleTime_(-1),
|
startSampleTime_(-1),
|
||||||
startSampledValues_(0),
|
startSampledValues_(0),
|
||||||
@ -99,6 +101,14 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
fieldTableName_(iF.name()),
|
fieldTableName_(iF.name()),
|
||||||
setAverage_(readBool(dict.lookup("setAverage"))),
|
setAverage_(readBool(dict.lookup("setAverage"))),
|
||||||
perturb_(dict.lookupOrDefault("perturb", 1e-5)),
|
perturb_(dict.lookupOrDefault("perturb", 1e-5)),
|
||||||
|
mapMethod_
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault<word>
|
||||||
|
(
|
||||||
|
"mapMethod",
|
||||||
|
"planarInterpolation"
|
||||||
|
)
|
||||||
|
),
|
||||||
mapperPtr_(NULL),
|
mapperPtr_(NULL),
|
||||||
sampleTimes_(0),
|
sampleTimes_(0),
|
||||||
startSampleTime_(-1),
|
startSampleTime_(-1),
|
||||||
@ -146,6 +156,7 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
fieldTableName_(ptf.fieldTableName_),
|
fieldTableName_(ptf.fieldTableName_),
|
||||||
setAverage_(ptf.setAverage_),
|
setAverage_(ptf.setAverage_),
|
||||||
perturb_(ptf.perturb_),
|
perturb_(ptf.perturb_),
|
||||||
|
mapMethod_(ptf.mapMethod_),
|
||||||
mapperPtr_(ptf.mapperPtr_),
|
mapperPtr_(ptf.mapperPtr_),
|
||||||
sampleTimes_(ptf.sampleTimes_),
|
sampleTimes_(ptf.sampleTimes_),
|
||||||
startSampleTime_(ptf.startSampleTime_),
|
startSampleTime_(ptf.startSampleTime_),
|
||||||
@ -176,6 +187,7 @@ timeVaryingMappedFixedValuePointPatchField
|
|||||||
fieldTableName_(ptf.fieldTableName_),
|
fieldTableName_(ptf.fieldTableName_),
|
||||||
setAverage_(ptf.setAverage_),
|
setAverage_(ptf.setAverage_),
|
||||||
perturb_(ptf.perturb_),
|
perturb_(ptf.perturb_),
|
||||||
|
mapMethod_(ptf.mapMethod_),
|
||||||
mapperPtr_(ptf.mapperPtr_),
|
mapperPtr_(ptf.mapperPtr_),
|
||||||
sampleTimes_(ptf.sampleTimes_),
|
sampleTimes_(ptf.sampleTimes_),
|
||||||
startSampleTime_(ptf.startSampleTime_),
|
startSampleTime_(ptf.startSampleTime_),
|
||||||
@ -290,13 +302,22 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::checkTable()
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// tbd: run-time selection
|
||||||
|
bool nearestOnly =
|
||||||
|
(
|
||||||
|
!mapMethod_.empty()
|
||||||
|
&& mapMethod_ != "planarInterpolation"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Allocate the interpolator
|
||||||
mapperPtr_.reset
|
mapperPtr_.reset
|
||||||
(
|
(
|
||||||
new pointToPointPlanarInterpolation
|
new pointToPointPlanarInterpolation
|
||||||
(
|
(
|
||||||
samplePoints,
|
samplePoints,
|
||||||
meshPts,
|
meshPts,
|
||||||
perturb_
|
perturb_,
|
||||||
|
nearestOnly
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -593,6 +614,18 @@ void Foam::timeVaryingMappedFixedValuePointPatchField<Type>::write
|
|||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(
|
||||||
|
!mapMethod_.empty()
|
||||||
|
&& mapMethod_ != "planarInterpolation"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
os.writeKeyword("mapMethod") << mapMethod_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
if (offset_.valid())
|
if (offset_.valid())
|
||||||
{
|
{
|
||||||
offset_->writeData(os);
|
offset_->writeData(os);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -68,7 +68,10 @@ class timeVaryingMappedFixedValuePointPatchField
|
|||||||
//- Fraction of perturbation (fraction of bounding box) to add
|
//- Fraction of perturbation (fraction of bounding box) to add
|
||||||
scalar perturb_;
|
scalar perturb_;
|
||||||
|
|
||||||
//- 2D interpolation
|
//- Interpolation scheme to use
|
||||||
|
word mapMethod_;
|
||||||
|
|
||||||
|
//- 2D interpolation (for 'planarInterpolation' mapMethod)
|
||||||
autoPtr<pointToPointPlanarInterpolation> mapperPtr_;
|
autoPtr<pointToPointPlanarInterpolation> mapperPtr_;
|
||||||
|
|
||||||
//- List of boundaryData time directories
|
//- List of boundaryData time directories
|
||||||
|
|||||||
Reference in New Issue
Block a user