Merge remote branch 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2010-04-07 18:01:55 +02:00
75 changed files with 361 additions and 428 deletions

View File

@ -102,6 +102,7 @@ public:
// Constructors
//- Construct null
solverPerformance()
:
initialResidual_(0),
@ -111,7 +112,7 @@ public:
singular_(false)
{}
//- Construct from components
solverPerformance
(
const word& solverName,
@ -132,6 +133,9 @@ public:
singular_(singular)
{}
//- Construct from Istream
solverPerformance(Istream&);
// Member functions
@ -204,6 +208,11 @@ public:
//- Print summary of solver performance
void print() const;
// Ostream Operator
friend Ostream& operator<<(Ostream&, const solverPerformance&);
};

View File

@ -30,6 +30,20 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::lduMatrix::solverPerformance::solverPerformance(Istream& is)
{
is.readBeginList("lduMatrix::solverPerformance");
is >> solverName_
>> fieldName_
>> initialResidual_
>> finalResidual_
>> noIterations_
>> converged_
>> singular_;
is.readEndList("lduMatrix::solverPerformance");
}
bool Foam::lduMatrix::solverPerformance::checkConvergence
(
const scalar Tolerance,
@ -104,4 +118,23 @@ void Foam::lduMatrix::solverPerformance::print() const
}
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Foam::lduMatrix::solverPerformance& sp
)
{
os << token::BEGIN_LIST
<< sp.solverName_ << token::SPACE
<< sp.fieldName_ << token::SPACE
<< sp.initialResidual_ << token::SPACE
<< sp.finalResidual_ << token::SPACE
<< sp.noIterations_ << token::SPACE
<< sp.converged_ << token::SPACE
<< sp.singular_ << token::SPACE
<< token::END_LIST;
return os;
}
// ************************************************************************* //

View File

@ -262,6 +262,7 @@ $(multivariateSchemes)/limitedCubic/multivariateLimitedCubic.C
finiteVolume/fv/fv.C
finiteVolume/fvSchemes/fvSchemes.C
finiteVolume/fvData/fvData.C
ddtSchemes = finiteVolume/ddtSchemes
$(ddtSchemes)/ddtScheme/ddtSchemes.C

View File

@ -0,0 +1,72 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "fvData.H"
#include "Time.H"
#include "lduMatrix.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
int Foam::fvData::debug(Foam::debug::debugSwitch("fvData", false));
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvData::fvData(const objectRegistry& obr)
:
IOdictionary
(
IOobject
(
"fvData",
obr.time().system(),
obr,
IOobject::NO_READ,
IOobject::NO_WRITE
)
)
{
set("solverPerformance", dictionary());
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::dictionary& Foam::fvData::solverPerformanceDict() const
{
return subDict("solverPerformance");
}
void Foam::fvData::setSolverPerformance
(
const word& name,
const lduMatrix::solverPerformance& sp
) const
{
const_cast<dictionary&>(solverPerformanceDict()).set(name, sp);
}
// ************************************************************************* //

View File

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fvData
Description
Database for finite volume solution data, solver performance and
other reduced data. fvMesh is derived from fvData so that all fields have
access to the fvData from the mesh reference they hold.
SourceFiles
fvData.C
\*---------------------------------------------------------------------------*/
#ifndef fvData_H
#define fvData_H
#include "IOdictionary.H"
#include "lduMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fvData Declaration
\*---------------------------------------------------------------------------*/
class fvData
:
public IOdictionary
{
// Private Member Functions
//- Disallow default bitwise copy construct
fvData(const fvData&);
//- Disallow default bitwise assignment
void operator=(const fvData&);
public:
//- Debug switch
static int debug;
// Constructors
//- Construct for objectRegistry
fvData(const objectRegistry& obr);
// Member Functions
// Access
//- Return the dictionary of solver performance data
// which includes initial and final residuals for convergence
// checking
const dictionary& solverPerformanceDict() const;
//- Add/set the solverPerformance entry for the named field
void setSolverPerformance
(
const word& name,
const lduMatrix::solverPerformance&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -164,6 +164,8 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
psi.correctBoundaryConditions();
psi.mesh().setSolverPerformance(psi.name(), solverPerfVec);
return solverPerfVec;
}
@ -175,6 +177,7 @@ Foam::fvMatrix<Type>::solver()
return solver(psi_.mesh().solverDict(psi_.name()));
}
template<class Type>
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::fvSolver::solve()
{

View File

@ -123,6 +123,8 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve
psi.correctBoundaryConditions();
psi.mesh().setSolverPerformance(psi.name(), solverPerf);
return solverPerf;
}
@ -166,6 +168,8 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::solve
psi.correctBoundaryConditions();
psi.mesh().setSolverPerformance(psi.name(), solverPerf);
return solverPerf;
}

View File

@ -151,6 +151,9 @@ Foam::fvMesh::fvMesh(const IOobject& io)
:
polyMesh(io),
surfaceInterpolation(*this),
fvSchemes(static_cast<const objectRegistry&>(*this)),
fvSolution(static_cast<const objectRegistry&>(*this)),
fvData(static_cast<const objectRegistry&>(*this)),
boundary_(*this, boundaryMesh()),
lduPtr_(NULL),
curTimeIndex_(time().timeIndex()),
@ -243,6 +246,9 @@ Foam::fvMesh::fvMesh
:
polyMesh(io, points, faces, allOwner, allNeighbour, syncPar),
surfaceInterpolation(*this),
fvSchemes(static_cast<const objectRegistry&>(*this)),
fvSolution(static_cast<const objectRegistry&>(*this)),
fvData(static_cast<const objectRegistry&>(*this)),
boundary_(*this),
lduPtr_(NULL),
curTimeIndex_(time().timeIndex()),
@ -273,6 +279,9 @@ Foam::fvMesh::fvMesh
:
polyMesh(io, points, faces, cells, syncPar),
surfaceInterpolation(*this),
fvSchemes(static_cast<const objectRegistry&>(*this)),
fvSolution(static_cast<const objectRegistry&>(*this)),
fvData(static_cast<const objectRegistry&>(*this)),
boundary_(*this),
lduPtr_(NULL),
curTimeIndex_(time().timeIndex()),

View File

@ -52,6 +52,9 @@ SourceFiles
#include "primitiveMesh.H"
#include "fvBoundaryMesh.H"
#include "surfaceInterpolation.H"
#include "fvSchemes.H"
#include "fvSolution.H"
#include "fvData.H"
#include "DimensionedField.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
@ -77,7 +80,10 @@ class fvMesh
:
public polyMesh,
public lduMesh,
public surfaceInterpolation
public surfaceInterpolation,
public fvSchemes,
public fvSolution,
public fvData
{
// Private data

View File

@ -57,8 +57,6 @@ void surfaceInterpolation::clearOut()
surfaceInterpolation::surfaceInterpolation(const fvMesh& fvm)
:
fvSchemes(static_cast<const objectRegistry&>(fvm)),
fvSolution(static_cast<const objectRegistry&>(fvm)),
mesh_(fvm),
weightingFactors_(NULL),
differenceFactors_(NULL),

View File

@ -37,8 +37,6 @@ SourceFiles
#include "tmp.H"
#include "scalar.H"
#include "fvSchemes.H"
#include "fvSolution.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "className.H"
@ -53,9 +51,6 @@ namespace Foam
\*---------------------------------------------------------------------------*/
class surfaceInterpolation
:
public fvSchemes,
public fvSolution
{
// Private data

View File

@ -151,20 +151,4 @@ Foam::cloudSet::~cloudSet()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::cloudSet::getRefPoint(const List<point>& pts) const
{
if (pts.size())
{
// Use first samplePt as starting point
return pts[0];
}
else
{
return vector::zero;
}
}
// ************************************************************************* //

View File

@ -75,6 +75,7 @@ class cloudSet
//- Uses calcSamples to obtain samples. Copies them into *this.
void genSamples();
public:
//- Runtime type information
@ -104,14 +105,7 @@ public:
// Destructor
virtual ~cloudSet();
// Member Functions
//- Get reference point
virtual point getRefPoint(const List<point>&) const;
virtual ~cloudSet();
};

View File

@ -25,6 +25,22 @@ License
#include "coordSet.H"
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum<Foam::coordSet::coordFormat, 5>::names[] =
{
"xyz",
"x",
"y",
"z",
"distance"
};
const Foam::NamedEnum<Foam::coordSet::coordFormat, 5>
Foam::coordSet::coordFormatNames_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct from components
@ -36,8 +52,8 @@ Foam::coordSet::coordSet
:
pointField(0),
name_(name),
axis_(axis),
refPoint_(vector::zero)
axis_(coordFormatNames_[axis]),
curveDist_(0)
{}
@ -47,62 +63,21 @@ Foam::coordSet::coordSet
const word& name,
const word& axis,
const List<point>& points,
const point& refPoint
const scalarList& curveDist
)
:
pointField(points),
name_(name),
axis_(axis),
refPoint_(refPoint)
axis_(coordFormatNames_[axis]),
curveDist_(curveDist)
{}
//- Construct from components
Foam::coordSet::coordSet
(
const word& name,
const word& axis,
const scalarField& points,
const scalar refPoint
)
:
pointField(points.size(), point::zero),
name_(name),
axis_(axis),
refPoint_(point::zero)
{
if (axis_ == "x" || axis_ == "distance")
{
refPoint_.x() = refPoint;
replace(point::X, points);
}
else if (axis_ == "y")
{
replace(point::Y, points);
}
else if (axis_ == "z")
{
replace(point::Z, points);
}
else
{
FatalErrorIn
(
"coordSet::coordSet(const word& name,"
"const word& axis, const List<scalar>& points,"
"const scalar refPoint)"
) << "Illegal axis specification " << axis_
<< " for sampling line " << name_
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::coordSet::hasVectorAxis() const
{
return axis_ == "xyz";
return axis_ == XYZ;
}
@ -113,22 +88,22 @@ Foam::scalar Foam::coordSet::scalarCoord
{
const point& p = operator[](index);
if (axis_ == "x")
if (axis_ == X)
{
return p.x();
}
else if (axis_ == "y")
else if (axis_ == Y)
{
return p.y();
}
else if (axis_ == "z")
else if (axis_ == Z)
{
return p.z();
}
else if (axis_ == "distance")
else if (axis_ == DISTANCE)
{
// Use distance to reference point
return mag(p - refPoint_);
return curveDist_[index];
}
else
{
@ -154,7 +129,7 @@ Foam::point Foam::coordSet::vectorCoord(const label index) const
Foam::Ostream& Foam::coordSet::write(Ostream& os) const
{
os << "name:" << name_ << " axis:" << axis_ << " reference:" << refPoint_
os << "name:" << name_ << " axis:" << axis_
<< endl
<< endl << "\t(coord)"
<< endl;

View File

@ -52,16 +52,38 @@ class coordSet
public pointField
{
public:
// Public data types
//- Enumeration defining the output format for coordinates
enum coordFormat
{
XYZ,
X,
Y,
Z,
DISTANCE
};
private:
//- String representation of coordFormat enums
static const NamedEnum<coordFormat, 5> coordFormatNames_;
protected:
//- Name
const word name_;
//- Axis write type
const word axis_;
const coordFormat axis_;
//- Cumulative distance "distance" write specifier.
scalarList curveDist_;
//- Reference point for "distance" write specifier.
point refPoint_;
public:
@ -81,16 +103,7 @@ public:
const word& name,
const word& axis,
const List<point>& points,
const point& refPoint = point::zero
);
//- Construct from components
coordSet
(
const word& name,
const word& axis,
const scalarField& points,
const scalar refPoint = 0.0
const scalarList& curveDist
);
@ -101,33 +114,26 @@ public:
return name_;
}
const word& axis() const
word axis() const
{
return axis_;
return coordFormatNames_[axis_];
}
const point& refPoint() const
//- Cumulative distance
const scalarList& curveDist() const
{
return refPoint_;
return curveDist_;
}
//- Is axis specification a vector
bool hasVectorAxis() const;
//- Get coordinate of point according to axis specification.
// If axis="distance" can be: -distance to starting point (e.g.
// uniformSet) or -distance to first sampling point
// (e.g. cloudSet)
scalar scalarCoord
(
const label index
) const;
// If axis="distance" is the curveDist[index]
scalar scalarCoord(const label index) const;
//- Get point according to axis="full" specification
vector vectorCoord
(
const label index
) const;
//- Get point according to axis="xyz" specification
vector vectorCoord(const label index) const;
Ostream& write(Ostream& os) const;
};

View File

@ -64,7 +64,7 @@ bool Foam::faceOnlySet::trackToBoundary
// Alias
const point& trackPt = singleParticle.position();
while (true)
while(true)
{
point oldPoint = trackPt;
@ -198,7 +198,7 @@ void Foam::faceOnlySet::calcSamples
// index in bHits; current boundary intersection
label bHitI = 1;
while (true)
while(true)
{
if (trackFaceI != -1)
{
@ -229,7 +229,7 @@ void Foam::faceOnlySet::calcSamples
);
// fill sampleSegments
for (label i = samplingPts.size() - 1; i >= startSegmentI; --i)
for(label i = samplingPts.size() - 1; i >= startSegmentI; --i)
{
samplingSegments.append(segmentI);
}
@ -380,12 +380,4 @@ Foam::faceOnlySet::~faceOnlySet()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::faceOnlySet::getRefPoint(const List<point>& pts) const
{
return start_;
}
// ************************************************************************* //

View File

@ -47,7 +47,7 @@ class passiveParticle;
template<class Type> class Particle;
/*---------------------------------------------------------------------------*\
Class faceOnlySet Declaration
Class faceOnlySet Declaration
\*---------------------------------------------------------------------------*/
class faceOnlySet
@ -92,6 +92,7 @@ class faceOnlySet
//- Uses calcSamples to obtain samples. Copies them into *this.
void genSamples();
public:
//- Runtime type information
@ -121,8 +122,7 @@ public:
// Destructor
virtual ~faceOnlySet();
virtual ~faceOnlySet();
// Member Functions
@ -136,9 +136,6 @@ public:
{
return end_;
}
//- Get reference point
virtual point getRefPoint(const List<point>&) const;
};

View File

@ -53,7 +53,7 @@ void Foam::midPointSet::genSamples()
label sampleI = 0;
while (true)
while(true)
{
// calculate midpoint between sampleI and sampleI+1 (if in same segment)
while

View File

@ -58,6 +58,7 @@ class midPointSet
void genSamples();
public:
//- Runtime type information
@ -88,8 +89,7 @@ public:
// Destructor
virtual ~midPointSet();
virtual ~midPointSet();
};

View File

@ -55,7 +55,7 @@ void Foam::midPointAndFaceSet::genSamples()
label sampleI = 0;
while (true)
while(true)
{
// sampleI is start of segment

View File

@ -59,6 +59,7 @@ class midPointAndFaceSet
void genSamples();
public:
//- Runtime type information
@ -89,8 +90,7 @@ public:
// Destructor
virtual ~midPointAndFaceSet();
virtual ~midPointAndFaceSet();
};

View File

@ -394,20 +394,4 @@ Foam::polyLineSet::~polyLineSet()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::polyLineSet::getRefPoint(const List<point>& pts) const
{
if (pts.size())
{
// Use first samplePt as starting point
return pts[0];
}
else
{
return vector::zero;
}
}
// ************************************************************************* //

View File

@ -121,12 +121,6 @@ public:
// Destructor
virtual ~polyLineSet();
// Member Functions
//- Get reference point
virtual point getRefPoint(const List<point>&) const;
};

View File

@ -354,10 +354,11 @@ void Foam::sampledSet::setSamples
{
operator[](sampleI) = samplingPts[sampleI];
}
curveDist_ = samplingCurveDist;
cells_ = samplingCells;
faces_ = samplingFaces;
segments_ = samplingSegments;
curveDist_ = samplingCurveDist;
}
@ -375,7 +376,6 @@ Foam::sampledSet::sampledSet
mesh_(mesh),
searchEngine_(searchEngine),
segments_(0),
curveDist_(0),
cells_(0),
faces_(0)
{}
@ -393,7 +393,6 @@ Foam::sampledSet::sampledSet
mesh_(mesh),
searchEngine_(searchEngine),
segments_(0),
curveDist_(0),
cells_(0),
faces_(0)
{}

View File

@ -41,13 +41,10 @@ SourceFiles
#ifndef sampledSet_H
#define sampledSet_H
#include "pointField.H"
#include "word.H"
#include "labelList.H"
#include "coordSet.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
#include "autoPtr.H"
#include "coordSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -80,10 +77,6 @@ protected:
//- Segment numbers
labelList segments_;
//- Parameter along sample curve. Uniquely identifies position
// along sampling. Used for combining parallel results.
scalarList curveDist_;
//- Cell numbers
labelList cells_;
@ -245,8 +238,7 @@ public:
// Destructor
virtual ~sampledSet();
virtual ~sampledSet();
// Member Functions
@ -266,11 +258,6 @@ public:
return segments_;
}
const scalarList& curveDist() const
{
return curveDist_;
}
const labelList& cells() const
{
return cells_;
@ -281,9 +268,6 @@ public:
return faces_;
}
//- Given all sampling points (on all processors) return reference point
virtual point getRefPoint(const List<point>&) const = 0;
//- Output for debugging
Ostream& write(Ostream&) const;
};

View File

@ -100,19 +100,6 @@ void Foam::sampledSets::combineSampledSets
SortableList<scalar> sortedDist(allCurveDist);
indexSets[setI] = sortedDist.indices();
// Get reference point (note: only master has all points)
point refPt;
if (allPts.size())
{
refPt = samplePts.getRefPoint(allPts);
}
else
{
refPt = vector::zero;
}
masterSampledSets.set
(
setI,
@ -121,7 +108,7 @@ void Foam::sampledSets::combineSampledSets
samplePts.name(),
samplePts.axis(),
List<point>(UIndirectList<point>(allPts, indexSets[setI])),
refPt
allCurveDist
)
);
}

View File

@ -268,8 +268,7 @@ public:
// Destructor
virtual ~sampledSets();
virtual ~sampledSets();
// Member Functions

View File

@ -57,7 +57,6 @@ class triSurfaceMeshPointSet
//- Name of triSurfaceMesh
const word surface_;
//- Sampling points
List<point> sampleCoords_;
@ -77,6 +76,7 @@ class triSurfaceMeshPointSet
//- Uses calcSamples to obtain samples. Copies them into *this.
void genSamples();
public:
//- Runtime type information
@ -96,8 +96,7 @@ public:
// Destructor
virtual ~triSurfaceMeshPointSet();
virtual ~triSurfaceMeshPointSet();
// Member Functions

View File

@ -64,7 +64,7 @@ bool Foam::uniformSet::nextSample
samplePt += offset;
sampleI++;
for (; sampleI < nPoints_; sampleI++)
for(; sampleI < nPoints_; sampleI++)
{
scalar s = (samplePt - currentPt) & normOffset;
@ -102,7 +102,7 @@ bool Foam::uniformSet::trackToBoundary
// Alias
const point& trackPt = singleParticle.position();
while (true)
while(true)
{
// Find next samplePt on/after trackPt. Update samplePt, sampleI
if (!nextSample(trackPt, offset, smallDist, samplePt, sampleI))
@ -304,7 +304,7 @@ void Foam::uniformSet::calcSamples
// index in bHits; current boundary intersection
label bHitI = 1;
while (true)
while(true)
{
// Initialize tracking starting from trackPt
Cloud<passiveParticle> particles(mesh(), IDLList<passiveParticle>());
@ -328,7 +328,7 @@ void Foam::uniformSet::calcSamples
);
// fill sampleSegments
for (label i = samplingPts.size() - 1; i >= startSegmentI; --i)
for(label i = samplingPts.size() - 1; i >= startSegmentI; --i)
{
samplingSegments.append(segmentI);
}
@ -483,14 +483,4 @@ Foam::uniformSet::~uniformSet()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::uniformSet::getRefPoint(const List<point>& pts) const
{
// Use start point as reference for 'distance'
return start_;
}
// ************************************************************************* //

View File

@ -139,14 +139,7 @@ public:
// Destructor
virtual ~uniformSet();
// Member Functions
//- Get reference point
virtual point getRefPoint(const List<point>&) const;
virtual ~uniformSet();
};