Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
henry
2009-06-22 21:03:20 +01:00
624 changed files with 15691 additions and 8948 deletions

View File

@ -177,7 +177,7 @@ Foam::sigFpe::~sigFpe()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::sigFpe::set()
void Foam::sigFpe::set(const bool verbose)
{
if (oldAction_.sa_handler)
{
@ -190,6 +190,12 @@ void Foam::sigFpe::set()
if (env("FOAM_SIGFPE"))
{
if (verbose)
{
Info<< "SigFpe : Enabling floating point exception trapping"
<< " (FOAM_SIGFPE)." << endl;
}
# ifdef LINUX_GNUC
feenableexcept
@ -240,6 +246,12 @@ void Foam::sigFpe::set()
if (env("FOAM_SETNAN"))
{
if (verbose)
{
Info<< "SetNaN : Initialising allocated memory to NaN"
<< " (FOAM_SETNAN)." << endl;
}
# ifdef LINUX_GNUC
// Set our malloc

View File

@ -107,7 +107,7 @@ public:
// Member functions
void set();
void set(const bool verbose);
};

View File

@ -81,7 +81,7 @@ Foam::sigInt::~sigInt()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::sigInt::set()
void Foam::sigInt::set(const bool verbose)
{
if (oldAction_.sa_handler)
{

View File

@ -78,7 +78,7 @@ public:
// Member functions
void set();
void set(const bool verbose);
};

View File

@ -83,7 +83,7 @@ Foam::sigQuit::~sigQuit()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::sigQuit::set()
void Foam::sigQuit::set(const bool verbose)
{
if (oldAction_.sa_handler)
{

View File

@ -78,7 +78,7 @@ public:
// Member functions
void set();
void set(const bool verbose);
};

View File

@ -83,7 +83,7 @@ Foam::sigSegv::~sigSegv()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::sigSegv::set()
void Foam::sigSegv::set(const bool verbose)
{
if (oldAction_.sa_handler)
{

View File

@ -78,7 +78,7 @@ public:
// Member functions
void set();
void set(const bool verbose);
};

View File

@ -60,6 +60,10 @@ $(sha1)/SHA1Digest.C
primitives/random/Random.C
functions = primitives/functions
$(functions)/Polynomial/makePolynomialsOrder7.C
containers/HashTables/HashTable/HashTableName.C
containers/HashTables/StaticHashTable/StaticHashTableName.C
containers/Lists/SortableList/ParSortableListName.C

View File

@ -73,7 +73,7 @@ void inplaceReorder(const UList<label>& oldToNew, ListType&);
template<class Container>
void inplaceMapValue(const UList<label>& oldToNew, Container&);
//- Recreate with mapped keys. Remove elements with negative key.
//- Recreate with mapped keys. Do not map elements with negative key.
template<class Container>
void inplaceMapKey(const UList<label>& oldToNew, Container&);

View File

@ -147,7 +147,7 @@ void Foam::inplaceMapKey
Container& lst
)
{
Container newLst(lst);
Container newLst(lst.size());
for
(

View File

@ -134,14 +134,26 @@ bool Foam::regIOobject::checkIn()
// any mapping
registered_ = db().checkIn(*this);
// checkin on defaultRegion is allowed to fail, since subsetted meshes
// check-in on defaultRegion is allowed to fail, since subsetted meshes
// are created with the same name as their originating mesh
if (!registered_ && debug && name() != polyMesh::defaultRegion)
{
WarningIn("regIOobject::checkIn()")
<< "failed to register object " << objectPath()
<< " the name already exists in the objectRegistry"
<< endl;
if (debug == 2)
{
// for ease of finding where attempted duplicate check-in
// originated
FatalErrorIn("regIOobject::checkIn()")
<< "failed to register object " << objectPath()
<< " the name already exists in the objectRegistry"
<< abort(FatalError);
}
else
{
WarningIn("regIOobject::checkIn()")
<< "failed to register object " << objectPath()
<< " the name already exists in the objectRegistry"
<< endl;
}
}
}

View File

@ -0,0 +1,112 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "DynamicField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * //
template<class Type>
const char* const DynamicField<Type>::typeName("DynamicField");
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
DynamicField<Type>::DynamicField(Istream& is)
:
Field<Type>(is),
capacity_(Field<Type>::size())
{}
template<class Type>
tmp<DynamicField<Type> > DynamicField<Type>::clone() const
{
return tmp<DynamicField<Type> >(new DynamicField<Type>(*this));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void DynamicField<Type>::setSize(const label nElem)
{
// allocate more capacity?
if (nElem > capacity_)
{
capacity_ = max(nElem, label(1 + capacity_*2));
Field<Type>::setSize(capacity_);
}
// adjust addressed size
Field<Type>::size(nElem);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * IOstream Operator * * * * * * * * * * * * * //
template<class Type>
Ostream& operator<<(Ostream& os, const DynamicField<Type>& f)
{
os << static_cast<const Field<Type>&>(f);
return os;
}
template<class Type>
Ostream& operator<<(Ostream& os, const tmp<DynamicField<Type> >& tf)
{
os << tf();
tf.clear();
return os;
}
template<class Type>
Istream& operator>>(Istream& is, DynamicField<Type>& lst)
{
is >> static_cast<Field<Type>&>(lst);
lst.capacity_ = lst.Field<Type>::size();
return is;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,227 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::DynamicField
Description
Dynamically sized Field. WIP.
SourceFiles
DynamicField.C
\*---------------------------------------------------------------------------*/
#ifndef DynamicField_H
#define DynamicField_H
#include "Field.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
template<class Type>
class DynamicField;
template<class Type>
Ostream& operator<<(Ostream&, const DynamicField<Type>&);
template<class Type>
Ostream& operator<<(Ostream&, const tmp<DynamicField<Type> >&);
template<class Type>
Istream& operator>>(Istream&, DynamicField<Type>&);
/*---------------------------------------------------------------------------*\
Class DynamicField Declaration
\*---------------------------------------------------------------------------*/
#include "CintDefs.H"
template<class Type>
class DynamicField
:
public Field<Type> //private Field<Type>
{
// Private data
//- The capacity (allocated size) of the underlying field.
label capacity_;
//- Construct given size and initial value
DynamicField(const label, const Type&);
//- Construct as copy of tmp<DynamicField>
# ifdef ConstructFromTmp
DynamicField(const tmp<DynamicField<Type> >&);
# endif
//- Construct from a dictionary entry
DynamicField(const word&, const dictionary&, const label);
public:
// Static data members
static const char* const typeName;
// Static Member Functions
//- Return a null field
inline static const DynamicField<Type>& null()
{
return *reinterpret_cast< DynamicField<Type>* >(0);
}
// Constructors
//- Construct null
// Used for temporary fields which are initialised after construction
DynamicField();
//- Construct given size
// Used for temporary fields which are initialised after construction
explicit inline DynamicField(const label);
//- Construct as copy of a UList\<Type\>
explicit inline DynamicField(const UList<Type>&);
//- Construct by transferring the List contents
explicit inline DynamicField(const Xfer<List<Type> >&);
//- Construct by 1 to 1 mapping from the given field
inline DynamicField
(
const UList<Type>& mapF,
const labelList& mapAddressing
);
//- Construct by interpolative mapping from the given field
inline DynamicField
(
const UList<Type>& mapF,
const labelListList& mapAddressing,
const scalarListList& weights
);
//- Construct by mapping from the given field
inline DynamicField
(
const UList<Type>& mapF,
const FieldMapper& map
);
//- Construct as copy
inline DynamicField(const DynamicField<Type>&);
//- Construct as copy or re-use as specified.
inline DynamicField(DynamicField<Type>&, bool reUse);
//- Construct by transferring the Field contents
inline DynamicField(const Xfer<DynamicField<Type> >&);
//- Construct from Istream
inline DynamicField(Istream&);
//- Clone
tmp<DynamicField<Type> > clone() const;
// Member Functions
//- Size of the underlying storage.
inline label capacity() const;
//- Append an element at the end of the list
inline void append(const Type&);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
void setSize(const label nElem);
// Member operators
inline void operator=(const DynamicField<Type>&);
inline void operator=(const UList<Type>&);
inline void operator=(const tmp<DynamicField<Type> >&);
//- Return element of Field.
inline Type& operator[](const label i);
//- Return element of constant Field.
inline const Type& operator[](const label) const;
// IOstream operators
friend Ostream& operator<<
#ifndef __CINT__
<Type>
#endif
(Ostream&, const DynamicField<Type>&);
friend Ostream& operator<<
#ifndef __CINT__
<Type>
#endif
(Ostream&, const tmp<DynamicField<Type> >&);
friend Istream& operator>>
#ifndef __CINT__
<Type>
#endif
(Istream&, DynamicField<Type>&);
};
#include "CintUndefs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "DynamicFieldI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "DynamicField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,221 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "DynamicField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
DynamicField<Type>::DynamicField()
:
Field<Type>(),
capacity_(0)
{}
template<class Type>
DynamicField<Type>::DynamicField(const label size)
:
Field<Type>(size),
capacity_(Field<Type>::size())
{
Field<Type>::size(0);
}
template<class Type>
inline Foam::DynamicField<Type>::DynamicField
(
const UList<Type>& lst
)
:
Field<Type>(lst),
capacity_(Field<Type>::size())
{}
template<class Type>
inline Foam::DynamicField<Type>::DynamicField
(
const Xfer<List<Type> >& lst
)
:
Field<Type>(lst),
capacity_(Field<Type>::size())
{}
template<class Type>
DynamicField<Type>::DynamicField
(
const UList<Type>& mapF,
const labelList& mapAddressing
)
:
Field<Type>(mapF, mapAddressing),
capacity_(Field<Type>::size())
{}
template<class Type>
DynamicField<Type>::DynamicField
(
const UList<Type>& mapF,
const labelListList& mapAddressing,
const scalarListList& weights
)
:
Field<Type>(mapF, mapAddressing, weights),
capacity_(Field<Type>::size())
{}
//- Construct by mapping from the given field
template<class Type>
DynamicField<Type>::DynamicField
(
const UList<Type>& mapF,
const FieldMapper& map
)
:
DynamicField<Type>(mapF, map),
capacity_(Field<Type>::size())
{}
template<class Type>
DynamicField<Type>::DynamicField(const DynamicField<Type>& f)
:
Field<Type>(f),
capacity_(Field<Type>::size())
{}
template<class Type>
DynamicField<Type>::DynamicField(DynamicField<Type>& f, bool reUse)
:
Field<Type>(f, reUse),
capacity_(Field<Type>::size())
{}
template<class Type>
DynamicField<Type>::DynamicField(const Xfer<DynamicField<Type> >& f)
:
Field<Type>(f),
capacity_(Field<Type>::size())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::label DynamicField<Type>::capacity() const
{
return capacity_;
}
template<class Type>
void DynamicField<Type>::append(const Type& t)
{
label elemI = Field<Type>::size();
setSize(elemI + 1);
this->operator[](elemI) = t;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
void DynamicField<Type>::operator=(const DynamicField<Type>& rhs)
{
if (this == &rhs)
{
FatalErrorIn("DynamicField<Type>::operator=(const DynamicField<Type>&)")
<< "attempted assignment to self"
<< abort(FatalError);
}
Field<Type>::operator=(rhs);
capacity_ = Field<Type>::size();
}
template<class Type>
void DynamicField<Type>::operator=(const UList<Type>& rhs)
{
Field<Type>::operator=(rhs);
capacity_ = Field<Type>::size();
}
template<class Type>
void DynamicField<Type>::operator=(const tmp<DynamicField>& rhs)
{
if (this == &(rhs()))
{
FatalErrorIn("DynamicField<Type>::operator=(const tmp<DynamicField>&)")
<< "attempted assignment to self"
<< abort(FatalError);
}
// This is dodgy stuff, don't try it at home.
DynamicField* fieldPtr = rhs.ptr();
List<Type>::transfer(*fieldPtr);
delete fieldPtr;
capacity_ = Field<Type>::size();
}
template<class Type>
Type& DynamicField<Type>::operator[](const label i)
{
return Field<Type>::operator[](i);
}
template<class Type>
const Type& DynamicField<Type>::operator[](const label i) const
{
return Field<Type>::operator[](i);
}
// * * * * * * * * * * * * * * * IOstream Operator * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -75,15 +75,15 @@ public:
//- The default cloud name: %defaultCloud
static word defaultName;
// Constructors
//- Construct for the given objectRegistry and named cloud instance
cloud(const objectRegistry&, const word& cloudName = "");
// Destructor
virtual ~cloud();
//- Destructor
virtual ~cloud();
// Member Functions

View File

@ -526,10 +526,10 @@ Foam::argList::argList
// Switch on signal trapping. We have to wait until after Pstream::init
// since this sets up its own ones.
sigFpe_.set();
sigInt_.set();
sigQuit_.set();
sigSegv_.set();
sigFpe_.set(bannerEnabled);
sigInt_.set(bannerEnabled);
sigQuit_.set(bannerEnabled);
sigSegv_.set(bannerEnabled);
if (Pstream::master() && bannerEnabled)
{

View File

@ -0,0 +1,225 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "Polynomial.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial()
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
name_("unknownPolynomialName"),
logActive_(false),
logCoeff_(0.0)
{}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial(const word& name, Istream& is)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(),
name_(is),
logActive_(false),
logCoeff_(0.0)
{
if (name_ != name)
{
FatalErrorIn
(
"Polynomial<PolySize>::Polynomial(const word&, Istream&)"
) << "Expected polynomial name " << name << " but read " << name_
<< nl << exit(FatalError);
}
VectorSpace<Polynomial<PolySize>, scalar, PolySize>::
operator=(VectorSpace<Polynomial<PolySize>, scalar, PolySize>(is));
if (this->size() == 0)
{
FatalErrorIn
(
"Polynomial<PolySize>::Polynomial(const word&, Istream&)"
) << "Polynomial coefficients for entry " << name_
<< " are invalid (empty)" << nl << exit(FatalError);
}
}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial(const Polynomial<PolySize>& poly)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(poly),
name_(poly.name_),
logActive_(poly.logActive_),
logCoeff_(poly.logCoeff_)
{}
template<int PolySize>
Foam::Polynomial<PolySize>::Polynomial
(
const word& name,
const Polynomial<PolySize>& poly
)
:
VectorSpace<Polynomial<PolySize>, scalar, PolySize>(poly),
name_(name),
logActive_(poly.logActive_),
logCoeff_(poly.logCoeff_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<int PolySize>
Foam::Polynomial<PolySize>::~Polynomial()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<int PolySize>
const Foam::word& Foam::Polynomial<PolySize>::name() const
{
return name_;
}
template<int PolySize>
bool& Foam::Polynomial<PolySize>::logActive()
{
return logActive_;
}
template<int PolySize>
Foam::scalar& Foam::Polynomial<PolySize>::logCoeff()
{
return logCoeff_;
}
template<int PolySize>
Foam::scalar Foam::Polynomial<PolySize>::evaluate(const scalar x) const
{
scalar y = this->v_[0];
for (label i=1; i<PolySize; i++)
{
y += this->v_[i]*pow(x, i);
}
if (logActive_)
{
y += logCoeff_*log(x);
}
return y;
}
template<int PolySize>
Foam::scalar Foam::Polynomial<PolySize>::integrateLimits
(
const scalar x1,
const scalar x2
) const
{
if (logActive_)
{
FatalErrorIn
(
"scalar Polynomial<PolySize>::integrateLimits"
"("
"const scalar, "
"const scalar"
") const"
) << "Cannot integrate polynomial with logarithmic coefficients"
<< nl << abort(FatalError);
}
intPolyType poly = this->integrate();
return poly.evaluate(x2) - poly.evaluate(x1);
}
template<int PolySize>
typename Foam::Polynomial<PolySize>::intPolyType
Foam::Polynomial<PolySize>::integrate(const scalar intConstant)
{
intPolyType newCoeffs;
newCoeffs[0] = intConstant;
forAll(*this, i)
{
newCoeffs[i + 1] = this->v_[i]/(i + 1);
}
return newCoeffs;
}
template<int PolySize>
typename Foam::Polynomial<PolySize>::polyType
Foam::Polynomial<PolySize>::integrateMinus1(const scalar intConstant)
{
polyType newCoeffs;
if (this->v_[0] > VSMALL)
{
newCoeffs.logActive() = true;
newCoeffs.logCoeff() = this->v_[0];
}
newCoeffs[0] = intConstant;
if (PolySize > 0)
{
for (label i=1; i<PolySize; i++)
{
newCoeffs[i] = this->v_[i]/i;
}
}
return newCoeffs;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<int PolySize>
void Foam::Polynomial<PolySize>::operator=(const Polynomial<PolySize>& poly)
{
name_ = poly.name_;
VectorSpace<Polynomial<PolySize>, scalar, PolySize>::operator=(poly);
logActive_ = poly.logActive_;
logCoeff_ = poly.logCoeff_;
}
// ************************************************************************* //

View File

@ -0,0 +1,198 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::Polynomial
Description
Polynomial templated on size (order):
poly = logCoeff*log(x) + sum(coeff_[i]*x^i)
where 0 <= i <= n
- integer powers, starting at zero
- evaluate(x) to evaluate the poly for a given value
- integrate(x1, x2) between two scalar values
- integrate() to return a new, intergated coeff polynomial
- increases the size (order)
- integrateMinus1() to return a new, integrated coeff polynomial where
the base poly starts at order -1
SourceFiles
Polynomial.C
\*---------------------------------------------------------------------------*/
#ifndef Polynomial_H
#define Polynomial_H
#include "word.H"
#include "scalar.H"
#include "Ostream.H"
#include "VectorSpace.H"
#include "Vector.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<int PolySize>
class Polynomial;
// Forward declaration of friend functions
template<int PolySize>
Ostream& operator<<
(
Ostream&,
const Polynomial<PolySize>&
);
/*---------------------------------------------------------------------------*\
Class Polynomial Declaration
\*---------------------------------------------------------------------------*/
template<int PolySize>
class Polynomial
:
public VectorSpace<Polynomial<PolySize>, scalar, PolySize>
{
private:
// Private data
//- Polynomial name
word name_;
//- Include the log term? - only activated using integrateMinus1()
bool logActive_;
//- Log coefficient - only activated using integrateMinus1()
scalar logCoeff_;
public:
typedef Polynomial<PolySize> polyType;
typedef Polynomial<PolySize+1> intPolyType;
//- Run-time type information
TypeName("Polynomial")
// Constructors
//- Construct null
Polynomial();
//- Construct from name and Istream
Polynomial(const word& name, Istream& is);
//- Copy constructor
Polynomial(const Polynomial& poly);
//- Copy constructor with name
Polynomial(const word& name, const Polynomial& poly);
//- Destructor
~Polynomial();
// Member Functions
// Access
//- Return const access to the polynomial name
const word& name() const;
//- Return access to the log term active flag
bool& logActive();
//- Return access to the log coefficient
scalar& logCoeff();
// Evaluation
//- Return polynomial value
scalar evaluate(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;
// Member operators
void operator=(const Polynomial& poly);
//- Ostream Operator
friend Ostream& operator<< <PolySize>
(
Ostream&,
const Polynomial&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makePolynomial(PolySize) \
\
defineTemplateTypeNameAndDebugWithName \
( \
Polynomial<PolySize>, \
"Polynomial<"#PolySize">", \
0 \
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "Polynomial.C"
# include "PolynomialIO.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "Polynomial.H"
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<int PolySize>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const Polynomial<PolySize>& poly
)
{
os << poly.name_ << token::SPACE
<< static_cast
<VectorSpace<Polynomial<PolySize>, scalar, PolySize> >(poly);
// Check state of Ostream
os.check
(
"Ostream& operator<<(Ostream&, const Polynomial<PolySize>&)"
);
return os;
}
// ************************************************************************* //

View File

@ -24,24 +24,28 @@ License
\*---------------------------------------------------------------------------*/
#include "TrackedReactingParcel.H"
#include "Polynomial.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template <class ParcelType>
Foam::TrackedReactingParcel<ParcelType>::TrackedReactingParcel
(
const TrackedReactingParcel<ParcelType>& p
)
:
ReactingParcel<ParcelType>(p),
ParticleTrackingData<ParcelType>(p)
{}
namespace Foam
{
makePolynomial(2);
makePolynomial(3);
makePolynomial(4);
makePolynomial(5);
makePolynomial(6);
makePolynomial(7);
makePolynomial(8);
// explicitly define max order + 1 to define the integrated form
defineTemplateTypeNameAndDebugWithName
(
Polynomial<9>,
"Polynomial<9>",
0
);
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "TrackedReactingParcelIO.C"
// ************************************************************************* //

View File

@ -383,6 +383,35 @@ void Foam::polyTopoChange::checkFace
<< " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError);
}
if (faceI >= 0 && faceI < faces_.size() && faceRemoved(faceI))
{
FatalErrorIn
(
"polyTopoChange::checkFace(const face&, const label"
", const label, const label, const label)"
) << "Face already marked for removal"
<< nl
<< "f:" << f
<< " faceI(-1 if added face):" << faceI
<< " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError);
}
forAll(f, fp)
{
if (f[fp] < points_.size() && pointRemoved(f[fp]))
{
FatalErrorIn
(
"polyTopoChange::checkFace(const face&, const label"
", const label, const label, const label)"
) << "Face uses removed vertices"
<< nl
<< "f:" << f
<< " faceI(-1 if added face):" << faceI
<< " own:" << own << " nei:" << nei
<< " patchI:" << patchI << abort(FatalError);
}
}
}

View File

@ -35,9 +35,11 @@ License
#include "plane.H"
#include "polyTopoChanger.H"
#include "polyAddPoint.H"
#include "polyRemovePoint.H"
#include "polyAddFace.H"
#include "polyModifyPoint.H"
#include "polyModifyFace.H"
#include "polyRemoveFace.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -765,6 +767,9 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
projectedSlavePoints
);
// Demand driven calculate the cut faces. Apart from the
// cutFaces/cutFaceMaster/cutFaceSlave no information from the cutPatch
// is used anymore!
const faceList& cutFaces = cutPatch.cutFaces();
const labelList& cutFaceMaster = cutPatch.cutFaceMaster();
const labelList& cutFaceSlave = cutPatch.cutFaceSlave();
@ -1109,22 +1114,26 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
{
nOrphanedMasters++;
// Recover original orientation
ref.setAction
(
polyModifyFace
(
masterPatch[faceI], // new face
masterPatchAddr[faceI], // master face index
-1, // owner
-1, // neighbour
false, // flux flip
-1, // patch ID
false, // remove from zone
masterFaceZoneID_.index(), // zone ID
false // zone flip
)
);
//// Recover original orientation
//ref.setAction
//(
// polyModifyFace
// (
// masterPatch[faceI], // new face
// masterPatchAddr[faceI], // master face index
// -1, // owner
// -1, // neighbour
// false, // flux flip
// -1, // patch ID
// false, // remove from zone
// masterFaceZoneID_.index(), // zone ID
// false // zone flip
// )
//);
//Pout<< "**MJ:deleting master face " << masterPatchAddr[faceI]
// << " old verts:" << masterPatch[faceI] << endl;
ref.setAction(polyRemoveFace(masterPatchAddr[faceI]));
}
}
@ -1136,22 +1145,26 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
{
nOrphanedSlaves++;
// Recover original orientation
ref.setAction
(
polyModifyFace
(
slavePatch[faceI], // new face
slavePatchAddr[faceI], // slave face index
-1, // owner
-1, // neighbour
false, // flux flip
-1, // patch ID
false, // remove from zone
slaveFaceZoneID_.index(), // zone ID
false // zone flip
)
);
//// Recover original orientation
//ref.setAction
//(
// polyModifyFace
// (
// slavePatch[faceI], // new face
// slavePatchAddr[faceI], // slave face index
// -1, // owner
// -1, // neighbour
// false, // flux flip
// -1, // patch ID
// false, // remove from zone
// slaveFaceZoneID_.index(), // zone ID
// false // zone flip
// )
//);
//Pout<< "**MJ:deleting slave face " << slavePatchAddr[faceI]
// << " old verts:" << slavePatch[faceI] << endl;
ref.setAction(polyRemoveFace(slavePatchAddr[faceI]));
}
}
@ -1400,24 +1413,46 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
face newFace;
newFace.transfer(newFaceLabels);
// Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
//Pout << "Modifying master stick-out face " << curFaceID
// << " old face: " << oldFace << " new face: " << newFace << endl;
// Modify the face
ref.setAction
(
polyModifyFace
if (mesh.isInternalFace(curFaceID))
{
ref.setAction
(
newFace, // modified face
curFaceID, // label of face being modified
own[curFaceID], // owner
nei[curFaceID], // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
)
);
polyModifyFace
(
newFace, // modified face
curFaceID, // label of face being modified
own[curFaceID], // owner
nei[curFaceID], // neighbour
false, // face flip
-1, // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
)
);
}
else
{
ref.setAction
(
polyModifyFace
(
newFace, // modified face
curFaceID, // label of face being modified
own[curFaceID], // owner
-1, // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
)
);
}
}
}
@ -1688,21 +1723,42 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
// Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
// Modify the face
ref.setAction
(
polyModifyFace
if (mesh.isInternalFace(curFaceID))
{
ref.setAction
(
newFace, // modified face
curFaceID, // label of face being modified
own[curFaceID], // owner
nei[curFaceID], // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
)
);
polyModifyFace
(
newFace, // modified face
curFaceID, // label of face being modified
own[curFaceID], // owner
nei[curFaceID], // neighbour
false, // face flip
-1, // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
)
);
}
else
{
ref.setAction
(
polyModifyFace
(
newFace, // modified face
curFaceID, // label of face being modified
own[curFaceID], // owner
-1, // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone
)
);
}
}
}
@ -1735,15 +1791,25 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
// slave patch
nRetiredPoints++;
//ref.setAction
//(
// polyModifyPoint
// (
// slaveMeshPoints[pointI], // point ID
// points[slaveMeshPoints[pointI]], // point
// false, // remove from zone
// mesh.pointZones().whichZone(slaveMeshPoints[pointI]),// zone
// false // in a cell
// )
//);
//Pout<< "MJ retire slave point " << slaveMeshPoints[pointI]
// << " coord " << points[slaveMeshPoints[pointI]]
// << endl;
ref.setAction
(
polyModifyPoint
polyRemovePoint
(
slaveMeshPoints[pointI], // point ID
points[slaveMeshPoints[pointI]], // point
false, // remove from zone
mesh.pointZones().whichZone(slaveMeshPoints[pointI]),// zone
false // in a cell
slaveMeshPoints[pointI]
)
);

View File

@ -28,6 +28,8 @@ Description
#include "enrichedPatch.H"
#include "demandDrivenData.H"
#include "OFstream.H"
#include "meshTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -249,6 +251,33 @@ bool Foam::enrichedPatch::checkSupport() const
}
void Foam::enrichedPatch::writeOBJ(const fileName& fName) const
{
OFstream str(fName);
const pointField& lp = localPoints();
forAll(lp, pointI)
{
meshTools::writeOBJ(str, lp[pointI]);
}
const faceList& faces = localFaces();
forAll(faces, faceI)
{
const face& f = faces[faceI];
str << 'f';
forAll(f, fp)
{
str << ' ' << f[fp]+1;
}
str << nl;
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //

View File

@ -199,9 +199,9 @@ public:
(
const primitiveFacePatch& masterPatch,
const primitiveFacePatch& slavePatch,
const labelList& slavePointPointHits,
const labelList& slavePointEdgeHits,
const List<objectHit>& slavePointFaceHits
const labelList& slavePointPointHits,// -1 or common point snapped to
const labelList& slavePointEdgeHits, // -1 or common edge snapped to
const List<objectHit>& slavePointFaceHits // master face snapped to
);
@ -276,6 +276,10 @@ public:
//- Check if the patch is fully supported
bool checkSupport() const;
//- Debugging: dump graphical representation to obj format file
void writeOBJ(const fileName&) const;
};

View File

@ -664,14 +664,15 @@ void Foam::slidingInterface::updateMesh(const mapPolyMesh& m)
masterPatchID_.update(mesh.boundaryMesh());
slavePatchID_.update(mesh.boundaryMesh());
if (!attached())
{
calcAttachedAddressing();
}
else
{
renumberAttachedAddressing(m);
}
//MJ:Disabled updating
// if (!attached())
// {
// calcAttachedAddressing();
// }
// else
// {
// renumberAttachedAddressing(m);
// }
}

View File

@ -33,15 +33,11 @@ Description
{
dimensionedScalar totalMass = fvc::domainIntegrate(rho);
scalar sumLocalContErr =
(
fvc::domainIntegrate(mag(rho - thermo->rho()))/totalMass
).value();
scalar sumLocalContErr =
(fvc::domainIntegrate(mag(rho - thermo.rho()))/totalMass).value();
scalar globalContErr =
(
fvc::domainIntegrate(rho - thermo->rho())/totalMass
).value();
scalar globalContErr =
(fvc::domainIntegrate(rho - thermo.rho())/totalMass).value();
cumulativeContErr += globalContErr;

View File

@ -1301,7 +1301,11 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::correction
{
tmp<Foam::fvMatrix<Type> > tAcorr = A - (A & A.psi());
if ((A.hasUpper() || A.hasLower()) && A.mesh().fluxRequired(A.psi().name()))
if
(
(A.hasUpper() || A.hasLower())
&& A.psi().mesh().fluxRequired(A.psi().name())
)
{
tAcorr().faceFluxCorrectionPtr() = (-A.flux()).ptr();
}
@ -1321,7 +1325,11 @@ Foam::tmp<Foam::fvMatrix<Type> > Foam::correction
// Note the matrix coefficients are still that of matrix A
const fvMatrix<Type>& A = tAcorr();
if ((A.hasUpper() || A.hasLower()) && A.mesh().fluxRequired(A.psi().name()))
if
(
(A.hasUpper() || A.hasLower())
&& A.psi().mesh().fluxRequired(A.psi().name())
)
{
tAcorr().faceFluxCorrectionPtr() = (-A.flux()).ptr();
}

View File

@ -78,6 +78,9 @@ class Cloud
const unallocLabelList& owner_;
const unallocLabelList& neighbour_;
//- Temporary storage for addressing. Used in findFaces.
mutable DynamicList<label> labels_;
// Private member functions

View File

@ -22,12 +22,77 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "IOPosition.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParticleType>
Foam::word Foam::IOPosition<ParticleType>::particlePropertiesName
(
"particleProperties"
);
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
template<class ParticleType>
void Foam::IOPosition<ParticleType>::readParticleProperties()
{
IOobject propsDictHeader
(
particlePropertiesName,
cloud_.db().time().timeName(),
"uniform"/cloud::prefix/cloud_.name(),
cloud_.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (propsDictHeader.headerOk())
{
const IOdictionary propsDict(propsDictHeader);
word procName("processor" + Foam::name(Pstream::myProcNo()));
if (propsDict.found(procName))
{
propsDict.subDict(procName).lookup("particleCount")
>> Particle<ParticleType>::particleCount;
}
}
}
template<class ParticleType>
void Foam::IOPosition<ParticleType>::writeParticleProperties() const
{
IOdictionary propsDict
(
IOobject
(
particlePropertiesName,
cloud_.db().time().timeName(),
"uniform"/cloud::prefix/cloud_.name(),
cloud_.db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
word procName("processor" + Foam::name(Pstream::myProcNo()));
propsDict.add(procName, dictionary());
propsDict.subDict(procName).add
(
"particleCount",
Particle<ParticleType>::particleCount
);
propsDict.regIOobject::write();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType>
@ -70,6 +135,8 @@ bool Foam::IOPosition<ParticleType>::write() const
template<class ParticleType>
bool Foam::IOPosition<ParticleType>::writeData(Ostream& os) const
{
writeParticleProperties();
os<< cloud_.size() << nl << token::BEGIN_LIST << nl;
forAllConstIter(typename Cloud<ParticleType>, cloud_, iter)
@ -90,6 +157,8 @@ void Foam::IOPosition<ParticleType>::readData
bool checkClass
)
{
readParticleProperties();
Istream& is = readStream(checkClass ? typeName : "");
token firstToken(is);

View File

@ -59,30 +59,38 @@ class IOPosition
const Cloud<ParticleType>& cloud_;
// Private member functions
//- Read particle properties dictionary
void readParticleProperties();
//- Write particle properties dictionary
void writeParticleProperties() const;
public:
//- Runtime type name information
virtual const word& type() const
{
return cloud_.type();
}
// Static data
//- Runtime type name information
virtual const word& type() const
{
return cloud_.type();
}
//- Name of particle properties dictionary
static word particlePropertiesName;
// Constructors
//- Construct from cloud
IOPosition
(
const Cloud<ParticleType>&
);
IOPosition(const Cloud<ParticleType>&);
// Member functions
void readData
(
Cloud<ParticleType>& c,
bool checkClass
);
void readData(Cloud<ParticleType>& c, bool checkClass);
bool write() const;

View File

@ -33,19 +33,26 @@ License
#include "wallPolyPatch.H"
#include "transform.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParticleType>
Foam::label Foam::Particle<ParticleType>::particleCount = 0;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ParticleType>
Foam::labelList Foam::Particle<ParticleType>::findFaces
void Foam::Particle<ParticleType>::findFaces
(
const vector& position
const vector& position,
DynamicList<label>& faceList
) const
{
const polyMesh& mesh = cloud_.polyMesh_;
const labelList& faces = mesh.cells()[celli_];
const vector& C = mesh.cellCentres()[celli_];
DynamicList<label> faceList(10);
faceList.clear();
forAll(faces, i)
{
label facei = faces[i];
@ -56,26 +63,23 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
faceList.append(facei);
}
}
faceList.shrink();
return faceList;
}
template<class ParticleType>
Foam::labelList Foam::Particle<ParticleType>::findFaces
void Foam::Particle<ParticleType>::findFaces
(
const vector& position,
const label celli,
const scalar stepFraction
const scalar stepFraction,
DynamicList<label>& faceList
) const
{
const polyMesh& mesh = cloud_.polyMesh_;
const polyMesh& mesh = cloud_.mesh();
const labelList& faces = mesh.cells()[celli];
const vector& C = mesh.cellCentres()[celli];
DynamicList<label> faceList(10);
faceList.clear();
forAll(faces, i)
{
label facei = faces[i];
@ -86,10 +90,6 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
faceList.append(facei);
}
}
faceList.shrink();
return faceList;
}
@ -182,7 +182,9 @@ Foam::Particle<ParticleType>::Particle
position_(position),
celli_(celli),
facei_(-1),
stepFraction_(0.0)
stepFraction_(0.0),
origProc_(Pstream::myProcNo()),
origId_(particleCount++)
{}
@ -193,7 +195,9 @@ Foam::Particle<ParticleType>::Particle(const Particle<ParticleType>& p)
position_(p.position_),
celli_(p.celli_),
facei_(p.facei_),
stepFraction_(p.stepFraction_)
stepFraction_(p.stepFraction_),
origProc_(p.origProc_),
origId_(p.origId_)
{}
@ -237,7 +241,8 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
{
const polyMesh& mesh = cloud_.polyMesh_;
labelList faces = findFaces(endPosition);
DynamicList<label>& faces = cloud_.labels_;
findFaces(endPosition, faces);
facei_ = -1;
scalar trackFraction = 0.0;

View File

@ -127,6 +127,12 @@ protected:
//- Fraction of time-step completed
scalar stepFraction_;
//- Originating processor id
label origProc_;
//- Local particle id on originating processor
label origId_;
// Private member functions
@ -151,18 +157,20 @@ protected:
const label facei
) const;
//- Return the faces between position and cell centre
labelList findFaces
//- Find the faces between position and cell centre
void findFaces
(
const vector& position
const vector& position,
DynamicList<label>& faceList
) const;
//- Return the faces between position and cell centre
labelList findFaces
//- Find the faces between position and cell centre
void findFaces
(
const vector& position,
const label celli,
const scalar stepFraction
const scalar stepFraction,
DynamicList<label>& faceList
) const;
@ -265,11 +273,14 @@ public:
// Static data members
//- Runtime type information
TypeName("Particle");
//- String representation of properties
static string propHeader;
//- Runtime type information
TypeName("Particle");
//- Cumulative particle count used for particle id
static label particleCount;
// Constructors
@ -394,6 +405,12 @@ public:
//- Return the fraction of time-step completed
inline scalar stepFraction() const;
//- Return the originating processor id
inline label origProc() const;
//- Return the particle id on originating processor
inline label origId() const;
// Track

View File

@ -26,15 +26,10 @@ License
#include "polyMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ParticleType>
inline scalar Particle<ParticleType>::lambda
inline Foam::scalar Foam::Particle<ParticleType>::lambda
(
const vector& from,
const vector& to,
@ -182,7 +177,7 @@ inline scalar Particle<ParticleType>::lambda
template<class ParticleType>
inline scalar Particle<ParticleType>::lambda
inline Foam::scalar Foam::Particle<ParticleType>::lambda
(
const vector& from,
const vector& to,
@ -234,23 +229,25 @@ inline scalar Particle<ParticleType>::lambda
template<class ParticleType>
inline bool Particle<ParticleType>::inCell() const
inline bool Foam::Particle<ParticleType>::inCell() const
{
labelList faces = findFaces(position_);
DynamicList<label>& faces = cloud_.labels_;
findFaces(position_, faces);
return (!faces.size());
}
template<class ParticleType>
inline bool Particle<ParticleType>::inCell
inline bool Foam::Particle<ParticleType>::inCell
(
const vector& position,
const label celli,
const scalar stepFraction
) const
{
labelList faces = findFaces(position, celli, stepFraction);
DynamicList<label>& faces = cloud_.labels_;
findFaces(position, celli, stepFraction, faces);
return (!faces.size());
}
@ -259,7 +256,7 @@ inline bool Particle<ParticleType>::inCell
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType>
inline Particle<ParticleType>::trackData::trackData
inline Foam::Particle<ParticleType>::trackData::trackData
(
Cloud<ParticleType>& cloud
)
@ -267,8 +264,10 @@ inline Particle<ParticleType>::trackData::trackData
cloud_(cloud)
{}
template<class ParticleType>
inline Cloud<ParticleType>& Particle<ParticleType>::trackData::cloud()
inline Foam::Cloud<ParticleType>&
Foam::Particle<ParticleType>::trackData::cloud()
{
return cloud_;
}
@ -277,76 +276,92 @@ inline Cloud<ParticleType>& Particle<ParticleType>::trackData::cloud()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType>
inline const Cloud<ParticleType>& Particle<ParticleType>::cloud() const
inline const Foam::Cloud<ParticleType>&
Foam::Particle<ParticleType>::cloud() const
{
return cloud_;
}
template<class ParticleType>
inline const vector& Particle<ParticleType>::position() const
inline const Foam::vector& Foam::Particle<ParticleType>::position() const
{
return position_;
}
template<class ParticleType>
inline vector& Particle<ParticleType>::position()
inline Foam::vector& Foam::Particle<ParticleType>::position()
{
return position_;
}
template<class ParticleType>
inline label Particle<ParticleType>::cell() const
{
return celli_;
}
template<class ParticleType>
inline label& Particle<ParticleType>::cell()
inline Foam::label Foam::Particle<ParticleType>::cell() const
{
return celli_;
}
template<class ParticleType>
inline label Particle<ParticleType>::face() const
inline Foam::label& Foam::Particle<ParticleType>::cell()
{
return celli_;
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::face() const
{
return facei_;
}
template<class ParticleType>
inline bool Particle<ParticleType>::onBoundary() const
inline bool Foam::Particle<ParticleType>::onBoundary() const
{
return facei_ != -1 && facei_ >= cloud_.pMesh().nInternalFaces();
}
template<class ParticleType>
inline scalar& Particle<ParticleType>::stepFraction()
inline Foam::scalar& Foam::Particle<ParticleType>::stepFraction()
{
return stepFraction_;
}
template<class ParticleType>
inline scalar Particle<ParticleType>::stepFraction() const
inline Foam::scalar Foam::Particle<ParticleType>::stepFraction() const
{
return stepFraction_;
}
template<class ParticleType>
inline bool Particle<ParticleType>::softImpact() const
inline Foam::label Foam::Particle<ParticleType>::origProc() const
{
return origProc_;
}
template<class ParticleType>
inline Foam::label Foam::Particle<ParticleType>::origId() const
{
return origId_;
}
template<class ParticleType>
inline bool Foam::Particle<ParticleType>::softImpact() const
{
return false;
}
template<class ParticleType>
inline scalar Particle<ParticleType>::currentTime() const
inline Foam::scalar Foam::Particle<ParticleType>::currentTime() const
{
return
cloud_.pMesh().time().value()
@ -355,14 +370,14 @@ inline scalar Particle<ParticleType>::currentTime() const
template<class ParticleType>
inline label Particle<ParticleType>::patch(const label facei) const
inline Foam::label Foam::Particle<ParticleType>::patch(const label facei) const
{
return cloud_.facePatch(facei);
}
template<class ParticleType>
inline label Particle<ParticleType>::patchFace
inline Foam::label Foam::Particle<ParticleType>::patchFace
(
const label patchi,
const label facei
@ -373,21 +388,18 @@ inline label Particle<ParticleType>::patchFace
template<class ParticleType>
inline scalar Particle<ParticleType>::wallImpactDistance(const vector&) const
inline Foam::scalar
Foam::Particle<ParticleType>::wallImpactDistance(const vector&) const
{
return 0.0;
}
template<class ParticleType>
inline label Particle<ParticleType>::faceInterpolation() const
inline Foam::label Foam::Particle<ParticleType>::faceInterpolation() const
{
return facei_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -31,12 +31,11 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParticleType>
Foam::string Foam::Particle<ParticleType>::propHeader = "(Px Py Pz) cellI";
Foam::string Foam::Particle<ParticleType>::propHeader =
"(Px Py Pz) cellI origProc origId";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from Istream
template<class ParticleType>
Foam::Particle<ParticleType>::Particle
(
@ -47,20 +46,26 @@ Foam::Particle<ParticleType>::Particle
:
cloud_(cloud),
facei_(-1),
stepFraction_(0.0)
stepFraction_(0.0),
origProc_(Pstream::myProcNo()),
origId_(-1)
{
if (is.format() == IOstream::ASCII)
{
is >> position_ >> celli_;
is >> position_ >> celli_ >> origProc_ >> origId_;
}
else
{
// In binary read both celli_ and facei_, needed for parallel transfer
// In binary read all particle data - needed for parallel transfer
is.read
(
reinterpret_cast<char*>(&position_),
sizeof(position_) + sizeof(celli_)
+ sizeof(facei_) + sizeof(stepFraction_)
sizeof(position_)
+ sizeof(celli_)
+ sizeof(facei_)
+ sizeof(stepFraction_)
+ sizeof(origProc_)
+ sizeof(origId_)
);
}
@ -92,7 +97,9 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const Particle<ParticleType>& p)
if (os.format() == IOstream::ASCII)
{
os << p.position_
<< token::SPACE << p.celli_;
<< token::SPACE << p.celli_
<< token::SPACE << p.origProc_
<< token::SPACE << p.origId_;
}
else
{
@ -100,8 +107,12 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const Particle<ParticleType>& p)
os.write
(
reinterpret_cast<const char*>(&p.position_),
sizeof(p.position_) + sizeof(p.celli_)
+ sizeof(p.facei_) + sizeof(p.stepFraction_)
sizeof(p.position_)
+ sizeof(p.celli_)
+ sizeof(p.facei_)
+ sizeof(p.stepFraction_)
+ sizeof(p.origProc_)
+ sizeof(p.origId_)
);
}

View File

@ -1,166 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::ParticleTrackingData
Description
Class to provide additional properties to allow construction of
particle tracks
SourceFiles
ParticleTrackingData.C
ParticleTrackingDataIO.C
\*---------------------------------------------------------------------------*/
#ifndef ParticleTrackingData_H
#define ParticleTrackingData_H
#include "Cloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes and friend functions
template<class ParcelType>
class ParticleTrackingData;
template<class ParcelType>
Ostream& operator<<
(
Ostream&,
const ParticleTrackingData<ParcelType>&
);
/*---------------------------------------------------------------------------*\
Class ParticleTrackingData Declaration
\*---------------------------------------------------------------------------*/
template<class ParcelType>
class ParticleTrackingData
{
// Private data
//- Reference to the cloud
const Cloud<ParcelType>& cloud_;
//- Originating processor id
label origProc_;
//- Local particle id
label id_;
//- Cumulative particle count used for particle id
static label PARTICLE_COUNT;
// Private member functions
//- Write properties - particle count
static void writeProperties(const Cloud<ParcelType>& cloud);
//- Read properties - particle count
static void readProperties(const Cloud<ParcelType>& cloud);
public:
// Constructors
//- Construct from cloud
ParticleTrackingData(const Cloud<ParcelType>& cloud);
//- Construct copy
ParticleTrackingData(const ParticleTrackingData& ptd);
//- Construct from Istream and mesh
ParticleTrackingData
(
const Cloud<ParcelType>& cloud,
Istream& is,
bool readFields
);
//- Destructor
~ParticleTrackingData();
// Member functions
// Access
//- Return const access to the cloud
inline const Cloud<ParcelType>& cloud() const;
//- Return const access to the originating processor id
inline label origProc() const;
//- Return const access to the local particle id
inline label id() const;
// I-O
//- Read fields
static void readFields(Cloud<ParcelType>& c);
//- Write fields
static void writeFields(const Cloud<ParcelType>& c);
// Ostream Operator
friend Ostream& operator<< <ParcelType>
(
Ostream&,
const ParticleTrackingData<ParcelType>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ParticleTrackingDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ParticleTrackingData.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,233 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "ParticleTrackingData.H"
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ParticleTrackingData<ParcelType>::readProperties
(
const Cloud<ParcelType>& cloud
)
{
IOobject propsDictHeader
(
"particleTrackingProperties",
cloud.db().time().timeName(),
"uniform/Lagrangian"/cloud.name(),
cloud.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (propsDictHeader.headerOk())
{
const IOdictionary propsDict(propsDictHeader);
word procName("processor" + name(Pstream::myProcNo()));
if (propsDict.found(procName))
{
propsDict.subDict(procName).lookup("particleCount") >>
PARTICLE_COUNT;
}
}
}
template<class ParcelType>
void Foam::ParticleTrackingData<ParcelType>::writeProperties
(
const Cloud<ParcelType>& cloud
)
{
if (cloud.db().time().outputTime())
{
IOdictionary propsDict
(
IOobject
(
"particleTrackingProperties",
cloud.db().time().timeName(),
"uniform/Lagrangian"/cloud.name(),
cloud.db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
word procName("processor" + name(Pstream::myProcNo()));
propsDict.add(procName, dictionary());
propsDict.subDict(procName).add("particleCount", PARTICLE_COUNT);
propsDict.regIOobject::write();
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::ParticleTrackingData<ParcelType>::ParticleTrackingData
(
const Cloud<ParcelType>& cloud,
Istream& is,
bool readFields
)
:
cloud_(cloud),
origProc_(-1),
id_(-1)
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
is >> origProc_ >> id_;
}
else
{
is.read
(
reinterpret_cast<char*>(&origProc_),
sizeof(origProc_) + sizeof(id_)
);
}
}
// Check state of Istream
is.check
(
"ParticleTrackingData<ParcelType>::ParticleTrackingData"
"("
"Istream&, "
"bool"
")"
);
}
template<class ParcelType>
void Foam::ParticleTrackingData<ParcelType>::readFields
(
Cloud<ParcelType>& c
)
{
if (!c.size())
{
return;
}
readProperties(c);
IOField<label> origProc(c.fieldIOobject("origProc", IOobject::MUST_READ));
c.checkFieldIOobject(c, origProc);
IOField<label> id(c.fieldIOobject("id", IOobject::MUST_READ));
c.checkFieldIOobject(c, id);
label i = 0;
forAllIter(typename Cloud<ParcelType>, c, iter)
{
ParcelType& p = iter();
p.origProc_ = origProc[i];
p.id_ = id[i];
i++;
}
}
template<class ParcelType>
void Foam::ParticleTrackingData<ParcelType>::writeFields
(
const Cloud<ParcelType>& c
)
{
writeProperties(c);
const label np = c.size();
IOField<label> origProc
(
c.fieldIOobject("origProc", IOobject::NO_READ),
np
);
IOField<label> id(c.fieldIOobject("id", IOobject::NO_READ), np);
label i = 0;
forAllConstIter(typename Cloud<ParcelType>, c, iter)
{
const ParcelType& p = iter();
origProc[i] = p.origProc();
id[i] = p.id();
i++;
}
origProc.write();
id.write();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class ParcelType>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const ParticleTrackingData<ParcelType>& p
)
{
if (os.format() == IOstream::ASCII)
{
os << p.origProc_ << token::SPACE << p.id_ << token::SPACE;
}
else
{
os.write
(
reinterpret_cast<const char*>(&p.origProc_),
sizeof(p.origProc_) + sizeof(p.id_)
);
}
// Check state of Ostream
os.check
(
"Ostream& operator<<"
"("
"Ostream&, "
"const ParticleTrackingData<ParcelType>&"
")"
);
return os;
}
// ************************************************************************* //

View File

@ -35,7 +35,7 @@ Foam::CoalCloud<ThermoType>::CoalCloud
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
)
:
ReactingMultiphaseCloud<CoalParcel<ThermoType> >

View File

@ -76,7 +76,7 @@ public:
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
);

View File

@ -10,7 +10,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
@ -30,6 +30,6 @@ LIB_LIBS = \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lcombustionThermophysicalModels \
-lreactionThermophysicalModels \
-lcompressibleRASModels \
-lcompressibleLESModels

View File

@ -28,7 +28,7 @@ License
#define createCoalParcelTypes_H
#include "makeParcelIOList.H"
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "CoalCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -38,12 +38,17 @@ License
createCoalParcelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
createCoalParcelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
createCoalParcelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "thermoPhysicsTypes.H"
#include "ReactingMultiphaseCloud.H"
#include "NoSurfaceReaction.H"
@ -44,12 +44,17 @@ License
makeCoalSurfaceReactionModelThermoType \
( \
ParcelType, \
specieConstProperties \
constGasThermoPhysics \
); \
makeCoalSurfaceReactionModelThermoType \
( \
ParcelType, \
specieReactingProperties \
gasThermoPhysics \
); \
makeCoalSurfaceReactionModelThermoType \
( \
ParcelType, \
icoPoly8ThermoPhysics \
);

View File

@ -50,10 +50,10 @@ Foam::COxidationDiffusionLimitedRate<CloudType>::COxidationDiffusionLimitedRate
CsLocalId_ = owner.composition().localId(idSolid, "C");
// Set local copies of thermo properties
WO2_ = owner.composition().carrierSpecies()[O2GlobalId_].W();
scalar WCO2 = owner.composition().carrierSpecies()[CO2GlobalId_].W();
WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
WC_ = WCO2 - WO2_;
HcCO2_ = owner.composition().carrierSpecies()[CO2GlobalId_].Hc();
HcCO2_ = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].Hc();
if (Sb_ < 0)
{
@ -120,8 +120,7 @@ Foam::scalar Foam::COxidationDiffusionLimitedRate<CloudType>::calculate
}
// Local mass fraction of O2 in the carrier phase
const scalar YO2 =
this->owner().carrierThermo().composition().Y(O2GlobalId_)[cellI];
const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
// Change in C mass [kg]
scalar dmC =

View File

@ -58,10 +58,10 @@ COxidationKineticDiffusionLimitedRate
CsLocalId_ = owner.composition().localId(idSolid, "C");
// Set local copies of thermo properties
WO2_ = owner.composition().carrierSpecies()[O2GlobalId_].W();
scalar WCO2 = owner.composition().carrierSpecies()[CO2GlobalId_].W();
WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
WC_ = WCO2 - WO2_;
HcCO2_ = owner.composition().carrierSpecies()[CO2GlobalId_].Hc();
HcCO2_ = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].Hc();
if (Sb_ < 0)
{
@ -128,8 +128,7 @@ Foam::scalar Foam::COxidationKineticDiffusionLimitedRate<CloudType>::calculate
}
// Local mass fraction of O2 in the carrier phase
const scalar YO2 =
this->owner().carrierThermo().composition().Y(O2GlobalId_)[cellI];
const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
// Diffusion rate coefficient
const scalar D0 = C1_/d*pow(0.5*(T + Tc), 0.75);

View File

@ -69,8 +69,8 @@ Foam::COxidationMurphyShaddix<CloudType>::COxidationMurphyShaddix
CsLocalId_ = owner.composition().localId(idSolid, "C");
// Set local copies of thermo properties
WO2_ = owner.composition().carrierSpecies()[O2GlobalId_].W();
scalar WCO2 = owner.composition().carrierSpecies()[CO2GlobalId_].W();
WO2_ = owner.mcCarrierThermo().speciesData()[O2GlobalId_].W();
scalar WCO2 = owner.mcCarrierThermo().speciesData()[CO2GlobalId_].W();
WC_ = WCO2 - WO2_;
}
@ -125,7 +125,7 @@ Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::calculate
// Cell carrier phase O2 species density [kg/m^3]
const scalar rhoO2 =
rhoc*this->owner().carrierThermo().composition().Y(O2GlobalId_)[cellI];
rhoc*this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
if (rhoO2 < SMALL)
{
@ -211,9 +211,9 @@ Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::calculate
this->owner().composition().solids().properties()[CsLocalId_].Hf()
+ this->owner().composition().solids().properties()[CsLocalId_].cp()*T;
const scalar HCO2 =
this->owner().composition().carrierSpecies()[CO2GlobalId_].H(T);
this->owner().mcCarrierThermo().speciesData()[CO2GlobalId_].H(T);
const scalar HO2 =
this->owner().composition().carrierSpecies()[O2GlobalId_].H(T);
this->owner().mcCarrierThermo().speciesData()[O2GlobalId_].H(T);
// Heat of reaction
return dOmega*(WC_*HC + WO2_*HO2 - (WC_ + WO2_)*HCO2);

View File

@ -11,7 +11,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude
LIB_LIBS = \

View File

@ -34,15 +34,14 @@ License
#include "wallPolyPatch.H"
#include "wedgePolyPatch.H"
#include "processorPolyPatch.H"
#include "combustionMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineParticleTypeNameAndDebug(parcel, 0);
defineTemplateTypeNameAndDebug(Cloud<parcel>, 0);
defineParticleTypeNameAndDebug(parcel, 0);
defineTemplateTypeNameAndDebug(Cloud<parcel>, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -30,7 +30,7 @@ License
#include "dragModel.H"
#include "evaporationModel.H"
#include "heatTransferModel.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -93,7 +93,7 @@ void parcel::setRelaxationTimes
for(label i=0; i<Nf; i++)
{
label j = sDB.liquidToGasIndex()[i];
scalar Y = sDB.composition().Y()[j][celli];
scalar Y = sDB.composition().Y()[j][celli];
scalar Wi = sDB.gasProperties()[j].W();
Yf[i] = Y;
Xf[i] = Y*W/Wi;
@ -139,14 +139,14 @@ void parcel::setRelaxationTimes
scalar Prandtl = Pr(cpMixture, muf, kMixture);
// calculate the characteritic times
if(liquidCore_> 0.5)
{
// no drag for parcels in the liquid core..
tauMomentum = GREAT;
}
else
{
{
tauMomentum = sDB.drag().relaxationTime
(
Urel(Up),
@ -218,10 +218,10 @@ void parcel::setRelaxationTimes
{
scalar Nusselt =
sDB.heatTransfer().Nu(Reynolds, Prandtl);
// calculating the boiling temperature of the liquid at ambient pressure
scalar tBoilingSurface = Td;
label Niter = 0;
scalar deltaT = 10.0;
scalar dp0 = fuels.properties()[i].pv(pressure, tBoilingSurface) - pressure;
@ -255,16 +255,16 @@ void parcel::setRelaxationTimes
}
dp0 = dp;
}
scalar vapourSurfaceEnthalpy = 0.0;
scalar vapourFarEnthalpy = 0.0;
for(label k = 0; k < sDB.gasProperties().size(); k++)
{
vapourSurfaceEnthalpy += sDB.composition().Y()[k][celli]*sDB.gasProperties()[k].H(tBoilingSurface);
vapourFarEnthalpy += sDB.composition().Y()[k][celli]*sDB.gasProperties()[k].H(temperature);
}
scalar kLiquid = fuels.properties()[i].K(pressure, 0.5*(tBoilingSurface+T()));
tauBoiling[i] = sDB.evaporation().boilingTime

View File

@ -36,7 +36,7 @@ License
#include "injectorModel.H"
#include "wallModel.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
#include "symmetryPolyPatch.H"
#include "wedgePolyPatch.H"
@ -56,8 +56,8 @@ Foam::spray::spray
const volScalarField& rho,
const volScalarField& p,
const volScalarField& T,
const combustionMixture& composition,
const PtrList<specieProperties>& gasProperties,
const basicMultiComponentMixture& composition,
const PtrList<gasThermoPhysics>& gasProperties,
const dictionary&,
const dictionary& environmentalProperties
)
@ -264,7 +264,7 @@ Foam::spray::spray
"spray::spray(const volVectorField& U, "
"const volScalarField& rho, const volScalarField& p, "
"const volScalarField& T, const combustionMixture& composition,"
"const PtrList<specieProperties>& gaseousFuelProperties, "
"const PtrList<gasThermoPhsyics>& gaseousFuelProperties, "
"const dictionary& thermophysicalProperties, "
"const dictionary& environmentalProperties)"
) << "spray::(...) only one wedgePolyPatch found. "

View File

@ -38,10 +38,10 @@ Description
#include "IOPtrList.H"
#include "interpolation.H"
#include "liquid.H"
#include "sprayThermoTypes.H"
#include "autoPtr.H"
#include "liquidMixture.H"
#include "Random.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,7 +58,7 @@ class injectorModel;
class heatTransferModel;
class wallModel;
class combustionMixture;
class basicMultiComponentMixture;
/*---------------------------------------------------------------------------*\
Class spray Declaration
@ -127,8 +127,8 @@ class spray
// Composition properties
const PtrList<specieProperties>& gasProperties_;
const combustionMixture& composition_;
const PtrList<gasThermoPhysics>& gasProperties_;
const basicMultiComponentMixture& composition_;
List<label> liquidToGasIndex_;
List<label> gasToLiquidIndex_;
@ -192,8 +192,8 @@ public:
const volScalarField& rho,
const volScalarField& p,
const volScalarField& T,
const combustionMixture& composition,
const PtrList<specieProperties>& gasProperties,
const basicMultiComponentMixture& composition,
const PtrList<gasThermoPhysics>& gasProperties,
const dictionary& thermophysicalProperties,
const dictionary& environmentalProperties
);
@ -257,8 +257,8 @@ public:
inline const vector& g() const;
inline const liquidMixture& fuels() const;
inline const PtrList<specieProperties>& gasProperties() const;
inline const combustionMixture& composition() const;
inline const PtrList<gasThermoPhysics>& gasProperties() const;
inline const basicMultiComponentMixture& composition() const;
inline const List<label>& liquidToGasIndex() const;
inline const List<label>& gasToLiquidIndex() const;

View File

@ -36,71 +36,85 @@ inline const Time& spray::runTime() const
return runTime_;
}
inline const fvMesh& spray::mesh() const
{
return mesh_;
}
inline const volVectorField& spray::U() const
{
return U_;
}
inline const volScalarField& spray::rho() const
{
return rho_;
}
inline const volScalarField& spray::p() const
{
return p_;
}
inline const volScalarField& spray::T() const
{
return T_;
}
inline PtrList<injector>& spray::injectors()
{
return injectors_;
}
inline const PtrList<injector>& spray::injectors() const
{
return injectors_;
}
inline const atomizationModel& spray::atomization() const
{
return atomization_;
}
inline const breakupModel& spray::breakup() const
{
return breakupModel_;
}
inline const collisionModel& spray::collisions() const
{
return collisionModel_;
}
inline const dispersionModel& spray::dispersion() const
{
return dispersionModel_;
}
inline const dragModel& spray::drag() const
{
return drag_;
}
inline const evaporationModel& spray::evaporation() const
{
return evaporation_;
}
inline const heatTransferModel& spray::heatTransfer() const
{
return heatTransfer_;
@ -112,11 +126,13 @@ inline const injectorModel& spray::injection() const
return injectorModel_;
}
inline const wallModel& spray::wall() const
{
return wall_;
}
inline tmp<volVectorField> spray::momentumSource() const
{
tmp<volVectorField> tsource
@ -146,6 +162,7 @@ inline tmp<volVectorField> spray::momentumSource() const
return tsource;
}
inline tmp<volScalarField> spray::evaporationSource(const label si) const
{
tmp<volScalarField> tsource
@ -179,6 +196,7 @@ inline tmp<volScalarField> spray::evaporationSource(const label si) const
return tsource;
}
inline tmp<volScalarField> spray::heatTransferSource() const
{
tmp<volScalarField> tsource
@ -209,6 +227,7 @@ inline Random& spray::rndGen()
return rndGen_;
}
inline label spray::subCycles() const
{
return subCycles_;
@ -226,81 +245,97 @@ inline const liquidMixture& spray::fuels() const
return fuels_;
}
inline const PtrList<specieProperties>& spray::gasProperties() const
inline const PtrList<gasThermoPhysics>& spray::gasProperties() const
{
return gasProperties_;
}
inline const combustionMixture& spray::composition() const
inline const basicMultiComponentMixture& spray::composition() const
{
return composition_;
}
inline const List<label>& spray::liquidToGasIndex() const
{
return liquidToGasIndex_;
}
inline const List<label>& spray::gasToLiquidIndex() const
{
return gasToLiquidIndex_;
}
inline const List<bool>& spray::isLiquidFuel() const
{
return isLiquidFuel_;
}
inline const bool& spray::twoD() const
{
return twoD_;
}
inline const vector& spray::axisOfSymmetry() const
{
return axisOfSymmetry_;
}
inline const vector& spray::axisOfWedge() const
{
return axisOfWedge_;
}
inline const vector& spray::axisOfWedgeNormal() const
{
return axisOfWedgeNormal_;
}
inline const scalar& spray::angleOfWedge() const
{
return angleOfWedge_;
}
inline const interpolation<vector>& spray::UInterpolator() const
{
return UInterpolator_;
}
inline const interpolation<scalar>& spray::rhoInterpolator() const
{
return rhoInterpolator_;
}
inline const interpolation<scalar>& spray::pInterpolator() const
{
return pInterpolator_;
}
inline const interpolation<scalar>& spray::TInterpolator() const
{
return TInterpolator_;
}
inline vectorField& spray::sms()
{
return sms_;
}
inline const vectorField& spray::sms() const
{
return sms_;
@ -312,6 +347,7 @@ inline scalarField& spray::shs()
return shs_;
}
inline const scalarField& spray::shs() const
{
return shs_;
@ -323,16 +359,19 @@ inline PtrList<scalarField>& spray::srhos()
return srhos_;
}
inline const PtrList<scalarField>& spray::srhos() const
{
return srhos_;
}
inline const scalar& spray::ambientPressure() const
{
return ambientPressure_;
}
inline const scalar& spray::ambientTemperature() const
{
return ambientTemperature_;

View File

@ -28,7 +28,7 @@ License
#include "LISA.H"
#include "addToRunTimeSelectionTable.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
#include "RosinRammler.H"
@ -84,7 +84,7 @@ void LISA::atomizeParcel
) const
{
const PtrList<volScalarField>& Y = spray_.composition().Y();
label Ns = Y.size();
@ -98,7 +98,7 @@ void LISA::atomizeParcel
{
Winv += Y[i][cellI]/spray_.gasProperties()[i].W();
}
scalar R = specie::RR*Winv;
// ideal gas law to evaluate density
@ -113,31 +113,31 @@ void LISA::atomizeParcel
scalar WeberNumber = p.We(vel, rhoAverage, sigma);
scalar tau = 0.0;
scalar dL = 0.0;
scalar dL = 0.0;
scalar k = 0.0;
scalar muFuel = fuels.mu(pressure, p.T(), p.X());
scalar rhoFuel = fuels.rho(1.0e+5, p.T(), p.X());
scalar nuFuel = muFuel/rhoFuel;
vector uDir = p.U()/mag(p.U());
scalar uGas = mag(vel & uDir);
vector Ug = uGas*uDir;
/*
/*
TL
It might be the relative velocity between Liquid and Gas, but I use the
absolute velocity of the parcel as suggested by the authors
absolute velocity of the parcel as suggested by the authors
*/
// scalar U = mag(p.Urel(vel));
scalar U = mag(p.U());
p.ct() += deltaT;
scalar Q = rhoAverage/rhoFuel;
const injectorType& it =
const injectorType& it =
spray_.injectors()[label(p.injector())].properties();
if (it.nHoles() > 1)
@ -150,38 +150,38 @@ void LISA::atomizeParcel
scalar pWalk = mag(p.position() - itPosition);
// Updating liquid sheet tickness... that is the droplet diameter
const vector direction = it.direction(0, spray_.runTime().value());
scalar h = (p.position() - itPosition) & direction;
scalar d = sqrt(sqr(pWalk)-sqr(h));
scalar time = pWalk/mag(p.U());
scalar elapsedTime = spray_.runTime().value();
scalar massFlow = it.massFlowRate(max(0.0,elapsedTime-time));
scalar hSheet = massFlow/(mathematicalConstant::pi*d*rhoFuel*mag(p.U()));
scalar hSheet = massFlow/(mathematicalConstant::pi*d*rhoFuel*mag(p.U()));
p.d() = min(hSheet,p.d());
if(WeberNumber > 27.0/16.0)
{
scalar kPos = 0.0;
scalar kNeg = Q*pow(U, 2.0)*rhoFuel/sigma;
scalar derivativePos = sqrt
(
Q*pow(U,2.0)
);
scalar derivativeNeg =
);
scalar derivativeNeg =
(
8.0*pow(nuFuel, 2.0)*pow(kNeg, 3.0)
+ Q*pow(U, 2.0)*kNeg
8.0*pow(nuFuel, 2.0)*pow(kNeg, 3.0)
+ Q*pow(U, 2.0)*kNeg
- 3.0*sigma/2.0/rhoFuel*pow(kNeg, 2.0)
)
/
@ -189,23 +189,23 @@ void LISA::atomizeParcel
(
4.0*pow(nuFuel, 2.0)*pow(kNeg, 4.0)
+ Q*pow(U, 2.0)*pow(kNeg, 2.0)
- sigma*pow(kNeg, 3.0)/rhoFuel
- sigma*pow(kNeg, 3.0)/rhoFuel
)
-
4.0*nuFuel*kNeg;
scalar kOld = 0.0;
scalar kOld = 0.0;
for(label i=0; i<40; i++)
{
k = kPos - (derivativePos/((derivativeNeg-derivativePos)/(kNeg-kPos)));
scalar derivativek =
scalar derivativek =
(
8.0*pow(nuFuel, 2.0)*pow(k, 3.0)
+ Q*pow(U, 2.0)*k
8.0*pow(nuFuel, 2.0)*pow(k, 3.0)
+ Q*pow(U, 2.0)*k
- 3.0*sigma/2.0/rhoFuel*pow(k, 2.0)
)
/
@ -213,10 +213,10 @@ void LISA::atomizeParcel
(
4.0*pow(nuFuel, 2.0)*pow(k, 4.0)
+ Q*pow(U, 2.0)*pow(k, 2.0)
- sigma*pow(k, 3.0)/rhoFuel
- sigma*pow(k, 3.0)/rhoFuel
)
-
4.0*nuFuel*k;
4.0*nuFuel*k;
if(derivativek > 0)
{
@ -228,17 +228,17 @@ void LISA::atomizeParcel
derivativeNeg = derivativek;
kNeg = k;
}
if(mag(k-kOld)/k < 1e-4)
{
break;
}
kOld = k;
}
scalar omegaS =
scalar omegaS =
- 2.0 * nuFuel * pow(k, 2.0)
+ sqrt
(
@ -246,22 +246,22 @@ void LISA::atomizeParcel
+ Q*pow(U, 2.0)*pow(k, 2.0)
- sigma*pow(k, 3.0)/rhoFuel
);
tau = cTau_/omegaS;
tau = cTau_/omegaS;
dL = sqrt(8.0*p.d()/k);
}
else
{
k =
k =
rhoAverage*pow(U, 2.0)
/
2.0*sigma;
scalar J = pWalk*p.d()/2.0;
tau = pow(3.0*cTau_,2.0/3.0)*cbrt(J*sigma/(sqr(Q)*pow(U,4.0)*rhoFuel));
dL = sqrt(4.0*p.d()/k);
@ -269,78 +269,78 @@ void LISA::atomizeParcel
scalar kL =
scalar kL =
1.0
/
(
dL *
dL *
pow(0.5 + 1.5 * muFuel/pow((rhoFuel*sigma*dL), 0.5), 0.5)
);
scalar dD = cbrt(3.0*mathematicalConstant::pi*pow(dL, 2.0)/kL);
scalar dD = cbrt(3.0*mathematicalConstant::pi*pow(dL, 2.0)/kL);
scalar lisaExp = 0.27;
scalar ambientPressure = 1.0e+5;
scalar pRatio = spray_.ambientPressure()/ambientPressure;
dD = dD*pow(pRatio,lisaExp);
// modifications to take account of the flash boiling on primary breakUp
scalar pExp = 0.135;
scalar chi = 0.0;
label Nf = fuels.components().size();
label Nf = fuels.components().size();
scalar Td = p.T();
for(label i = 0; i < Nf ; i++)
{
if(fuels.properties()[i].pv(spray_.ambientPressure(), Td) >= 0.999*spray_.ambientPressure())
{
// The fuel is boiling.....
// Calculation of the boiling temperature
// Calculation of the boiling temperature
scalar tBoilingSurface = Td;
label Niter = 200;
for(label k=0; k< Niter ; k++)
{
scalar pBoil = fuels.properties()[i].pv(pressure, tBoilingSurface);
if(pBoil > pressure)
{
tBoilingSurface = tBoilingSurface - (Td-temperature)/Niter;
tBoilingSurface = tBoilingSurface - (Td-temperature)/Niter;
}
else
{
break;
}
}
scalar hl = fuels.properties()[i].hl(spray_.ambientPressure(), tBoilingSurface);
scalar iTp = fuels.properties()[i].h(spray_.ambientPressure(), Td) - spray_.ambientPressure()/fuels.properties()[i].rho(spray_.ambientPressure(), Td);
scalar iTb = fuels.properties()[i].h(spray_.ambientPressure(), tBoilingSurface) - spray_.ambientPressure()/fuels.properties()[i].rho(spray_.ambientPressure(), tBoilingSurface);
chi += p.X()[i]*(iTp-iTb)/hl;
}
}
}
// bounding chi
chi = max(chi, 0.0);
chi = min(chi, 1.0);
// modifing dD to take account of flash boiling
dD = dD*(1.0 - chi*pow(pRatio, -pExp));
scalar lBU = Cl_ * mag(p.U())*tau;
if(pWalk > lBU)
@ -349,7 +349,7 @@ void LISA::atomizeParcel
p.liquidCore() = 0.0;
// calculate the new diameter with a Rosin Rammler distribution
scalar minValue = min(p.d(),dD/10.0);
scalar maxValue = dD;
@ -357,30 +357,30 @@ void LISA::atomizeParcel
if(maxValue - minValue < SMALL)
{
minValue = p.d()/10.0;
}
}
scalar range = maxValue - minValue;
scalar y = 0;
scalar x = 0;
bool success = false;
while(!success)
{
x = minValue + range*rndGen_.scalar01();
y = rndGen_.scalar01();
scalar p = 0.0;
scalar nExp = 1;
scalar xx = pow(x/dD, nExp);
p = xx*exp(-xx);
if (y<p)
if (y<p)
{
success = true;
}
@ -388,13 +388,13 @@ void LISA::atomizeParcel
}
// New droplet diameter
p.d() = x;
p.ct() = 0.0;
}
}
}

View File

@ -28,7 +28,7 @@ License
#include "blobsSheetAtomization.H"
#include "addToRunTimeSelectionTable.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
#include "RosinRammler.H"

View File

@ -28,7 +28,7 @@ License
#include "noAtomization.H"
#include "addToRunTimeSelectionTable.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,7 +28,7 @@ License
#include "reitzDiwakar.H"
#include "addToRunTimeSelectionTable.H"
#include "combustionMixture.H"
#include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -34,9 +34,6 @@ License
template<class ParcelType>
Foam::scalar Foam::DsmcCloud<ParcelType>::kb = 1.380650277e-23;
template<class ParcelType>
Foam::scalar Foam::DsmcCloud<ParcelType>::Tref = 273;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -172,9 +172,6 @@ public:
//- Boltzmann constant
static scalar kb;
//- Reference temperature for all models
static scalar Tref;
// Constructors

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -97,6 +97,7 @@ Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::LarsenBorgnakkeVariableHardS
)
:
BinaryCollisionModel<CloudType>(dict, cloud, typeName),
Tref_(readScalar(this->coeffDict().lookup("Tref"))),
relaxationCollisionNumber_
(
readScalar(this->coeffDict().lookup("relaxationCollisionNumber"))
@ -156,7 +157,7 @@ Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::sigmaTcR
// calculating cross section = pi*dPQ^2, where dPQ is from Bird, eq. 4.79
scalar sigmaTPQ =
mathematicalConstant::pi*dPQ*dPQ
*pow(2.0*CloudType::kb*CloudType::Tref/(mR*cR*cR), omegaPQ - 0.5)
*pow(2.0*CloudType::kb*Tref_/(mR*cR*cR), omegaPQ - 0.5)
/exp(Foam::lgamma(2.5 - omegaPQ));
return sigmaTPQ*cR;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,6 +50,9 @@ class LarsenBorgnakkeVariableHardSphere
{
// Private data
//- Reference temperature
const scalar Tref_;
//- Relaxation collision number
const scalar relaxationCollisionNumber_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,7 +35,8 @@ Foam::VariableHardSphere<CloudType>::VariableHardSphere
CloudType& cloud
)
:
BinaryCollisionModel<CloudType>(dict, cloud, typeName)
BinaryCollisionModel<CloudType>(dict, cloud, typeName),
Tref_(readScalar(this->coeffDict().lookup("Tref")))
{}
@ -90,7 +91,7 @@ Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
// calculating cross section = pi*dPQ^2, where dPQ is from Bird, eq. 4.79
scalar sigmaTPQ =
mathematicalConstant::pi*dPQ*dPQ
*pow(2.0*CloudType::kb*CloudType::Tref/(mR*cR*cR), omegaPQ - 0.5)
*pow(2.0*CloudType::kb*Tref_/(mR*cR*cR), omegaPQ - 0.5)
/exp(Foam::lgamma(2.5 - omegaPQ));
return sigmaTPQ*cR;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -47,6 +47,12 @@ class VariableHardSphere
:
public BinaryCollisionModel<CloudType>
{
// Private data
//- Reference temperature
const scalar Tref_;
public:
//- Runtime type information

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 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) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -23,7 +23,6 @@ $(DERIVEDCLOUDS)/basicKinematicCloud/basicKinematicCloud.C
$(DERIVEDCLOUDS)/basicThermoCloud/basicThermoCloud.C
$(DERIVEDCLOUDS)/BasicReactingCloud/defineBasicReactingCloud.C
$(DERIVEDCLOUDS)/BasicReactingMultiphaseCloud/defineBasicReactingMultiphaseCloud.C
$(DERIVEDCLOUDS)/BasicTrackedReactingCloud/defineBasicTrackedReactingCloud.C
/* kinematic parcel sub-models */
@ -46,12 +45,6 @@ $(REACTINGPARCEL)/defineBasicReactingParcel.C
$(REACTINGPARCEL)/makeBasicReactingParcelSubmodels.C
/* tracked reacting parcel sub-models */
TRACKEDREACTINGPARCEL=$(DERIVEDPARCELS)/BasicTrackedReactingParcel
$(TRACKEDREACTINGPARCEL)/defineTrackedReactingParcel.C
$(TRACKEDREACTINGPARCEL)/makeBasicTrackedReactingParcelSubmodels.C
/* reacting multiphase parcel sub-models */
REACTINGMPPARCEL=$(DERIVEDPARCELS)/BasicReactingMultiphaseParcel
$(REACTINGMPPARCEL)/defineBasicReactingMultiphaseParcel.C

View File

@ -9,7 +9,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
@ -28,6 +28,6 @@ LIB_LIBS = \
-lsolidMixture \
-lspecie \
-lbasicThermophysicalModels \
-lcombustionThermophysicalModels \
-lreactionThermophysicalModels \
-lcompressibleRASModels \
-lcompressibleLESModels

View File

@ -151,18 +151,18 @@ Foam::KinematicCloud<ParcelType>::~KinematicCloud()
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
if (!fullyDescribed)
{
pPtr->rho() = constProps_.rho0();
parcel.rho() = constProps_.rho0();
}
scalar carrierDt = this->db().time().deltaT().value();
pPtr->stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
}

View File

@ -357,7 +357,7 @@ public:
//- Check parcel properties
void checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);

View File

@ -28,7 +28,6 @@ License
#include "CompositionModel.H"
#include "PhaseChangeModel.H"
#include "multiComponentMixture.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
@ -68,14 +67,16 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
)
:
ThermoCloud<ParcelType>(cloudName, rho, U, g, thermo),
reactingCloud(),
constProps_(this->particleProperties()),
carrierThermo_(thermo),
carrierSpecies_(thermo.composition().Y().size()),
mcCarrierThermo_
(
dynamic_cast<multiComponentMixture<thermoType>&>(thermo)
),
compositionModel_
(
CompositionModel<ReactingCloud<ParcelType> >::New
@ -92,23 +93,9 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
*this
)
),
rhoTrans_(thermo.composition().Y().size()),
rhoTrans_(mcCarrierThermo_.species().size()),
dMassPhaseChange_(0.0)
{
// Create the carrier species
forAll(carrierSpecies_, specieI)
{
carrierSpecies_.set
(
specieI,
new thermoType
(
dynamic_cast<const multiComponentMixture<thermoType>&>
(thermo).speciesData()[specieI]
)
);
}
// Set storage for mass source fields and initialise to zero
forAll(rhoTrans_, i)
{
@ -119,9 +106,7 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
(
IOobject
(
this->name()
+ "rhoTrans_"
+ thermo.composition().Y()[i].name(),
this->name() + "rhoTrans_" + mcCarrierThermo_.species()[i],
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
@ -148,34 +133,34 @@ Foam::ReactingCloud<ParcelType>::~ReactingCloud()
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
ThermoCloud<ParcelType>::checkParcelProperties
(
pPtr,
parcel,
lagrangianDt,
fullyDescribed
);
if (!fullyDescribed)
{
pPtr->Y() = composition().YMixture0();
parcel.Y() = composition().YMixture0();
}
else
{
checkSuppliedComposition
(
pPtr->Y(),
parcel.Y(),
composition().YMixture0(),
"YMixture"
);
}
// derived information - store initial mass
pPtr->mass0() = pPtr->mass();
parcel.mass0() = parcel.mass();
}
@ -193,9 +178,9 @@ void Foam::ReactingCloud<ParcelType>::resetSourceTerms()
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::evolve()
{
const volScalarField& T = carrierThermo_.T();
const volScalarField cp = carrierThermo_.Cp();
const volScalarField& p = carrierThermo_.p();
const volScalarField& T = this->carrierThermo().T();
const volScalarField cp = this->carrierThermo().Cp();
const volScalarField& p = this->carrierThermo().p();
autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
(

View File

@ -41,11 +41,9 @@ SourceFiles
#ifndef ReactingCloud_H
#define ReactingCloud_H
#include "autoPtr.H"
#include "hCombustionThermo.H"
#include "ThermoCloud.H"
#include "reactingCloud.H"
#include "multiComponentMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -94,11 +92,8 @@ protected:
//- Parcel constant properties
typename ParcelType::constantProperties constProps_;
//- Thermodynamics package (combustion)
hCombustionThermo& carrierThermo_;
//- Gas phase properties
PtrList<thermoType> carrierSpecies_;
//- Multi-component carrier phase thermo
multiComponentMixture<thermoType>& mcCarrierThermo_;
// References to the cloud sub-models
@ -148,7 +143,7 @@ public:
const volScalarField& rho,
const volVectorField& U,
const dimensionedVector& g,
hCombustionThermo& thermo
basicThermo& thermo
);
@ -168,14 +163,12 @@ public:
inline const typename ParcelType::constantProperties&
constProps() const;
//- Return const access to carrier phase thermo package
inline const hCombustionThermo& carrierThermo() const;
//- Return const access to multi-component carrier phase thermo
inline const multiComponentMixture<thermoType>&
mcCarrierThermo() const;
//- Return access to carrier phase thermo package
inline hCombustionThermo& carrierThermo();
//- Gas phase properties
inline const PtrList<thermoType>& carrierSpecies() const;
//- Return access to multi-component carrier phase thermo
inline multiComponentMixture<thermoType>& mcCarrierThermo();
// Sub-models
@ -224,7 +217,7 @@ public:
//- Check parcel properties
void checkParcelProperties
(
ParcelType* pPtr,
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);

View File

@ -35,26 +35,18 @@ Foam::ReactingCloud<ParcelType>::constProps() const
template<class ParcelType>
inline const Foam::hCombustionThermo&
Foam::ReactingCloud<ParcelType>::carrierThermo() const
inline const Foam::multiComponentMixture<typename ParcelType::thermoType>&
Foam::ReactingCloud<ParcelType>::mcCarrierThermo() const
{
return carrierThermo_;
return mcCarrierThermo_;
}
template<class ParcelType>
inline Foam::hCombustionThermo&
Foam::ReactingCloud<ParcelType>::carrierThermo()
inline Foam::multiComponentMixture<typename ParcelType::thermoType>&
Foam::ReactingCloud<ParcelType>::mcCarrierThermo()
{
return carrierThermo_;
}
template<class ParcelType>
inline const Foam::PtrList<typename ParcelType::thermoType>&
Foam::ReactingCloud<ParcelType>::carrierSpecies() const
{
return carrierSpecies_;
return mcCarrierThermo_;
}

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