git pushMerge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
laurence
2013-06-11 14:30:48 +01:00
47 changed files with 1182 additions and 184 deletions

View File

@ -677,6 +677,7 @@ template<class Type>
template<class Form, class Cmpt, int nCmpt>
void Foam::Field<Type>::operator=(const VectorSpace<Form,Cmpt,nCmpt>& vs)
{
typedef VectorSpace<Form,Cmpt,nCmpt> VSType;
TFOR_ALL_F_OP_S(Type, *this, =, VSType, vs)
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,6 +27,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "scalarField.H"
#include "unitConversion.H"
#define TEMPLATE
#include "FieldFunctionsM.C"
@ -155,6 +156,11 @@ UNARY_FUNCTION(scalar, scalar, j1)
UNARY_FUNCTION(scalar, scalar, y0)
UNARY_FUNCTION(scalar, scalar, y1)
UNARY_FUNCTION(scalar, scalar, degToRad)
UNARY_FUNCTION(scalar, scalar, radToDeg)
UNARY_FUNCTION(scalar, scalar, atmToPa)
UNARY_FUNCTION(scalar, scalar, paToAtm)
#define BesselFunc(func) \
void func(scalarField& res, const int n, const UList<scalar>& sf) \

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -130,6 +130,10 @@ UNARY_FUNCTION(scalar, scalar, j1)
UNARY_FUNCTION(scalar, scalar, y0)
UNARY_FUNCTION(scalar, scalar, y1)
UNARY_FUNCTION(scalar, scalar, degToRad)
UNARY_FUNCTION(scalar, scalar, radToDeg)
UNARY_FUNCTION(scalar, scalar, atmToPa)
UNARY_FUNCTION(scalar, scalar, paToAtm)
#define BesselFunc(func) \
void func(scalarField& Res, const int n, const UList<scalar>& sf); \

View File

@ -63,16 +63,6 @@ public:
const vectorField& cellCtrs
);
// static tmp<scalarField> faceOrthogonality(const polyMesh& mesh)
// {
// return faceOrthogonality
// (
// mesh,
// mesh.faceAreas(),
// mesh.cellCentres()
// );
// }
//- Generate skewness field
static tmp<scalarField> faceSkewness
(
@ -83,18 +73,6 @@ public:
const vectorField& cellCtrs
);
// static tmp<scalarField> faceSkewness(const polyMesh& mesh)
// {
// return faceSkewness
// (
// mesh,
// mesh.points(),
// mesh.faceCentres(),
// mesh.faceAreas(),
// mesh.cellCentres()
// );
// }
//- Generate interpolation factors field
static tmp<scalarField> faceWeights
(

View File

@ -88,7 +88,17 @@ Foam::porosityModel::porosityModel
const word& cellZoneName
)
:
MeshObject<fvMesh, Foam::UpdateableMeshObject, porosityModel>(mesh),
regIOobject
(
IOobject
(
name,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
)
),
name_(name),
mesh_(mesh),
dict_(dict),

View File

@ -36,7 +36,6 @@ SourceFiles
#ifndef porosityModel_H
#define porosityModel_H
#include "MeshObject.H"
#include "fvMesh.H"
#include "dictionary.H"
#include "fvMatricesFwd.H"
@ -56,7 +55,7 @@ namespace Foam
class porosityModel
:
public MeshObject<fvMesh, UpdateableMeshObject, porosityModel>
public regIOobject
{
private:

View File

@ -109,8 +109,6 @@ Foam::treeDataEdge::findIntersectOp::findIntersectOp
(
const indexedOctree<treeDataEdge>& tree
)
:
tree_(tree)
{}

View File

@ -121,8 +121,6 @@ public:
class findIntersectOp
{
const indexedOctree<treeDataEdge>& tree_;
public:
findIntersectOp(const indexedOctree<treeDataEdge>& tree);

View File

@ -70,8 +70,6 @@ Foam::treeDataPoint::findIntersectOp::findIntersectOp
(
const indexedOctree<treeDataPoint>& tree
)
:
tree_(tree)
{}

View File

@ -104,8 +104,6 @@ public:
class findIntersectOp
{
const indexedOctree<treeDataPoint>& tree_;
public:
findIntersectOp(const indexedOctree<treeDataPoint>& tree);

View File

@ -66,76 +66,6 @@ void Foam::treeDataPrimitivePatch<PatchType>::update()
}
template<class PatchType>
bool Foam::treeDataPrimitivePatch<PatchType>::findIntersection
(
const indexedOctree<treeDataPrimitivePatch<PatchType> >& tree,
const label index,
const point& start,
const point& end,
point& intersectionPoint
)
{
const treeDataPrimitivePatch<PatchType>& shape = tree.shapes();
const PatchType& patch = shape.patch();
const pointField& points = patch.points();
const typename PatchType::FaceType& f = patch[index];
// Do quick rejection test
if (shape.cacheBb_)
{
const treeBoundBox& faceBb = shape.bbs_[index];
if ((faceBb.posBits(start) & faceBb.posBits(end)) != 0)
{
// start and end in same block outside of faceBb.
return false;
}
}
const vector dir(end - start);
pointHit inter;
if (f.size() == 3)
{
inter = triPointRef
(
points[f[0]],
points[f[1]],
points[f[2]]
).intersection(start, dir, intersection::HALF_RAY, shape.planarTol_);
}
else
{
const pointField& faceCentres = patch.faceCentres();
inter = f.intersection
(
start,
dir,
faceCentres[index],
points,
intersection::HALF_RAY,
shape.planarTol_
);
}
if (inter.hit() && inter.distance() <= 1)
{
// Note: no extra test on whether intersection is in front of us
// since using half_ray
intersectionPoint = inter.hitPoint();
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
@ -187,6 +117,19 @@ Foam::treeDataPrimitivePatch<PatchType>::findAllIntersectOp::findAllIntersectOp
{}
template<class PatchType>
Foam::treeDataPrimitivePatch<PatchType>::
findSelfIntersectOp::findSelfIntersectOp
(
const indexedOctree<treeDataPrimitivePatch<PatchType> >& tree,
const label edgeID
)
:
tree_(tree),
edgeID_(edgeID)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class PatchType>
@ -645,4 +588,116 @@ bool Foam::treeDataPrimitivePatch<PatchType>::findAllIntersectOp::operator()
}
template<class PatchType>
bool Foam::treeDataPrimitivePatch<PatchType>::findSelfIntersectOp::operator()
(
const label index,
const point& start,
const point& end,
point& intersectionPoint
) const
{
if (edgeID_ == -1)
{
FatalErrorIn
(
"findSelfIntersectOp::operator()\n"
"(\n"
" const label index,\n"
" const point& start,\n"
" const point& end,\n"
" point& intersectionPoint\n"
") const"
) << "EdgeID not set. Please set edgeID to the index of"
<< " the edge you are testing"
<< exit(FatalError);
}
const treeDataPrimitivePatch<PatchType>& shape = tree_.shapes();
const PatchType& patch = shape.patch();
const typename PatchType::FaceType& f = patch.localFaces()[index];
const edge& e = patch.edges()[edgeID_];
if (findIndex(f, e[0]) == -1 && findIndex(f, e[1]) == -1)
{
return findIntersection(tree_, index, start, end, intersectionPoint);
}
else
{
return false;
}
}
template<class PatchType>
bool Foam::treeDataPrimitivePatch<PatchType>::findIntersection
(
const indexedOctree<treeDataPrimitivePatch<PatchType> >& tree,
const label index,
const point& start,
const point& end,
point& intersectionPoint
)
{
const treeDataPrimitivePatch<PatchType>& shape = tree.shapes();
const PatchType& patch = shape.patch();
const pointField& points = patch.points();
const typename PatchType::FaceType& f = patch[index];
// Do quick rejection test
if (shape.cacheBb_)
{
const treeBoundBox& faceBb = shape.bbs_[index];
if ((faceBb.posBits(start) & faceBb.posBits(end)) != 0)
{
// start and end in same block outside of faceBb.
return false;
}
}
const vector dir(end - start);
pointHit inter;
if (f.size() == 3)
{
inter = triPointRef
(
points[f[0]],
points[f[1]],
points[f[2]]
).intersection(start, dir, intersection::HALF_RAY, shape.planarTol_);
}
else
{
const pointField& faceCentres = patch.faceCentres();
inter = f.intersection
(
start,
dir,
faceCentres[index],
points,
intersection::HALF_RAY,
shape.planarTol_
);
}
if (inter.hit() && inter.distance() <= 1)
{
// Note: no extra test on whether intersection is in front of us
// since using half_ray
intersectionPoint = inter.hitPoint();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -86,16 +86,6 @@ class treeDataPrimitivePatch
//- Initialise all member data
void update();
//- Find intersection of line with shapes
static bool findIntersection
(
const indexedOctree<treeDataPrimitivePatch<PatchType> >& tree,
const label index,
const point& start,
const point& end,
point& intersectionPoint
);
public:
@ -141,8 +131,8 @@ public:
findIntersectOp(const indexedOctree<treeDataPrimitivePatch>& tree);
//- Calculate intersection of triangle with ray. Sets result
// accordingly
//- Calculate intersection of any face with ray. Sets result
// accordingly. Used to find first intersection.
bool operator()
(
const label index,
@ -167,8 +157,34 @@ public:
DynamicList<label>& shapeMask
);
//- Calculate intersection of triangle with ray. Sets result
// accordingly
//- Calculate intersection of unique face with ray. Sets result
// accordingly. Used to find all faces.
bool operator()
(
const label index,
const point& start,
const point& end,
point& intersectionPoint
) const;
};
class findSelfIntersectOp
{
const indexedOctree<treeDataPrimitivePatch>& tree_;
const label edgeID_;
public:
findSelfIntersectOp
(
const indexedOctree<treeDataPrimitivePatch>& tree,
const label edgeID
);
//- Calculate intersection of face with edge of patch. Excludes
// faces that use edgeID. Used to find self intersection.
bool operator()
(
const label index,
@ -234,6 +250,16 @@ public:
const point& centre,
const scalar radiusSqr
) const;
//- Helper: find intersection of line with shapes
static bool findIntersection
(
const indexedOctree<treeDataPrimitivePatch<PatchType> >& tree,
const label index,
const point& start,
const point& end,
point& intersectionPoint
);
};

View File

@ -74,6 +74,26 @@ const Foam::NamedEnum<Foam::distributedTriSurfaceMesh::distributionType, 3>
// Read my additional data from the dictionary
bool Foam::distributedTriSurfaceMesh::read()
{
if
(
Pstream::parRun()
&&
(
regIOobject::fileModificationChecking == timeStampMaster
|| regIOobject::fileModificationChecking == inotifyMaster
)
)
{
FatalErrorIn("Foam::distributedTriSurfaceMesh::read()")
<< " distributedTriSurfaceMesh is being constructed\n"
<< " using 'timeStampMaster' or 'inotifyMaster.'\n"
<< " Modify the entry fileModificationChecking\n"
<< " in the etc/controlDict.\n"
<< " Use 'timeStamp' instead."
<< exit(FatalError);
}
// Get bb of all domains.
procBb_.setSize(Pstream::nProcs());
@ -183,10 +203,6 @@ void Foam::distributedTriSurfaceMesh::distributeSegment
List<DynamicList<label> >& sendMap
) const
{
// Work points
point clipPt;
// 1. Fully local already handled outside. Note: retest is cheap.
if (isLocal(procBb_[Pstream::myProcNo()], start, end))
{
@ -227,6 +243,9 @@ void Foam::distributedTriSurfaceMesh::distributeSegment
// Scheme a: any processor that intersects the segment gets
// the segment.
// Intersection point
point clipPt;
if (bb.intersects(start, end, clipPt))
{
sendMap[procI].append(allSegments.size());

View File

@ -61,6 +61,7 @@ void Foam::codedFunctionObject::prepare
dynCode.setFilterVariable("codeExecute", codeExecute_);
dynCode.setFilterVariable("codeEnd", codeEnd_);
dynCode.setFilterVariable("codeData", codeData_);
dynCode.setFilterVariable("codeTimeSet", codeTimeSet_);
//dynCode.setFilterVariable("codeWrite", codeWrite_);
// compile filtered C template
@ -187,7 +188,8 @@ bool Foam::codedFunctionObject::end()
bool Foam::codedFunctionObject::timeSet()
{
return false;
updateLibrary(redirectType_);
return redirectFunctionObject().timeSet();
}
@ -267,6 +269,24 @@ bool Foam::codedFunctionObject::read(const dictionary& dict)
);
}
const entry* timeSetPtr = dict.lookupEntryPtr
(
"codeTimeSet",
false,
false
);
if (timeSetPtr)
{
codeTimeSet_ = stringOps::trim(timeSetPtr->stream());
stringOps::inplaceExpand(codeTimeSet_, dict);
dynamicCodeContext::addLineDirective
(
codeTimeSet_,
timeSetPtr->startLineNumber(),
dict.name()
);
}
updateLibrary(redirectType_);
return redirectFunctionObject().read(dict);
}

View File

@ -31,6 +31,39 @@ Description
This function object provides a general interface to enable dynamic code
compilation.
The entries are
code : c++; upon functionObject::write()
codeInclude : include files
codeOptions : include paths; inserted into EXE_INC in Make/options
codeLibs : link line; inserted into LIB_LIBS in Make/options
codeExecute : c++;upon functionObject::execute();
codeRead : c++; upon functionObject::read();
codeEnd : c++; upon functionObject::end();
codeData : c++; local member data (null constructed);
codeTimeSet : c++; upon functionObject::timeSet();
localCode : c++; local static functions
Example of function object specification:
\verbatim
difference
{
functionObjectLibs ("libutilityFunctionObjects.so");
type coded;
// Name of on-the-fly generated functionObject
redirectType writeMagU;
code
#{
// Lookup U
const volVectorField& U = mesh().lookupObject<volVectorField>("U");
// Write
mag(U).write();
}
}
\endverbatim
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
@ -77,6 +110,7 @@ protected:
string codeRead_;
string codeExecute_;
string codeEnd_;
string codeTimeSet_;
//- Underlying functionObject
mutable autoPtr<functionObject> redirectFunctionObjectPtr_;

View File

@ -76,7 +76,7 @@ tmp<volVectorField> laminar::Us() const
(
IOobject
(
typeName + ".Us",
typeName + ":Us",
owner_.regionMesh().time().timeName(),
owner_.regionMesh(),
IOobject::NO_READ,
@ -104,7 +104,7 @@ tmp<volScalarField> laminar::mut() const
(
IOobject
(
typeName + ".mut",
typeName + ":mut",
owner_.regionMesh().time().timeName(),
owner_.regionMesh(),
IOobject::NO_READ,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,8 +26,6 @@ License
#include "standardPhaseChange.H"
#include "addToRunTimeSelectionTable.H"
#include "thermoSingleLayer.H"
#include "specie.H"
#include "heatTransferModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -294,10 +294,20 @@ tmp<fvScalarMatrix> thermoSingleLayer::q(volScalarField& hs) const
{
dimensionedScalar Tstd("Tstd", dimTemperature, 298.15);
volScalarField htcst = htcs_->h()();
volScalarField htcwt = htcw_->h()();
forAll(alpha_, i)
{
htcst[i] *= max(alpha_[i], ROOTVSMALL);
htcwt[i] *= max(alpha_[i], ROOTVSMALL);
}
htcst.correctBoundaryConditions();
htcwt.correctBoundaryConditions();
return
(
- fvm::Sp(htcs_->h()/Cp_, hs) - htcs_->h()*(Tstd - TPrimary_)
- fvm::Sp(htcw_->h()/Cp_, hs) - htcw_->h()*(Tstd - Tw_)
- fvm::Sp(htcst/Cp_, hs) - htcst*(Tstd - TPrimary_)
- fvm::Sp(htcwt/Cp_, hs) -htcwt*(Tstd - Tw_)
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,13 +35,17 @@ Description
#include "specie.H"
#include "rhoConst.H"
#include "hConstThermo.H"
#include "hPolynomialThermo.H"
#include "hExponentialThermo.H"
#include "constIsoSolidTransport.H"
#include "constAnIsoSolidTransport.H"
#include "exponentialSolidTransport.H"
#include "polynomialSolidTransport.H"
#include "sensibleEnthalpy.H"
#include "thermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -57,8 +61,7 @@ namespace Foam
>,
sensibleEnthalpy
>
>
hConstSolidThermoPhysics;
> hConstSolidThermoPhysics;
typedef
exponentialSolidTransport
@ -71,8 +74,23 @@ namespace Foam
>,
sensibleEnthalpy
>
>
hExponentialSolidThermoPhysics;
> hExponentialSolidThermoPhysics;
typedef
polynomialSolidTransport
<
species::thermo
<
hPolynomialThermo
<
rhoConst<specie>,
8
>,
sensibleEnthalpy
>,
8
> hTransportThermoPoly8SolidThermoPhysics;
}

View File

@ -0,0 +1,110 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "polynomialSolidTransport.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Thermo, int PolySize>
Foam::polynomialSolidTransport<Thermo, PolySize>::polynomialSolidTransport
(
Istream& is
)
:
Thermo(is),
kappaCoeffs_("kappaCoeffs<" + Foam::name(PolySize) + '>', is)
{
}
template<class Thermo, int PolySize>
Foam::polynomialSolidTransport<Thermo, PolySize>::polynomialSolidTransport
(
const dictionary& dict
)
:
Thermo(dict),
kappaCoeffs_
(
dict.subDict("transport").lookup
(
"kappaCoeffs<" + Foam::name(PolySize) + '>'
)
)
{
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Thermo, int PolySize>
void Foam::polynomialSolidTransport<Thermo, PolySize>::write(Ostream& os) const
{
os << this->name() << endl;
os << token::BEGIN_BLOCK << incrIndent << nl;
Thermo::write(os);
dictionary dict("transport");
dict.add
(
word("kappaCoeffs<" + Foam::name(PolySize) + '>'),
kappaCoeffs_
);
os << indent << dict.dictName() << dict;
os << decrIndent << token::END_BLOCK << nl;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Thermo, int PolySize>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const polynomialSolidTransport<Thermo, PolySize>& pt
)
{
os << static_cast<const Thermo&>(pt) << tab
<< "kappaCoeffs<" << Foam::name(PolySize) << '>' << tab
<< pt.kappaCoeffs_;
os.check
(
"Ostream& operator<<"
"("
"Ostream&, "
"const polynomialSolidTransport<Thermo, PolySize>&"
")"
);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,237 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::polynomialSolidTransport
Description
Transport package using polynomial functions for solid kappa
SourceFiles
polynomialSolidTransportI.H
polynomialSolidTransport.C
\*---------------------------------------------------------------------------*/
#ifndef polynomialSolidTransport_H
#define polynomialSolidTransport_H
#include "Polynomial.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
template<class Thermo, int PolySize> class polynomialSolidTransport;
template<class Thermo, int PolySize>
inline polynomialSolidTransport<Thermo, PolySize> operator+
(
const polynomialSolidTransport<Thermo, PolySize>&,
const polynomialSolidTransport<Thermo, PolySize>&
);
template<class Thermo, int PolySize>
inline polynomialSolidTransport<Thermo, PolySize> operator-
(
const polynomialSolidTransport<Thermo, PolySize>&,
const polynomialSolidTransport<Thermo, PolySize>&
);
template<class Thermo, int PolySize>
inline polynomialSolidTransport<Thermo, PolySize> operator*
(
const scalar,
const polynomialSolidTransport<Thermo, PolySize>&
);
template<class Thermo, int PolySize>
inline polynomialSolidTransport<Thermo, PolySize> operator==
(
const polynomialSolidTransport<Thermo, PolySize>&,
const polynomialSolidTransport<Thermo, PolySize>&
);
template<class Thermo, int PolySize>
Ostream& operator<<
(
Ostream&,
const polynomialSolidTransport<Thermo, PolySize>&
);
/*---------------------------------------------------------------------------*\
Class polynomialSolidTransport Declaration
\*---------------------------------------------------------------------------*/
template<class Thermo, int PolySize=8>
class polynomialSolidTransport
:
public Thermo
{
// Private data
//- Thermal conductivity polynomial coefficients
// Note: input in [W/m/K]
Polynomial<PolySize> kappaCoeffs_;
// Private Member Functions
//- Construct from components
inline polynomialSolidTransport
(
const Thermo& t,
const Polynomial<PolySize>& kappaPoly
);
public:
// Constructors
//- Construct copy
inline polynomialSolidTransport(const polynomialSolidTransport&);
//- Construct as named copy
inline polynomialSolidTransport
(
const word&,
const polynomialSolidTransport&
);
//- Construct from Istream
polynomialSolidTransport(Istream& is);
//- Construct from dictionary
polynomialSolidTransport(const dictionary& dict);
//- Construct and return a clone
inline autoPtr<polynomialSolidTransport> clone() const;
// Selector from Istream
inline static autoPtr<polynomialSolidTransport> New(Istream& is);
// Selector from dictionary
inline static autoPtr<polynomialSolidTransport> New
(
const dictionary&dict
);
// Member functions
//- Return the instantiated type name
static word typeName()
{
return "polynomial<" + Thermo::typeName() + '>';
}
//- Is the thermal conductivity isotropic
static const bool isotropic = true;
//- Dynamic viscosity [kg/ms]
inline scalar mu(const scalar p, const scalar T) const;
//- Thermal conductivity [W/mK]
inline scalar kappa(const scalar p, const scalar T) const;
//- Thermal conductivity [W/mK]
inline vector Kappa(const scalar p, const scalar T) const;
//- Thermal diffusivity of enthalpy [kg/ms]
inline scalar alphah(const scalar p, const scalar T) const;
//- Write to Ostream
void write(Ostream& os) const;
// Member operators
inline polynomialSolidTransport& operator=
(
const polynomialSolidTransport&
);
inline void operator+=(const polynomialSolidTransport&);
inline void operator-=(const polynomialSolidTransport&);
inline void operator*=(const scalar);
// Friend operators
friend polynomialSolidTransport operator+ <Thermo, PolySize>
(
const polynomialSolidTransport&,
const polynomialSolidTransport&
);
friend polynomialSolidTransport operator- <Thermo, PolySize>
(
const polynomialSolidTransport&,
const polynomialSolidTransport&
);
friend polynomialSolidTransport operator* <Thermo, PolySize>
(
const scalar,
const polynomialSolidTransport&
);
friend polynomialSolidTransport operator== <Thermo, PolySize>
(
const polynomialSolidTransport&,
const polynomialSolidTransport&
);
// Ostream Operator
friend Ostream& operator<< <Thermo, PolySize>
(
Ostream&,
const polynomialSolidTransport&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "polynomialSolidTransportI.H"
#ifdef NoRepository
# include "polynomialSolidTransport.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,289 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "specie.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Thermo, int PolySize>
inline Foam::polynomialSolidTransport<Thermo, PolySize>::
polynomialSolidTransport
(
const polynomialSolidTransport& pt
)
:
Thermo(pt),
kappaCoeffs_(pt.kappaCoeffs_)
{}
template<class Thermo, int PolySize>
inline Foam::polynomialSolidTransport<Thermo, PolySize>::
polynomialSolidTransport
(
const Thermo& t,
const Polynomial<PolySize>& kappaCoeffs
)
:
Thermo(t),
kappaCoeffs_(kappaCoeffs)
{}
template<class Thermo, int PolySize>
inline Foam::polynomialSolidTransport<Thermo, PolySize>::
polynomialSolidTransport
(
const word& name,
const polynomialSolidTransport& pt
)
:
Thermo(name, pt),
kappaCoeffs_(pt.kappaCoeffs_)
{}
template<class Thermo, int PolySize>
inline Foam::autoPtr<Foam::polynomialSolidTransport<Thermo, PolySize> >
Foam::polynomialSolidTransport<Thermo, PolySize>::clone() const
{
return autoPtr<polynomialSolidTransport<Thermo, PolySize> >
(
new polynomialSolidTransport<Thermo, PolySize>(*this)
);
}
template<class Thermo, int PolySize>
inline Foam::autoPtr<Foam::polynomialSolidTransport<Thermo, PolySize> >
Foam::polynomialSolidTransport<Thermo, PolySize>::New(Istream& is)
{
return autoPtr<polynomialSolidTransport<Thermo, PolySize> >
(
new polynomialSolidTransport<Thermo, PolySize>(is)
);
}
template<class Thermo, int PolySize>
inline Foam::autoPtr<Foam::polynomialSolidTransport<Thermo, PolySize> >
Foam::polynomialSolidTransport<Thermo, PolySize>::New(const dictionary& dict)
{
return autoPtr<polynomialSolidTransport<Thermo, PolySize> >
(
new polynomialSolidTransport<Thermo, PolySize>(dict)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Thermo, int PolySize>
inline Foam::scalar Foam::polynomialSolidTransport<Thermo, PolySize>::mu
(
const scalar p,
const scalar T
) const
{
notImplemented
(
"Foam::scalar Foam::polynomialSolidTransport<thermo, PolySize>mu::"
"("
" const scalar p, const scalar T"
") const"
);
return scalar(0);
}
template<class Thermo, int PolySize>
inline Foam::scalar Foam::polynomialSolidTransport<Thermo, PolySize>::kappa
(
const scalar p,
const scalar T
) const
{
return kappaCoeffs_.value(T);
}
template<class Thermo, int PolySize>
inline Foam::vector Foam::polynomialSolidTransport<Thermo, PolySize>::Kappa
(
const scalar p,
const scalar T
) const
{
const scalar kappa(kappaCoeffs_.value(T));
return vector(kappa, kappa, kappa);
}
template<class Thermo, int PolySize>
inline Foam::scalar Foam::polynomialSolidTransport<Thermo, PolySize>::alphah
(
const scalar p, const scalar T
) const
{
return kappa(p, T)/this->Cpv(p, T);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Thermo, int PolySize>
inline Foam::polynomialSolidTransport<Thermo, PolySize>&
Foam::polynomialSolidTransport<Thermo, PolySize>::operator=
(
const polynomialSolidTransport<Thermo, PolySize>& pt
)
{
Thermo::operator=(pt);
kappaCoeffs_ = pt.kappaCoeffs_;
return *this;
}
template<class Thermo, int PolySize>
inline void Foam::polynomialSolidTransport<Thermo, PolySize>::operator+=
(
const polynomialSolidTransport<Thermo, PolySize>& pt
)
{
scalar molr1 = this->nMoles();
Thermo::operator+=(pt);
molr1 /= this->nMoles();
scalar molr2 = pt.nMoles()/this->nMoles();
kappaCoeffs_ = molr1*kappaCoeffs_ + molr2*pt.kappaCoeffs_;
}
template<class Thermo, int PolySize>
inline void Foam::polynomialSolidTransport<Thermo, PolySize>::operator-=
(
const polynomialSolidTransport<Thermo, PolySize>& pt
)
{
scalar molr1 = this->nMoles();
Thermo::operator-=(pt);
molr1 /= this->nMoles();
scalar molr2 = pt.nMoles()/this->nMoles();
kappaCoeffs_ = molr1*kappaCoeffs_ - molr2*pt.kappaCoeffs_;
}
template<class Thermo, int PolySize>
inline void Foam::polynomialSolidTransport<Thermo, PolySize>::operator*=
(
const scalar s
)
{
Thermo::operator*=(s);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class Thermo, int PolySize>
inline Foam::polynomialSolidTransport<Thermo, PolySize> Foam::operator+
(
const polynomialSolidTransport<Thermo, PolySize>& pt1,
const polynomialSolidTransport<Thermo, PolySize>& pt2
)
{
Thermo t
(
static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
);
scalar molr1 = pt1.nMoles()/t.nMoles();
scalar molr2 = pt2.nMoles()/t.nMoles();
return polynomialSolidTransport<Thermo, PolySize>
(
t,
molr1*pt1.kappaCoeffs_ + molr2*pt2.kappaCoeffs_
);
}
template<class Thermo, int PolySize>
inline Foam::polynomialSolidTransport<Thermo, PolySize> Foam::operator-
(
const polynomialSolidTransport<Thermo, PolySize>& pt1,
const polynomialSolidTransport<Thermo, PolySize>& pt2
)
{
Thermo t
(
static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
);
scalar molr1 = pt1.nMoles()/t.nMoles();
scalar molr2 = pt2.nMoles()/t.nMoles();
return polynomialSolidTransport<Thermo, PolySize>
(
t,
molr1*pt1.kappaCoeffs_ - molr2*pt2.kappaCoeffs_
);
}
template<class Thermo, int PolySize>
inline Foam::polynomialSolidTransport<Thermo, PolySize> Foam::operator*
(
const scalar s,
const polynomialSolidTransport<Thermo, PolySize>& pt
)
{
return polynomialSolidTransport<Thermo, PolySize>
(
s*static_cast<const Thermo&>(pt),
pt.kappaCoeffs_
);
}
template<class Thermo, int PolySize>
inline Foam::polynomialSolidTransport<Thermo, PolySize> Foam::operator==
(
const polynomialSolidTransport<Thermo, PolySize>& pt1,
const polynomialSolidTransport<Thermo, PolySize>& pt2
)
{
return pt2 - pt1;
}
// ************************************************************************* //

View File

@ -103,6 +103,58 @@ addToRunTimeSelectionTable \
);
#define makeSolidThermoPhysicsType(BaseThermo,Cthermo,Mixture,SolidPhysicsType)\
\
\
\
typedef \
heThermo \
< \
BaseThermo, \
Mixture<SolidPhysicsType> \
> heThermo##Mixture##SolidPhysicsType; \
\
typedef \
Cthermo \
< \
BaseThermo, \
Mixture<SolidPhysicsType> \
> Cthermo##Mixture##SolidPhysicsType; \
\
\
defineTemplateTypeNameAndDebugWithName \
( \
Cthermo##Mixture##SolidPhysicsType, \
( \
#Cthermo"<"#Mixture"<" \
+ SolidPhysicsType::typeName() \
+ ">>" \
).c_str(), \
0 \
); \
\
\
addToRunTimeSelectionTable \
( \
basicThermo, \
Cthermo##Mixture##SolidPhysicsType, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
BaseThermo, \
Cthermo##Mixture##SolidPhysicsType, \
fvMesh \
); \
\
addToRunTimeSelectionTable \
( \
BaseThermo, \
Cthermo##Mixture##SolidPhysicsType, \
dictionary \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,14 +31,17 @@ License
#include "rhoConst.H"
#include "hConstThermo.H"
#include "hExponentialThermo.H"
#include "hPolynomialThermo.H"
#include "constIsoSolidTransport.H"
#include "constAnIsoSolidTransport.H"
#include "exponentialSolidTransport.H"
#include "polynomialSolidTransport.H"
#include "pureMixture.H"
#include "sensibleEnthalpy.H"
#include "sensibleInternalEnergy.H"
#include "thermo.H"
#include "solidThermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -83,6 +86,14 @@ makeSolidThermo
specie
);
makeSolidThermoPhysicsType
(
solidThermo,
heSolidThermo,
pureMixture,
hTransportThermoPoly8SolidThermoPhysics
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -111,7 +111,7 @@ inline Foam::scalar Foam::constTransport<Thermo>::kappa
const scalar T
) const
{
return this->Cp(p, T)*mu(p, T)*rPr_;
return this->Cpv(p, T)*mu(p, T)*rPr_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -129,7 +129,7 @@ inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::alphah
const scalar p, const scalar T
) const
{
return kappa(p, T)/this->Cp(p, T);
return kappa(p, T)/this->Cpv(p, T);
}

View File

@ -158,7 +158,7 @@ inline Foam::scalar Foam::sutherlandTransport<Thermo>::alphah
) const
{
return kappa(p, T)/this->Cp(p, T);
return kappa(p, T)/this->Cpv(p, T);
}

View File

@ -80,7 +80,7 @@ public:
//- Construct null
inline deltaData();
//- Construct from origin, yStar, distance
//- Construct from delta value
inline deltaData(const scalar delta);

View File

@ -237,9 +237,9 @@ void epsilonWallFunctionFvPatchScalarField::calculate
scalar w = cornerWeights[faceI];
epsilon[cellI] = w*Cmu75*pow(k[cellI], 1.5)/(kappa_*y[faceI]);
epsilon[cellI] += w*Cmu75*pow(k[cellI], 1.5)/(kappa_*y[faceI]);
G[cellI] =
G[cellI] +=
w
*(mutw[faceI] + muw[faceI])
*magGradUw[faceI]
@ -464,6 +464,8 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs
FieldType& epsilon = const_cast<FieldType&>(dimensionedInternalField());
scalarField& epsilonf = *this;
// only set the values if the weights are < 1 - tolerance
forAll(weights, faceI)
{
@ -475,6 +477,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs
G[cellI] = w*G[cellI] + (1.0 - w)*G0[cellI];
epsilon[cellI] = w*epsilon[cellI] + (1.0 - w)*epsilon0[cellI];
epsilonf[faceI] = epsilon[cellI];
}
}

View File

@ -244,9 +244,9 @@ void omegaWallFunctionFvPatchScalarField::calculate
scalar omegaLog = sqrt(k[cellI])/(Cmu25*kappa_*y[faceI]);
omega[cellI] = w*sqrt(sqr(omegaVis) + sqr(omegaLog));
omega[cellI] += w*sqrt(sqr(omegaVis) + sqr(omegaLog));
G[cellI] =
G[cellI] +=
w
*(mutw[faceI] + muw[faceI])
*magGradUw[faceI]
@ -481,6 +481,8 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs
FieldType& omega = const_cast<FieldType&>(dimensionedInternalField());
scalarField& omegaf = *this;
// only set the values if the weights are < 1 - tolerance
forAll(weights, faceI)
{
@ -492,6 +494,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs
G[cellI] = w*G[cellI] + (1.0 - w)*G0[cellI];
omega[cellI] = w*omega[cellI] + (1.0 - w)*omega0[cellI];
omegaf[faceI] = omega[cellI];
}
}

View File

@ -464,6 +464,8 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs
FieldType& epsilon = const_cast<FieldType&>(dimensionedInternalField());
scalarField& epsilonf = *this;
// only set the values if the weights are < 1 - tolerance
forAll(weights, faceI)
{
@ -475,6 +477,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs
G[cellI] = w*G[cellI] + (1.0 - w)*G0[cellI];
epsilon[cellI] = w*epsilon[cellI] + (1.0 - w)*epsilon0[cellI];
epsilonf[faceI] = epsilon[cellI];
}
}

View File

@ -242,9 +242,9 @@ void omegaWallFunctionFvPatchScalarField::calculate
scalar omegaLog = sqrt(k[cellI])/(Cmu25*kappa_*y[faceI]);
omega[cellI] = w*sqrt(sqr(omegaVis) + sqr(omegaLog));
omega[cellI] += w*sqrt(sqr(omegaVis) + sqr(omegaLog));
G[cellI] =
G[cellI] +=
w
*(nutw[faceI] + nuw[faceI])
*magGradUw[faceI]
@ -479,6 +479,8 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs
FieldType& omega = const_cast<FieldType&>(dimensionedInternalField());
scalarField& omegaf = *this;
// only set the values if the weights are < 1 - tolerance
forAll(weights, faceI)
{
@ -490,6 +492,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs
G[cellI] = w*G[cellI] + (1.0 - w)*G0[cellI];
omega[cellI] = w*omega[cellI] + (1.0 - w)*omega0[cellI];
omegaf[faceI] = omega[cellI];
}
}