Minor-clean-up

This commit is contained in:
Hrvoje Jasak 2013-04-10 17:22:22 +01:00
parent d18a90bdce
commit 8a2e272af9
3 changed files with 32 additions and 28 deletions

View file

@ -170,11 +170,11 @@ Foam::RBFInterpolation::RBFInterpolation
(
const dictionary& dict,
const vectorField& controlPoints,
const vectorField& allPoints
const vectorField& dataPoints
)
:
controlPoints_(controlPoints),
allPoints_(allPoints),
dataPoints_(dataPoints),
RBF_(RBFFunction::New(word(dict.lookup("RBF")), dict)),
BPtr_(NULL),
focalPoint_(dict.lookup("focalPoint")),
@ -190,7 +190,7 @@ Foam::RBFInterpolation::RBFInterpolation
)
:
controlPoints_(rbf.controlPoints_),
allPoints_(rbf.allPoints_),
dataPoints_(rbf.dataPoints_),
RBF_(rbf.RBF_->clone()),
BPtr_(NULL),
focalPoint_(rbf.focalPoint_),

View file

@ -29,8 +29,8 @@ Description
Radial basis function interpolation class
Description
Interpolation class which uses Radial Basis Functions to interpolate the
fluid displacements for given boundary displacements.
Interpolation class which uses Radial Basis Functions to interpolate
field from given data points to arbitrary set of points.
The coefficient vectors, alpha and beta are determined by solving
the system:
@ -38,25 +38,17 @@ Description
| db | = | Mbb Pb | | alpha |
| 0 | | Pb 0 | | beta |
where db are the given boundary displacements,
where db are the given field values at data carrier points.
Mbb the boundary RBF correlation matrix (NbxNb), containing RBF evaluations
at the boundary nodes, and Pb some linear polynomial matrix (Nbx4).
Those coefficients are calculated every timestep, with the current
boundary displacements db, with the inverse of Mbb. Using those
coefficients, the RBF is evaluated at all fluid points every
timestep.
The efficiency of this method is increased by:
1) using control points which is a subset of the moving
boundary points. Those control points are selected by
a coarsening function.
2) The outer boundary points are neglected since a cutoff function
is used toward the outer boundaries.
In cases where far field data is not of interest, a cutoff function
is used to eliminate unnecessary data points in the far field
Author
Frank Bos, TU Delft. All rights reserved.
Dubravko Matijasevic, FSB Zagreb.
Reorganisation by Hrvoje Jasak, Wikki Ltd.
SourceFiles
RBFInterpolation.C
@ -90,7 +82,7 @@ class RBFInterpolation
const vectorField& controlPoints_;
//- Reference to all points
const vectorField& allPoints_;
const vectorField& dataPoints_;
//- RBF function
autoPtr<RBFFunction> RBF_;
@ -136,7 +128,7 @@ public:
(
const dictionary& dict,
const vectorField& controlPoints,
const vectorField& allPoints
const vectorField& dataPoints
);
//- Construct as copy
@ -150,6 +142,18 @@ public:
// Member Functions
//- Return reference to control points
const vectorField& controlPoints() const
{
return controlPoints_;
}
//- Reference to all points
const vectorField& dataPoints() const
{
return dataPoints_;
}
//- Interpolate
template<class Type>
tmp<Field<Type> > interpolate(const Field<Type>& ctrlField) const;

View file

@ -43,7 +43,7 @@ Foam::tmp<Foam::Field<Type> > Foam::RBFInterpolation::interpolate
{
// HJ and FB (05 Jan 2009)
// Collect the values from ALL control points to all CPUs
// Then, each CPU will do interpolation only on local allPoints_
// Then, each CPU will do interpolation only on local dataPoints_
if (ctrlField.size() != controlPoints_.size())
{
@ -60,7 +60,7 @@ Foam::tmp<Foam::Field<Type> > Foam::RBFInterpolation::interpolate
tmp<Field<Type> > tresult
(
new Field<Type>(allPoints_.size(), pTraits<Type>::zero)
new Field<Type>(dataPoints_.size(), pTraits<Type>::zero)
);
Field<Type>& result = tresult();
@ -107,10 +107,10 @@ Foam::tmp<Foam::Field<Type> > Foam::RBFInterpolation::interpolate
// Algorithmic improvement, Matteo Lombardi. 21/Mar/2011
forAll (allPoints_, flPoint)
forAll (dataPoints_, flPoint)
{
// Cut-off function to justify neglecting outer boundary points
t = (Foam::mag(allPoints_[flPoint] - focalPoint_) - innerRadius_)/
t = (Foam::mag(dataPoints_[flPoint] - focalPoint_) - innerRadius_)/
(outerRadius_ - innerRadius_);
if (t >= 1)
@ -122,7 +122,7 @@ Foam::tmp<Foam::Field<Type> > Foam::RBFInterpolation::interpolate
{
// Full calculation of weights
scalarField weights =
RBF_->weights(controlPoints_, allPoints_[flPoint]);
RBF_->weights(controlPoints_, dataPoints_[flPoint]);
forAll (controlPoints_, i)
{
@ -133,9 +133,9 @@ Foam::tmp<Foam::Field<Type> > Foam::RBFInterpolation::interpolate
{
result[flPoint] +=
beta[0]
+ beta[1]*allPoints_[flPoint].x()
+ beta[2]*allPoints_[flPoint].y()
+ beta[3]*allPoints_[flPoint].z();
+ beta[1]*dataPoints_[flPoint].x()
+ beta[2]*dataPoints_[flPoint].y()
+ beta[3]*dataPoints_[flPoint].z();
}
scalar w;
@ -146,7 +146,7 @@ Foam::tmp<Foam::Field<Type> > Foam::RBFInterpolation::interpolate
}
else
{
w = 1 - sqr(t)*(3-2*t);
w = 1 - sqr(t)*(3 - 2*t);
}
result[flPoint] = w*result[flPoint];