Merge branch 'master' into cvm

Conflicts:
	applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
	src/edgeMesh/Make/files
	src/edgeMesh/featureEdgeMesh/featureEdgeMesh.C
	src/edgeMesh/featureEdgeMesh/featureEdgeMesh.H
This commit is contained in:
graham
2011-02-17 11:20:03 +00:00
388 changed files with 47966 additions and 6703 deletions

View File

@ -39,6 +39,7 @@ parallel/decompose/AllwmakeLnInclude
dummyThirdParty/Allwmake $*
wmake $makeOption lagrangian/basic
wmake $makeOption lagrangian/distributionModels
wmake $makeOption finiteVolume
wmake $makeOption genericPatchFields
@ -64,8 +65,6 @@ lagrangian/Allwmake $*
postProcessing/Allwmake $*
mesh/Allwmake $*
wmake $makeOption errorEstimation
fvAgglomerationMethods/Allwmake $*
wmake $makeOption fvMotionSolver

View File

@ -29,7 +29,7 @@ Description
SeeAlso
The manpage regex(7) for more information about POSIX regular expressions.
These differ somewhat from \c Perl and @c sed regular expressions.
These differ somewhat from \c Perl and \c sed regular expressions.
SourceFiles
regExp.C

View File

@ -66,6 +66,7 @@ primitives/functions/DataEntry/makeDataEntries.C
primitives/functions/DataEntry/polynomial/polynomial.C
primitives/functions/DataEntry/polynomial/polynomialIO.C
primitives/functions/Polynomial/polynomialFunction.C
strings = primitives/strings
$(strings)/string/string.C
@ -164,11 +165,16 @@ $(functionEntries)/includeIfPresentEntry/includeIfPresentEntry.C
$(functionEntries)/inputModeEntry/inputModeEntry.C
$(functionEntries)/removeEntry/removeEntry.C
calcEntry = $(functionEntries)/calcEntry
$(calcEntry)/calcEntryParser.atg
$(calcEntry)/calcEntryInternal.C
$(calcEntry)/calcEntry.C
/*
* Requires customized coco-cpp
* could be dropped or activated in the future
*/
/*
calcEntry = $(functionEntries)/calcEntry
$(calcEntry)/calcEntryParser.atg
$(calcEntry)/calcEntryInternal.C
$(calcEntry)/calcEntry.C
*/
IOdictionary = db/IOobjects/IOdictionary
$(IOdictionary)/IOdictionary.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -137,7 +137,7 @@ Foam::IOdictionary::IOdictionary(const IOobject& io)
}
// Everyone check or just master
bool masterOnly =
bool masterOnly =
regIOobject::fileModificationChecking == timeStampMaster
|| regIOobject::fileModificationChecking == inotifyMaster;
@ -195,7 +195,7 @@ Foam::IOdictionary::IOdictionary(const IOobject& io, const dictionary& dict)
}
// Everyone check or just master
bool masterOnly =
bool masterOnly =
regIOobject::fileModificationChecking == timeStampMaster
|| regIOobject::fileModificationChecking == inotifyMaster;
@ -239,6 +239,18 @@ Foam::IOdictionary::IOdictionary(const IOobject& io, const dictionary& dict)
}
Foam::IOdictionary::IOdictionary(const IOobject& io, Istream& is)
:
regIOobject(io)
{
dictionary::name() = IOobject::objectPath();
// Note that we do construct the dictionary null and read in afterwards
// so that if there is some fancy massaging due to a functionEntry in
// the dictionary at least the type information is already complete.
is >> *this;
}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
Foam::IOdictionary::~IOdictionary()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -75,6 +75,9 @@ public:
//- Construct given an IOobject and dictionary
IOdictionary(const IOobject&, const dictionary&);
//- Construct given an IOobject and Istream
IOdictionary(const IOobject&, Istream&);
//- Destructor
virtual ~IOdictionary();

View File

@ -486,14 +486,29 @@ Foam::dictionary& Foam::dictionary::subDict(const word& keyword)
Foam::dictionary Foam::dictionary::subOrEmptyDict
(
const word& keyword
const word& keyword,
const bool mustRead
) const
{
const entry* entryPtr = lookupEntryPtr(keyword, false, true);
if (entryPtr == NULL)
{
return dictionary(*this, dictionary(name() + "::" + keyword));
if (mustRead)
{
FatalIOErrorIn
(
"dictionary::subOrEmptyDict(const word& keyword, const bool)",
*this
) << "keyword " << keyword << " is undefined in dictionary "
<< name()
<< exit(FatalIOError);
return entryPtr->dict();
}
else
{
return dictionary(*this, dictionary(name() + "::" + keyword));
}
}
else
{
@ -741,13 +756,14 @@ bool Foam::dictionary::changeKeyword
if (iter()->keyword().isPattern())
{
FatalErrorIn
FatalIOErrorIn
(
"dictionary::changeKeyword(const word&, const word&, bool)"
"dictionary::changeKeyword(const word&, const word&, bool)",
*this
) << "Old keyword "<< oldKeyword
<< " is a pattern."
<< "Pattern replacement not yet implemented."
<< exit(FatalError);
<< exit(FatalIOError);
}
@ -781,9 +797,10 @@ bool Foam::dictionary::changeKeyword
}
else
{
WarningIn
IOWarningIn
(
"dictionary::changeKeyword(const word&, const word&, bool)"
"dictionary::changeKeyword(const word&, const word&, bool)",
*this
) << "cannot rename keyword "<< oldKeyword
<< " to existing keyword " << newKeyword
<< " in dictionary " << name() << endl;
@ -815,9 +832,9 @@ bool Foam::dictionary::merge(const dictionary& dict)
// Check for assignment to self
if (this == &dict)
{
FatalErrorIn("dictionary::merge(const dictionary&)")
FatalIOErrorIn("dictionary::merge(const dictionary&)", *this)
<< "attempted merge to self for dictionary " << name()
<< abort(FatalError);
<< abort(FatalIOError);
}
bool changed = false;
@ -896,9 +913,9 @@ void Foam::dictionary::operator=(const dictionary& rhs)
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn("dictionary::operator=(const dictionary&)")
FatalIOErrorIn("dictionary::operator=(const dictionary&)", *this)
<< "attempted assignment to self for dictionary " << name()
<< abort(FatalError);
<< abort(FatalIOError);
}
name() = rhs.name();
@ -919,9 +936,9 @@ void Foam::dictionary::operator+=(const dictionary& rhs)
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn("dictionary::operator+=(const dictionary&)")
FatalIOErrorIn("dictionary::operator+=(const dictionary&)", *this)
<< "attempted addition assignment to self for dictionary " << name()
<< abort(FatalError);
<< abort(FatalIOError);
}
forAllConstIter(IDLList<entry>, rhs, iter)
@ -936,9 +953,9 @@ void Foam::dictionary::operator|=(const dictionary& rhs)
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn("dictionary::operator|=(const dictionary&)")
FatalIOErrorIn("dictionary::operator|=(const dictionary&)", *this)
<< "attempted assignment to self for dictionary " << name()
<< abort(FatalError);
<< abort(FatalIOError);
}
forAllConstIter(IDLList<entry>, rhs, iter)
@ -956,9 +973,9 @@ void Foam::dictionary::operator<<=(const dictionary& rhs)
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn("dictionary::operator<<=(const dictionary&)")
FatalIOErrorIn("dictionary::operator<<=(const dictionary&)", *this)
<< "attempted assignment to self for dictionary " << name()
<< abort(FatalError);
<< abort(FatalIOError);
}
forAllConstIter(IDLList<entry>, rhs, iter)

View File

@ -239,7 +239,7 @@ public:
//- Destructor
~dictionary();
virtual ~dictionary();
// Member functions
@ -368,7 +368,11 @@ public:
//- Find and return a sub-dictionary as a copy, or
// return an empty dictionary if the sub-dictionary does not exist
dictionary subOrEmptyDict(const word&) const;
dictionary subOrEmptyDict
(
const word&,
const bool mustRead = false
) const;
//- Return the table of contents
wordList toc() const;

View File

@ -27,7 +27,7 @@ Class
Description
Specify a file to include if it exists. Expects a single string to follow.
The \c \#includeIfPresent directive is similar to the @c \#include
The \c \#includeIfPresent directive is similar to the \c \#include
directive, but does not generate an error if the file does not exist.
See Also

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -95,17 +95,22 @@ Foam::tmp
>
Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is)
{
if (is.version() < 2.0)
{
FatalIOErrorIn
return readField
(
IOdictionary
(
"GeometricField<Type, PatchField, GeoMesh>::readField(Istream&)",
IOobject
(
this->name(),
this->time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
is
) << "IO versions < 2.0 are not supported."
<< exit(FatalIOError);
}
return readField(dictionary(is));
)
);
}
@ -384,45 +389,6 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
const IOobject& io,
const Mesh& mesh,
Istream& is
)
:
DimensionedField<Type, GeoMesh>(io, mesh, dimless, false),
timeIndex_(this->time().timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
boundaryField_(*this, readField(is))
{
// Check compatibility between field and mesh
if (this->size() != GeoMesh::size(this->mesh()))
{
FatalIOErrorIn
(
"GeometricField<Type, PatchField, GeoMesh>::GeometricField"
"(const IOobject&, const Mesh&, Istream&)",
is
) << " number of field elements = " << this->size()
<< " number of mesh elements = " << GeoMesh::size(this->mesh())
<< exit(FatalIOError);
}
readOldTimeIfPresent();
if (debug)
{
Info<< "Finishing read-construct of "
"GeometricField<Type, PatchField, GeoMesh>"
<< endl << this->info() << endl;
}
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -325,14 +325,6 @@ public:
const Mesh&
);
//- Construct and read from given stream
GeometricField
(
const IOobject&,
const Mesh&,
Istream&
);
//- Construct from dictionary
GeometricField
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -21,9 +21,9 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
@mainpage OpenFOAM&reg;: open source CFD
\mainpage OpenFOAM&reg;: open source CFD
@section about About OpenFOAM
\section about About OpenFOAM
OpenFOAM is a free, open source CFD software package produced by
a commercial company,
@ -35,7 +35,7 @@ License
heat transfer, to solid dynamics and electromagnetics.
<a href="http://www.openfoam.com/features">More ...</a>
@section users Our commitment to the users
\section users Our commitment to the users
OpenFOAM comes with full commercial support from OpenCFD, including
<a href="http://www.openfoam.com/support/software.php">
@ -48,7 +48,7 @@ License
These activities fund the development, maintenance and release of
OpenFOAM to make it an extremely viable commercial open source product.
@section opensource Our commitment to open source
\section opensource Our commitment to open source
OpenCFD is committed to open source software, continually developing and
maintaining OpenFOAM under the

View File

@ -550,11 +550,12 @@ Foam::label Foam::polyBoundaryMesh::whichPatch(const label faceIndex) const
Foam::labelHashSet Foam::polyBoundaryMesh::patchSet
(
const wordList& patchNames
const wordReList& patchNames,
const bool warnNotFound
) const
{
wordList allPatchNames = names();
labelHashSet ps(size());
const wordList allPatchNames(this->names());
labelHashSet ids(size());
forAll(patchNames, i)
{
@ -562,20 +563,23 @@ Foam::labelHashSet Foam::polyBoundaryMesh::patchSet
// of all patch names for matches
labelList patchIDs = findStrings(patchNames[i], allPatchNames);
if (patchIDs.empty())
if (patchIDs.empty() && warnNotFound)
{
WarningIn("polyBoundaryMesh::patchSet(const wordList&)")
<< "Cannot find any patch names matching " << patchNames[i]
WarningIn
(
"polyBoundaryMesh::patchSet"
"(const wordReList&, const bool) const"
) << "Cannot find any patch names matching " << patchNames[i]
<< endl;
}
forAll(patchIDs, j)
{
ps.insert(patchIDs[j]);
ids.insert(patchIDs[j]);
}
}
return ps;
return ids;
}

View File

@ -38,6 +38,7 @@ SourceFiles
#include "polyPatchList.H"
#include "regIOobject.H"
#include "labelPair.H"
#include "wordReList.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -166,9 +167,13 @@ public:
//- Per boundary face label the patch index
const labelList& patchID() const;
//- Return the set of patch IDs corresponding to the given list of names
// Wild cards are expanded.
labelHashSet patchSet(const wordList&) const;
//- Return the set of patch IDs corresponding to the given names
// By default warns if given names are not found.
labelHashSet patchSet
(
const wordReList& patchNames,
const bool warnNotFound = true
) const;
//- Check whether all procs have all patches and in same order. Return
// true if in error.

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -41,6 +41,18 @@ Foam::Polynomial<PolySize>::Polynomial()
}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial
(
const Polynomial<PolySize>& poly
)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(poly),
logActive_(poly.logActive_),
logCoeff_(poly.logCoeff_)
{}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial(const scalar coeffs[PolySize])
:
@ -68,7 +80,7 @@ Foam::Polynomial<PolySize>::Polynomial(const UList<scalar>& coeffs)
(
"Polynomial<PolySize>::Polynomial(const UList<scalar>&)"
) << "Size mismatch: Needed " << PolySize
<< " but got " << coeffs.size()
<< " but given " << coeffs.size()
<< nl << exit(FatalError);
}
@ -79,6 +91,39 @@ Foam::Polynomial<PolySize>::Polynomial(const UList<scalar>& coeffs)
}
// template<int PolySize>
// Foam::Polynomial<PolySize>::Polynomial(const polynomialFunction& poly)
// :
// VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
// logActive_(poly.logActive()),
// logCoeff_(poly.logCoeff())
// {
// if (poly.size() != PolySize)
// {
// FatalErrorIn
// (
// "Polynomial<PolySize>::Polynomial(const polynomialFunction&)"
// ) << "Size mismatch: Needed " << PolySize
// << " but given " << poly.size()
// << nl << exit(FatalError);
// }
//
// for (int i = 0; i < PolySize; ++i)
// {
// this->v_[i] = poly[i];
// }
// }
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial(Istream& is)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(is),
logActive_(false),
logCoeff_(0.0)
{}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial(const word& name, Istream& is)
:
@ -111,38 +156,17 @@ Foam::Polynomial<PolySize>::Polynomial(const word& name, Istream& is)
}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial(Istream& is)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(is),
logActive_(false),
logCoeff_(0.0)
{}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial
(
const Polynomial<PolySize>& poly
)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(poly),
logActive_(poly.logActive_),
logCoeff_(poly.logCoeff_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<int PolySize>
bool& Foam::Polynomial<PolySize>::logActive()
bool Foam::Polynomial<PolySize>::logActive() const
{
return logActive_;
}
template<int PolySize>
Foam::scalar& Foam::Polynomial<PolySize>::logCoeff()
Foam::scalar Foam::Polynomial<PolySize>::logCoeff() const
{
return logCoeff_;
}
@ -151,27 +175,27 @@ Foam::scalar& Foam::Polynomial<PolySize>::logCoeff()
template<int PolySize>
Foam::scalar Foam::Polynomial<PolySize>::value(const scalar x) const
{
scalar y = this->v_[0];
scalar val = this->v_[0];
// avoid costly pow() in calculation
scalar powX = x;
for (label i=1; i<PolySize; ++i)
{
y += this->v_[i]*powX;
val += this->v_[i]*powX;
powX *= x;
}
if (logActive_)
{
y += logCoeff_*log(x);
val += logCoeff_*log(x);
}
return y;
return val;
}
template<int PolySize>
Foam::scalar Foam::Polynomial<PolySize>::integrateLimits
Foam::scalar Foam::Polynomial<PolySize>::integrate
(
const scalar x1,
const scalar x2
@ -181,7 +205,7 @@ Foam::scalar Foam::Polynomial<PolySize>::integrateLimits
{
FatalErrorIn
(
"scalar Polynomial<PolySize>::integrateLimits"
"scalar Polynomial<PolySize>::integrate"
"("
"const scalar, "
"const scalar"
@ -190,22 +214,33 @@ Foam::scalar Foam::Polynomial<PolySize>::integrateLimits
<< nl << abort(FatalError);
}
intPolyType poly = this->integrate();
return poly.value(x2) - poly.value(x1);
// avoid costly pow() in calculation
scalar powX1 = x1;
scalar powX2 = x2;
scalar val = this->v_[0]*(powX2 - powX1);
for (label i=1; i<PolySize; ++i)
{
val += this->v_[i]/(i + 1) * (powX2 - powX1);
powX1 *= x1;
powX2 *= x2;
}
return val;
}
template<int PolySize>
typename Foam::Polynomial<PolySize>::intPolyType
Foam::Polynomial<PolySize>::integrate(const scalar intConstant)
Foam::Polynomial<PolySize>::integral(const scalar intConstant) const
{
intPolyType newCoeffs;
newCoeffs[0] = intConstant;
forAll(*this, i)
{
newCoeffs[i + 1] = this->v_[i]/(i + 1);
newCoeffs[i+1] = this->v_[i]/(i + 1);
}
return newCoeffs;
@ -214,14 +249,14 @@ Foam::Polynomial<PolySize>::integrate(const scalar intConstant)
template<int PolySize>
typename Foam::Polynomial<PolySize>::polyType
Foam::Polynomial<PolySize>::integrateMinus1(const scalar intConstant)
Foam::Polynomial<PolySize>::integralMinus1(const scalar intConstant) const
{
polyType newCoeffs;
if (this->v_[0] > VSMALL)
{
newCoeffs.logActive() = true;
newCoeffs.logCoeff() = this->v_[0];
newCoeffs.logActive_ = true;
newCoeffs.logCoeff_ = this->v_[0];
}
newCoeffs[0] = intConstant;

View File

@ -29,14 +29,14 @@ Description
poly = logCoeff*log(x) + sum(coeff_[i]*x^i)
where 0 \<= i \<= n
where 0 \<= i \<= N
- integer powers, starting at zero
- value(x) to evaluate the poly for a given value
- integrate(x1, x2) between two scalar values
- integrate() to return a new, intergated coeff polynomial
- integral() to return a new, integral coeff polynomial
- increases the size (order)
- integrateMinus1() to return a new, integrated coeff polynomial where
- integralMinus1() to return a new, integral coeff polynomial where
the base poly starts at order -1
SourceFiles
@ -85,10 +85,10 @@ class Polynomial
// Private data
//- Include the log term? - only activated using integrateMinus1()
//- Include the log term? - only activated using integralMinus1()
bool logActive_;
//- Log coefficient - only activated using integrateMinus1()
//- Log coefficient - only activated using integralMinus1()
scalar logCoeff_;
@ -104,6 +104,9 @@ public:
//- Construct null, with all coefficients = 0.0
Polynomial();
//- Copy constructor
Polynomial(const Polynomial&);
//- Construct from C-array of coefficients
explicit Polynomial(const scalar coeffs[PolySize]);
@ -111,24 +114,21 @@ public:
explicit Polynomial(const UList<scalar>& coeffs);
//- Construct from Istream
Polynomial(Istream& is);
Polynomial(Istream&);
//- Construct from name and Istream
Polynomial(const word& name, Istream& is);
//- Copy constructor
Polynomial(const Polynomial& poly);
Polynomial(const word& name, Istream&);
// Member Functions
// Access
//- Return access to the log term active flag
bool& logActive();
//- Return true if the log term is active
bool logActive() const;
//- Return access to the log coefficient
scalar& logCoeff();
//- Return the log coefficient
scalar logCoeff() const;
// Evaluation
@ -136,16 +136,17 @@ public:
//- Return polynomial value
scalar value(const scalar x) const;
//- Return integrated polynomial coefficients
// argument becomes zeroth element (constant of integration)
intPolyType integrate(const scalar intConstant = 0.0);
//- Return integrated polynomial coefficients when lowest order
// is -1. Argument added to zeroth element
polyType integrateMinus1(const scalar intConstant = 0.0);
//- Integrate between two values
scalar integrateLimits(const scalar x1, const scalar x2) const;
scalar integrate(const scalar x1, const scalar x2) const;
//- Return integral coefficients.
// Argument becomes zeroth element (constant of integration)
intPolyType integral(const scalar intConstant = 0.0) const;
//- Return integral coefficients when lowest order is -1.
// Argument becomes zeroth element (constant of integration)
polyType integralMinus1(const scalar intConstant = 0.0) const;
//- Ostream Operator

View File

@ -0,0 +1,415 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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 "polynomialFunction.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(polynomialFunction, 0);
}
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
Foam::polynomialFunction Foam::polynomialFunction::cloneIntegral
(
const polynomialFunction& poly,
const scalar intConstant
)
{
polynomialFunction newPoly(poly.size()+1);
newPoly[0] = intConstant;
forAll(poly, i)
{
newPoly[i+1] = poly[i]/(i + 1);
}
return newPoly;
}
Foam::polynomialFunction Foam::polynomialFunction::cloneIntegralMinus1
(
const polynomialFunction& poly,
const scalar intConstant
)
{
polynomialFunction newPoly(poly.size()+1);
if (poly[0] > VSMALL)
{
newPoly.logActive_ = true;
newPoly.logCoeff_ = poly[0];
}
newPoly[0] = intConstant;
for (label i=1; i < poly.size(); ++i)
{
newPoly[i] = poly[i]/i;
}
return newPoly;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::polynomialFunction::polynomialFunction(const label order)
:
scalarList(order, 0.0),
logActive_(false),
logCoeff_(0.0)
{
if (this->empty())
{
FatalErrorIn
(
"polynomialFunction::polynomialFunction(const label order)"
) << "polynomialFunction coefficients are invalid (empty)"
<< nl << exit(FatalError);
}
}
Foam::polynomialFunction::polynomialFunction(const polynomialFunction& poly)
:
scalarList(poly),
logActive_(poly.logActive_),
logCoeff_(poly.logCoeff_)
{}
Foam::polynomialFunction::polynomialFunction(const UList<scalar>& coeffs)
:
scalarList(coeffs),
logActive_(false),
logCoeff_(0.0)
{
if (this->empty())
{
FatalErrorIn
(
"polynomialFunction::polynomialFunction(const UList<scalar>&)"
) << "polynomialFunction coefficients are invalid (empty)"
<< nl << exit(FatalError);
}
}
Foam::polynomialFunction::polynomialFunction(Istream& is)
:
scalarList(is),
logActive_(false),
logCoeff_(0.0)
{
if (this->empty())
{
FatalErrorIn
(
"polynomialFunction::polynomialFunction(Istream&)"
) << "polynomialFunction coefficients are invalid (empty)"
<< nl << exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::polynomialFunction::~polynomialFunction()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::polynomialFunction::logActive() const
{
return logActive_;
}
Foam::scalar Foam::polynomialFunction::logCoeff() const
{
return logCoeff_;
}
Foam::scalar Foam::polynomialFunction::value(const scalar x) const
{
const scalarList& coeffs = *this;
scalar val = coeffs[0];
// avoid costly pow() in calculation
scalar powX = x;
for (label i=1; i<coeffs.size(); ++i)
{
val += coeffs[i]*powX;
powX *= x;
}
if (logActive_)
{
val += this->logCoeff_*log(x);
}
return val;
}
Foam::scalar Foam::polynomialFunction::integrate
(
const scalar x1,
const scalar x2
) const
{
const scalarList& coeffs = *this;
if (logActive_)
{
FatalErrorIn
(
"scalar polynomialFunction::integrate"
"("
"const scalar, "
"const scalar"
") const"
) << "Cannot integrate polynomial with logarithmic coefficients"
<< nl << abort(FatalError);
}
// avoid costly pow() in calculation
scalar powX1 = x1;
scalar powX2 = x2;
scalar val = coeffs[0]*(powX2 - powX1);
for (label i=1; i<coeffs.size(); ++i)
{
val += coeffs[i]/(i + 1)*(powX2 - powX1);
powX1 *= x1;
powX2 *= x2;
}
return val;
}
Foam::polynomialFunction
Foam::polynomialFunction::integral(const scalar intConstant) const
{
return cloneIntegral(*this, intConstant);
}
Foam::polynomialFunction
Foam::polynomialFunction::integralMinus1(const scalar intConstant) const
{
return cloneIntegralMinus1(*this, intConstant);
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
Foam::polynomialFunction&
Foam::polynomialFunction::operator+=(const polynomialFunction& poly)
{
scalarList& coeffs = *this;
if (coeffs.size() > poly.size())
{
forAll(poly, i)
{
coeffs[i] += poly[i];
}
}
else
{
coeffs.setSize(poly.size(), 0.0);
forAll(coeffs, i)
{
coeffs[i] += poly[i];
}
}
return *this;
}
Foam::polynomialFunction&
Foam::polynomialFunction::operator-=(const polynomialFunction& poly)
{
scalarList& coeffs = *this;
if (coeffs.size() > poly.size())
{
forAll(poly, i)
{
coeffs[i] -= poly[i];
}
}
else
{
coeffs.setSize(poly.size(), 0.0);
forAll(coeffs, i)
{
coeffs[i] -= poly[i];
}
}
return *this;
}
Foam::polynomialFunction&
Foam::polynomialFunction::operator*=(const scalar s)
{
scalarList& coeffs = *this;
forAll(coeffs, i)
{
coeffs[i] *= s;
}
return *this;
}
Foam::polynomialFunction&
Foam::polynomialFunction::operator/=(const scalar s)
{
scalarList& coeffs = *this;
forAll(coeffs, i)
{
coeffs[i] /= s;
}
return *this;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const polynomialFunction& poly)
{
// output like VectorSpace
os << token::BEGIN_LIST;
if (!poly.empty())
{
for (int i=0; i<poly.size()-1; i++)
{
os << poly[i] << token::SPACE;
}
os << poly.last();
}
os << token::END_LIST;
// Check state of Ostream
os.check("operator<<(Ostream&, const polynomialFunction&)");
return os;
}
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
Foam::polynomialFunction
Foam::operator+
(
const polynomialFunction& p1,
const polynomialFunction& p2
)
{
polynomialFunction poly(p1);
return poly += p2;
}
Foam::polynomialFunction
Foam::operator-
(
const polynomialFunction& p1,
const polynomialFunction& p2
)
{
polynomialFunction poly(p1);
return poly -= p2;
}
Foam::polynomialFunction
Foam::operator*
(
const scalar s,
const polynomialFunction& p
)
{
polynomialFunction poly(p);
return poly *= s;
}
Foam::polynomialFunction
Foam::operator/
(
const scalar s,
const polynomialFunction& p
)
{
polynomialFunction poly(p);
return poly /= s;
}
Foam::polynomialFunction
Foam::operator*
(
const polynomialFunction& p,
const scalar s
)
{
polynomialFunction poly(p);
return poly *= s;
}
Foam::polynomialFunction
Foam::operator/
(
const polynomialFunction& p,
const scalar s
)
{
polynomialFunction poly(p);
return poly /= s;
}
// ************************************************************************* //

View File

@ -0,0 +1,246 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2011 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::polynomialFunction
Description
Polynomial function representation
poly = logCoeff*log(x) + sum(coeff_[i]*x^i)
where 0 \<= i \<= N
- integer powers, starting at zero
- value(x) to evaluate the poly for a given value
- integrate(x1, x2) between two scalar values
- integral() to return a new, integral coeff polynomial
- increases the size (order)
- integralMinus1() to return a new, integral coeff polynomial where
the base poly starts at order -1
SeeAlso
Foam::Polynomial for a templated implementation
SourceFiles
polynomialFunction.C
\*---------------------------------------------------------------------------*/
#ifndef polynomialFunction_H
#define polynomialFunction_H
#include "scalarList.H"
#include "Ostream.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class polynomialFunction;
// Forward declaration of friend functions
Ostream& operator<<(Ostream&, const polynomialFunction&);
/*---------------------------------------------------------------------------*\
Class polynomialFunction Declaration
\*---------------------------------------------------------------------------*/
class polynomialFunction
:
private scalarList
{
// Private data
//- Include the log term? - only activated using integralMinus1()
bool logActive_;
//- Log coefficient - only activated using integralMinus1()
scalar logCoeff_;
// Private Member Functions
//- Return integral coefficients.
// Argument becomes zeroth element (constant of integration)
static polynomialFunction cloneIntegral
(
const polynomialFunction&,
const scalar intConstant = 0.0
);
//- Return integral coefficients when lowest order is -1.
// Argument becomes zeroth element (constant of integration)
static polynomialFunction cloneIntegralMinus1
(
const polynomialFunction&,
const scalar intConstant = 0.0
);
//- Disallow default bitwise assignment
void operator=(const polynomialFunction&);
public:
//- Runtime type information
TypeName("polynomialFunction");
// Constructors
//- Construct a particular size, with all coefficients = 0.0
explicit polynomialFunction(const label);
//- Copy constructor
polynomialFunction(const polynomialFunction&);
//- Construct from a list of coefficients
explicit polynomialFunction(const UList<scalar>& coeffs);
//- Construct from Istream
polynomialFunction(Istream&);
//- Destructor
virtual ~polynomialFunction();
// Member Functions
//- Return the number of coefficients
using scalarList::size;
//- Return coefficient
using scalarList::operator[];
// Access
//- Return true if the log term is active
bool logActive() const;
//- Return the log coefficient
scalar logCoeff() const;
// Evaluation
//- Return polynomial value
scalar value(const scalar x) const;
//- Integrate between two values
scalar integrate(const scalar x1, const scalar x2) const;
//- Return integral coefficients.
// Argument becomes zeroth element (constant of integration)
polynomialFunction integral
(
const scalar intConstant = 0.0
) const;
//- Return integral coefficients when lowest order is -1.
// Argument becomes zeroth element (constant of integration)
polynomialFunction integralMinus1
(
const scalar intConstant = 0.0
) const;
// Member Operators
polynomialFunction& operator+=(const polynomialFunction&);
polynomialFunction& operator-=(const polynomialFunction&);
polynomialFunction& operator*=(const scalar);
polynomialFunction& operator/=(const scalar);
//- Ostream Operator
friend Ostream& operator<<(Ostream&, const polynomialFunction&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
polynomialFunction operator+
(
const polynomialFunction&,
const polynomialFunction&
);
polynomialFunction operator-
(
const polynomialFunction&,
const polynomialFunction&
);
polynomialFunction operator*
(
const scalar,
const polynomialFunction&
);
polynomialFunction operator/
(
const scalar,
const polynomialFunction&
);
polynomialFunction operator*
(
const polynomialFunction&,
const scalar
);
polynomialFunction operator/
(
const polynomialFunction&,
const scalar
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -35,7 +35,7 @@ Description
write OpenFOAM meshes and/or results to another CFD format
- currently just STAR-CD
@par Files
\par Files
"constant/boundaryRegion" is an IOMap<dictionary> that contains
the boundary type and names. eg,

View File

@ -43,75 +43,6 @@ defineTypeNameAndDebug(Foam::addPatchCellLayer, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Calculate global faces per pp edge.
Foam::labelListList Foam::addPatchCellLayer::calcGlobalEdgeFaces
(
const polyMesh& mesh,
const globalIndex& globalFaces,
const indirectPrimitivePatch& pp,
const labelList& meshEdges
)
{
//// Determine coupled edges just so we don't have to have storage
//// for all non-coupled edges.
//
//PackedBoolList isCoupledEdge(mesh.nEdges());
//
//const polyBoundaryMesh& patches = mesh.boundaryMesh();
//
//forAll(patches, patchI)
//{
// const polyPatch& pp = patches[patchI];
//
// if (pp.coupled())
// {
// const labelList& meshEdges = pp.meshEdges();
//
// forAll(meshEdges, i)
// {
// isCoupledEdge.set(meshEdges[i], 1);
// }
// }
//}
// From mesh edge to global face labels. Sized only for pp edges.
labelListList globalEdgeFaces(mesh.nEdges());
const labelListList& edgeFaces = pp.edgeFaces();
forAll(edgeFaces, edgeI)
{
label meshEdgeI = meshEdges[edgeI];
//if (isCoupledEdge.get(meshEdgeI) == 1)
{
const labelList& eFaces = edgeFaces[edgeI];
// Store face and processor as unique tag.
labelList& globalEFaces = globalEdgeFaces[meshEdgeI];
globalEFaces.setSize(eFaces.size());
forAll(eFaces, i)
{
globalEFaces[i] =
globalFaces.toGlobal(pp.addressing()[eFaces[i]]);
}
}
}
// Synchronise across coupled edges.
syncTools::syncEdgeList
(
mesh,
globalEdgeFaces,
uniqueEqOp(),
labelList() // null value
);
// Extract pp part
return labelListList(UIndirectList<labelList>(globalEdgeFaces, meshEdges));
}
Foam::label Foam::addPatchCellLayer::nbrFace
(
const labelListList& edgeFaces,
@ -316,12 +247,12 @@ Foam::labelPair Foam::addPatchCellLayer::getEdgeString
Foam::label Foam::addPatchCellLayer::addSideFace
(
const indirectPrimitivePatch& pp,
const labelList& patchID, // prestored patch per pp face
const labelListList& addedCells, // per pp face the new extruded cell
const face& newFace,
const label newPatchID,
const label ownFaceI, // pp face that provides owner
const label nbrFaceI,
const label patchEdgeI, // edge to add to
const label meshEdgeI, // corresponding mesh edge
const label layerI, // layer
const label numEdgeFaces, // number of layers for edge
@ -329,8 +260,9 @@ Foam::label Foam::addPatchCellLayer::addSideFace
polyTopoChange& meshMod
) const
{
// Edge to 'inflate' from
// Face or edge to 'inflate' from
label inflateEdgeI = -1;
label inflateFaceI = -1;
// Check mesh faces using edge
if (addToMesh_)
@ -346,8 +278,6 @@ Foam::label Foam::addPatchCellLayer::addSideFace
}
}
// Get my mesh face and its zone.
label meshFaceI = pp.addressing()[ownFaceI];
// Zone info comes from any side patch face. Otherwise -1 since we
// don't know what to put it in - inherit from the extruded faces?
label zoneI = -1; //mesh_.faceZones().whichZone(meshFaceI);
@ -358,14 +288,15 @@ Foam::label Foam::addPatchCellLayer::addSideFace
// Is patch edge external edge of indirectPrimitivePatch?
if (nbrFaceI == -1)
{
// External edge so external face. Patch id is obtained from
// any other patch connected to edge.
// External edge so external face.
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Loop over all faces connected to edge to inflate and
// see if any boundary face (but not meshFaceI)
label otherPatchID = patchID[ownFaceI];
// see if we can find a face that is otherPatchID
// Get my mesh face and its zone.
label meshFaceI = pp.addressing()[ownFaceI];
forAll(meshFaces, k)
{
@ -373,11 +304,14 @@ Foam::label Foam::addPatchCellLayer::addSideFace
if
(
faceI != meshFaceI
&& !mesh_.isInternalFace(faceI)
(faceI != meshFaceI)
&& (patches.whichPatch(faceI) == newPatchID)
)
{
otherPatchID = patches.whichPatch(faceI);
// Found the patch face. Use it to inflate from
inflateEdgeI = -1;
inflateFaceI = faceI;
zoneI = mesh_.faceZones().whichZone(faceI);
if (zoneI != -1)
{
@ -414,7 +348,7 @@ Foam::label Foam::addPatchCellLayer::addSideFace
//Pout<< "Added boundary face:" << newFace
// << " own:" << addedCells[ownFaceI][layerOwn]
// << " patch:" << otherPatchID
// << " patch:" << newPatchID
// << endl;
addedFaceI = meshMod.setAction
@ -426,9 +360,9 @@ Foam::label Foam::addPatchCellLayer::addSideFace
-1, // neighbour
-1, // master point
inflateEdgeI, // master edge
-1, // master face
inflateFaceI, // master face
false, // flux flip
otherPatchID, // patch for face
newPatchID, // patch for face
zoneI, // zone for face
flip // face zone flip
)
@ -510,6 +444,51 @@ Foam::label Foam::addPatchCellLayer::addSideFace
}
Foam::label Foam::addPatchCellLayer::findProcPatch
(
const polyMesh& mesh,
const label nbrProcID
)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(mesh.globalData().processorPatches(), i)
{
label patchI = mesh.globalData().processorPatches()[i];
if
(
refCast<const processorPolyPatch>(patches[patchI]).neighbProcNo()
== nbrProcID
)
{
return patchI;
}
}
return -1;
}
void Foam::addPatchCellLayer::setFaceProps
(
const polyMesh& mesh,
const label faceI,
label& patchI,
label& zoneI,
bool& zoneFlip
)
{
patchI = mesh.boundaryMesh().whichPatch(faceI);
zoneI = mesh.faceZones().whichZone(faceI);
if (zoneI != -1)
{
label index = mesh.faceZones()[zoneI].whichFace(faceI);
zoneFlip = mesh.faceZones()[zoneI].flipMap()[index];
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from mesh
@ -561,10 +540,251 @@ Foam::labelListList Foam::addPatchCellLayer::addedCells() const
}
// Calculate global faces per pp edge.
Foam::labelListList Foam::addPatchCellLayer::globalEdgeFaces
(
const polyMesh& mesh,
const globalIndex& globalFaces,
const indirectPrimitivePatch& pp
)
{
// Precalculate mesh edges for pp.edges.
const labelList meshEdges(pp.meshEdges(mesh.edges(), mesh.pointEdges()));
// From mesh edge to global face labels. Non-empty sublists only for
// pp edges.
labelListList globalEdgeFaces(mesh.nEdges());
const labelListList& edgeFaces = pp.edgeFaces();
forAll(edgeFaces, edgeI)
{
label meshEdgeI = meshEdges[edgeI];
const labelList& eFaces = edgeFaces[edgeI];
// Store face and processor as unique tag.
labelList& globalEFaces = globalEdgeFaces[meshEdgeI];
globalEFaces.setSize(eFaces.size());
forAll(eFaces, i)
{
globalEFaces[i] = globalFaces.toGlobal(pp.addressing()[eFaces[i]]);
}
}
// Synchronise across coupled edges.
syncTools::syncEdgeList
(
mesh,
globalEdgeFaces,
uniqueEqOp(),
labelList() // null value
);
// Extract pp part
return labelListList(UIndirectList<labelList>(globalEdgeFaces, meshEdges));
}
void Foam::addPatchCellLayer::calcSidePatch
(
const polyMesh& mesh,
const globalIndex& globalFaces,
const labelListList& globalEdgeFaces,
const indirectPrimitivePatch& pp,
labelList& sidePatchID,
label& nPatches,
Map<label>& nbrProcToPatch,
Map<label>& patchToNbrProc
)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Precalculate mesh edges for pp.edges.
const labelList meshEdges(pp.meshEdges(mesh.edges(), mesh.pointEdges()));
sidePatchID.setSize(pp.nEdges());
sidePatchID = -1;
// These also get determined but not (yet) exported:
// - whether face is created from other face or edge
// - what zone&orientation face should have
labelList inflateEdgeI(pp.nEdges(), -1);
labelList inflateFaceI(pp.nEdges(), -1);
labelList sideZoneID(pp.nEdges(), -1);
boolList sideFlip(pp.nEdges(), false);
nPatches = patches.size();
forAll(globalEdgeFaces, edgeI)
{
const labelList& eGlobalFaces = globalEdgeFaces[edgeI];
if
(
eGlobalFaces.size() == 2
&& pp.edgeFaces()[edgeI].size() == 1
)
{
// Locally but not globally a boundary edge. Hence a coupled
// edge. Find the patch to use if on different
// processors.
label f0 = eGlobalFaces[0];
label f1 = eGlobalFaces[1];
label otherProcI = -1;
if (globalFaces.isLocal(f0) && !globalFaces.isLocal(f1))
{
otherProcI = globalFaces.whichProcID(f1);
}
else if (!globalFaces.isLocal(f0) && globalFaces.isLocal(f1))
{
otherProcI = globalFaces.whichProcID(f0);
}
if (otherProcI != -1)
{
sidePatchID[edgeI] = findProcPatch(mesh, otherProcI);
if (sidePatchID[edgeI] == -1)
{
// Cannot find a patch to processor. See if already
// marked for addition
if (nbrProcToPatch.found(otherProcI))
{
sidePatchID[edgeI] = nbrProcToPatch[otherProcI];
}
else
{
sidePatchID[edgeI] = nPatches;
nbrProcToPatch.insert(otherProcI, nPatches);
patchToNbrProc.insert(nPatches, otherProcI);
nPatches++;
}
}
}
}
}
// Determine face properties for all other boundary edges
// ------------------------------------------------------
const labelListList& edgeFaces = pp.edgeFaces();
forAll(edgeFaces, edgeI)
{
if (edgeFaces[edgeI].size() == 1 && sidePatchID[edgeI] == -1)
{
// Proper, uncoupled patch edge.
label myFaceI = pp.addressing()[edgeFaces[edgeI][0]];
// Pick up any boundary face on this edge and use its properties
label meshEdgeI = meshEdges[edgeI];
const labelList& meshFaces = mesh.edgeFaces()[meshEdgeI];
forAll(meshFaces, k)
{
label faceI = meshFaces[k];
if (faceI != myFaceI && !mesh.isInternalFace(faceI))
{
setFaceProps
(
mesh,
faceI,
sidePatchID[edgeI],
sideZoneID[edgeI],
sideFlip[edgeI]
);
inflateFaceI[edgeI] = faceI;
inflateEdgeI[edgeI] = -1;
break;
}
}
}
}
// Now hopefully every boundary edge has a side patch. Check
forAll(edgeFaces, edgeI)
{
if (edgeFaces[edgeI].size() == 1 && sidePatchID[edgeI] == -1)
{
const edge& e = pp.edges()[edgeI];
FatalErrorIn("addPatchCellLayer::calcSidePatch(..)")
<< "Have no sidePatchID for edge " << edgeI << " points "
<< pp.points()[pp.meshPoints()[e[0]]]
<< pp.points()[pp.meshPoints()[e[1]]]
<< abort(FatalError);
}
}
// Now we have sidepatch see if we have patchface or edge to inflate
// from.
forAll(edgeFaces, edgeI)
{
if (edgeFaces[edgeI].size() == 1 && inflateFaceI[edgeI] == -1)
{
// 1. Do we have a boundary face to inflate from
label myFaceI = pp.addressing()[edgeFaces[edgeI][0]];
// Pick up any boundary face on this edge and use its properties
label meshEdgeI = meshEdges[edgeI];
const labelList& meshFaces = mesh.edgeFaces()[meshEdgeI];
forAll(meshFaces, k)
{
label faceI = meshFaces[k];
if (faceI != myFaceI)
{
if (mesh.isInternalFace(faceI))
{
inflateEdgeI[edgeI] = meshEdgeI;
}
else
{
if (patches.whichPatch(faceI) == sidePatchID[edgeI])
{
setFaceProps
(
mesh,
faceI,
sidePatchID[edgeI],
sideZoneID[edgeI],
sideFlip[edgeI]
);
inflateFaceI[edgeI] = faceI;
inflateEdgeI[edgeI] = -1;
break;
}
}
}
}
}
}
}
void Foam::addPatchCellLayer::setRefinement
(
const globalIndex& globalFaces,
const labelListList& globalEdgeFaces,
const scalarField& expansionRatio,
const indirectPrimitivePatch& pp,
const labelList& sidePatchID,
const labelList& exposedPatchID,
const labelList& nFaceLayers,
const labelList& nPointLayers,
@ -575,7 +795,7 @@ void Foam::addPatchCellLayer::setRefinement
if (debug)
{
Pout<< "addPatchCellLayer::setRefinement : Adding up to "
<< max(nPointLayers)
<< gMax(nPointLayers)
<< " layers of cells to indirectPrimitivePatch with "
<< pp.nPoints() << " points" << endl;
}
@ -788,8 +1008,6 @@ void Foam::addPatchCellLayer::setRefinement
label meshEdgeI = meshEdges[edgeI];
// Mesh faces using edge
// Mesh faces using edge
const labelList& meshFaces = mesh_.edgeFaces(meshEdgeI, ef);
@ -1213,22 +1431,6 @@ void Foam::addPatchCellLayer::setRefinement
}
// Global indices engine
const globalIndex globalFaces(mesh_.nFaces());
// Get for all pp edgeFaces a unique faceID
labelListList globalEdgeFaces
(
calcGlobalEdgeFaces
(
mesh_,
globalFaces,
pp,
meshEdges
)
);
// Mark off which edges have been extruded
boolList doneEdge(pp.nEdges(), false);
@ -1474,16 +1676,17 @@ void Foam::addPatchCellLayer::setRefinement
addSideFace
(
pp,
patchID,
addedCells,
newFace,
newFace, // vertices of new face
sidePatchID[startEdgeI],// -1 or patch for face
patchFaceI,
nbrFaceI,
startEdgeI, // edge to inflate from
meshEdgeI, // corresponding mesh edge
i,
numEdgeSideFaces,
meshFaces,
meshEdgeI, // (mesh) edge to inflate
i, // layer
numEdgeSideFaces, // num layers
meshFaces, // edgeFaces
meshMod
);
}

View File

@ -181,16 +181,6 @@ class addPatchCellLayer
// Private Member Functions
//- Per patch edge the pp faces (in global indices) using it. Uses
// uniqueEqOp() to remove duplicates.
labelListList calcGlobalEdgeFaces
(
const polyMesh& mesh,
const globalIndex& globalFaces,
const indirectPrimitivePatch& pp,
const labelList& meshEdges
);
//- Get the face on the other side of the edge.
static label nbrFace
(
@ -226,12 +216,13 @@ class addPatchCellLayer
label addSideFace
(
const indirectPrimitivePatch&,
const labelList& patchID,
const labelListList& addedCells,
const face& newFace,
const label newPatchID,
const label ownFaceI,
const label nbrFaceI,
const label patchEdgeI,
const label meshEdgeI,
const label layerI,
const label numEdgeFaces,
@ -239,6 +230,18 @@ class addPatchCellLayer
polyTopoChange&
) const;
//- Find patch to neighbouring processor
static label findProcPatch(const polyMesh&, const label nbrProcID);
//- Extract properties from mesh face
static void setFaceProps
(
const polyMesh&,
const label,
label&,
label&,
bool&
);
//- Disallow default bitwise copy construct
addPatchCellLayer(const addPatchCellLayer&);
@ -256,7 +259,7 @@ public:
// Constructors
//- Construct from mesh.
addPatchCellLayer(const polyMesh& mesh, const bool addToMesh = true);
addPatchCellLayer(const polyMesh&, const bool addToMesh = true);
// Member Functions
@ -291,6 +294,33 @@ public:
// Edit
//- Per patch edge the pp faces (in global indices) using it. Uses
// uniqueEqOp() to remove duplicates.
static labelListList globalEdgeFaces
(
const polyMesh&,
const globalIndex& globalFaces,
const indirectPrimitivePatch& pp
);
//- Boundary edges get extruded into boundary faces. Determine patch
// for these faces. This might be a to-be-created processor patch
// (patchI >= mesh.boundaryMesh().size()) in which case the
// nbrProcToPatch, patchToNbrProc give the correspondence. nPatches
// is the new number of patches.
static void calcSidePatch
(
const polyMesh&,
const globalIndex& globalFaces,
const labelListList& globalEdgeFaces,
const indirectPrimitivePatch& pp,
labelList& sidePatchID,
label& nPatches,
Map<label>& nbrProcToPatch,
Map<label>& patchToNbrProc
);
//- Play commands into polyTopoChange to create layers on top
// of indirectPrimitivePatch (have to be outside faces).
// Gets displacement per patch point.
@ -313,8 +343,11 @@ public:
// (instead of e.g. from patch faces)
void setRefinement
(
const globalIndex& globalFaces,
const labelListList& globalEdgeFaces,
const scalarField& expansionRatio,
const indirectPrimitivePatch& pp,
const labelList& sidePatchID,
const labelList& exposedPatchID,
const labelList& nFaceLayers,
const labelList& nPointLayers,
@ -326,20 +359,26 @@ public:
//- Add with constant expansion ratio and same nLayers everywhere
void setRefinement
(
const globalIndex& globalFaces,
const labelListList& globalEdgeFaces,
const label nLayers,
const indirectPrimitivePatch& pp,
const labelList& sidePatchID,
const vectorField& overallDisplacement,
polyTopoChange& meshMod
)
{
setRefinement
(
scalarField(pp.nPoints(), 1.0), // expansion ration
globalFaces,
globalEdgeFaces,
scalarField(pp.nPoints(), 1.0), // expansion ration
pp,
sidePatchID,
labelList(0),
labelList(pp.size(), nLayers),
labelList(pp.nPoints(), nLayers),
overallDisplacement / nLayers,
labelList(pp.size(), nLayers), // nFaceLayers
labelList(pp.nPoints(), nLayers), // nPointLayers
overallDisplacement / nLayers, // firstLayerDisp
meshMod
);
}

View File

@ -20,6 +20,10 @@ $(edgeFormats)/starcd/STARCDedgeFormatRunTime.C
$(edgeFormats)/vtk/VTKedgeFormat.C
$(edgeFormats)/vtk/VTKedgeFormatRunTime.C
extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C
featureEdgeMesh/featureEdgeMesh.C
LIB = $(FOAM_LIBBIN)/libedgeMesh

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,377 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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::extendedFeatureEdgeMesh
Description
Description of feature edges and points.
Feature points are a sorted subset at the start of the overall points list:
0 .. concaveStart_-1 : convex points (w.r.t normals)
concaveStart_-1 .. mixedStart_-1 : concave points
mixedStart_ .. nonFeatureStart_ : mixed internal/external points
nonFeatureStart_ .. size-1 : non-feature points
Feature edges are the edgeList of the edgeMesh and are sorted:
0 .. internalStart_-1 : external edges (convex w.r.t normals)
internalStart_ .. flatStart_-1 : internal edges (concave)
flatStart_ .. openStart_-1 : flat edges (neither concave or convex)
can arise from region interfaces on
flat surfaces
openStart_ .. multipleStart_-1 : open edges (e.g. from baffle surfaces)
multipleStart_ .. size-1 : multiply connected edges
The edge direction and feature edge and feature point adjacent normals
are stored.
SourceFiles
extendedFeatureEdgeMeshI.H
extendedFeatureEdgeMesh.C
\*---------------------------------------------------------------------------*/
#ifndef extendedFeatureEdgeMesh_H
#define extendedFeatureEdgeMesh_H
#include "edgeMesh.H"
#include "surfaceFeatures.H"
#include "objectRegistry.H"
#include "IOdictionary.H"
#include "indexedOctree.H"
#include "treeDataEdge.H"
#include "pointIndexHit.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class extendedFeatureEdgeMesh Declaration
\*---------------------------------------------------------------------------*/
class extendedFeatureEdgeMesh
:
public regIOobject,
public edgeMesh
{
public:
//- Runtime type information
TypeName("extendedFeatureEdgeMesh");
enum pointStatus
{
CONVEX, // Fully convex point (w.r.t normals)
CONCAVE, // Fully concave point
MIXED, // A point surrounded by both convex and concave edges
NONFEATURE // Not a feature point
};
enum edgeStatus
{
EXTERNAL, // "Convex" edge
INTERNAL, // "Concave" edge
FLAT, // Neither concave or convex, on a flat surface
OPEN, // i.e. only connected to one face
MULTIPLE, // Multiply connected (connected to more than two faces)
NONE // Not a classified feature edge (consistency with
// surfaceFeatures)
};
private:
// Static data
//- Angular closeness tolerance for treating normals as the same
static scalar cosNormalAngleTol_;
//- Index of the start of the convex feature points - static as 0
static label convexStart_;
//- Index of the start of the external feature edges - static as 0
static label externalStart_;
// Private data
//- Index of the start of the concave feature points
label concaveStart_;
//- Index of the start of the mixed type feature points
label mixedStart_;
//- Index of the start of the non-feature points
label nonFeatureStart_;
//- Index of the start of the internal feature edges
label internalStart_;
//- Index of the start of the flat feature edges
label flatStart_;
//- Index of the start of the open feature edges
label openStart_;
//- Index of the start of the multiply-connected feature edges
label multipleStart_;
//- Normals of the features, to be referred to by index by both feature
// points and edges, unsorted
vectorField normals_;
//- Flat and open edges require the direction of the edge
vectorField edgeDirections_;
//- Indices of the normals that are adjacent to the feature edges
labelListList edgeNormals_;
//- Indices of the normals that are adjacent to the feature points
labelListList featurePointNormals_;
//- Feature edges which are on the boundary between regions
labelList regionEdges_;
//- Search tree for all edges
mutable autoPtr<indexedOctree<treeDataEdge> > edgeTree_;
//- Individual search trees for each type of edge
mutable PtrList<indexedOctree<treeDataEdge> > edgeTreesByType_;
// Private Member Functions
//- Classify the type of feature point. Requires valid stored member
// data for edges and normals.
pointStatus classifyFeaturePoint(label ptI) const;
//- Classify the type of feature edge. Requires face centre 0 to face
// centre 1 vector to distinguish internal from external
edgeStatus classifyEdge
(
const List<vector>& norms,
const labelList& edNorms,
const vector& fC0tofC1
) const;
public:
// Static data
//- Number of possible point types (i.e. number of slices)
static label nPointTypes;
//- Number of possible feature edge types (i.e. number of slices)
static label nEdgeTypes;
// Constructors
//- Construct (read) given an IOobject
extendedFeatureEdgeMesh(const IOobject&);
//- Construct as copy
explicit extendedFeatureEdgeMesh
(
const IOobject&,
const extendedFeatureEdgeMesh&
);
//- Construct by transferring components (points, edges)
extendedFeatureEdgeMesh
(
const IOobject&,
const Xfer<pointField>&,
const Xfer<edgeList>&
);
//- Construct (read) given surfaceFeatures, an objectRegistry and a
// fileName to write to. Extracts, classifies and reorders the data
// from surfaceFeatures.
extendedFeatureEdgeMesh
(
const surfaceFeatures& sFeat,
const objectRegistry& obr,
const fileName& sFeatFileName
);
//- Construct from all components
extendedFeatureEdgeMesh
(
const IOobject& io,
const pointField& pts,
const edgeList& eds,
label concaveStart,
label mixedStart,
label nonFeatureStart,
label internalStart,
label flatStart,
label openStart,
label multipleStart,
const vectorField& normals,
const vectorField& edgeDirections,
const labelListList& edgeNormals,
const labelListList& featurePointNormals,
const labelList& regionEdges
);
//- Destructor
~extendedFeatureEdgeMesh();
// Member Functions
// Find
//- Find nearest surface edge for the sample point.
void nearestFeatureEdge
(
const point& sample,
scalar searchDistSqr,
pointIndexHit& info
) const;
//- Find nearest surface edge for each sample point.
void nearestFeatureEdge
(
const pointField& samples,
const scalarField& searchDistSqr,
List<pointIndexHit>& info
) const;
//- Find the nearest point on each type of feature edge
void nearestFeatureEdgeByType
(
const point& sample,
const scalarField& searchDistSqr,
List<pointIndexHit>& info
) const;
// Access
//- Return the index of the start of the convex feature points
inline label convexStart() const;
//- Return the index of the start of the concave feature points
inline label concaveStart() const;
//- Return the index of the start of the mixed type feature points
inline label mixedStart() const;
//- Return the index of the start of the non-feature points
inline label nonFeatureStart() const;
//- Return the index of the start of the external feature edges
inline label externalStart() const;
//- Return the index of the start of the internal feature edges
inline label internalStart() const;
//- Return the index of the start of the flat feature edges
inline label flatStart() const;
//- Return the index of the start of the open feature edges
inline label openStart() const;
//- Return the index of the start of the multiply-connected feature
// edges
inline label multipleStart() const;
//- Return whether or not the point index is a feature point
inline bool featurePoint(label ptI) const;
//- Return the normals of the surfaces adjacent to the feature edges
// and points
inline const vectorField& normals() const;
//- Return the edgeDirection vectors
inline const vectorField& edgeDirections() const;
//- Return the direction of edgeI, pointing away from ptI
inline vector edgeDirection(label edgeI, label ptI) const;
//- Return the indices of the normals that are adjacent to the
// feature edges
inline const labelListList& edgeNormals() const;
//- Return the normal vectors for a given set of normal indices
inline vectorField edgeNormals(const labelList& edgeNormIs) const;
//- Return the normal vectors for a given edge
inline vectorField edgeNormals(label edgeI) const;
//- Return the indices of the normals that are adjacent to the
// feature points
inline const labelListList& featurePointNormals() const;
//- Return the normal vectors for a given feature point
inline vectorField featurePointNormals(label ptI) const;
//- Return the feature edges which are on the boundary between
// regions
inline const labelList& regionEdges() const;
//- Return the pointStatus of a specified point
inline pointStatus getPointStatus(label ptI) const;
//- Return the edgeStatus of a specified edge
inline edgeStatus getEdgeStatus(label edgeI) const;
//- Demand driven construction of octree for boundary edges
const indexedOctree<treeDataEdge>& edgeTree() const;
//- Demand driven construction of octree for boundary edges by type
const PtrList<indexedOctree<treeDataEdge> >&
edgeTreesByType() const;
// Write
//- Write all components of the extendedFeatureEdgeMesh as obj files
void writeObj(const fileName& prefix) const;
//- Give precedence to the regIOobject write
using regIOobject::write;
//- WriteData function required for regIOobject write operation
virtual bool writeData(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "extendedFeatureEdgeMeshI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,78 +25,79 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::label Foam::featureEdgeMesh::convexStart() const
inline Foam::label Foam::extendedFeatureEdgeMesh::convexStart() const
{
return convexStart_;
}
inline Foam::label Foam::featureEdgeMesh::concaveStart() const
inline Foam::label Foam::extendedFeatureEdgeMesh::concaveStart() const
{
return concaveStart_;
}
inline Foam::label Foam::featureEdgeMesh::mixedStart() const
inline Foam::label Foam::extendedFeatureEdgeMesh::mixedStart() const
{
return mixedStart_;
}
inline Foam::label Foam::featureEdgeMesh::nonFeatureStart() const
inline Foam::label Foam::extendedFeatureEdgeMesh::nonFeatureStart() const
{
return nonFeatureStart_;
}
inline Foam::label Foam::featureEdgeMesh::externalStart() const
inline Foam::label Foam::extendedFeatureEdgeMesh::externalStart() const
{
return externalStart_;
}
inline Foam::label Foam::featureEdgeMesh::internalStart() const
inline Foam::label Foam::extendedFeatureEdgeMesh::internalStart() const
{
return internalStart_;
}
inline Foam::label Foam::featureEdgeMesh::flatStart() const
inline Foam::label Foam::extendedFeatureEdgeMesh::flatStart() const
{
return flatStart_;
}
inline Foam::label Foam::featureEdgeMesh::openStart() const
inline Foam::label Foam::extendedFeatureEdgeMesh::openStart() const
{
return openStart_;
}
inline Foam::label Foam::featureEdgeMesh::multipleStart() const
inline Foam::label Foam::extendedFeatureEdgeMesh::multipleStart() const
{
return multipleStart_;
}
inline bool Foam::featureEdgeMesh::featurePoint(label ptI) const
inline bool Foam::extendedFeatureEdgeMesh::featurePoint(label ptI) const
{
return ptI < nonFeatureStart_;
}
inline const Foam::vectorField& Foam::featureEdgeMesh::normals() const
inline const Foam::vectorField& Foam::extendedFeatureEdgeMesh::normals() const
{
return normals_;
}
inline const Foam::vectorField& Foam::featureEdgeMesh::edgeDirections() const
inline const Foam::vectorField& Foam::extendedFeatureEdgeMesh::edgeDirections()
const
{
return edgeDirections_;
}
inline Foam::vector Foam::featureEdgeMesh::edgeDirection
inline Foam::vector Foam::extendedFeatureEdgeMesh::edgeDirection
(
label edgeI,
label ptI
@ -114,7 +115,7 @@ inline Foam::vector Foam::featureEdgeMesh::edgeDirection
}
else
{
FatalErrorIn("Foam::featureEdgeMesh::edgedirection")
FatalErrorIn("Foam::extendedFeatureEdgeMesh::edgedirection")
<< "Requested ptI " << ptI << " is not a point on the requested "
<< "edgeI " << edgeI << ". edgeI start and end: "
<< e.start() << " " << e.end()
@ -125,13 +126,14 @@ inline Foam::vector Foam::featureEdgeMesh::edgeDirection
}
inline const Foam::labelListList& Foam::featureEdgeMesh::edgeNormals() const
inline const Foam::labelListList& Foam::extendedFeatureEdgeMesh::edgeNormals()
const
{
return edgeNormals_;
}
inline Foam::vectorField Foam::featureEdgeMesh::edgeNormals
inline Foam::vectorField Foam::extendedFeatureEdgeMesh::edgeNormals
(
const labelList& edgeNormIs
) const
@ -147,27 +149,28 @@ inline Foam::vectorField Foam::featureEdgeMesh::edgeNormals
}
inline Foam::vectorField Foam::featureEdgeMesh::edgeNormals(label edgeI) const
inline Foam::vectorField Foam::extendedFeatureEdgeMesh::edgeNormals(label edgeI)
const
{
return edgeNormals(edgeNormals_[edgeI]);
}
inline const Foam::labelListList&
Foam::featureEdgeMesh::featurePointNormals() const
Foam::extendedFeatureEdgeMesh::featurePointNormals() const
{
return featurePointNormals_;
}
inline Foam::vectorField Foam::featureEdgeMesh::featurePointNormals
inline Foam::vectorField Foam::extendedFeatureEdgeMesh::featurePointNormals
(
label ptI
) const
{
if (!featurePoint(ptI))
{
WarningIn("vectorField featureEdgeMesh::featurePointNormals")
WarningIn("vectorField extendedFeatureEdgeMesh::featurePointNormals")
<< "Requesting the normals of a non-feature point. "
<< "Returned zero length vectorField."
<< endl;
@ -188,13 +191,14 @@ inline Foam::vectorField Foam::featureEdgeMesh::featurePointNormals
}
inline const Foam::labelList& Foam::featureEdgeMesh::regionEdges() const
inline const Foam::labelList& Foam::extendedFeatureEdgeMesh::regionEdges() const
{
return regionEdges_;
}
inline Foam::featureEdgeMesh::pointStatus Foam::featureEdgeMesh::getPointStatus
inline Foam::extendedFeatureEdgeMesh::pointStatus
Foam::extendedFeatureEdgeMesh::getPointStatus
(
label ptI
) const
@ -218,7 +222,8 @@ inline Foam::featureEdgeMesh::pointStatus Foam::featureEdgeMesh::getPointStatus
}
inline Foam::featureEdgeMesh::edgeStatus Foam::featureEdgeMesh::getEdgeStatus
inline Foam::extendedFeatureEdgeMesh::edgeStatus
Foam::extendedFeatureEdgeMesh::getEdgeStatus
(
label edgeI
) const

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,27 +25,12 @@ Class
Foam::featureEdgeMesh
Description
edgeMesh + IO.
Feature points are a sorted subset at the start of the overall points list:
0 .. concaveStart_-1 : convex points (w.r.t normals)
concaveStart_ .. mixedStart_-1 : concave points
mixedStart_ .. nonFeatureStart_ : mixed internal/external points
nonFeatureStart_ .. size-1 : non-feature points
Feature edges are the edgeList of the edgeMesh and are sorted:
0 .. internalStart_-1 : external edges (convex w.r.t normals)
internalStart_ .. flatStart_-1 : internal edges (concave)
flatStart_ .. openStart_-1 : flat edges (neither concave or convex)
can arise from region interfaces on
flat surfaces
openStart_ .. multipleStart_-1 : open edges (e.g. from baffle surfaces)
multipleStart_ .. size-1 : multiply connected edges
The edge direction and feature edge and feature point adjacent normals
are stored.
See also extendedFeatureEdgeMesh type which stores additional classification
of features.
SourceFiles
featureEdgeMeshI.H
featureEdgeMesh.C
\*---------------------------------------------------------------------------*/
@ -54,10 +39,7 @@ SourceFiles
#define featureEdgeMesh_H
#include "edgeMesh.H"
#include "surfaceFeatures.H"
#include "IOdictionary.H"
#include "indexedOctree.H"
#include "treeDataEdge.H"
#include "regIOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -65,7 +47,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class featureEdgeMesh Declaration
Class featureEdgeMesh Declaration
\*---------------------------------------------------------------------------*/
class featureEdgeMesh
@ -76,279 +58,31 @@ class featureEdgeMesh
public:
//- Runtime type information
TypeName("featureEdgeMesh");
enum pointStatus
{
CONVEX, // Fully convex point (w.r.t normals)
CONCAVE, // Fully concave point
MIXED, // A point surrounded by both convex and concave edges
NONFEATURE // Not a feature point
};
enum edgeStatus
{
EXTERNAL, // "Convex" edge
INTERNAL, // "Concave" edge
FLAT, // Neither concave or convex, on a flat surface
OPEN, // i.e. only connected to one face
MULTIPLE, // Multiply connected (connected to more than two faces)
NONE // Not a classified feature edge (consistency with
// surfaceFeatures)
};
private:
// Static data
//- Angular closeness tolerance for treating normals as the same
static scalar cosNormalAngleTol_;
//- Index of the start of the convex feature points - static as 0
static label convexStart_;
//- Index of the start of the external feature edges - static as 0
static label externalStart_;
// Private data
//- Index of the start of the concave feature points
label concaveStart_;
//- Index of the start of the mixed type feature points
label mixedStart_;
//- Index of the start of the non-feature points
label nonFeatureStart_;
//- Index of the start of the internal feature edges
label internalStart_;
//- Index of the start of the flat feature edges
label flatStart_;
//- Index of the start of the open feature edges
label openStart_;
//- Index of the start of the multiply-connected feature edges
label multipleStart_;
//- Normals of the features, to be referred to by index by both feature
// points and edges, unsorted
vectorField normals_;
//- Flat and open edges require the direction of the edge
vectorField edgeDirections_;
//- Indices of the normals that are adjacent to the feature edges
labelListList edgeNormals_;
//- Indices of the normals that are adjacent to the feature points
labelListList featurePointNormals_;
//- Feature edges which are on the boundary between regions
labelList regionEdges_;
//- Search tree for all edges
mutable autoPtr<indexedOctree<treeDataEdge> > edgeTree_;
//- Individual search trees for each type of edge
mutable PtrList<indexedOctree<treeDataEdge> > edgeTreesByType_;
// Private Member Functions
//- Classify the type of feature point. Requires valid stored member
// data for edges and normals.
pointStatus classifyFeaturePoint(label ptI) const;
//- Classify the type of feature edge. Requires face centre 0 to face
// centre 1 vector to distinguish internal from external
edgeStatus classifyEdge
(
const List<vector>& norms,
const labelList& edNorms,
const vector& fC0tofC1
) const;
public:
// Static data
//- Number of possible point types (i.e. number of slices)
static label nPointTypes;
//- Number of possible feature edge types (i.e. number of slices)
static label nEdgeTypes;
// Constructors
//- Construct (read) given an IOobject
featureEdgeMesh(const IOobject&);
//- Construct as copy
explicit featureEdgeMesh(const IOobject&, const featureEdgeMesh&);
//- Construct by transferring components (points, edges)
//- Construct from featureEdgeMesh data
featureEdgeMesh
(
const IOobject&,
const Xfer<pointField>&,
const Xfer<edgeList>&
const pointField&,
const edgeList&
);
//- Construct given surfaceFeatures, extracts, classifies and reorders
// the data.
featureEdgeMesh
(
const IOobject& io,
const surfaceFeatures& sFeat
);
//- Construct from all components
featureEdgeMesh
(
const IOobject& io,
const pointField& pts,
const edgeList& eds,
label concaveStart,
label mixedStart,
label nonFeatureStart,
label internalStart,
label flatStart,
label openStart,
label multipleStart,
const vectorField& normals,
const vectorField& edgeDirections,
const labelListList& edgeNormals,
const labelListList& featurePointNormals,
const labelList& regionEdges
);
//- Construct as copy
featureEdgeMesh(const IOobject&, const featureEdgeMesh&);
//- Destructor
~featureEdgeMesh();
//- ReadData function required for regIOobject read operation
virtual bool readData(Istream&);
// Member Functions
// Find
//- Find nearest surface edge for the sample point.
void nearestFeatureEdge
(
const point& sample,
scalar searchDistSqr,
pointIndexHit& info
) const;
//- Find nearest surface edge for each sample point.
void nearestFeatureEdge
(
const pointField& samples,
const scalarField& searchDistSqr,
List<pointIndexHit>& info
) const;
//- Find the nearest point on each type of feature edge
void nearestFeatureEdgeByType
(
const point& sample,
const scalarField& searchDistSqr,
List<pointIndexHit>& info
) const;
// Access
//- Return the index of the start of the convex feature points
inline label convexStart() const;
//- Return the index of the start of the concave feature points
inline label concaveStart() const;
//- Return the index of the start of the mixed type feature points
inline label mixedStart() const;
//- Return the index of the start of the non-feature points
inline label nonFeatureStart() const;
//- Return the index of the start of the external feature edges
inline label externalStart() const;
//- Return the index of the start of the internal feature edges
inline label internalStart() const;
//- Return the index of the start of the flat feature edges
inline label flatStart() const;
//- Return the index of the start of the open feature edges
inline label openStart() const;
//- Return the index of the start of the multiply-connected feature
// edges
inline label multipleStart() const;
//- Return whether or not the point index is a feature point
inline bool featurePoint(label ptI) const;
//- Return the normals of the surfaces adjacent to the feature edges
// and points
inline const vectorField& normals() const;
//- Return the edgeDirection vectors
inline const vectorField& edgeDirections() const;
//- Return the direction of edgeI, pointing away from ptI
inline vector edgeDirection(label edgeI, label ptI) const;
//- Return the indices of the normals that are adjacent to the
// feature edges
inline const labelListList& edgeNormals() const;
//- Return the normal vectors for a given set of normal indices
inline vectorField edgeNormals(const labelList& edgeNormIs) const;
//- Return the normal vectors for a given edge
inline vectorField edgeNormals(label edgeI) const;
//- Return the indices of the normals that are adjacent to the
// feature points
inline const labelListList& featurePointNormals() const;
//- Return the normal vectors for a given feature point
inline vectorField featurePointNormals(label ptI) const;
//- Return the feature edges which are on the boundary between
// regions
inline const labelList& regionEdges() const;
//- Return the pointStatus of a specified point
inline pointStatus getPointStatus(label ptI) const;
//- Return the edgeStatus of a specified edge
inline edgeStatus getEdgeStatus(label edgeI) const;
//- Demand driven construction of octree for boundary edges
const indexedOctree<treeDataEdge>& edgeTree() const;
//- Demand driven construction of octree for boundary edges by type
const PtrList<indexedOctree<treeDataEdge> >&
edgeTreesByType() const;
// Write
//- Write all components of the featureEdgeMesh as obj files
void writeObj(const fileName& prefix) const;
//- Give precedence to the regIOobject write
using regIOobject::write;
//- WriteData function required for regIOobject write operation
virtual bool writeData(Ostream&) const;
//- WriteData function required for regIOobject write operation
virtual bool writeData(Ostream&) const;
};
@ -358,10 +92,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "featureEdgeMeshI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,9 +0,0 @@
errorDrivenRefinement = errorDrivenRefinement
errorEstimate = errorEstimate
evaluateError = evaluateError
$(evaluateError)/evaluateError.C
$(errorDrivenRefinement)/errorDrivenRefinement.C
LIB = $(FOAM_LIBBIN)/liberrorEstimation

View File

@ -1,9 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh

View File

@ -1,277 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 "errorDrivenRefinement.H"
#include "polyTopoChanger.H"
#include "polyMesh.H"
#include "primitiveMesh.H"
#include "polyTopoChange.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "evaluateError.H"
#include "fvc.H"
#include "mapPolyMesh.H"
#include "topoCellLooper.H"
#include "cellCuts.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(errorDrivenRefinement, 0);
addToRunTimeSelectionTable
(
polyMeshModifier,
errorDrivenRefinement,
dictionary
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from dictionary
Foam::errorDrivenRefinement::errorDrivenRefinement
(
const word& name,
const dictionary& dict,
const label index,
const polyTopoChanger& mme
)
:
polyMeshModifier(name, index, mme, false),
refinementEngine_(topoChanger().mesh(), true),
errorField_(dict.lookup("errorField"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::errorDrivenRefinement::~errorDrivenRefinement()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::errorDrivenRefinement::changeTopology() const
{
const Time& runTime = topoChanger().mesh().time();
if (runTime.foundObject<volVectorField>(errorField_))
{
if (debug)
{
Info<< "errorDrivenRefinement::changeTopology() : triggering topo"
<< " change since found errorField "
<< errorField_ << endl;
}
return true;
}
else
{
if (debug)
{
Info<< "errorDrivenRefinement::changeTopology() : no topo"
<< " change request from me since no errorField "
<< errorField_ << endl;
}
return false;
}
}
void Foam::errorDrivenRefinement::setRefinement(polyTopoChange& ref) const
{
// Insert the coarsen/refinement instructions into the topological change
if (debug)
{
Info<< "errorDrivenRefinement::setRefinement(polyTopoChange& ref)"
<< endl;
}
const polyMesh& mesh = topoChanger().mesh();
const Time& runTime = mesh.time();
if (debug)
{
Info<< "Looking up vector field with name " << errorField_ << endl;
}
const volVectorField& resError =
runTime.lookupObject<volVectorField>(errorField_);
const volScalarField magResError(Foam::mag(resError));
scalar min = Foam::min(magResError).value();
scalar max = Foam::max(magResError).value();
scalar avg = Foam::average(magResError).value();
if (debug)
{
Info<< "Writing magResError" << endl;
magResError.write();
Info<< "min:" << min << " max:" << max << " avg:" << avg << endl;
}
// Get faces to remove and cells to refine based on error
evaluateError refPattern
(
magResError, // Error on cells
resError, // Error vector on cells
fvc::interpolate(magResError), // Error on faces
refinementEngine_.getSplitFaces() // Current live split faces
);
// Insert mesh refinement into polyTopoChange:
// - remove split faces
// - refine cells
// Give 'hint' of faces to remove to cell splitter.
const labelList& candidates = refPattern.unsplitFaces();
////Hack:no unsplitting
//labelList candidates;
labelList removedFaces(refinementEngine_.removeSplitFaces(candidates, ref));
// Now success will be for every candidates whether face has been removed.
// Protect cells using face from refinement.
// List of protected cells
boolList markedCell(mesh.nCells(), false);
forAll(removedFaces, i)
{
label faceI = removedFaces[i];
markedCell[mesh.faceOwner()[faceI]] = true;
if (mesh.isInternalFace(faceI))
{
markedCell[mesh.faceNeighbour()[faceI]] = true;
}
}
// Repack list of cells to refine.
List<refineCell> refCells = refPattern.refCells();
label newRefCellI = 0;
forAll(refCells, refCellI)
{
label cellI = refCells[refCellI].cellNo();
if (!markedCell[cellI] && (newRefCellI != refCellI))
{
refCells[newRefCellI++] = refCells[refCellI];
}
}
if (debug)
{
Info<< "errorDrivenRefinement : shrinking refCells from "
<< refCells.size()
<< " to " << newRefCellI << endl;
}
refCells.setSize(newRefCellI);
// Determine cut pattern using topological cell walker
topoCellLooper cellWalker(mesh);
cellCuts cuts(mesh, cellWalker, refCells);
// Do actual splitting
refinementEngine_.setRefinement(cuts, ref);
}
// Has the responsability of moving my newly introduced points onto the right
// place. This is since the whole mesh might e.g. have been moved by another
// meshmodifier. So using preMotionPoints is hack for if I am only meshModifier.
// Good solution:
// - remember new point label of introduced point and vertices
// of edge it is created from (in setRefinement)
// - in here reposition point at correct position between current vertex
// position of edge endpoints.
void Foam::errorDrivenRefinement::modifyMotionPoints
(
pointField& motionPoints
) const
{
if (debug)
{
Info<< "errorDrivenRefinement::modifyMotionPoints(*pointField&)"
<< endl;
}
}
void Foam::errorDrivenRefinement::updateMesh(const mapPolyMesh& morphMap)
{
// Mesh has changed topologically. Update local topological data
if (debug)
{
Info<< "errorDrivenRefinement::updateMesh"
<< "(const mapPolyMesh& morphMap)" << endl;
}
refinementEngine_.updateMesh(morphMap);
}
void Foam::errorDrivenRefinement::write(Ostream& os) const
{
os << nl << type() << nl;
}
void Foam::errorDrivenRefinement::writeDict(Ostream& os) const
{
os << nl << name() << nl << token::BEGIN_BLOCK << nl
<< " type " << type()
<< token::END_STATEMENT << nl
<< token::END_BLOCK << endl;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -1,136 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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::errorDrivenRefinement
Description
Refines and coarsens based on error estimate.
SourceFiles
errorDrivenRefinement.C
\*---------------------------------------------------------------------------*/
#ifndef errorDrivenRefinement_H
#define errorDrivenRefinement_H
#include "polyMeshModifier.H"
#include "undoableMeshCutter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
/*---------------------------------------------------------------------------*\
Class errorDrivenRefinement Declaration
\*---------------------------------------------------------------------------*/
class errorDrivenRefinement
:
public polyMeshModifier
{
// Private data
//- Refinement/coarsening engine
mutable undoableMeshCutter refinementEngine_;
//- Name of volVectorField which contains error.
word errorField_;
// Private Member Functions
//- Disallow default bitwise copy construct
errorDrivenRefinement(const errorDrivenRefinement&);
//- Disallow default bitwise assignment
void operator=(const errorDrivenRefinement&);
public:
//- Runtime type information
TypeName("errorDrivenRefinement");
// Constructors
//- Construct from dictionary
errorDrivenRefinement
(
const word& name,
const dictionary& dict,
const label index,
const polyTopoChanger& mme
);
//- Destructor
virtual ~errorDrivenRefinement();
// Member Functions
//- Check for topology change
virtual bool changeTopology() const;
//- Insert the layer addition/removal instructions
// into the topological change
virtual void setRefinement(polyTopoChange&) const;
//- Modify motion points to comply with the topological change
virtual void modifyMotionPoints(pointField& motionPoints) const;
//- Force recalculation of locally stored data on topological change
virtual void updateMesh(const mapPolyMesh&);
//- Write
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&) const;
// Access
//- Underlying mesh modifier
const undoableMeshCutter& refinementEngine() const
{
return refinementEngine_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

File diff suppressed because it is too large Load Diff

View File

@ -1,542 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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::errorEstimate
Description
Residual error estimation
SourceFiles
errorEstimate.C
\*---------------------------------------------------------------------------*/
#ifndef errorEstimate_H
#define errorEstimate_H
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class errorEstimate Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class errorEstimate
:
public refCount
{
// Private data
// Reference to GeometricField<Type, fvPatchField, volMesh>
const GeometricField<Type, fvPatchField, volMesh>& psi_;
//- Dimension set
dimensionSet dimensions_;
//- Cell residual pointer
Field<Type> residual_;
//- Normalisation factor
scalarField normFactor_;
// Private Member Functions
//- Return boundary condition types for the error field
wordList errorBCTypes() const;
public:
// Static data members
ClassName("errorEstimate");
// Constructors
//- Construct from components
errorEstimate
(
const GeometricField<Type, fvPatchField, volMesh>& psi,
const dimensionSet& ds,
const Field<Type>& res,
const scalarField& norm
);
//- Construct as copy
errorEstimate(const errorEstimate<Type>&);
//- Destructor
~errorEstimate();
// Member Functions
// Access
//- Return field
const GeometricField<Type, fvPatchField, volMesh>& psi() const
{
return psi_;
}
//- Return residual dimensions
const dimensionSet& dimensions() const
{
return dimensions_;
}
// Raw residual (for calculus)
Field<Type>& res()
{
return residual_;
}
const Field<Type>& res() const
{
return residual_;
}
// Error Estimate
//- Cell residual (volume intensive)
tmp<GeometricField<Type, fvPatchField, volMesh> > residual() const;
//- Normalisation factor
tmp<volScalarField> normFactor() const;
//- Error estimate
tmp<GeometricField<Type, fvPatchField, volMesh> > error() const;
// Member Operators
void operator=(const errorEstimate<Type>&);
void operator=(const tmp<errorEstimate<Type> >&);
void negate();
void operator+=(const errorEstimate<Type>&);
void operator+=(const tmp<errorEstimate<Type> >&);
void operator-=(const errorEstimate<Type>&);
void operator-=(const tmp<errorEstimate<Type> >&);
void operator+=(const GeometricField<Type,fvPatchField,volMesh>&);
void operator+=(const tmp<GeometricField<Type,fvPatchField,volMesh> >&);
void operator-=(const GeometricField<Type,fvPatchField,volMesh>&);
void operator-=(const tmp<GeometricField<Type,fvPatchField,volMesh> >&);
void operator+=(const dimensioned<Type>&);
void operator-=(const dimensioned<Type>&);
void operator*=(const volScalarField&);
void operator*=(const tmp<volScalarField>&);
void operator*=(const dimensioned<scalar>&);
// Friend Functions
// Friend Operators
};
// * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
template<class Type>
void checkMethod
(
const errorEstimate<Type>&,
const errorEstimate<Type>&,
const char*
);
template<class Type>
void checkMethod
(
const errorEstimate<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const char*
);
template<class Type>
void checkMethod
(
const errorEstimate<Type>&,
const dimensioned<Type>&,
const char*
);
// * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * //
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const errorEstimate<Type>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<errorEstimate<Type> >&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const errorEstimate<Type>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<errorEstimate<Type> >&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const errorEstimate<Type>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const errorEstimate<Type>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const errorEstimate<Type>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const tmp<errorEstimate<Type> >&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const errorEstimate<Type>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const tmp<errorEstimate<Type> >&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const errorEstimate<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<errorEstimate<Type> >&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const errorEstimate<Type>&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<errorEstimate<Type> >&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const GeometricField<Type, fvPatchField, volMesh>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const GeometricField<Type, fvPatchField, volMesh>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const errorEstimate<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const errorEstimate<Type>&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const GeometricField<Type, fvPatchField, volMesh>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const GeometricField<Type, fvPatchField, volMesh>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<errorEstimate<Type> >&,
const dimensioned<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const dimensioned<Type>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&,
const dimensioned<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const dimensioned<Type>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const errorEstimate<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const tmp<errorEstimate<Type> >&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const errorEstimate<Type>&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const tmp<errorEstimate<Type> >&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const errorEstimate<Type>&,
const dimensioned<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const tmp<errorEstimate<Type> >&,
const dimensioned<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const volScalarField&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const volScalarField&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const tmp<volScalarField>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const tmp<volScalarField>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const dimensioned<scalar>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const dimensioned<scalar>&,
const tmp<errorEstimate<Type> >&
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "errorEstimate.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,168 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 "resErrorDiv.H"
#include "fvc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace resError
{
template<class Type>
tmp<errorEstimate<Type> >
div
(
const surfaceScalarField& flux,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
const scalarField& vols = mesh.V();
const surfaceVectorField& faceCentres = mesh.Cf();
const volVectorField& cellCentres = mesh.C();
const fvPatchList& patches = mesh.boundary();
const labelUList& owner = mesh.owner();
const labelUList& neighbour = mesh.neighbour();
Field<Type> res(vols.size(), pTraits<Type>::zero);
scalarField aNorm(vols.size(), 0.0);
// Get sign of flux
const surfaceScalarField signF(pos(flux));
// Calculate gradient of the solution
GeometricField
<
typename outerProduct<vector, Type>::type, fvPatchField, volMesh
>
gradVf(fvc::grad(vf));
// Internal faces
forAll(owner, faceI)
{
// Calculate the centre of the face
const vector& curFaceCentre = faceCentres[faceI];
// Owner
vector ownD = curFaceCentre - cellCentres[owner[faceI]];
// Subtract convection
res[owner[faceI]] -=
(
vf[owner[faceI]]
+ (ownD & gradVf[owner[faceI]])
)*flux[faceI];
aNorm[owner[faceI]] += signF[faceI]*flux[faceI];
// Neighbour
vector neiD = curFaceCentre - cellCentres[neighbour[faceI]];
// Subtract convection
res[neighbour[faceI]] +=
(
vf[neighbour[faceI]]
+ (neiD & gradVf[neighbour[faceI]])
)*flux[faceI];
aNorm[neighbour[faceI]] -= (1.0 - signF[faceI])*flux[faceI];
}
forAll(patches, patchI)
{
const vectorField& patchFaceCentres =
faceCentres.boundaryField()[patchI];
const scalarField& patchFlux = flux.boundaryField()[patchI];
const scalarField& patchSignFlux = signF.boundaryField()[patchI];
const labelList& fCells = patches[patchI].faceCells();
forAll(fCells, faceI)
{
vector d =
patchFaceCentres[faceI] - cellCentres[fCells[faceI]];
// Subtract convection
res[fCells[faceI]] -=
(
vf[fCells[faceI]]
+ (d & gradVf[fCells[faceI]])
)*patchFlux[faceI];
aNorm[fCells[faceI]] += patchSignFlux[faceI]*patchFlux[faceI];
}
}
res /= vols;
aNorm /= vols;
return tmp<errorEstimate<Type> >
(
new errorEstimate<Type>
(
vf,
flux.dimensions()*vf.dimensions(),
res,
aNorm
)
);
}
template<class Type>
tmp<errorEstimate<Type> >
div
(
const tmp<surfaceScalarField>& tflux,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > Div(resError::div(tflux(), vf));
tflux.clear();
return Div;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace resError
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,80 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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/>.
InNamespace
Foam::resError
Description
Residual error estimate for the fv convection operators.
SourceFiles
resErrorDiv.C
\*---------------------------------------------------------------------------*/
#ifndef resErrorDiv_H
#define resErrorDiv_H
#include "errorEstimate.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace resError
{
// Divergence terms
template<class Type>
tmp<errorEstimate<Type> > div
(
const surfaceScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > div
(
const tmp<surfaceScalarField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
} // End namespace resError
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "resErrorDiv.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,292 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 "resErrorLaplacian.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace resError
{
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
surfaceScalarField Gamma
(
IOobject
(
"gamma",
vf.time().constant(),
vf.db(),
IOobject::NO_READ
),
vf.mesh(),
dimensionedScalar("1", dimless, 1.0)
);
return resError::laplacian(Gamma, vf);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const dimensionedScalar& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
surfaceScalarField Gamma
(
IOobject
(
gamma.name(),
vf.time().timeName(),
vf.db(),
IOobject::NO_READ
),
vf.mesh(),
gamma
);
return resError::laplacian(Gamma, vf);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const volScalarField& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return resError::laplacian(fvc::interpolate(gamma), vf);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const tmp<volScalarField>& tgamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > Laplacian(resError::laplacian(tgamma(), vf));
tgamma.clear();
return Laplacian;
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const surfaceScalarField& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
const scalarField& vols = mesh.V();
const surfaceVectorField& Sf = mesh.Sf();
const surfaceScalarField magSf(mesh.magSf());
const fvPatchList& patches = mesh.boundary();
const labelUList& owner = mesh.owner();
const labelUList& neighbour = mesh.neighbour();
const surfaceScalarField& delta =
mesh.surfaceInterpolation::deltaCoeffs();
Field<Type> res(vols.size(), pTraits<Type>::zero);
scalarField aNorm(vols.size(), 0.0);
// Calculate gradient of the solution
GeometricField
<
typename outerProduct<vector, Type>::type, fvPatchField, volMesh
>
gradVf(fvc::grad(vf));
// Internal faces
forAll(owner, faceI)
{
// Owner
// Subtract diffusion
res[owner[faceI]] -=
gamma[faceI]*(Sf[faceI] & gradVf[owner[faceI]]);
aNorm[owner[faceI]] += delta[faceI]*gamma[faceI]*magSf[faceI];
// Neighbour
// Subtract diffusion
res[neighbour[faceI]] +=
gamma[faceI]*(Sf[faceI] & gradVf[neighbour[faceI]]);
aNorm[neighbour[faceI]] += delta[faceI]*gamma[faceI]*magSf[faceI];
}
forAll(patches, patchI)
{
const vectorField& patchSf = Sf.boundaryField()[patchI];
const scalarField& patchMagSf = magSf.boundaryField()[patchI];
const scalarField& patchGamma = gamma.boundaryField()[patchI];
const scalarField& patchDelta = delta.boundaryField()[patchI];
const labelList& fCells = patches[patchI].faceCells();
forAll(fCells, faceI)
{
// Subtract diffusion
res[fCells[faceI]] -=
patchGamma[faceI]*
(
patchSf[faceI] & gradVf[fCells[faceI]]
);
aNorm[fCells[faceI]] +=
patchDelta[faceI]*patchGamma[faceI]*patchMagSf[faceI];
}
}
res /= vols;
aNorm /= vols;
return tmp<errorEstimate<Type> >
(
new errorEstimate<Type>
(
vf,
delta.dimensions()*gamma.dimensions()*magSf.dimensions()
*vf.dimensions(),
res,
aNorm
)
);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const tmp<surfaceScalarField>& tgamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > tresError(resError::laplacian(tgamma(), vf));
tgamma.clear();
return tresError;
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const volTensorField& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
return resError::laplacian
(
(mesh.Sf() & fvc::interpolate(gamma) & mesh.Sf())
/sqr(mesh.magSf()),
vf
);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const tmp<volTensorField>& tgamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > Laplacian = resError::laplacian(tgamma(), vf);
tgamma.clear();
return Laplacian;
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const surfaceTensorField& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
return resError::laplacian
(
(mesh.Sf() & gamma & mesh.Sf())/sqr(mesh.magSf()),
vf
);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const tmp<surfaceTensorField>& tgamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > Laplacian = resError::laplacian(tgamma(), vf);
tgamma.clear();
return Laplacian;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace resError
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,134 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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/>.
InNamespace
Foam::resError
Description
Residual error estimate for the fv laplacian operators
SourceFiles
resErrorLaplacian.C
\*---------------------------------------------------------------------------*/
#ifndef resErrorLaplacian_H
#define resErrorLaplacian_H
#include "errorEstimate.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace resError
{
// Laplacian terms
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const dimensionedScalar&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const volScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const tmp<volScalarField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const surfaceScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const tmp<surfaceScalarField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const volTensorField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const tmp<volTensorField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const surfaceTensorField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const tmp<surfaceTensorField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "resErrorLaplacian.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,130 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 "resErrorSup.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace resError
{
template<class Type>
tmp<errorEstimate<Type> >
Sp
(
const volScalarField& sp,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return tmp<errorEstimate<Type> >
(
new errorEstimate<Type>
(
vf,
sp.dimensions()*vf.dimensions(),
sp.internalField()*vf.internalField(),
scalarField(vf.internalField().size(), 0)
)
);
}
template<class Type>
tmp<errorEstimate<Type> >
Sp
(
const tmp<volScalarField>& tsp,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > tee = resError::Sp(tsp(), vf);
tsp.clear();
return tee;
}
template<class Type>
tmp<errorEstimate<Type> >
Sp
(
const dimensionedScalar& sp,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return tmp<errorEstimate<Type> >
(
new errorEstimate<Type>
(
vf,
sp.dimensions()*vf.dimensions(),
sp.value()*vf.internalField(),
scalarField(vf.internalField().size(), 0)
)
);
}
template<class Type>
tmp<errorEstimate<Type> >
SuSp
(
const volScalarField& sp,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return Sp(sp, vf);
}
template<class Type>
tmp<errorEstimate<Type> >
SuSp
(
const tmp<volScalarField>& tsp,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > tee = resError::SuSp(tsp(), vf);
tsp.clear();
return tee;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace resError
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,106 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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/>.
InNamespace
Foam::resError
Description
Residual error estimate for the fv source operators
SourceFiles
resErrorSup.C
\*---------------------------------------------------------------------------*/
#ifndef resErrorSup_H
#define resErrorSup_H
#include "errorEstimate.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace resError
{
// Implicit source
template<class Type>
tmp<errorEstimate<Type> > Sp
(
const volScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > Sp
(
const tmp<volScalarField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > Sp
(
const dimensionedScalar&,
const GeometricField<Type, fvPatchField, volMesh>&
);
// Implicit/Explicit source depending on sign of coefficient
template<class Type>
tmp<errorEstimate<Type> > SuSp
(
const volScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > SuSp
(
const tmp<volScalarField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "resErrorSup.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,164 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 "evaluateError.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "refineCell.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct null
Foam::evaluateError::evaluateError()
:
unsplitFaces_(),
refCells_()
{}
// Construct from components
Foam::evaluateError::evaluateError
(
const volScalarField& cellError,
const volVectorField& gradTheta,
const surfaceScalarField& faceError,
const labelList& candidateFaces
)
:
unsplitFaces_(candidateFaces.size()),
refCells_()
{
const polyMesh& mesh = cellError.mesh();
// picks up the error field and the gradient of the variable
// and appends lists of cells to refine/unrefine based on the width of
// standard deviation of the error distribution
// calculate the average error
scalar avgError = cellError.average().value();
scalar squareError = sqr(cellError)().average().value();
scalar deviation = sqrt(squareError - sqr(avgError));
Info<< "avgError:" << avgError
<< " squareError:" << squareError
<< " deviation:" << deviation
<< endl;
scalar ref = avgError + deviation;
scalar unref = avgError - deviation;
Info<< "evaluateError : refinement criterion : " << ref << endl
<< " unrefinement criterion : " << unref << endl;
// Coarsen mesh first.
// Find out set of candidateFaces where error is above crit.
// Construct to filter unrefinement pattern
// removeFaces faceRemover(mesh);
// Keep track of unrefinement pattern.
boolList markedFace(mesh.nFaces(), false);
label unsplitFaceI = 0;
// Subset candidate faces and update refinement pattern interference pattern
forAll(candidateFaces, candidateFaceI)
{
label faceI = candidateFaces[candidateFaceI];
if (markedFace[faceI])
{
Info<< "evaluateError : protected candidate face:" << faceI
<< endl;
}
else
{
// if (faceError[faceI] < unref)
if (unsplitFaceI < (candidateFaces.size()/2 + 1))
{
unsplitFaces_[unsplitFaceI++] = faceI;
// faceRemover.markAffectedFaces(faceI, markedFace);
}
}
}
unsplitFaces_.setSize(unsplitFaceI);
// Now we have:
// -unsplitFaces_: all the faces that will be removed
// -markedFace : all the faces affected by this removal.
// From markedFace protect the cells using them.
boolList markedCells(mesh.nCells(), false);
// forAll(markedFace, faceI)
// {
// if (markedFace[faceI])
// {
// markedCells[mesh.faceOwner()[faceI]] = true;
//
// if (mesh.isInternalFace(faceI))
// {
// markedCells[mesh.faceNeighbour()[faceI]] = true;
// }
// }
// }
// Select the cells that need to be split.
// Two pass: count first, select later.
label refCellI = 0;
forAll(cellError, cellI)
{
if ((cellError[cellI] > ref) && !markedCells[cellI])
{
refCellI++;
}
}
refCells_.setSize(refCellI);
refCellI = 0;
forAll(cellError, cellI)
{
if ((cellError[cellI] > ref) && !markedCells[cellI])
{
refCells_[refCellI++] = refineCell(cellI, gradTheta[cellI]);
}
}
Info<< "evaluateError : selected " << unsplitFaces_.size()
<< " faces out of " << candidateFaces.size() << " for removal" << endl;
Info<< "evaluateError : selected " << refCells_.size()
<< " cells out of " << cellError.size() << " for refinement" << endl;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,6 +36,7 @@ SourceFiles
#define inverseDistanceDiffusivity_H
#include "uniformDiffusivity.H"
#include "wordReList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,7 +44,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class inverseDistanceDiffusivity Declaration
Class inverseDistanceDiffusivity Declaration
\*---------------------------------------------------------------------------*/
class inverseDistanceDiffusivity
@ -53,9 +54,8 @@ class inverseDistanceDiffusivity
// Private data
//- Patches selected to base the distance on
// These can contain regular expressions and the actual patch names
// will be searched for.
wordList patchNames_;
// These can contain patch names or regular expressions to search for.
wordReList patchNames_;
// Private Member Functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -21,23 +21,20 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::resError
Description
Namespace for residual error estimate operators.
\*---------------------------------------------------------------------------*/
#ifndef resError_H
#define resError_H
#include "coalParcel.H"
#include "resErrorDiv.H"
#include "resErrorLaplacian.H"
#include "resErrorSup.H"
// Using thermodynamic variant
#include "makeThermoParcelForces.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
namespace Foam
{
// Kinematic sub-models
makeThermoParcelForces(coalParcel);
};
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,8 +26,8 @@ License
#include "coalParcel.H"
// Kinematic
#include "makeThermoParcelForces.H" // thermo variant
#include "makeParcelDispersionModels.H"
#include "makeParcelDragModels.H"
#include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant
#include "makeParcelCollisionModels.H"
#include "makeParcelPatchInteractionModels.H"
@ -52,8 +52,8 @@ License
namespace Foam
{
// Kinematic sub-models
makeThermoParcelForces(coalParcel);
makeParcelDispersionModels(coalParcel);
makeParcelDragModels(coalParcel);
makeReactingMultiphaseParcelInjectionModels(coalParcel);
makeParcelCollisionModels(coalParcel);
makeParcelPatchInteractionModels(coalParcel);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -78,10 +78,6 @@ $(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphase
IntegrationScheme/makeIntegrationSchemes.C
/* particle forces */
particleForces/particleForces.C
/* phase properties */
phaseProperties/phaseProperties/phaseProperties.C
phaseProperties/phaseProperties/phasePropertiesIO.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,7 +30,6 @@ License
#include "CollisionModel.H"
#include "DispersionModel.H"
#include "DragModel.H"
#include "InjectionModel.H"
#include "PatchInteractionModel.H"
#include "PostProcessingModel.H"
@ -209,15 +208,6 @@ void Foam::KinematicCloud<ParcelType>::setModels()
).ptr()
);
dragModel_.reset
(
DragModel<KinematicCloud<ParcelType> >::New
(
subModelProperties_,
*this
).ptr()
);
injectionModel_.reset
(
InjectionModel<KinematicCloud<ParcelType> >::New
@ -306,7 +296,7 @@ void Foam::KinematicCloud<ParcelType>::preEvolve()
Info<< "\nSolving cloud " << this->name() << endl;
this->dispersion().cacheFields(true);
forces_.cacheFields(true, solution_.interpolationSchemes());
forces_.cacheFields(true);
updateCellOccupancy();
}
@ -390,7 +380,7 @@ void Foam::KinematicCloud<ParcelType>::evolveCloud
}
else
{
// this->surfaceFilm().injectStreadyState(td);
// this->surfaceFilm().injectSteadyState(td);
this->injection().injectSteadyState(td, solution_.deltaT());
@ -473,7 +463,7 @@ void Foam::KinematicCloud<ParcelType>::postEvolve()
}
this->dispersion().cacheFields(false);
forces_.cacheFields(false, solution_.interpolationSchemes());
forces_.cacheFields(false);
this->postProcessing().post();
@ -488,14 +478,15 @@ void Foam::KinematicCloud<ParcelType>::cloudReset(KinematicCloud<ParcelType>& c)
rndGen_ = c.rndGen_;
collisionModel_ = c.collisionModel_->clone();
dispersionModel_= c.dispersionModel_->clone();
dragModel_ = c.dragModel_->clone();
injectionModel_ = c.injectionModel_->clone();
patchInteractionModel_ = c.patchInteractionModel_->clone();
postProcessingModel_ = c.postProcessingModel_->clone();
forces_.transfer(c.forces_);
UIntegrator_ = c.UIntegrator_->clone();
collisionModel_.reset(c.collisionModel_.ptr());
dispersionModel_.reset(c.dispersionModel_.ptr());
injectionModel_.reset(c.injectionModel_.ptr());
patchInteractionModel_.reset(c.patchInteractionModel_.ptr());
postProcessingModel_.reset(c.postProcessingModel_.ptr());
UIntegrator_.reset(c.UIntegrator_.ptr());
}
@ -529,7 +520,10 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
),
solution_(mesh_, particleProperties_.subDict("solution")),
constProps_(particleProperties_, solution_.active()),
subModelProperties_(particleProperties_.subOrEmptyDict("subModels")),
subModelProperties_
(
particleProperties_.subOrEmptyDict("subModels", solution_.active())
),
rndGen_
(
label(0),
@ -540,10 +534,19 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
U_(U),
mu_(mu),
g_(g),
forces_(mesh_, particleProperties_, g_.value(), solution_.active()),
forces_
(
*this,
mesh_,
subModelProperties_.subOrEmptyDict
(
"particleForces",
solution_.active()
),
solution_.active()
),
collisionModel_(NULL),
dispersionModel_(NULL),
dragModel_(NULL),
injectionModel_(NULL),
patchInteractionModel_(NULL),
postProcessingModel_(NULL),
@ -606,7 +609,7 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
const word& name
)
:
Cloud<ParcelType>(c.mesh(), name, c),
Cloud<ParcelType>(c.mesh_, name, c),
kinematicCloud(),
cloudCopyPtr_(NULL),
mesh_(c.mesh_),
@ -623,7 +626,6 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
forces_(c.forces_),
collisionModel_(c.collisionModel_->clone()),
dispersionModel_(c.dispersionModel_->clone()),
dragModel_(c.dragModel_->clone()),
injectionModel_(c.injectionModel_->clone()),
patchInteractionModel_(c.patchInteractionModel_->clone()),
postProcessingModel_(c.postProcessingModel_->clone()),
@ -661,7 +663,6 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
c.UCoeff_()
)
)
{}
@ -698,10 +699,9 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
U_(c.U_),
mu_(c.mu_),
g_(c.g_),
forces_(mesh),
forces_(*this, mesh),
collisionModel_(NULL),
dispersionModel_(NULL),
dragModel_(NULL),
injectionModel_(NULL),
patchInteractionModel_(NULL),
postProcessingModel_(NULL),
@ -830,8 +830,10 @@ void Foam::KinematicCloud<ParcelType>::info() const
<< linearKineticEnergy << nl
<< " Rotational kinetic energy = "
<< rotationalKineticEnergy << nl;
this->injection().info(Info);
this->surfaceFilm().info(Info);
this->patchInteraction().info(Info);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -29,10 +29,14 @@ Description
- holds a 'cloudSolution' class that stores all relevant solution info
- particle forces
- buoyancy
- drag
- pressure gradient
- sub-models:
- Collision model
- Dispersion model
- Drag model
- Injection model
- Patch interaction model
- Post-processing model
@ -55,7 +59,6 @@ SourceFiles
#include "fvMesh.H"
#include "volFields.H"
#include "fvMatrices.H"
#include "particleForces.H"
#include "IntegrationSchemesFwd.H"
@ -72,9 +75,6 @@ class CollisionModel;
template<class CloudType>
class DispersionModel;
template<class CloudType>
class DragModel;
template<class CloudType>
class InjectionModel;
@ -98,6 +98,14 @@ class KinematicCloud
public Cloud<ParcelType>,
public kinematicCloud
{
public:
//- Type of parcel the cloud was instantiated for
typedef ParcelType parcelType;
private:
// Private data
//- Cloud copy pointer
@ -316,7 +324,7 @@ protected:
//- Optional particle forces
particleForces forces_;
typename ParcelType::forceType forces_;
// References to the cloud sub-models
@ -329,9 +337,6 @@ protected:
autoPtr<DispersionModel<KinematicCloud<ParcelType> > >
dispersionModel_;
//- Drag transfer model
autoPtr<DragModel<KinematicCloud<ParcelType> > > dragModel_;
//- Injector model
autoPtr<InjectionModel<KinematicCloud<ParcelType> > >
injectionModel_;
@ -450,10 +455,6 @@ public:
virtual ~KinematicCloud();
//- Type of parcel the cloud was instantiated for
typedef ParcelType parcelType;
// Member Functions
// Access
@ -521,7 +522,7 @@ public:
//- Optional particle forces
inline const particleForces& forces() const;
inline const typename ParcelType::forceType& forces() const;
// Sub-models
@ -542,10 +543,6 @@ public:
inline DispersionModel<KinematicCloud<ParcelType> >&
dispersion();
//- Return const-access to the drag model
inline const DragModel<KinematicCloud<ParcelType> >&
drag() const;
//- Return const access to the injection model
inline const InjectionModel<KinematicCloud<ParcelType> >&
injection() const;
@ -558,6 +555,10 @@ public:
inline const PatchInteractionModel<KinematicCloud<ParcelType> >&
patchInteraction() const;
//- Return reference to the patch interaction model
inline PatchInteractionModel<KinematicCloud<ParcelType> >&
patchInteraction();
//- Return reference to post-processing model
inline PostProcessingModel<KinematicCloud<ParcelType> >&
postProcessing();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -257,7 +257,7 @@ Foam::KinematicCloud<ParcelType>::g() const
template<class ParcelType>
inline const Foam::particleForces&
inline const typename ParcelType::forceType&
Foam::KinematicCloud<ParcelType>::forces() const
{
return forces_;
@ -296,14 +296,6 @@ Foam::KinematicCloud<ParcelType>::dispersion()
}
template<class ParcelType>
inline const Foam::DragModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::drag() const
{
return dragModel_;
}
template<class ParcelType>
inline const Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::injection() const
@ -320,6 +312,14 @@ Foam::KinematicCloud<ParcelType>::patchInteraction() const
}
template<class ParcelType>
inline Foam::PatchInteractionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::patchInteraction()
{
return patchInteractionModel_();
}
template<class ParcelType>
inline Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::injection()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,8 +85,8 @@ void Foam::ReactingCloud<ParcelType>::cloudReset(ReactingCloud<ParcelType>& c)
{
ThermoCloud<ParcelType>::cloudReset(c);
compositionModel_ = c.compositionModel_->clone();
phaseChangeModel_ = c.phaseChangeModel_->clone();
compositionModel_.reset(c.compositionModel_.ptr());
phaseChangeModel_.reset(c.phaseChangeModel_.ptr());
dMassPhaseChange_ = c.dMassPhaseChange_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -61,8 +61,8 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::cloudReset
{
ReactingCloud<ParcelType>::cloudReset(c);
devolatilisationModel_ = c.devolatilisationModel_->clone();
surfaceReactionModel_ = c.surfaceReactionModel_->clone();
devolatilisationModel_.reset(c.devolatilisationModel_.ptr());
surfaceReactionModel_.reset(c.surfaceReactionModel_.ptr());
dMassDevolatilisation_ = c.dMassDevolatilisation_;
dMassSurfaceReaction_ = c.dMassSurfaceReaction_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -60,8 +60,8 @@ void Foam::ThermoCloud<ParcelType>::cloudReset(ThermoCloud<ParcelType>& c)
{
KinematicCloud<ParcelType>::cloudReset(c);
heatTransferModel_ = c.heatTransferModel_->clone();
TIntegrator_ = c.TIntegrator_->clone();
heatTransferModel_.reset(c.heatTransferModel_.ptr());
TIntegrator_.reset(c.TIntegrator_.ptr());
radiation_ = c.radiation_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -42,16 +42,19 @@ void Foam::KinematicParcel<ParcelType>::setCellValues
if (rhoc_ < td.cloud().constProps().rhoMin())
{
WarningIn
(
"void Foam::KinematicParcel<ParcelType>::setCellValues"
"("
"TrackData&, "
"const scalar, "
"const label"
")"
) << "Limiting observed density in cell " << cellI << " to "
<< td.cloud().constProps().rhoMin() << nl << endl;
if (debug)
{
WarningIn
(
"void Foam::KinematicParcel<ParcelType>::setCellValues"
"("
"TrackData&, "
"const scalar, "
"const label"
")"
) << "Limiting observed density in cell " << cellI << " to "
<< td.cloud().constProps().rhoMin() << nl << endl;
}
rhoc_ = td.cloud().constProps().rhoMin();
}
@ -176,46 +179,21 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
scalar& Cud
) const
{
const polyMesh& mesh = this->cloud().pMesh();
// Momentum transfer coefficient
const scalar utc = td.cloud().drag().utc(Re, d, mu) + ROOTVSMALL;
tetIndices tetIs = this->currentTetIndices();
const typename ParcelType::forceType& forces = td.cloud().forces();
// Momentum source due to particle forces
const vector Fcp = mass*td.cloud().forces().calcCoupled
(
this->position(),
tetIs,
dt,
rhoc_,
rho,
Uc_,
U,
d
);
const vector Fncp = mass*td.cloud().forces().calcNonCoupled
(
this->position(),
tetIs,
dt,
rhoc_,
rho,
Uc_,
U,
d
);
const ParcelType& p = static_cast<const ParcelType&>(*this);
const forceSuSp Fcp = forces.calcCoupled(p, dt, mass, Re, mu);
const forceSuSp Fncp = forces.calcNonCoupled(p, dt, mass, Re, mu);
const forceSuSp Feff = Fcp + Fncp;
// New particle velocity
//~~~~~~~~~~~~~~~~~~~~~~
// Update velocity - treat as 3-D
const scalar As = this->areaS(d);
const vector ap = Uc_ + (Fcp + Fncp + Su)/(utc*As);
const scalar bp = 6.0*utc/(rho*d);
const vector ap = Uc_ + (Feff.Su() + Su)/(Feff.Sp() + ROOTVSMALL);
const scalar bp = Feff.Sp()/mass;
Cud = bp;
@ -224,9 +202,10 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
vector Unew = Ures.value();
dUTrans += dt*(utc*As*(Ures.average() - Uc_) - Fcp);
dUTrans += dt*(Feff.Sp()*(Ures.average() - Uc_) - Fcp.Su());
// Apply correction to velocity and dUTrans for reduced-D cases
const polyMesh& mesh = this->cloud().pMesh();
meshTools::constrainDirection(mesh, mesh.solutionD(), Unew);
meshTools::constrainDirection(mesh, mesh.solutionD(), dUTrans);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -56,6 +56,8 @@ SourceFiles
#include "labelFieldIOField.H"
#include "vectorFieldIOField.H"
#include "ParticleForceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -88,6 +90,10 @@ class KinematicParcel
{
public:
//- Type of force to be used by this parcel type
typedef ParticleForceList<KinematicCloud<ParcelType> > forceType;
//- Class to hold kinematic particle constant properties
class constantProperties
{
@ -456,6 +462,15 @@ public:
//- Return const access to turbulent velocity fluctuation
inline const vector& UTurb() const;
//- Return const access to carrier density [kg/m3]
inline scalar rhoc() const;
//- Return const access to carrier velocity [m/s]
inline const vector& Uc() const;
//- Return const access to carrier viscosity [Pa.s]
inline scalar muc() const;
//- Return const access to the collision records
inline const collisionRecordList& collisionRecords() const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -409,6 +409,27 @@ inline const Foam::vector& Foam::KinematicParcel<ParcelType>::UTurb() const
}
template <class ParcelType>
inline Foam::scalar Foam::KinematicParcel<ParcelType>::rhoc() const
{
return rhoc_;
}
template <class ParcelType>
inline const Foam::vector& Foam::KinematicParcel<ParcelType>::Uc() const
{
return Uc_;
}
template <class ParcelType>
inline Foam::scalar Foam::KinematicParcel<ParcelType>::muc() const
{
return muc_;
}
template<class ParcelType>
inline bool& Foam::KinematicParcel<ParcelType>::active()
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -344,6 +344,12 @@ public:
//- Return the parcel sensible enthalpy
inline scalar hs() const;
//- Return const access to carrier temperature
inline scalar Tc() const;
//- Return const access to carrier specific heat capacity
inline scalar Cpc() const;
// Edit

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -321,6 +321,20 @@ inline Foam::scalar Foam::ThermoParcel<ParcelType>::hs() const
}
template<class ParcelType>
inline Foam::scalar Foam::ThermoParcel<ParcelType>::Tc() const
{
return Tc_;
}
template<class ParcelType>
inline Foam::scalar Foam::ThermoParcel<ParcelType>::Cpc() const
{
return Cpc_;
}
template<class ParcelType>
inline Foam::scalar& Foam::ThermoParcel<ParcelType>::T()
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,8 +26,8 @@ License
#include "basicKinematicParcel.H"
// Kinematic
#include "makeParcelForces.H"
#include "makeParcelDispersionModels.H"
#include "makeParcelDragModels.H"
#include "makeParcelInjectionModels.H"
#include "makeParcelCollisionModels.H"
#include "makeParcelPatchInteractionModels.H"
@ -39,8 +39,8 @@ License
namespace Foam
{
// Kinematic sub-models
makeParcelForces(basicKinematicParcel);
makeParcelDispersionModels(basicKinematicParcel);
makeParcelDragModels(basicKinematicParcel);
makeParcelInjectionModels(basicKinematicParcel);
makeParcelCollisionModels(basicKinematicParcel);
makeParcelPatchInteractionModels(basicKinematicParcel);

Some files were not shown because too many files have changed in this diff Show More