mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -85,6 +85,7 @@ $(primitiveLists)/vectorListIOList.C
|
||||
$(primitiveLists)/sphericalTensorList.C
|
||||
$(primitiveLists)/symmTensorList.C
|
||||
$(primitiveLists)/tensorList.C
|
||||
$(primitiveLists)/hashedWordList.C
|
||||
|
||||
Streams = db/IOstreams
|
||||
$(Streams)/token/tokenIO.C
|
||||
|
||||
@ -686,8 +686,14 @@ public:
|
||||
|
||||
// Useful derived info
|
||||
|
||||
//- Is the point in the cell bounding box
|
||||
bool pointInCellBB(const point& p, label celli) const;
|
||||
//- Is the point in the cell bounding box, option relative
|
||||
// tolerance to increase the effective size of the boundBox
|
||||
bool pointInCellBB
|
||||
(
|
||||
const point& p,
|
||||
label celli,
|
||||
scalar tol = 0
|
||||
) const;
|
||||
|
||||
//- Is the point in the cell
|
||||
bool pointInCell(const point& p, label celli) const;
|
||||
|
||||
@ -30,16 +30,33 @@ License
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Is the point in the cell bounding box
|
||||
bool Foam::primitiveMesh::pointInCellBB(const point& p, label celli) const
|
||||
bool Foam::primitiveMesh::pointInCellBB
|
||||
(
|
||||
const point& p,
|
||||
label celli,
|
||||
scalar tol
|
||||
) const
|
||||
{
|
||||
return boundBox
|
||||
boundBox bb
|
||||
(
|
||||
cells()[celli].points
|
||||
(
|
||||
faces(),
|
||||
points()
|
||||
)
|
||||
).contains(p);
|
||||
),
|
||||
false
|
||||
);
|
||||
|
||||
if (tol > SMALL)
|
||||
{
|
||||
bb = boundBox
|
||||
(
|
||||
bb.min() - tol*bb.span(),
|
||||
bb.max() + tol*bb.span()
|
||||
);
|
||||
}
|
||||
|
||||
return bb.contains(p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
159
src/OpenFOAM/primitives/Lists/hashedWordList.C
Normal file
159
src/OpenFOAM/primitives/Lists/hashedWordList.C
Normal file
@ -0,0 +1,159 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-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 "hashedWordList.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::hashedWordList::rehash()
|
||||
{
|
||||
indices_.clear();
|
||||
forAll(*this, i)
|
||||
{
|
||||
indices_.insert(List<word>::operator[](i), i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::hashedWordList::hashedWordList()
|
||||
:
|
||||
List<word>()
|
||||
{}
|
||||
|
||||
|
||||
Foam::hashedWordList::hashedWordList(const UList<word>& names)
|
||||
:
|
||||
List<word>(names)
|
||||
{
|
||||
rehash();
|
||||
}
|
||||
|
||||
|
||||
Foam::hashedWordList::hashedWordList(const hashedWordList& names)
|
||||
:
|
||||
List<word>(static_cast<const UList<word>&>(names))
|
||||
{
|
||||
rehash();
|
||||
}
|
||||
|
||||
|
||||
Foam::hashedWordList::hashedWordList(const Xfer< List<word> >& names)
|
||||
:
|
||||
List<word>(names)
|
||||
{
|
||||
rehash();
|
||||
}
|
||||
|
||||
|
||||
Foam::hashedWordList::hashedWordList
|
||||
(
|
||||
const label nNames,
|
||||
const char** names
|
||||
)
|
||||
:
|
||||
List<word>(nNames)
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
List<word>::operator[](i) = names[i];
|
||||
}
|
||||
|
||||
rehash();
|
||||
}
|
||||
|
||||
|
||||
Foam::hashedWordList::hashedWordList
|
||||
(
|
||||
const char** names
|
||||
)
|
||||
{
|
||||
// count names
|
||||
label nNames = 0;
|
||||
for (unsigned i = 0; names[i] && *(names[i]); ++i)
|
||||
{
|
||||
++nNames;
|
||||
}
|
||||
|
||||
List<word>::setSize(nNames);
|
||||
forAll(*this, i)
|
||||
{
|
||||
List<word>::operator[](i) = names[i];
|
||||
}
|
||||
|
||||
rehash();
|
||||
}
|
||||
|
||||
|
||||
Foam::hashedWordList::hashedWordList(Istream& is)
|
||||
{
|
||||
is >> *this;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::hashedWordList::clear()
|
||||
{
|
||||
List<word>::clear();
|
||||
indices_.clear();
|
||||
}
|
||||
|
||||
|
||||
void Foam::hashedWordList::append(const word& name)
|
||||
{
|
||||
const label idx = size();
|
||||
List<word>::append(name);
|
||||
indices_.insert(name, idx);
|
||||
}
|
||||
|
||||
|
||||
void Foam::hashedWordList::transfer(List<word>& lst)
|
||||
{
|
||||
List<word>::transfer(lst);
|
||||
rehash();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, hashedWordList& lst)
|
||||
{
|
||||
is >> static_cast<List<word>&>(lst);
|
||||
lst.rehash();
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const hashedWordList& lst)
|
||||
{
|
||||
os << static_cast<const List<word>&>(lst);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
149
src/OpenFOAM/primitives/Lists/hashedWordList.H
Normal file
149
src/OpenFOAM/primitives/Lists/hashedWordList.H
Normal file
@ -0,0 +1,149 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-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::hashedWordList
|
||||
|
||||
Description
|
||||
A wordList with hashed indices for faster lookup by name.
|
||||
|
||||
SourceFiles
|
||||
hashedWordListI.H
|
||||
hashedWordList.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef hashedWordList_H
|
||||
#define hashedWordList_H
|
||||
|
||||
#include "wordList.H"
|
||||
#include "HashTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class hashedWordList;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
Istream& operator>>(Istream&, hashedWordList&);
|
||||
Ostream& operator<<(Ostream&, const hashedWordList&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class hashedWordList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class hashedWordList
|
||||
:
|
||||
public List<word>
|
||||
{
|
||||
// Private data
|
||||
|
||||
HashTable<label, word> indices_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- rebuild the hash of indices
|
||||
void rehash();
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
hashedWordList();
|
||||
|
||||
//- Copy constructor.
|
||||
hashedWordList(const hashedWordList&);
|
||||
|
||||
//- Construct from list of names
|
||||
hashedWordList(const UList<word>& names);
|
||||
|
||||
//- Construct by transferring the parameter contents
|
||||
hashedWordList(const Xfer< List<word> >& names);
|
||||
|
||||
//- Construct from number and list of names
|
||||
hashedWordList(const label nNames, const char** names);
|
||||
|
||||
//- Construct from a NULL-terminated list of names
|
||||
hashedWordList(const char** names);
|
||||
|
||||
//- Construct from Istream
|
||||
hashedWordList(Istream&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Clear the list, i.e. set size to zero.
|
||||
void clear();
|
||||
|
||||
//- Append an element at the end of the list
|
||||
void append(const word&);
|
||||
|
||||
//- Does the list contain the specified name
|
||||
inline bool contains(const word&) const;
|
||||
|
||||
//- Transfer the contents of the argument List into this list
|
||||
// and annul the argument list.
|
||||
void transfer(List<word>&);
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Assignment operator from list of names
|
||||
inline void operator=(const UList<word>& names);
|
||||
|
||||
//- Assignment operator.
|
||||
inline void operator=(const hashedWordList&);
|
||||
|
||||
//- Allow readonly access to list of words
|
||||
inline operator const Foam::UList<word>&() const;
|
||||
|
||||
//- Return name corresponding to specified index
|
||||
inline const word& operator[](const label index) const;
|
||||
|
||||
//- Return index corresponding to specified name
|
||||
inline label operator[](const word&) const;
|
||||
|
||||
|
||||
// Istream operators
|
||||
|
||||
friend Istream& operator>>(Istream&, hashedWordList&);
|
||||
friend Ostream& operator<<(Ostream&, const hashedWordList&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "hashedWordListI.H"
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -21,32 +21,44 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::speciesTable::contains(const word& specieName) const
|
||||
inline bool Foam::hashedWordList::contains(const word& name) const
|
||||
{
|
||||
return specieIndices_.found(specieName);
|
||||
return indices_.found(name);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::word& Foam::speciesTable::operator[]
|
||||
(
|
||||
const label specieIndex
|
||||
) const
|
||||
inline void Foam::hashedWordList::operator=(const UList<word>& lst)
|
||||
{
|
||||
return wordList::operator[](specieIndex);
|
||||
List<word>::operator=(lst);
|
||||
rehash();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::speciesTable::operator[](const word& specieName) const
|
||||
inline void Foam::hashedWordList::operator=(const hashedWordList& lst)
|
||||
{
|
||||
return specieIndices_[specieName];
|
||||
operator=(static_cast<const UList<word>&>(lst));
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::word& Foam::hashedWordList::operator[]
|
||||
(
|
||||
const label index
|
||||
) const
|
||||
{
|
||||
return List<word>::operator[](index);
|
||||
}
|
||||
|
||||
|
||||
// could return -1 instead of bombing out
|
||||
inline Foam::label Foam::hashedWordList::operator[](const word& name) const
|
||||
{
|
||||
return indices_[name];
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,50 @@ Foam::Polynomial<PolySize>::Polynomial()
|
||||
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
|
||||
logActive_(false),
|
||||
logCoeff_(0.0)
|
||||
{}
|
||||
{
|
||||
for (int i = 0; i < PolySize; ++i)
|
||||
{
|
||||
this->v_[i] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
Foam::Polynomial<PolySize>::Polynomial(const scalar coeffs[PolySize])
|
||||
:
|
||||
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
|
||||
logActive_(false),
|
||||
logCoeff_(0.0)
|
||||
{
|
||||
for (int i=0; i<PolySize; i++)
|
||||
{
|
||||
this->v_[i] = coeffs[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
Foam::Polynomial<PolySize>::Polynomial(const UList<scalar>& coeffs)
|
||||
:
|
||||
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
|
||||
logActive_(false),
|
||||
logCoeff_(0.0)
|
||||
{
|
||||
if (coeffs.size() != PolySize)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Polynomial<PolySize>::Polynomial(const UList<scalar>&)"
|
||||
) << "Size mismatch: Needed " << PolySize
|
||||
<< " but got " << coeffs.size()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
for (int i = 0; i < PolySize; ++i)
|
||||
{
|
||||
this->v_[i] = coeffs[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<int PolySize>
|
||||
@ -101,9 +144,12 @@ Foam::scalar Foam::Polynomial<PolySize>::evaluate(const scalar x) const
|
||||
{
|
||||
scalar y = this->v_[0];
|
||||
|
||||
for (label i=1; i<PolySize; i++)
|
||||
// avoid costly pow() in calculation
|
||||
scalar powX = x;
|
||||
for (label i=1; i<PolySize; ++i)
|
||||
{
|
||||
y += this->v_[i]*pow(x, i);
|
||||
y += this->v_[i]*powX;
|
||||
powX *= x;
|
||||
}
|
||||
|
||||
if (logActive_)
|
||||
@ -170,13 +216,9 @@ Foam::Polynomial<PolySize>::integrateMinus1(const scalar intConstant)
|
||||
}
|
||||
|
||||
newCoeffs[0] = intConstant;
|
||||
|
||||
if (PolySize > 0)
|
||||
for (label i=1; i<PolySize; ++i)
|
||||
{
|
||||
for (label i=1; i<PolySize; i++)
|
||||
{
|
||||
newCoeffs[i] = this->v_[i]/i;
|
||||
}
|
||||
newCoeffs[i] = this->v_[i]/i;
|
||||
}
|
||||
|
||||
return newCoeffs;
|
||||
|
||||
@ -29,7 +29,7 @@ Description
|
||||
|
||||
poly = logCoeff*log(x) + sum(coeff_[i]*x^i)
|
||||
|
||||
where 0 <= i <= n
|
||||
where 0 \<= i \<= n
|
||||
|
||||
- integer powers, starting at zero
|
||||
- evaluate(x) to evaluate the poly for a given value
|
||||
@ -51,6 +51,7 @@ SourceFiles
|
||||
#include "scalar.H"
|
||||
#include "Ostream.H"
|
||||
#include "VectorSpace.H"
|
||||
#include "StaticAssert.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -79,6 +80,9 @@ class Polynomial
|
||||
:
|
||||
public VectorSpace<Polynomial<PolySize>, scalar, PolySize>
|
||||
{
|
||||
//- Size must be positive (non-zero)
|
||||
StaticAssert(PolySize > 0);
|
||||
|
||||
// Private data
|
||||
|
||||
//- Include the log term? - only activated using integrateMinus1()
|
||||
@ -97,9 +101,15 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Construct null, with all coefficients = 0.0
|
||||
Polynomial();
|
||||
|
||||
//- Construct from C-array of coefficients
|
||||
explicit Polynomial(const scalar coeffs[PolySize]);
|
||||
|
||||
//- Construct from a list of coefficients
|
||||
explicit Polynomial(const UList<scalar>& coeffs);
|
||||
|
||||
//- Construct from name and Istream
|
||||
Polynomial(const word& name, Istream& is);
|
||||
|
||||
|
||||
@ -34,14 +34,14 @@ scalar meanCoNum = 0.0;
|
||||
|
||||
if (mesh.nInternalFaces())
|
||||
{
|
||||
surfaceScalarField SfUfbyDelta =
|
||||
mesh.surfaceInterpolation::deltaCoeffs()*mag(phi)/fvc::interpolate(rho);
|
||||
scalarField sumPhi =
|
||||
fvc::surfaceSum(mag(phi))().internalField()
|
||||
/rho.internalField();
|
||||
|
||||
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||
.value()*runTime.deltaTValue();
|
||||
CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaT().value();
|
||||
|
||||
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||
.value()*runTime.deltaTValue();
|
||||
meanCoNum =
|
||||
0.5*(gSum(sumPhi)/sum(mesh.V().field()))*runTime.deltaT().value();
|
||||
}
|
||||
|
||||
Info<< "Courant Number mean: " << meanCoNum
|
||||
|
||||
@ -34,14 +34,13 @@ scalar meanCoNum = 0.0;
|
||||
|
||||
if (mesh.nInternalFaces())
|
||||
{
|
||||
surfaceScalarField SfUfbyDelta =
|
||||
mesh.surfaceInterpolation::deltaCoeffs()*mag(phi);
|
||||
scalarField sumPhi =
|
||||
fvc::surfaceSum(mag(phi))().internalField();
|
||||
|
||||
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||
.value()*runTime.deltaTValue();
|
||||
CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaT().value();
|
||||
|
||||
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||
.value()*runTime.deltaTValue();
|
||||
meanCoNum =
|
||||
0.5*(gSum(sumPhi)/sum(mesh.V().field()))*runTime.deltaT().value();
|
||||
}
|
||||
|
||||
Info<< "Courant Number mean: " << meanCoNum
|
||||
|
||||
@ -249,7 +249,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
|
||||
min
|
||||
(
|
||||
openFraction_
|
||||
+ max
|
||||
+ min
|
||||
(
|
||||
this->db().time().deltaTValue()/openingTime_,
|
||||
maxOpenFractionDelta_
|
||||
|
||||
@ -121,9 +121,9 @@ void Foam::Cloud<ParticleType>::initCloud(const bool checkClass)
|
||||
}
|
||||
else
|
||||
{
|
||||
Pout<< "Cannot read particle positions file " << nl
|
||||
Pout<< "Cannot read particle positions file:" << nl
|
||||
<< " " << ioP.path() << nl
|
||||
<< " assuming the initial cloud contains 0 particles." << endl;
|
||||
<< "Assuming the initial cloud contains 0 particles." << endl;
|
||||
}
|
||||
|
||||
// Ask for the tetBasePtIs to trigger all processors to build
|
||||
|
||||
@ -970,11 +970,12 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
|
||||
// number, but hasn't been able to find a cell to
|
||||
// occupy.
|
||||
|
||||
if(!cloud_.polyMesh_.pointInCellBB(position_, oldCellI))
|
||||
if(!cloud_.polyMesh_.pointInCellBB(position_, oldCellI, 0.1))
|
||||
{
|
||||
// If the position is not inside the bound-box of
|
||||
// the cell that it thought it should be in, then
|
||||
// this is considered an error.
|
||||
// If the position is not inside the (slightly
|
||||
// extended) bound-box of the cell that it thought
|
||||
// it should be in, then this is considered an
|
||||
// error.
|
||||
|
||||
FatalErrorIn
|
||||
(
|
||||
@ -985,18 +986,20 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
|
||||
")"
|
||||
) << "cell, tetFace and tetPt search failure at position "
|
||||
<< position_ << nl
|
||||
<< "for requested cell " << oldCellI << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// The position is in the bound-box of the cell. This
|
||||
// situation may arise because the face decomposition
|
||||
// of the cell is not the same as when the particle
|
||||
// acquired the cell index. For example, it has been
|
||||
// read into a mesh that has made a different face
|
||||
// base-point decision for a boundary face and now
|
||||
// this particle is in a position that is not in the
|
||||
// mesh. Gradually move the particle towards the
|
||||
// centre of the cell that it thought that it was in.
|
||||
// The position is in the (slightly extended)
|
||||
// bound-box of the cell. This situation may arise
|
||||
// because the face decomposition of the cell is not
|
||||
// the same as when the particle acquired the cell
|
||||
// index. For example, it has been read into a mesh
|
||||
// that has made a different face base-point decision
|
||||
// for a boundary face and now this particle is in a
|
||||
// position that is not in the mesh. Gradually move
|
||||
// the particle towards the centre of the cell that it
|
||||
// thought that it was in.
|
||||
|
||||
cellI_ = oldCellI;
|
||||
|
||||
|
||||
@ -1108,7 +1108,7 @@ Foam::moleculeCloud::moleculeCloud
|
||||
mesh_(mesh),
|
||||
pot_(pot),
|
||||
cellOccupancy_(mesh_.nCells()),
|
||||
il_(mesh_, pot_.pairPotentials().rCutMax(), true),
|
||||
il_(mesh_, pot_.pairPotentials().rCutMax(), false),
|
||||
constPropList_(),
|
||||
rndGen_(clock::getTime())
|
||||
{
|
||||
|
||||
@ -5,3 +5,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lliquids \
|
||||
-lthermophysicalFunctions
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ License
|
||||
|
||||
const Foam::scalar Foam::liquidMixture::TrMax = 0.999;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::liquidMixture::liquidMixture
|
||||
@ -41,32 +42,26 @@ Foam::liquidMixture::liquidMixture
|
||||
components_(thermophysicalProperties.lookup("liquidComponents")),
|
||||
properties_(components_.size())
|
||||
{
|
||||
// use sub-dictionary "liquidProperties" if possible to avoid
|
||||
// can use sub-dictionary "liquidProperties" to avoid
|
||||
// collisions with identically named gas-phase entries
|
||||
// (eg, H2O liquid vs. gas)
|
||||
const dictionary* subDictPtr = thermophysicalProperties.subDictPtr
|
||||
(
|
||||
"liquidProperties"
|
||||
);
|
||||
|
||||
const dictionary& props =
|
||||
(
|
||||
subDictPtr ? *subDictPtr : thermophysicalProperties
|
||||
);
|
||||
|
||||
forAll(components_, i)
|
||||
{
|
||||
const dictionary* subDictPtr = thermophysicalProperties.subDictPtr
|
||||
properties_.set
|
||||
(
|
||||
"liquidProperties"
|
||||
i,
|
||||
liquid::New(props.lookup(components_[i]))
|
||||
);
|
||||
|
||||
if (subDictPtr)
|
||||
{
|
||||
properties_.set
|
||||
(
|
||||
i,
|
||||
liquid::New(subDictPtr->lookup(components_[i]))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
properties_.set
|
||||
(
|
||||
i,
|
||||
liquid::New(thermophysicalProperties.lookup(components_[i]))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ class liquidMixture
|
||||
{
|
||||
// Private data
|
||||
|
||||
// maximum reduced temperature
|
||||
//- Maximum reduced temperature
|
||||
static const scalar TrMax;
|
||||
|
||||
//- The names of the liquids
|
||||
@ -130,6 +130,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the liquid names
|
||||
inline const List<word>& components() const
|
||||
{
|
||||
return components_;
|
||||
@ -141,6 +142,13 @@ public:
|
||||
return properties_;
|
||||
}
|
||||
|
||||
//- Return the number of liquids in the mixture
|
||||
inline label size() const
|
||||
{
|
||||
return components_.size();
|
||||
}
|
||||
|
||||
|
||||
//- Calculate the critical temperature of mixture
|
||||
scalar Tc(const scalarField& x) const;
|
||||
|
||||
|
||||
@ -1 +1,5 @@
|
||||
EXE_INC = -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lthermophysicalFunctions
|
||||
|
||||
@ -44,38 +44,38 @@ Description
|
||||
The look-up table ("speciesTable") file should be in constant
|
||||
|
||||
i.e. dictionary
|
||||
@verbatim
|
||||
LookUpTableFileName "speciesTable";
|
||||
|
||||
LookUpTableFileName "speciesTable";
|
||||
EhrrCoeff 0.0;
|
||||
|
||||
EhrrCoeff 0.0;
|
||||
CO2
|
||||
{
|
||||
Tcommon 300.; // Common Temp
|
||||
invTemp true; // Is the polynomial using inverse temperature?
|
||||
Tlow 300.; // Low Temp
|
||||
Thigh 2500.; // High Temp
|
||||
|
||||
CO2
|
||||
{
|
||||
Tcommon 300.; // Common Temp
|
||||
invTemp true; // Is the polynomial using inverse temperature?
|
||||
Tlow 300.; // Low Temp
|
||||
Thigh 2500.; // High Temp
|
||||
|
||||
loTcoeffs // coeffs for T < Tcommon
|
||||
(
|
||||
0 // a0 +
|
||||
0 // a1*T +
|
||||
0 // a2*T^(+/-)2 +
|
||||
0 // a3*T^(+/-)3 +
|
||||
0 // a4*T^(+/-)4 +
|
||||
0 // a5*T^(+/-)5 +
|
||||
);
|
||||
hiTcoeffs // coeffs for T > Tcommon
|
||||
(
|
||||
18.741
|
||||
-121.31e3
|
||||
273.5e6
|
||||
-194.05e9
|
||||
56.31e12
|
||||
-5.8169e15
|
||||
);
|
||||
|
||||
}
|
||||
loTcoeffs // coeffs for T < Tcommon
|
||||
(
|
||||
0 // a0 +
|
||||
0 // a1*T +
|
||||
0 // a2*T^(+/-)2 +
|
||||
0 // a3*T^(+/-)3 +
|
||||
0 // a4*T^(+/-)4 +
|
||||
0 // a5*T^(+/-)5 +
|
||||
);
|
||||
hiTcoeffs // coeffs for T > Tcommon
|
||||
(
|
||||
18.741
|
||||
-121.31e3
|
||||
273.5e6
|
||||
-194.05e9
|
||||
56.31e12
|
||||
-5.8169e15
|
||||
);
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
SourceFiles
|
||||
greyMeanAbsorptionEmission.C
|
||||
|
||||
@ -46,53 +46,52 @@ Description
|
||||
The look Up table file should be in the constant directory.
|
||||
|
||||
band dictionary:
|
||||
|
||||
band0
|
||||
{
|
||||
bandLimits (1.0e-6 2.63e-6);
|
||||
EhrrCoeff 0.0;
|
||||
species
|
||||
@verbatim
|
||||
band0
|
||||
{
|
||||
CH4
|
||||
bandLimits (1.0e-6 2.63e-6);
|
||||
EhrrCoeff 0.0;
|
||||
species
|
||||
{
|
||||
Tcommon 300.;
|
||||
Tlow 300.;
|
||||
Thigh 2500.;
|
||||
invTemp false;
|
||||
loTcoeffs (0 0 0 0 0 0) ;
|
||||
hiTcoeffs (.1 0 0 0 0 0);
|
||||
}
|
||||
CO2
|
||||
{
|
||||
Tcommon 300.;
|
||||
Tlow 300.;
|
||||
Thigh 2500.;
|
||||
invTemp false;
|
||||
loTcoeffs (0 0 0 0 0 0) ;
|
||||
hiTcoeffs (.1 0 0 0 0 0);
|
||||
}
|
||||
|
||||
H2O
|
||||
{
|
||||
Tcommon 300.;
|
||||
Tlow 300.;
|
||||
Thigh 2500.;
|
||||
invTemp false;
|
||||
loTcoeffs (0 0 0 0 0 0) ;
|
||||
hiTcoeffs (.1 0 0 0 0 0);
|
||||
}
|
||||
|
||||
Ysoot
|
||||
{
|
||||
Tcommon 300.;
|
||||
Tlow 300.;
|
||||
Thigh 2500.;
|
||||
invTemp false;
|
||||
loTcoeffs (0 0 0 0 0 0) ;
|
||||
hiTcoeffs (.1 0 0 0 0 0);
|
||||
CH4
|
||||
{
|
||||
Tcommon 300.;
|
||||
Tlow 300.;
|
||||
Thigh 2500.;
|
||||
invTemp false;
|
||||
loTcoeffs (0 0 0 0 0 0) ;
|
||||
hiTcoeffs (.1 0 0 0 0 0);
|
||||
}
|
||||
CO2
|
||||
{
|
||||
Tcommon 300.;
|
||||
Tlow 300.;
|
||||
Thigh 2500.;
|
||||
invTemp false;
|
||||
loTcoeffs (0 0 0 0 0 0) ;
|
||||
hiTcoeffs (.1 0 0 0 0 0);
|
||||
}
|
||||
H2O
|
||||
{
|
||||
Tcommon 300.;
|
||||
Tlow 300.;
|
||||
Thigh 2500.;
|
||||
invTemp false;
|
||||
loTcoeffs (0 0 0 0 0 0) ;
|
||||
hiTcoeffs (.1 0 0 0 0 0);
|
||||
}
|
||||
Ysoot
|
||||
{
|
||||
Tcommon 300.;
|
||||
Tlow 300.;
|
||||
Thigh 2500.;
|
||||
invTemp false;
|
||||
loTcoeffs (0 0 0 0 0 0) ;
|
||||
hiTcoeffs (.1 0 0 0 0 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
|
||||
SourceFiles
|
||||
|
||||
@ -859,7 +859,7 @@ Foam::chemkinReader::chemkinReader
|
||||
:
|
||||
lineNo_(1),
|
||||
specieNames_(10),
|
||||
speciesTable_(static_cast<const wordList&>(wordList()))
|
||||
speciesTable_()
|
||||
{
|
||||
read(CHEMKINFileName, thermoFileName);
|
||||
}
|
||||
@ -870,7 +870,7 @@ Foam::chemkinReader::chemkinReader(const dictionary& thermoDict)
|
||||
:
|
||||
lineNo_(1),
|
||||
specieNames_(10),
|
||||
speciesTable_(static_cast<const wordList&>(wordList()))
|
||||
speciesTable_()
|
||||
{
|
||||
fileName chemkinFile
|
||||
(
|
||||
|
||||
@ -35,13 +35,24 @@ Foam::solidMixture::solidMixture
|
||||
components_(thermophysicalProperties.lookup("solidComponents")),
|
||||
properties_(components_.size())
|
||||
{
|
||||
// can use sub-dictionary "solidProperties" to avoid
|
||||
// collisions with identically named gas-phase entries
|
||||
const dictionary* subDictPtr = thermophysicalProperties.subDictPtr
|
||||
(
|
||||
"solidProperties"
|
||||
);
|
||||
|
||||
const dictionary& props =
|
||||
(
|
||||
subDictPtr ? *subDictPtr : thermophysicalProperties
|
||||
);
|
||||
|
||||
forAll(components_, i)
|
||||
{
|
||||
properties_.set
|
||||
(
|
||||
i,
|
||||
solid::New(thermophysicalProperties.lookup(components_[i]))
|
||||
solid::New(props.lookup(components_[i]))
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -82,12 +93,12 @@ Foam::scalar Foam::solidMixture::rho
|
||||
const scalarField& X
|
||||
) const
|
||||
{
|
||||
scalar tmp = 0.0;
|
||||
scalar val = 0.0;
|
||||
forAll(properties_, i)
|
||||
{
|
||||
tmp += properties_[i].rho()*X[i];
|
||||
val += properties_[i].rho()*X[i];
|
||||
}
|
||||
return tmp;
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
@ -96,12 +107,12 @@ Foam::scalar Foam::solidMixture::cp
|
||||
const scalarField& Y
|
||||
) const
|
||||
{
|
||||
scalar tmp = 0.0;
|
||||
scalar val = 0.0;
|
||||
forAll(properties_, i)
|
||||
{
|
||||
tmp += properties_[i].cp()*Y[i];
|
||||
val += properties_[i].cp()*Y[i];
|
||||
}
|
||||
return tmp;
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,7 +25,18 @@ Class
|
||||
Foam::solidMixture
|
||||
|
||||
Description
|
||||
Foam::solidMixture
|
||||
A mixture of solids.
|
||||
|
||||
Note
|
||||
The dictionary constructor searches for the entry @c solidComponents,
|
||||
which is a wordList. The solid properties of each component can either
|
||||
be contained within a @c solidProperties sub-dictionary or (for legacy
|
||||
purposes) can be found directly in the dictionary.
|
||||
The @c solidProperties sub-dictionary entry should be used when possible
|
||||
to avoid conflicts with identically named gas-phase entries.
|
||||
|
||||
SeeAlso
|
||||
Foam::liquidMixture
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -74,7 +85,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the sold names
|
||||
//- Return the solid names
|
||||
inline const List<word>& components() const
|
||||
{
|
||||
return components_;
|
||||
@ -86,6 +97,13 @@ public:
|
||||
return properties_;
|
||||
}
|
||||
|
||||
//- Return the number of solids in the mixture
|
||||
inline label size() const
|
||||
{
|
||||
return components_.size();
|
||||
}
|
||||
|
||||
|
||||
//- Returns the mass fractions, given mole fractions
|
||||
scalarField Y(const scalarField& X) const;
|
||||
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
atomicWeights = atomicWeights
|
||||
specie = specie
|
||||
speciesTable = speciesTable
|
||||
equationOfState = equationOfState
|
||||
reactions = reaction/reactions
|
||||
|
||||
$(atomicWeights)/atomicWeights.C
|
||||
$(specie)/specie.C
|
||||
$(speciesTable)/speciesTable.C
|
||||
$(equationOfState)/perfectGas/perfectGas.C
|
||||
$(reactions)/makeChemkinReactions.C
|
||||
$(reactions)/makeReactionThermoReactions.C
|
||||
|
||||
@ -42,7 +42,7 @@ inline Foam::thirdBodyEfficiencies::thirdBodyEfficiencies
|
||||
"thirdBodyEfficiencies::thirdBodyEfficiencies"
|
||||
"(const speciesTable& species, const scalarList& efficiencies)"
|
||||
) << "number of efficiencies = " << size()
|
||||
<< " is not equat to the number of species " << species_.size()
|
||||
<< " is not equal to the number of species " << species_.size()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -105,7 +105,7 @@ inline Foam::thirdBodyEfficiencies::thirdBodyEfficiencies
|
||||
"(const speciesTable& species, Istream& is)",
|
||||
is
|
||||
) << "number of efficiencies = " << size()
|
||||
<< " is not equat to the number of species " << species_.size()
|
||||
<< " is not equal to the number of species " << species_.size()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,83 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-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 "speciesTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::speciesTable::setIndices()
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
specieIndices_.insert(wordList::operator[](i), i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from list of specie names
|
||||
Foam::speciesTable::speciesTable(const wordList& specieNames)
|
||||
:
|
||||
wordList(specieNames)
|
||||
{
|
||||
setIndices();
|
||||
}
|
||||
|
||||
|
||||
// Construct from number of species and list of specie names
|
||||
Foam::speciesTable::speciesTable(const label nSpecies, const char** specieNames)
|
||||
:
|
||||
wordList(nSpecies)
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
wordList::operator[](i) = specieNames[i];
|
||||
}
|
||||
|
||||
setIndices();
|
||||
}
|
||||
|
||||
|
||||
// Construct from Istream
|
||||
Foam::speciesTable::speciesTable(Istream& is)
|
||||
:
|
||||
wordList(is)
|
||||
{
|
||||
setIndices();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, speciesTable& st)
|
||||
{
|
||||
is >> static_cast<wordList&>(st);
|
||||
st.setIndices();
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -21,89 +21,25 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Typedef
|
||||
Foam::speciesTable
|
||||
|
||||
Description
|
||||
A table of species
|
||||
|
||||
SourceFiles
|
||||
speciesTableI.H
|
||||
speciesTable.C
|
||||
A table of species as a hashedWordList
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef speciesTable_H
|
||||
#define speciesTable_H
|
||||
|
||||
#include "wordList.H"
|
||||
#include "HashTable.H"
|
||||
#include "hashedWordList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class speciesTable Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class speciesTable
|
||||
:
|
||||
public wordList
|
||||
{
|
||||
// Private data
|
||||
|
||||
HashTable<label> specieIndices_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
void setIndices();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from list of specie names
|
||||
speciesTable(const wordList& specieNames);
|
||||
|
||||
//- Construct from number of species and list of specie names
|
||||
speciesTable(const label nSpecies, const char** specieNames);
|
||||
|
||||
//- Construct from Istream
|
||||
speciesTable(Istream&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Does the table contain the given specie
|
||||
inline bool contains(const word& specieName) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Return a specie's name
|
||||
inline const word& operator[](const label) const;
|
||||
|
||||
//- Lookup a specie's name and return its index
|
||||
inline label operator[](const word&) const;
|
||||
|
||||
|
||||
// Istream operators
|
||||
|
||||
friend Istream& operator>>(Istream&, speciesTable&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "speciesTableI.H"
|
||||
typedef hashedWordList speciesTable;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Reference in New Issue
Block a user