Merge remote branch 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2010-06-18 12:52:46 +02:00
282 changed files with 5138 additions and 2204 deletions

View File

@ -36,7 +36,8 @@ Foam::IOField<Type>::IOField(const IOobject& io)
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOField::IOField(const IOobject&)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
<< "IOField " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}
@ -65,7 +66,8 @@ Foam::IOField<Type>::IOField(const IOobject& io, const label size)
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOField::IOField(const IOobject&, const label)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
<< "IOField " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}
@ -98,7 +100,8 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Field<Type>& f)
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOField::IOField(const IOobject&, const Field<Type>&)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
<< "IOField " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}
@ -133,7 +136,8 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Xfer<Field<Type> >& f)
WarningIn
(
"IOField::IOField(const IOobject&, const Xfer<Field<Type> >&)"
) << "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
) << "IOField " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< endl;
}

View File

@ -36,8 +36,9 @@ Foam::IOList<T>::IOList(const IOobject& io)
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOList::IOList(const IOobject&)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< "IOList " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOList does not support automatic rereading."
<< endl;
}
if
@ -64,8 +65,9 @@ Foam::IOList<T>::IOList(const IOobject& io, const label size)
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOList::IOList(const IOobject&, const label)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< "IOList " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOList does not support automatic rereading."
<< endl;
}
if
@ -96,8 +98,9 @@ Foam::IOList<T>::IOList(const IOobject& io, const List<T>& list)
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOList::IOList(const IOobject&, const List<T>&)")
<< "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
<< "IOList " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOList does not support automatic rereading."
<< endl;
}
@ -131,8 +134,9 @@ Foam::IOList<T>::IOList(const IOobject& io, const Xfer<List<T> >& list)
WarningIn
(
"IOList::IOList(const IOobject&, const Xfer<List<T> >&)"
) << "IOField constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOField does not support automatic rereading."
) << "IOList " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOList does not support automatic rereading."
<< endl;
}

View File

@ -48,7 +48,8 @@ Foam::IOdictionary::IOdictionary(const IOobject& io)
{
WarningIn("IOdictionary::IOdictionary(const IOobject&)")
//FatalErrorIn("IOdictionary::IOdictionary(const IOobject&)")
<< "Dictionary constructed with IOobject::MUST_READ"
<< "Dictionary " << name()
<< " constructed with IOobject::MUST_READ"
" instead of IOobject::MUST_READ_IF_MODIFIED." << nl
<< "Use MUST_READ_IF_MODIFIED if you need automatic rereading."
<< endl;
@ -82,7 +83,8 @@ Foam::IOdictionary::IOdictionary(const IOobject& io, const dictionary& dict)
WarningIn
(
"IOdictionary::IOdictionary(const IOobject& const dictionary&)"
) << "Dictionary constructed with IOobject::MUST_READ"
) << "Dictionary " << name()
<< " constructed with IOobject::MUST_READ"
" instead of IOobject::MUST_READ_IF_MODIFIED." << nl
<< "Use MUST_READ_IF_MODIFIED if you need automatic rereading."
<< endl;

View File

@ -61,7 +61,21 @@ Foam::Istream& Foam::regIOobject::readStream()
}
else
{
// Search intelligently for file
objPath = filePath();
if (!objPath.size())
{
FatalIOError
(
"regIOobject::readStream()",
__FILE__,
__LINE__,
objectPath(),
0
) << "cannot find file"
<< exit(FatalIOError);
}
}
if (!(isPtr_ = objectStream(objPath)))

View File

@ -3,5 +3,6 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-lOpenFOAM \
-ltriSurface \
-lmeshTools

View File

@ -25,7 +25,7 @@ Class
Foam::interpolationCell
Description
Foam::interpolationCell
Uses the cell value for any point in the cell
\*---------------------------------------------------------------------------*/

View File

@ -87,7 +87,7 @@ public:
static int debug;
//- Tolerance used in calculating barycentric co-ordinates
// (applied to normailised values)
// (applied to normalised values)
static scalar tol;

View File

@ -25,7 +25,8 @@ Class
Foam::interpolationCellPoint
Description
Foam::interpolationCellPoint
Given cell centre values and point (vertex) values decompose into
tetrahedra and linear interpolate within them.
\*---------------------------------------------------------------------------*/

View File

@ -25,7 +25,8 @@ Class
Foam::volPointInterpolation
Description
Foam::volPointInterpolation
Interpolate from cell centres to points (vertices) using inverse distance
weighting
SourceFiles
volPointInterpolation.C

View File

@ -28,6 +28,7 @@ License
#include "WallInteractionModel.H"
#include "InflowBoundaryModel.H"
#include "constants.H"
#include "zeroGradientFvPatchFields.H"
using namespace Foam::constant;
@ -459,6 +460,8 @@ void Foam::DsmcCloud<ParcelType>::collisions()
reduce(collisionCandidates, sumOp<label>());
sigmaTcRMax_.correctBoundaryConditions();
if (collisionCandidates)
{
Info<< " Collisions = "
@ -550,6 +553,8 @@ void Foam::DsmcCloud<ParcelType>::calculateFields()
rhoM *= nParticle_/mesh().cellVolumes();
rhoM_.correctBoundaryConditions();
dsmcRhoN_.correctBoundaryConditions();
linearKE *= nParticle_/mesh().cellVolumes();
linearKE_.correctBoundaryConditions();
@ -851,7 +856,8 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensionSet(0, 3, -1, 0, 0), 0.0)
dimensionedScalar("zero", dimensionSet(0, 3, -1, 0, 0), 0.0),
zeroGradientFvPatchScalarField::typeName
),
collisionSelectionRemainder_(),
q_

View File

@ -83,10 +83,10 @@ class DsmcCloud
//- Dictionary of particle properties
IOdictionary particleProperties_;
//- A list of unique instances of molecule types in the simulation.
// The position of an entry in the list maps to the label identifying
// the typeId, i.e. where typeIdList_ = (N2 O2 CO2)
// N2 has typeId label = 0, O2 = 1, CO2 = 2.
//- A list of unique instances of molecule types in the
// simulation. The position of an entry in the list maps to
// the label identifying the typeId, i.e. where typeIdList_ =
// (N2 O2 CO2) N2 has typeId label = 0, O2 = 1, CO2 = 2.
List<word> typeIdList_;
//- Number of real atoms/molecules represented by a parcel
@ -95,9 +95,9 @@ class DsmcCloud
//- A data structure holding which particles are in which cell
List<DynamicList<ParcelType*> > cellOccupancy_;
//- An IOField holding the value of (sigmaT * cR)max for each cell (see
// Bird p220). Initialised with the parcels, updated as required, and
// read in on start/restart.
//- A field holding the value of (sigmaT * cR)max for each
// cell (see Bird p220). Initialised with the parcels,
// updated as required, and read in on start/restart.
volScalarField sigmaTcRMax_;
//- A field holding the remainder from the previous collision selections

View File

@ -70,25 +70,6 @@ protected:
// (usually there is only one)
static label masterFace(const polyMesh&, const label, const label);
// // From mesh to compact row storage format
// // (like CompactListList)
// static void calcCSR
// (
// const polyMesh& mesh,
// List<int>& adjncy,
// List<int>& xadj
// );
//
// // From cell-cell connections to compact row storage format
// // (like CompactListList)
// static void calcCSR
// (
// const labelListList& cellCells,
// List<int>& adjncy,
// List<int>& xadj
// );
private:
// Private Member Functions

View File

@ -50,10 +50,14 @@ namespace Foam
// is in the cells from neighbouring processors which need to be renumbered.
void Foam::multiLevelDecomp::subsetGlobalCellCells
(
const label nDomains,
const label domainI,
const labelList& dist,
const labelListList& cellCells,
const labelList& set,
labelListList& subCellCells,
label& cutConnections
labelList& cutConnections
) const
{
// Determine new index for cells by inverting subset
@ -68,10 +72,14 @@ void Foam::multiLevelDecomp::subsetGlobalCellCells
List<Map<label> > compactMap;
mapDistribute map(globalCells, subCellCells, compactMap);
map.distribute(oldToNew);
labelList allDist(dist);
map.distribute(allDist);
// Now subCellCells contains indices into oldToNew which are the
// new locations of the neighbouring cells.
cutConnections.setSize(nDomains);
cutConnections = 0;
forAll(subCellCells, subCellI)
@ -85,7 +93,7 @@ void Foam::multiLevelDecomp::subsetGlobalCellCells
label subCellI = oldToNew[cCells[i]];
if (subCellI == -1)
{
cutConnections++;
cutConnections[allDist[cCells[i]]]++;
}
else
{
@ -118,16 +126,6 @@ void Foam::multiLevelDecomp::decompose
)
);
//Pout<< "At level " << levelI << endl;
//forAll(dist, i)
//{
// Pout<< " " << i << " at:" << points[i]
// << " original:" << pointMap[i] << " dist:" << dist[i]
// << " connected to:" << pointField(points, pointPoints[i])
// << endl;
//}
//Pout<< endl;
forAll(pointMap, i)
{
label orig = pointMap[i];
@ -146,30 +144,62 @@ void Foam::multiLevelDecomp::decompose
finalDecomp *= methods_[levelI+1].nDomains();
// Extract processor+local index from point-point addressing
forAll(domainToPoints, domainI)
if (debug && Pstream::master())
{
const labelList& myPoints = domainToPoints[domainI];
Pout<< "Decomposition at level " << levelI << " :" << endl;
}
for (label domainI = 0; domainI < n; domainI++)
{
// Extract elements for current domain
const labelList domainPoints(findIndices(dist, domainI));
// Subset point-wise data.
pointField subPoints(points, myPoints);
scalarField subWeights(pointWeights, myPoints);
labelList subPointMap(UIndirectList<label>(pointMap, myPoints));
pointField subPoints(points, domainPoints);
scalarField subWeights(pointWeights, domainPoints);
labelList subPointMap(UIndirectList<label>(pointMap, domainPoints));
// Subset point-point addressing (adapt global numbering)
labelListList subPointPoints;
label nOutsideConnections;
labelList nOutsideConnections;
subsetGlobalCellCells
(
n,
domainI,
dist,
pointPoints,
myPoints,
domainPoints,
subPointPoints,
nOutsideConnections
);
//Info<< "At level " << levelI << " domain " << domainI
// << " have connections to other domains "
// << returnReduce(nOutsideConnections, sumOp<label>())
// << endl;
label nPoints = returnReduce(domainPoints.size(), plusOp<label>());
Pstream::listCombineGather(nOutsideConnections, plusEqOp<label>());
Pstream::listCombineScatter(nOutsideConnections);
label nPatches = 0;
label nFaces = 0;
forAll(nOutsideConnections, i)
{
if (nOutsideConnections[i] > 0)
{
nPatches++;
nFaces += nOutsideConnections[i];
}
}
string oldPrefix;
if (debug && Pstream::master())
{
Pout<< " Domain " << domainI << nl
<< " Number of cells = " << nPoints << nl
<< " Number of inter-domain patches = " << nPatches
<< nl
<< " Number of inter-domain faces = " << nFaces << nl
<< endl;
oldPrefix = Pout.prefix();
Pout.prefix() = " " + oldPrefix;
}
decompose
(
@ -181,6 +211,98 @@ void Foam::multiLevelDecomp::decompose
finalDecomp
);
if (debug && Pstream::master())
{
Pout.prefix() = oldPrefix;
}
}
if (debug)
{
// Do straight decompose of two levels
label nNext = methods_[levelI+1].nDomains();
label nTotal = n*nNext;
// Retrieve original level0 dictionary and modify number of domains
dictionary::const_iterator iter =
decompositionDict_.subDict(typeName + "Coeffs").begin();
dictionary myDict = iter().dict();
myDict.set("numberOfSubdomains", nTotal);
if (debug && Pstream::master())
{
Pout<< "Reference decomposition with " << myDict << " :"
<< endl;
}
autoPtr<decompositionMethod> method0 = decompositionMethod::New
(
myDict
);
labelList dist
(
method0().decompose
(
pointPoints,
points,
pointWeights
)
);
for (label blockI = 0; blockI < n; blockI++)
{
// Count the number inbetween blocks of nNext size
label nPoints = 0;
labelList nOutsideConnections(n, 0);
forAll(pointPoints, pointI)
{
if ((dist[pointI] / nNext) == blockI)
{
nPoints++;
const labelList& pPoints = pointPoints[pointI];
forAll(pPoints, i)
{
label distBlockI = dist[pPoints[i]] / nNext;
if (distBlockI != blockI)
{
nOutsideConnections[distBlockI]++;
}
}
}
}
reduce(nPoints, plusOp<label>());
Pstream::listCombineGather
(
nOutsideConnections,
plusEqOp<label>()
);
Pstream::listCombineScatter(nOutsideConnections);
label nPatches = 0;
label nFaces = 0;
forAll(nOutsideConnections, i)
{
if (nOutsideConnections[i] > 0)
{
nPatches++;
nFaces += nOutsideConnections[i];
}
}
if (debug && Pstream::master())
{
Pout<< " Domain " << blockI << nl
<< " Number of cells = " << nPoints << nl
<< " Number of inter-domain patches = "
<< nPatches << nl
<< " Number of inter-domain faces = " << nFaces
<< nl << endl;
}
}
}
}
}

View File

@ -59,10 +59,14 @@ class multiLevelDecomp
// for a (consistent) subset
void subsetGlobalCellCells
(
const label nDomains,
const label domainI,
const labelList& dist,
const labelListList& cellCells,
const labelList& set,
labelListList& subCellCells,
label& cutConnections
labelList& cutConnections
) const;
//- Decompose level methodI without addressing

View File

@ -25,8 +25,8 @@ Class
Foam::sixDoFRigidBodyMotionConstraints::fixedAxis
Description
sixDoFRigidBodyMotionConstraint. Axis of body fixed global
space.
sixDoFRigidBodyMotionConstraint. Body may only rotate around
an axis fixed in global space.
SourceFiles
fixedAxis.C

View File

@ -27,6 +27,8 @@ Class
Description
A sampledSurface defined by a cuttingPlane. Always triangulated.
Note: does not actually cut until update() called.
SourceFiles
sampledPlane.C

View File

@ -18,4 +18,8 @@ wmake libso radiation
wmake libso barotropicCompressibilityModel
wmake libso thermalPorousZone
# Should be combined with solids&solidMixture
wmake libso basicSolidThermo
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,7 @@
constSolidThermo/constSolidThermo.C
directionalSolidThermo/directionalSolidThermo.C
basicSolidThermo/basicSolidThermo.C
basicSolidThermo/newBasicSolidThermo.C
interpolatedSolidThermo/interpolatedSolidThermo.C
LIB = $(FOAM_LIBBIN)/libbasicSolidThermo

View File

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

View File

@ -0,0 +1,91 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "basicSolidThermo.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(basicSolidThermo, 0);
defineRunTimeSelectionTable(basicSolidThermo, mesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh)
:
IOdictionary
(
IOobject
(
"solidThermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
mesh_(mesh),
T_
(
IOobject
(
"T",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::basicSolidThermo::~basicSolidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::basicSolidThermo::writeData(Ostream& os) const
{
return true;
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const basicSolidThermo& s)
{
s.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,196 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicSolidThermo
Description
The thermophysical properties of a basicSolidThermo
SourceFiles
basicSolidThermo.C
newBasicSolidThermo.C
\*---------------------------------------------------------------------------*/
#ifndef basicSolidThermo_H
#define basicSolidThermo_H
#include "runTimeSelectionTables.H"
#include "volFields.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class basicSolidThermo
:
public IOdictionary
{
protected:
// Protected data
const fvMesh& mesh_;
//- Temperature [K]
volScalarField T_;
public:
//- Runtime type information
TypeName("basicSolidThermo");
// Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
basicSolidThermo,
mesh,
(const fvMesh& mesh),
(mesh)
);
// Constructors
//- Construct from mesh
basicSolidThermo(const fvMesh&);
//- Return a pointer to a new basicSolidThermo created from
// the solidThermophysicalProperties dictionary
static autoPtr<basicSolidThermo> New(const fvMesh&);
// Destructor
virtual ~basicSolidThermo();
// Member Functions
//- Update properties
virtual void correct() = 0;
// Physical constants which define the basicSolidThermo
//- Temperature [K]
inline const volScalarField& T() const;
//- Temperature [K]
inline volScalarField& T();
//- Density [kg/m3]
virtual tmp<volScalarField> rho() const = 0;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> cp() const = 0;
//- Thermal conductivity [W/(m.K)]
virtual tmp<volScalarField> K() const = 0;
//- Thermal conductivity [W/(m.K)]
virtual tmp<volSymmTensorField> directionalK() const = 0;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const = 0;
//- Emissivity []
virtual tmp<volScalarField> emissivity() const = 0;
// Per patch calculation
//- Density [kg/m3]
virtual tmp<scalarField> rho(const label patchI) const = 0;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<scalarField> cp(const label patchI) const = 0;
//- Thermal conductivity [W/(m.K)]
virtual tmp<scalarField> K(const label patchI) const = 0;
//- Thermal conductivity [W/(m.K)]
virtual tmp<symmTensorField> directionalK(const label) const =0;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) const = 0;
//- Emissivity []
virtual tmp<scalarField> emissivity(const label) const = 0;
// // Point wise properties
//
// //- Density [kg/m3]
// virtual scalar rho(const scalar T) const = 0;
//
// //- Specific heat capacity [J/(kg.K)]
// virtual scalar cp(const scalar T) const = 0;
//
// //- Thermal conductivity [W/(m.K)]
// virtual scalar K(const scalar T) const = 0;
//
// //- Heat of formation [J/kg]
// virtual scalar Hf(const scalar T) const = 0;
//
// //- Emissivity []
// virtual scalar emissivity(const scalar T) const = 0;
// I-O
//- Write the basicSolidThermo properties
virtual bool writeData(Ostream& os) const = 0;
//- Read solidThermophysicalProperties dictionary
virtual bool read() = 0;
// Ostream Operator
friend Ostream& operator<<(Ostream& os, const basicSolidThermo& s);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "basicSolidThermoI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "basicSolidThermo.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::volScalarField& Foam::basicSolidThermo::T() const
{
return T_;
}
Foam::volScalarField& Foam::basicSolidThermo::T()
{
return T_;
}
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "basicSolidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::basicSolidThermo> Foam::basicSolidThermo::New
(
const fvMesh& mesh
)
{
if (debug)
{
Info<< "basicSolidThermo::New(const fvMesh&): "
<< "constructing basicSolidThermo"
<< endl;
}
const word thermoType
(
IOdictionary
(
IOobject
(
"solidThermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).lookup("thermoType")
);
meshConstructorTable::iterator cstrIter =
meshConstructorTablePtr_->find(thermoType);
if (cstrIter == meshConstructorTablePtr_->end())
{
FatalErrorIn
(
"basicSolidThermo::New(const fvMesh&, const word&)"
) << "Unknown solidThermo type " << thermoType
<< endl << endl
<< "Valid solidThermo types are :" << endl
<< meshConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<basicSolidThermo>(cstrIter()(mesh));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,232 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "interpolateSolidThermo.H"
#include "addToRunTimeSelectionTable.H"
#include "interpolateXY.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(interpolateSolidThermo, 0);
addToRunTimeSelectionTable
(
basicSolidThermo,
interpolateSolidThermo,
dictionary
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::interpolateSolidThermo::interpolateSolidThermo
(
const fvMesh& mesh,
const dictionary& dict
)
:
basicSolidThermo(mesh, dict, typeName),
TValues_(dict_.lookup("TValues")),
rhoValues_(dict_.lookup("rhoValues")),
cpValues_(dict_.lookup("cpValues")),
KValues_(dict_.lookup("KValues")),
HfValues_(dict_.lookup("HfValues")),
emissivityValues_(dict_.lookup("emissivityValues"))
{
if
(
(TValues_.size() != rhoValues_.size())
&& (TValues_.size() != cpValues_.size())
&& (TValues_.size() != rhoValues_.size())
&& (TValues_.size() != KValues_.size())
&& (TValues_.size() != HfValues_.size())
&& (TValues_.size() != emissivityValues_.size())
)
{
FatalIOErrorIn
(
"interpolateSolidThermo::interpolateSolidThermo\n"
"(\n"
" const fvMesh& mesh,\n"
" const dictionary& dict\n"
")\n",
dict_
) << "Size of property tables should be equal to size of Temperature"
<< " values " << TValues_.size()
<< exit(FatalIOError);
}
for (label i = 1; i < TValues_.size(); i++)
{
if (TValues_[i] <= TValues_[i-1])
{
FatalIOErrorIn
(
"interpolateSolidThermo::interpolateSolidThermo\n"
"(\n"
" const fvMesh& mesh,\n"
" const dictionary& dict\n"
")\n",
dict_
) << "Temperature values are not in increasing order "
<< TValues_ << exit(FatalIOError);
}
}
correct();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::interpolateSolidThermo::~interpolateSolidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::interpolateSolidThermo::correct()
{
// rho
rho_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
rhoValues_
);
forAll(rho_.boundaryField(), patchI)
{
rho_.boundaryField()[patchI] == interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
rhoValues_
);
}
// cp
cp_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
cpValues_
);
forAll(cp_.boundaryField(), patchI)
{
cp_.boundaryField()[patchI] == interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
cpValues_
);
}
// K
K_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
KValues_
);
forAll(K_.boundaryField(), patchI)
{
K_.boundaryField()[patchI] == interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
KValues_
);
}
// Hf
Hf_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
HfValues_
);
forAll(Hf_.boundaryField(), patchI)
{
Hf_.boundaryField()[patchI] == interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
HfValues_
);
}
// emissivity
emissivity_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
emissivityValues_
);
forAll(emissivity_.boundaryField(), patchI)
{
emissivity_.boundaryField()[patchI] == interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
emissivityValues_
);
}
}
void Foam::interpolateSolidThermo::write(Ostream& os) const
{
basicSolidThermo::write(os);
os.writeKeyword("TValues") << TValues_ << token::END_STATEMENT << nl;
os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl;
os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl;
os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl;
os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl;
os.writeKeyword("emissivityValues") << emissivityValues_
<< token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const interpolateSolidThermo& s)
{
s.write(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,124 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::interpolateSolidThermo
Description
The thermophysical properties of a interpolateSolidThermo
SourceFiles
interpolateSolidThermo.C
\*---------------------------------------------------------------------------*/
#ifndef interpolateSolidThermo_H
#define interpolateSolidThermo_H
#include "basicSolidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class basicSolidThermo;
Ostream& operator<<
(
Ostream&,
const basicSolidThermo&
);
/*---------------------------------------------------------------------------*\
Class interpolateSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class interpolateSolidThermo
:
public basicSolidThermo
{
// Private data
//- Temperature points for which there are values
const Field<scalar> TValues_;
//- Density at given temperatures
const Field<scalar> rhoValues_;
const Field<scalar> cpValues_;
const Field<symmTensor> KValues_;
const Field<scalar> HfValues_;
const Field<scalar> emissivityValues_;
public:
//- Runtime type information
TypeName("interpolateSolidThermo");
// Constructors
//- Construct from mesh
interpolateSolidThermo(const fvMesh& mesh, const dictionary& dict);
// Destructor
virtual ~interpolateSolidThermo();
// Member Functions
//- Update properties
virtual void correct();
// I-O
//- Write the interpolateSolidThermo properties
virtual void write(Ostream& os) const;
// Ostream Operator
friend Ostream& operator<<
(
Ostream& os,
const interpolateSolidThermo& s
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,410 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "constSolidThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(constSolidThermo, 0);
addToRunTimeSelectionTable(basicSolidThermo, constSolidThermo, mesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::constSolidThermo::constSolidThermo(const fvMesh& mesh)
:
basicSolidThermo(mesh),
constRho_("zero", dimDensity, 0.0),
constCp_("zero", dimEnergy/(dimMass*dimTemperature), 0.0),
constK_("zero", dimEnergy/dimTime/(dimLength*dimTemperature), 0.0),
constHf_("zero", dimEnergy/dimMass, 0.0),
constEmissivity_("zero", dimless, 0.0)
{
read();
correct();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::constSolidThermo::~constSolidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::constSolidThermo::correct()
{}
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::rho() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"rho",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
constRho_
)
);
}
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::cp() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"cp",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
constCp_
)
);
}
//Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::K() const
//{
// vector v(eigenValues(constK_.value()));
//
// if (mag(v.x() - v.z()) > SMALL)
// {
// FatalErrorIn("directionalSolidThermo::K() const")
// << "Supplied K " << constK_
// << " are not isotropic. Eigenvalues are "
// << v << exit(FatalError);
// }
//
// return tmp<volScalarField>
// (
// new volScalarField
// (
// IOobject
// (
// "K",
// mesh_.time().timeName(),
// mesh_,
// IOobject::NO_READ,
// IOobject::NO_WRITE
// ),
// mesh_,
// v.x()
// )
// );
//}
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::K() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"K",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
constK_
)
);
}
//Foam::tmp<Foam::volSymmTensorField> Foam::constSolidThermo::directionalK()
//const
//{
// return tmp<volSymmTensorField>
// (
// new volSymmTensorField
// (
// IOobject
// (
// "K",
// mesh_.time().timeName(),
// mesh_,
// IOobject::NO_READ,
// IOobject::NO_WRITE
// ),
// mesh_,
// constK_
// )
// );
//}
Foam::tmp<Foam::volSymmTensorField> Foam::constSolidThermo::directionalK() const
{
dimensionedSymmTensor t
(
constK_.name(),
constK_.dimensions(),
symmTensor
(
constK_.value(),
0.0,
0.0,
constK_.value(),
0.0,
constK_.value()
)
);
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"K",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
t
)
);
}
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::Hf() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"Hf",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
constHf_
)
);
}
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::emissivity() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"emissivity",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
constEmissivity_
)
);
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::rho
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constRho_.value()
)
);
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::cp
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constCp_.value()
)
);
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::K
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constK_.value()
)
);
}
Foam::tmp<Foam::symmTensorField> Foam::constSolidThermo::directionalK
(
const label patchI
) const
{
symmTensor t
(
constK_.value(),
0.0,
0.0,
constK_.value(),
0.0,
constK_.value()
);
return tmp<symmTensorField>
(
new symmTensorField
(
T_.boundaryField()[patchI].size(),
t
)
);
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Hf
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constHf_.value()
)
);
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::emissivity
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constEmissivity_.value()
)
);
}
bool Foam::constSolidThermo::read()
{
return read(subDict(typeName + "Coeffs"));
}
bool Foam::constSolidThermo::read(const dictionary& dict)
{
constRho_ = dimensionedScalar(dict.lookup("rho"));
constCp_ = dimensionedScalar(dict.lookup("cp"));
constK_ = dimensionedScalar(dict.lookup("K"));
constHf_ = dimensionedScalar(dict.lookup("Hf"));
constEmissivity_ = dimensionedScalar(dict.lookup("emissivity"));
Info<< "Constructed constSolidThermo with" << nl
<< " rho : " << constRho_ << nl
<< " cp : " << constCp_ << nl
<< " K : " << constK_ << nl
<< " Hf : " << constHf_ << nl
<< " emissivity : " << constEmissivity_ << nl
<< endl;
return true;
}
bool Foam::constSolidThermo::writeData(Ostream& os) const
{
bool ok = basicSolidThermo::writeData(os);
os.writeKeyword("rho") << constRho_ << token::END_STATEMENT << nl;
os.writeKeyword("cp") << constCp_ << token::END_STATEMENT << nl;
os.writeKeyword("K") << constK_ << token::END_STATEMENT << nl;
os.writeKeyword("Hf") << constHf_ << token::END_STATEMENT << nl;
os.writeKeyword("emissivity") << constEmissivity_ << token::END_STATEMENT
<< nl;
return ok && os.good();
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const constSolidThermo& s)
{
s.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,158 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::constSolidThermo
Description
The thermophysical properties of a constSolidThermo
SourceFiles
constSolidThermo.C
\*---------------------------------------------------------------------------*/
#ifndef constSolidThermo_H
#define constSolidThermo_H
#include "basicSolidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class constSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class constSolidThermo
:
public basicSolidThermo
{
//- Density [kg/m3]
dimensionedScalar constRho_;
//- Specific heat capacity [J/(kg.K)]
dimensionedScalar constCp_;
//- Thermal conductivity [W/(m.K)]
//dimensionedSymmTensor constK_;
dimensionedScalar constK_;
//- Heat of formation [J/kg]
dimensionedScalar constHf_;
//- Emissivity
dimensionedScalar constEmissivity_;
public:
//- Runtime type information
TypeName("constSolidThermo");
// Constructors
//- Construct from mesh
constSolidThermo(const fvMesh& mesh);
// Destructor
virtual ~constSolidThermo();
// Member Functions
//- Update properties
virtual void correct();
//- Density [kg/m3]
virtual tmp<volScalarField> rho() const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> cp() const;
//- Thermal conductivity [W/(m.K)]
// Note: needs supplied K to be isotropic
virtual tmp<volScalarField> K() const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<volSymmTensorField> directionalK() const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
//- Emissivity []
virtual tmp<volScalarField> emissivity() const;
// Per patch calculation
//- Density [kg/m3]
virtual tmp<scalarField> rho(const label patchI) const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<scalarField> cp(const label patchI) const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<scalarField> K(const label patchI) const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<symmTensorField> directionalK(const label patchI) const;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) const;
//- Emissivity []
virtual tmp<scalarField> emissivity(const label) const;
// I-O
//- Write the constSolidThermo properties
virtual bool writeData(Ostream& os) const;
//- Read solidThermophysicalProperties dictionary
virtual bool read();
//- Read solidThermophysicalProperties dictionary
bool read(const dictionary&);
// Ostream Operator
friend Ostream& operator<<(Ostream& os, const constSolidThermo& s);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,765 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "directionalSolidThermo.H"
#include "addToRunTimeSelectionTable.H"
#include "interpolateXY.H"
#include "transform.H"
#include "transformField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(directionalSolidThermo, 0);
addToRunTimeSelectionTable
(
basicSolidThermo,
directionalSolidThermo,
mesh
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::directionalSolidThermo::directionalSolidThermo(const fvMesh& mesh)
:
basicSolidThermo(mesh),
ccTransforms_
(
IOobject
(
"ccTransforms",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimLength
)
{
read();
// Determine transforms for cell centres
forAll(mesh.C(), cellI)
{
vector dir = mesh.C()[cellI] - coordSys_.origin();
dir /= mag(dir);
// Define local coordinate system with
// - e1 : axis from cc to centre
// - e3 : rotation axis
coordinateSystem cs
(
"cc",
coordSys_.origin(),
coordSys_.e3(), //z',e3
dir //x',e1
);
ccTransforms_[cellI] = cs.R();
}
forAll(mesh.C().boundaryField(), patchI)
{
const fvPatchVectorField& patchC = mesh.C().boundaryField()[patchI];
fvPatchTensorField& patchT = ccTransforms_.boundaryField()[patchI];
tensorField tc(patchT.size());
forAll(tc, i)
{
vector dir = patchC[i] - coordSys_.origin();
dir /= mag(dir);
coordinateSystem cs
(
"cc",
coordSys_.origin(),
coordSys_.e3(), //z',e3
dir //x',e1
);
tc[i] = cs.R();
}
patchT = tc;
}
if (debug)
{
Info<< "directionalSolidThermo : dumping converted Kxx, Kyy, Kzz"
<< endl;
{
volVectorField Kxx
(
IOobject
(
"Kxx",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimless
);
Kxx.internalField() = transform
(
ccTransforms_.internalField(),
vectorField
(
ccTransforms_.internalField().size(),
point(1, 0, 0)
)
);
forAll(Kxx.boundaryField(), patchI)
{
Kxx.boundaryField()[patchI] = transform
(
ccTransforms_.boundaryField()[patchI],
vectorField
(
ccTransforms_.boundaryField()[patchI].size(),
point(1, 0, 0)
)
);
}
Kxx.write();
}
{
volVectorField Kyy
(
IOobject
(
"Kyy",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimless
);
Kyy.internalField() = transform
(
ccTransforms_.internalField(),
vectorField
(
ccTransforms_.internalField().size(),
point(0, 1, 0)
)
);
forAll(Kyy.boundaryField(), patchI)
{
Kyy.boundaryField()[patchI] = transform
(
ccTransforms_.boundaryField()[patchI],
vectorField
(
ccTransforms_.boundaryField()[patchI].size(),
point(0, 1, 0)
)
);
}
Kyy.write();
}
{
volVectorField Kzz
(
IOobject
(
"Kzz",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimless
);
Kzz.internalField() = transform
(
ccTransforms_.internalField(),
vectorField
(
ccTransforms_.internalField().size(),
point(0, 0, 1)
)
);
forAll(Kzz.boundaryField(), patchI)
{
Kzz.boundaryField()[patchI] = transform
(
ccTransforms_.boundaryField()[patchI],
vectorField
(
ccTransforms_.boundaryField()[patchI].size(),
point(0, 0, 1)
)
);
}
Kzz.write();
}
}
correct();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::directionalSolidThermo::~directionalSolidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::symmTensor Foam::directionalSolidThermo::transformPrincipal
(
const tensor& tt,
const vector& st
) const
{
return symmTensor
(
tt.xx()*st.x()*tt.xx()
+ tt.xy()*st.y()*tt.xy()
+ tt.xz()*st.z()*tt.xz(),
tt.xx()*st.x()*tt.yx()
+ tt.xy()*st.y()*tt.yy()
+ tt.xz()*st.z()*tt.yz(),
tt.xx()*st.x()*tt.zx()
+ tt.xy()*st.y()*tt.zy()
+ tt.xz()*st.z()*tt.zz(),
tt.yx()*st.x()*tt.yx()
+ tt.yy()*st.y()*tt.yy()
+ tt.yz()*st.z()*tt.yz(),
tt.yx()*st.x()*tt.zx()
+ tt.yy()*st.y()*tt.zy()
+ tt.yz()*st.z()*tt.zz(),
tt.zx()*st.x()*tt.zx()
+ tt.zy()*st.y()*tt.zy()
+ tt.zz()*st.z()*tt.zz()
);
}
void Foam::directionalSolidThermo::transformField
(
symmTensorField& fld,
const tensorField& tt,
const vectorField& st
) const
{
fld.setSize(tt.size());
forAll(fld, i)
{
fld[i] = transformPrincipal(tt[i], st[i]);
}
}
void Foam::directionalSolidThermo::correct()
{}
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::rho() const
{
tmp<volScalarField> trho
(
new volScalarField
(
IOobject
(
"rho",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimDensity
)
);
volScalarField& rho = trho();
rho.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
rhoValues_
);
forAll(rho.boundaryField(), patchI)
{
rho.boundaryField()[patchI] == this->rho(patchI)();
}
return trho;
}
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::cp() const
{
tmp<volScalarField> tcp
(
new volScalarField
(
IOobject
(
"cp",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/(dimMass*dimTemperature)
)
);
volScalarField& cp = tcp();
cp.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
cpValues_
);
forAll(cp.boundaryField(), patchI)
{
cp.boundaryField()[patchI] == this->cp(patchI)();
}
return tcp;
}
Foam::tmp<Foam::volSymmTensorField> Foam::directionalSolidThermo::directionalK()
const
{
tmp<volSymmTensorField> tK
(
new volSymmTensorField
(
IOobject
(
"K",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/dimTime/(dimLength*dimTemperature)
)
);
volSymmTensorField& K = tK();
// Get temperature interpolated properties (principal directions)
Field<vector> localK
(
interpolateXY
(
T_.internalField(),
TValues_,
KValues_
)
);
// Transform into global coordinate system
transformField(K.internalField(), ccTransforms_.internalField(), localK);
forAll(K.boundaryField(), patchI)
{
K.boundaryField()[patchI] == this->directionalK(patchI)();
}
return tK;
}
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::K() const
{
forAll(KValues_, i)
{
const vector& v = KValues_[i];
if
(
v.x() != v.y()
|| v.x() != v.z()
|| v.y() != v.z()
)
{
FatalErrorIn("directionalSolidThermo::K() const")
<< "Supplied K values " << KValues_
<< " are not isotropic." << exit(FatalError);
}
}
// Get temperature interpolated properties (principal directions)
Field<vector> localK
(
interpolateXY
(
T_.internalField(),
TValues_,
KValues_
)
);
tmp<volScalarField> tK
(
new volScalarField
(
IOobject
(
"K",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/dimTime/(dimLength*dimTemperature)
)
);
volScalarField& K = tK();
K.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
KValues_.component(0)()
);
forAll(K.boundaryField(), patchI)
{
K.boundaryField()[patchI] == this->K(patchI)();
}
return tK;
}
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::Hf() const
{
tmp<volScalarField> tHf
(
new volScalarField
(
IOobject
(
"Hf",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/dimMass
)
);
volScalarField& Hf = tHf();
Hf.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
HfValues_
);
forAll(Hf.boundaryField(), patchI)
{
Hf.boundaryField()[patchI] == this->Hf(patchI)();
}
return tHf;
}
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::emissivity() const
{
tmp<volScalarField> temissivity
(
new volScalarField
(
IOobject
(
"emissivity",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimless
)
);
volScalarField& emissivity = temissivity();
emissivity.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
emissivityValues_
);
forAll(emissivity.boundaryField(), patchI)
{
emissivity.boundaryField()[patchI] == this->emissivity(patchI)();
}
return temissivity;
}
Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::rho
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
rhoValues_
)
)
);
}
Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::cp
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
cpValues_
)
)
);
}
Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::K
(
const label patchI
) const
{
forAll(KValues_, i)
{
const vector& v = KValues_[i];
if
(
v.x() != v.y()
|| v.x() != v.z()
|| v.y() != v.z()
)
{
FatalErrorIn("directionalSolidThermo::K() const")
<< "Supplied K values " << KValues_
<< " are not isotropic." << exit(FatalError);
}
}
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
KValues_.component(0)()
)
)
);
}
Foam::tmp<Foam::symmTensorField> Foam::directionalSolidThermo::directionalK
(
const label patchI
) const
{
const fvPatchScalarField& patchT = T_.boundaryField()[patchI];
Field<vector> localK(interpolateXY(patchT, TValues_, KValues_));
tmp<symmTensorField> tglobalK(new symmTensorField(localK.size()));
transformField(tglobalK(), ccTransforms_.boundaryField()[patchI], localK);
return tglobalK;
}
Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::Hf
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
HfValues_
)
)
);
}
Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::emissivity
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
emissivityValues_
)
)
);
}
bool Foam::directionalSolidThermo::read()
{
return read(subDict(typeName + "Coeffs"));
}
bool Foam::directionalSolidThermo::read(const dictionary& dict)
{
TValues_ = Field<scalar>(dict.lookup("TValues"));
rhoValues_ = Field<scalar>(dict.lookup("rhoValues"));
cpValues_ = Field<scalar>(dict.lookup("cpValues"));
KValues_ = Field<vector>(dict.lookup("KValues"));
HfValues_ = Field<scalar>(dict.lookup("HfValues"));
emissivityValues_ = Field<scalar>(dict.lookup("emissivityValues"));
coordSys_ = coordinateSystem(dict, mesh_);
Info<< "Constructed directionalSolidThermo with samples" << nl
<< " T : " << TValues_ << nl
<< " rho : " << rhoValues_ << nl
<< " cp : " << cpValues_ << nl
<< " K : " << KValues_ << nl
<< " in coordinates system" << nl
<< " type : " << coordSys_.type() << nl
<< " e3 : " << coordSys_.e3() << nl
<< " e1 : " << coordSys_.e1() << nl
<< " Hf : " << HfValues_ << nl
<< " emissivity : " << emissivityValues_ << nl
<< endl;
if
(
(TValues_.size() != rhoValues_.size())
&& (TValues_.size() != cpValues_.size())
&& (TValues_.size() != rhoValues_.size())
&& (TValues_.size() != KValues_.size())
&& (TValues_.size() != HfValues_.size())
&& (TValues_.size() != emissivityValues_.size())
)
{
FatalIOErrorIn("directionalSolidThermo::read()", dict)
<< "Size of property tables should be equal to size of Temperature"
<< " values " << TValues_.size()
<< exit(FatalIOError);
}
for (label i = 1; i < TValues_.size(); i++)
{
if (TValues_[i] <= TValues_[i-1])
{
FatalIOErrorIn("directionalSolidThermo::read()", dict)
<< "Temperature values are not in increasing order "
<< TValues_ << exit(FatalIOError);
}
}
return true;
}
bool Foam::directionalSolidThermo::writeData(Ostream& os) const
{
bool ok = basicSolidThermo::writeData(os);
os.writeKeyword("TValues") << TValues_ << token::END_STATEMENT << nl;
os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl;
os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl;
os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl;
os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl;
os.writeKeyword("emissivityValues") << emissivityValues_
<< token::END_STATEMENT << nl;
return ok && os.good();
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const directionalSolidThermo& s)
{
s.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,183 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directionalSolidThermo
Description
Directional conductivity + table interpolation.
SourceFiles
directionalSolidThermo.C
\*---------------------------------------------------------------------------*/
#ifndef directionalSolidThermo_H
#define directionalSolidThermo_H
#include "basicSolidThermo.H"
#include "coordinateSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directionalSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class directionalSolidThermo
:
public basicSolidThermo
{
// Private data
//- Temperature samples
Field<scalar> TValues_;
//- Density at given temperatures
Field<scalar> rhoValues_;
Field<scalar> cpValues_;
Field<vector> KValues_;
Field<scalar> HfValues_;
Field<scalar> emissivityValues_;
//- Coordinate system used for the directional properties
coordinateSystem coordSys_;
//- Transformation for cell centres
volTensorField ccTransforms_;
// Private Member Functions
//- Transform principal values of symmTensor
symmTensor transformPrincipal(const tensor& tt, const vector& st) const;
//- Transform principal values of symmTensor
void transformField
(
symmTensorField& fld,
const tensorField& tt,
const vectorField& st
) const;
public:
//- Runtime type information
TypeName("directionalSolidThermo");
// Constructors
//- Construct from mesh
directionalSolidThermo(const fvMesh& mesh);
// Destructor
virtual ~directionalSolidThermo();
// Member Functions
//- Update properties
virtual void correct();
//- Density [kg/m3]
virtual tmp<volScalarField> rho() const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> cp() const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<volScalarField> K() const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<volSymmTensorField> directionalK() const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
//- Emissivity []
virtual tmp<volScalarField> emissivity() const;
// Per patch calculation
//- Density [kg/m3]
virtual tmp<scalarField> rho(const label patchI) const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<scalarField> cp(const label patchI) const;
//- Thermal conductivity [W/(m.K)]
// Note: needs Kvalues to be isotropic
virtual tmp<scalarField> K(const label patchI) const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<symmTensorField> directionalK(const label patchI) const;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) const;
//- Emissivity []
virtual tmp<scalarField> emissivity(const label) const;
// I-O
//- Write the directionalSolidThermo properties
virtual bool writeData(Ostream& os) const;
//- Read the directionalSolidThermo properties
virtual bool read();
//- Read the directionalSolidThermo properties
bool read(const dictionary& dict);
// Ostream Operator
friend Ostream& operator<<
(
Ostream& os,
const directionalSolidThermo& s
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,501 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "interpolatedSolidThermo.H"
#include "addToRunTimeSelectionTable.H"
#include "interpolateXY.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(interpolatedSolidThermo, 0);
addToRunTimeSelectionTable
(
basicSolidThermo,
interpolatedSolidThermo,
mesh
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::interpolatedSolidThermo::interpolatedSolidThermo(const fvMesh& mesh)
:
basicSolidThermo(mesh)
{
read();
correct();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::interpolatedSolidThermo::~interpolatedSolidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::interpolatedSolidThermo::correct()
{}
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::rho() const
{
tmp<volScalarField> trho
(
new volScalarField
(
IOobject
(
"rho",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimDensity
)
);
volScalarField& rho = trho();
rho.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
rhoValues_
);
forAll(rho.boundaryField(), patchI)
{
rho.boundaryField()[patchI] == this->rho(patchI)();
}
return trho;
}
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::cp() const
{
tmp<volScalarField> tcp
(
new volScalarField
(
IOobject
(
"cp",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/(dimMass*dimTemperature)
)
);
volScalarField& cp = tcp();
cp.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
cpValues_
);
forAll(cp.boundaryField(), patchI)
{
cp.boundaryField()[patchI] == this->cp(patchI)();
}
return tcp;
}
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::K() const
{
tmp<volScalarField> tK
(
new volScalarField
(
IOobject
(
"K",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/dimTime/(dimLength*dimTemperature)
)
);
volScalarField& K = tK();
K.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
KValues_
);
forAll(K.boundaryField(), patchI)
{
K.boundaryField()[patchI] == this->K(patchI)();
}
return tK;
}
Foam::tmp<Foam::volSymmTensorField>
Foam::interpolatedSolidThermo::directionalK()
const
{
tmp<volSymmTensorField> tK
(
new volSymmTensorField
(
IOobject
(
"K",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedSymmTensor
(
"zero",
dimEnergy/dimTime/(dimLength*dimTemperature),
symmTensor::zero
)
)
);
volSymmTensorField& K = tK();
Field<scalar> scalarK
(
interpolateXY
(
T_.internalField(),
TValues_,
KValues_
)
);
K.internalField().replace(symmTensor::XX, scalarK);
K.internalField().replace(symmTensor::YY, scalarK);
K.internalField().replace(symmTensor::ZZ, scalarK);
forAll(K.boundaryField(), patchI)
{
K.boundaryField()[patchI] == this->directionalK(patchI)();
}
return tK;
}
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::Hf() const
{
tmp<volScalarField> tHf
(
new volScalarField
(
IOobject
(
"Hf",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/dimMass
)
);
volScalarField& Hf = tHf();
Hf.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
HfValues_
);
forAll(Hf.boundaryField(), patchI)
{
Hf.boundaryField()[patchI] == this->Hf(patchI)();
}
return tHf;
}
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::emissivity() const
{
tmp<volScalarField> temissivity
(
new volScalarField
(
IOobject
(
"emissivity",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimless
)
);
volScalarField& emissivity = temissivity();
emissivity.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
emissivityValues_
);
forAll(emissivity.boundaryField(), patchI)
{
emissivity.boundaryField()[patchI] == this->emissivity(patchI)();
}
return temissivity;
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::rho
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
rhoValues_
)
)
);
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::cp
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
cpValues_
)
)
);
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::K
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
KValues_
)
)
);
}
Foam::tmp<Foam::symmTensorField> Foam::interpolatedSolidThermo::directionalK
(
const label patchI
) const
{
const fvPatchScalarField& patchT = T_.boundaryField()[patchI];
Field<scalar> scalarK(interpolateXY(patchT, TValues_, KValues_));
tmp<symmTensorField> tfld
(
new symmTensorField
(
scalarK.size(),
symmTensor::zero
)
);
symmTensorField& fld = tfld();
fld.replace(symmTensor::XX, scalarK);
fld.replace(symmTensor::YY, scalarK);
fld.replace(symmTensor::ZZ, scalarK);
return tfld;
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::Hf
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
HfValues_
)
)
);
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::emissivity
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
emissivityValues_
)
)
);
}
bool Foam::interpolatedSolidThermo::read()
{
return read(subDict(typeName + "Coeffs"));
}
bool Foam::interpolatedSolidThermo::read(const dictionary& dict)
{
TValues_ = Field<scalar>(dict.lookup("TValues"));
rhoValues_ = Field<scalar>(dict.lookup("rhoValues"));
cpValues_ = Field<scalar>(dict.lookup("cpValues"));
KValues_ = Field<scalar>(dict.lookup("KValues"));
HfValues_ = Field<scalar>(dict.lookup("HfValues"));
emissivityValues_ = Field<scalar>(dict.lookup("emissivityValues"));
Info<< "Constructed interpolatedSolidThermo with samples" << nl
<< " T : " << TValues_ << nl
<< " rho : " << rhoValues_ << nl
<< " cp : " << cpValues_ << nl
<< " K : " << KValues_ << nl
<< " Hf : " << HfValues_ << nl
<< " emissivity : " << emissivityValues_ << nl
<< endl;
if
(
(TValues_.size() != rhoValues_.size())
&& (TValues_.size() != cpValues_.size())
&& (TValues_.size() != rhoValues_.size())
&& (TValues_.size() != KValues_.size())
&& (TValues_.size() != HfValues_.size())
&& (TValues_.size() != emissivityValues_.size())
)
{
FatalIOErrorIn("interpolatedSolidThermo::read()", dict)
<< "Size of property tables should be equal to size of Temperature"
<< " values " << TValues_.size()
<< exit(FatalIOError);
}
for (label i = 1; i < TValues_.size(); i++)
{
if (TValues_[i] <= TValues_[i-1])
{
FatalIOErrorIn("interpolatedSolidThermo::read()", dict)
<< "Temperature values are not in increasing order "
<< TValues_ << exit(FatalIOError);
}
}
return true;
}
bool Foam::interpolatedSolidThermo::writeData(Ostream& os) const
{
bool ok = basicSolidThermo::writeData(os);
os.writeKeyword("TValues") << TValues_ << token::END_STATEMENT << nl;
os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl;
os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl;
os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl;
os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl;
os.writeKeyword("emissivityValues") << emissivityValues_
<< token::END_STATEMENT << nl;
return ok && os.good();
}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const interpolatedSolidThermo& s)
{
s.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,161 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::interpolatedSolidThermo
Description
Table interpolated solid thermo.
SourceFiles
interpolatedSolidThermo.C
\*---------------------------------------------------------------------------*/
#ifndef interpolatedSolidThermo_H
#define interpolatedSolidThermo_H
#include "basicSolidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class interpolatedSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class interpolatedSolidThermo
:
public basicSolidThermo
{
// Private data
//- Temperature samples
Field<scalar> TValues_;
//- Density at given temperatures
Field<scalar> rhoValues_;
Field<scalar> cpValues_;
Field<scalar> KValues_;
Field<scalar> HfValues_;
Field<scalar> emissivityValues_;
public:
//- Runtime type information
TypeName("interpolatedSolidThermo");
// Constructors
//- Construct from mesh
interpolatedSolidThermo(const fvMesh& mesh);
// Destructor
virtual ~interpolatedSolidThermo();
// Member Functions
//- Update properties
virtual void correct();
//- Density [kg/m3]
virtual tmp<volScalarField> rho() const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> cp() const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<volScalarField> K() const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<volSymmTensorField> directionalK() const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
//- Emissivity []
virtual tmp<volScalarField> emissivity() const;
// Per patch calculation
//- Density [kg/m3]
virtual tmp<scalarField> rho(const label patchI) const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<scalarField> cp(const label patchI) const;
//- Thermal conductivity [W/(m.K)]
// Note: needs Kvalues to be isotropic
virtual tmp<scalarField> K(const label patchI) const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<symmTensorField> directionalK(const label patchI) const;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) const;
//- Emissivity []
virtual tmp<scalarField> emissivity(const label) const;
// I-O
//- Write the interpolatedSolidThermo properties
virtual bool writeData(Ostream& os) const;
//- Read the interpolatedSolidThermo properties
virtual bool read();
//- Read the interpolatedSolidThermo properties
bool read(const dictionary& dict);
// Ostream Operator
friend Ostream& operator<<
(
Ostream& os,
const interpolatedSolidThermo& s
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -60,10 +60,11 @@ DeardorffDiffStress::DeardorffDiffStress
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel),
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
GenSGSStress(rho, U, phi, thermoPhysicalModel),
ck_

View File

@ -101,7 +101,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -41,12 +41,18 @@ GenEddyVisc::GenEddyVisc
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
)
:
LESModel
(
word("GenEddyVisc"), rho, U, phi, thermoPhysicalModel
word("GenEddyVisc"),
rho,
U,
phi,
thermoPhysicalModel,
turbulenceModelName
),
ce_

View File

@ -90,7 +90,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -41,7 +41,8 @@ GenSGSStress::GenSGSStress
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
)
:
LESModel
@ -50,7 +51,8 @@ GenSGSStress::GenSGSStress
rho,
U,
phi,
thermoPhysicalModel
thermoPhysicalModel,
turbulenceModelName
),
ce_

View File

@ -90,7 +90,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -58,10 +58,11 @@ LESModel::LESModel
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
)
:
turbulenceModel(rho, U, phi, thermoPhysicalModel),
turbulenceModel(rho, U, phi, thermoPhysicalModel, turbulenceModelName),
IOdictionary
(
@ -97,7 +98,8 @@ autoPtr<LESModel> LESModel::New
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
)
{
// get model name, but do not register the dictionary
@ -129,9 +131,11 @@ autoPtr<LESModel> LESModel::New
(
"LESModel::New"
"("
"const volScalarField&, "
"const volVectorField&, "
"const surfaceScalarField&, "
"const basicThermo&"
"const basicThermo&, "
"const word&"
")"
) << "Unknown LESModel type "
<< modelType << nl << nl
@ -140,7 +144,10 @@ autoPtr<LESModel> LESModel::New
<< exit(FatalError);
}
return autoPtr<LESModel>(cstrIter()(rho, U, phi, thermoPhysicalModel));
return autoPtr<LESModel>
(
cstrIter()(rho, U, phi, thermoPhysicalModel, turbulenceModelName)
);
}
@ -160,7 +167,20 @@ void LESModel::correct()
bool LESModel::read()
{
if (regIOobject::read())
// Bit of trickery : we are both IOdictionary ('RASProperties') and
// an regIOobject (from the turbulenceModel). Problem is to distinguish
// between the two - we only want to reread the IOdictionary.
bool ok = IOdictionary::readData
(
IOdictionary::readStream
(
IOdictionary::type()
)
);
IOdictionary::close();
if (ok)
{
if (const dictionary* dictPtr = subDictPtr(type() + "Coeffs"))
{

View File

@ -121,9 +121,10 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
),
(rho, U, phi, thermoPhysicalModel)
(rho, U, phi, thermoPhysicalModel, turbulenceModelName)
);
@ -136,7 +137,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);
@ -148,7 +150,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -68,10 +68,11 @@ Smagorinsky::Smagorinsky
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel),
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
ck_

View File

@ -96,7 +96,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -106,10 +106,11 @@ SpalartAllmaras::SpalartAllmaras
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel),
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
sigmaNut_
(

View File

@ -111,7 +111,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -90,10 +90,11 @@ dynOneEqEddy::dynOneEqEddy
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel),
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
filterPtr_(LESfilter::New(U.mesh(), coeffDict())),

View File

@ -107,7 +107,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -63,10 +63,11 @@ lowReOneEqEddy::lowReOneEqEddy
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel),
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
ck_

View File

@ -98,7 +98,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -59,10 +59,11 @@ oneEqEddy::oneEqEddy
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
)
:
LESModel(typeName, rho, U, phi, thermoPhysicalModel),
LESModel(typeName, rho, U, phi, thermoPhysicalModel, turbulenceModelName),
GenEddyVisc(rho, U, phi, thermoPhysicalModel),
ck_

View File

@ -101,7 +101,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -50,10 +50,11 @@ LRR::LRR
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel),
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(

View File

@ -119,7 +119,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -50,10 +50,11 @@ LaunderGibsonRSTM::LaunderGibsonRSTM
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel),
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(

View File

@ -128,7 +128,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -65,10 +65,11 @@ LaunderSharmaKE::LaunderSharmaKE
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel),
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(

View File

@ -112,7 +112,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -35,12 +35,8 @@ kqRWallFunctions = $(wallFunctions)/kqRWallFunctions
$(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C
/* Patch fields */
derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C
derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C
backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C
LIB = $(FOAM_LIBBIN)/libcompressibleRASModels

View File

@ -1,6 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \

View File

@ -59,10 +59,11 @@ RASModel::RASModel
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
turbulenceModel(rho, U, phi, thermophysicalModel),
turbulenceModel(rho, U, phi, thermophysicalModel, turbulenceModelName),
IOdictionary
(
@ -103,7 +104,8 @@ autoPtr<RASModel> RASModel::New
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
{
// get model name, but do not register the dictionary
@ -138,7 +140,8 @@ autoPtr<RASModel> RASModel::New
"const volScalarField&, "
"const volVectorField&, "
"const surfaceScalarField&, "
"basicThermo&"
"basicThermo&, "
"const word&"
")"
) << "Unknown RASModel type "
<< modelType << nl << nl
@ -149,7 +152,7 @@ autoPtr<RASModel> RASModel::New
return autoPtr<RASModel>
(
cstrIter()(rho, U, phi, thermophysicalModel)
cstrIter()(rho, U, phi, thermophysicalModel, turbulenceModelName)
);
}
@ -212,7 +215,22 @@ void RASModel::correct()
bool RASModel::read()
{
if (regIOobject::read())
//if (regIOobject::read())
// Bit of trickery : we are both IOdictionary ('RASProperties') and
// an regIOobject from the turbulenceModel level. Problem is to distinguish
// between the two - we only want to reread the IOdictionary.
bool ok = IOdictionary::readData
(
IOdictionary::readStream
(
IOdictionary::type()
)
);
IOdictionary::close();
if (ok)
{
lookup("turbulence") >> turbulence_;

View File

@ -134,9 +134,10 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
),
(rho, U, phi, thermoPhysicalModel)
(rho, U, phi, thermoPhysicalModel, turbulenceModelName)
);
@ -149,7 +150,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);
@ -161,7 +163,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -49,10 +49,11 @@ RNGkEpsilon::RNGkEpsilon
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel),
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(

View File

@ -108,7 +108,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -109,10 +109,11 @@ SpalartAllmaras::SpalartAllmaras
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel),
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
sigmaNut_
(

View File

@ -149,7 +149,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -221,24 +221,13 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
{
label faceCellI = patch().faceCells()[faceI];
scalar yPlus =
Cmu25*y[faceI]*sqrt(k[faceCellI])
/(muw[faceI]/rhow[faceI]);
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]);
if (yPlus > yPlusLam_)
{
G[faceCellI] =
(mutw[faceI] + muw[faceI])
*magGradUw[faceI]
*Cmu25*sqrt(k[faceCellI])
/(kappa_*y[faceI]);
}
else
{
G[faceCellI] = 0.0;
}
G[faceCellI] =
(mutw[faceI] + muw[faceI])
*magGradUw[faceI]
*Cmu25*sqrt(k[faceCellI])
/(kappa_*y[faceI]);
}
fixedInternalValueFvPatchField<scalar>::updateCoeffs();

View File

@ -223,28 +223,15 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
{
label faceCellI = patch().faceCells()[faceI];
scalar yPlus =
Cmu25*y[faceI]*sqrt(k[faceCellI])
/(muw[faceI]/rhow[faceI]);
scalar omegaVis = 6.0*muw[faceI]/(rhow[faceI]*beta1_*sqr(y[faceI]));
scalar omegaLog = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
omega[faceCellI] = sqrt(sqr(omegaVis) + sqr(omegaLog));
if (yPlus > yPlusLam_)
{
G[faceCellI] =
(mutw[faceI] + muw[faceI])
*magGradUw[faceI]
*Cmu25*sqrt(k[faceCellI])
/(kappa_*y[faceI]);
}
else
{
G[faceCellI] = 0.0;
}
G[faceCellI] =
(mutw[faceI] + muw[faceI])
*magGradUw[faceI]
*Cmu25*sqrt(k[faceCellI])
/(kappa_*y[faceI]);
}
fixedInternalValueFvPatchField<scalar>::updateCoeffs();

View File

@ -49,10 +49,11 @@ kEpsilon::kEpsilon
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel),
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(

View File

@ -104,7 +104,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -92,10 +92,11 @@ kOmegaSST::kOmegaSST
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel),
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
alphaK1_
(

View File

@ -187,7 +187,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -47,10 +47,11 @@ laminar::laminar
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel)
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName)
{}

View File

@ -68,7 +68,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -90,10 +90,11 @@ realizableKE::realizableKE
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel),
RASModel(typeName, rho, U, phi, thermophysicalModel, turbulenceModelName),
Cmu_
(

View File

@ -126,7 +126,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -1,4 +1,11 @@
turbulenceModel.C
laminar/laminar.C
derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C
derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C
derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C
LIB = $(FOAM_LIBBIN)/libcompressibleTurbulenceModel

View File

@ -1,8 +1,14 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude
LIB_LIBS = \
-lfiniteVolume
-lbasicSolidThermo \
-lbasicThermophysicalModels \
-lspecie \
-lfiniteVolume \
-lmeshTools

View File

@ -0,0 +1,181 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "temperatureCoupledBase.H"
#include "volFields.H"
#include "basicSolidThermo.H"
#include "turbulenceModel.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum<Foam::temperatureCoupledBase::KMethodType, 4>::
names[] =
{
"basicThermo",
"solidThermo",
"directionalSolidThermo",
"lookup"
};
const Foam::NamedEnum<Foam::temperatureCoupledBase::KMethodType, 4>
Foam::temperatureCoupledBase::KMethodTypeNames_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::temperatureCoupledBase::temperatureCoupledBase
(
const fvPatch& patch,
const word& calculationType,
const word& KName
)
:
patch_(patch),
method_(KMethodTypeNames_[calculationType]),
KName_(KName)
{}
Foam::temperatureCoupledBase::temperatureCoupledBase
(
const fvPatch& patch,
const dictionary& dict
)
:
patch_(patch),
method_(KMethodTypeNames_.read(dict.lookup("K"))),
KName_(dict.lookup("KName"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::K
(
const scalarField& Tp
) const
{
const fvMesh& mesh = patch_.boundaryMesh().mesh();
switch (method_)
{
case BASICTHERMO:
{
const compressible::turbulenceModel& model =
mesh.lookupObject<compressible::turbulenceModel>
(
"turbulenceModel"
);
return
model.alphaEff()().boundaryField()[patch_.index()]
*model.thermo().Cp(Tp, patch_.index());
}
break;
case SOLIDTHERMO:
{
const basicSolidThermo& thermo =
mesh.lookupObject<basicSolidThermo>
(
"solidThermophysicalProperties"
);
return thermo.K(patch_.index());
}
break;
case DIRECTIONALSOLIDTHERMO:
{
vectorField n = patch_.nf();
const basicSolidThermo& thermo =
mesh.lookupObject<basicSolidThermo>
(
"solidThermophysicalProperties"
);
return n & thermo.directionalK(patch_.index()) & n;
}
break;
case LOOKUP:
{
if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
{
return patch_.lookupPatchField<volScalarField, scalar>(KName_);
}
else if
(
mesh.objectRegistry::foundObject<volSymmTensorField>(KName_)
)
{
const symmTensorField& KWall =
patch_.lookupPatchField<volSymmTensorField, scalar>(KName_);
vectorField n = patch_.nf();
return n & KWall & n;
}
else
{
FatalErrorIn("temperatureCoupledBase::K() const")
<< "Did not find field " << KName_
<< " on mesh " << mesh.name() << " patch " << patch_.name()
<< endl
<< "Please set 'K' to one of " << KMethodTypeNames_.toc()
<< " and 'KName' to the name of the volScalar"
<< " or volSymmTensor field (if K=lookup)"
<< exit(FatalError);
return scalarField(0);
}
}
default:
{
FatalErrorIn("temperatureCoupledBase::K() const")
<< "Unimplemented method " << method_ << endl
<< "Please set 'K' to one of " << KMethodTypeNames_.toc()
<< " and 'KName' to the name of the volScalar"
<< " or volSymmTensor field (if K=lookup)"
<< exit(FatalError);
}
break;
}
return scalarField(0);
}
void Foam::temperatureCoupledBase::write(Ostream& os) const
{
os.writeKeyword("K") << KMethodTypeNames_[method_]
<< token::END_STATEMENT << nl;
os.writeKeyword("KName") << KName_ << token::END_STATEMENT << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
temperatureCoupledBase
Description
Common functions for use in temperature coupled boundaries. For now only
K() : heat conduction at patch. Gets supplied how to lookup/calculate K:
- 'lookup' : lookup volScalarField (or volSymmTensorField) with name
- 'basicThermo' : use basicThermo and default compressible::turbulenceModel
to calculate K
- 'solidThermo' : use basicSolidThermo K()
- 'directionalSolidThermo' directionalK()
SourceFiles
temperatureCoupledBase.C
\*---------------------------------------------------------------------------*/
#ifndef temperatureCoupledBase_H
#define temperatureCoupledBase_H
#include "scalarField.H"
#include "NamedEnum.H"
#include "fvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class temperatureCoupledBase Declaration
\*---------------------------------------------------------------------------*/
class temperatureCoupledBase
{
public:
//- Type of supplied K
enum KMethodType
{
BASICTHERMO,
SOLIDTHERMO,
DIRECTIONALSOLIDTHERMO,
LOOKUP
};
private:
// Private data
static const NamedEnum<KMethodType, 4> KMethodTypeNames_;
//- Underlying patch
const fvPatch& patch_;
//- How to get K
const KMethodType method_;
//- Name of thermal conductivity field (if looked up from database)
const word KName_;
public:
// Constructors
//- Construct from patch and K name
temperatureCoupledBase
(
const fvPatch& patch,
const word& calculationMethod,
const word& KName
);
//- Construct from patch and dictionary
temperatureCoupledBase
(
const fvPatch& patch,
const dictionary& dict
);
// Member functions
//- Method to obtain K
word KMethod() const
{
return KMethodTypeNames_[method_];
}
//- Name of thermal conductivity field
const word& KName() const
{
return KName_;
}
//- Given patch temperature calculate corresponding K field
tmp<scalarField> K(const scalarField& Tp) const;
//- Write
void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -27,7 +27,6 @@ License
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "RASModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,6 +61,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
)
:
fixedGradientFvPatchScalarField(p, iF),
temperatureCoupledBase(patch(), "undefined", "undefined-K"),
heatSource_(hsPower),
q_(p.size(), 0.0)
{}
@ -77,6 +77,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
)
:
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
temperatureCoupledBase(patch(), ptf.KMethod(), ptf.KName()),
heatSource_(ptf.heatSource_),
q_(ptf.q_, mapper)
{}
@ -91,6 +92,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
)
:
fixedGradientFvPatchScalarField(p, iF),
temperatureCoupledBase(patch(), dict),
heatSource_(heatSourceTypeNames_.read(dict.lookup("heatSource"))),
q_("q", dict, p.size())
{
@ -106,6 +108,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
)
:
fixedGradientFvPatchScalarField(thftpsf),
temperatureCoupledBase(patch(), thftpsf.KMethod(), thftpsf.KName()),
heatSource_(thftpsf.heatSource_),
q_(thftpsf.q_)
{}
@ -119,6 +122,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
)
:
fixedGradientFvPatchScalarField(thftpsf, iF),
temperatureCoupledBase(patch(), thftpsf.KMethod(), thftpsf.KName()),
heatSource_(thftpsf.heatSource_),
q_(thftpsf.q_)
{}
@ -161,27 +165,19 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
return;
}
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField alphaEffp = rasModel.alphaEff(patchI);
const scalarField& Tp = *this;
const scalarField Cpp = rasModel.thermo().Cp(Tp, patchI);
switch (heatSource_)
{
case hsPower:
{
const scalar Ap = gSum(patch().magSf());
gradient() = q_/(Ap*Cpp*alphaEffp);
gradient() = q_/(Ap*K(Tp));
break;
}
case hsFlux:
{
gradient() = q_/(Cpp*alphaEffp);
gradient() = q_/K(Tp);
break;
}
default:
@ -208,12 +204,11 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::write
Ostream& os
) const
{
fvPatchScalarField::write(os);
fixedGradientFvPatchScalarField::write(os);
os.writeKeyword("heatSource") << heatSourceTypeNames_[heatSource_]
<< token::END_STATEMENT << nl;
temperatureCoupledBase::write(os);
q_.writeEntry("q", os);
gradient().writeEntry("gradient", os);
writeEntry("value", os);
}

View File

@ -36,6 +36,7 @@ Description
type compressible::turbulentHeatFluxTemperature;
heatSource flux; // power [W]; flux [W/m2]
q uniform 10; // heat power or flux
K basicThermo; // calculate K by alphaEff*thermo.Cp
value uniform 300; // initial temperature value
}
@ -48,9 +49,8 @@ SourceFiles
#ifndef turbulentHeatFluxTemperatureFvPatchScalarFields_H
#define turbulentHeatFluxTemperatureFvPatchScalarFields_H
#include "fvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
#include "NamedEnum.H"
#include "temperatureCoupledBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -65,7 +65,8 @@ namespace compressible
class turbulentHeatFluxTemperatureFvPatchScalarField
:
public fixedGradientFvPatchScalarField
public fixedGradientFvPatchScalarField,
public temperatureCoupledBase
{
public:

View File

@ -29,8 +29,6 @@ License
#include "volFields.H"
#include "directMappedPatchBase.H"
#include "regionProperties.H"
#include "basicThermo.H"
#include "RASModel.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -111,8 +109,8 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF),
neighbourFieldName_("undefined-neighbourFieldName"),
KName_("undefined-K")
temperatureCoupledBase(patch(), "undefined", "undefined-K"),
neighbourFieldName_("undefined-neighbourFieldName")
{}
@ -126,8 +124,8 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
neighbourFieldName_(ptf.neighbourFieldName_),
KName_(ptf.KName_)
temperatureCoupledBase(patch(), ptf.KMethod(), ptf.KName()),
neighbourFieldName_(ptf.neighbourFieldName_)
{}
@ -140,8 +138,8 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF, dict),
neighbourFieldName_(dict.lookup("neighbourFieldName")),
KName_(dict.lookup("K"))
temperatureCoupledBase(patch(), dict),
neighbourFieldName_(dict.lookup("neighbourFieldName"))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
@ -172,61 +170,13 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
)
:
fixedValueFvPatchScalarField(wtcsf, iF),
neighbourFieldName_(wtcsf.neighbourFieldName_),
KName_(wtcsf.KName_)
temperatureCoupledBase(patch(), wtcsf.KMethod(), wtcsf.KName()),
neighbourFieldName_(wtcsf.neighbourFieldName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const
{
const fvMesh& mesh = patch().boundaryMesh().mesh();
if (KName_ == "none")
{
const compressible::RASModel& model =
db().lookupObject<compressible::RASModel>("RASProperties");
tmp<volScalarField> talpha = model.alphaEff();
const basicThermo& thermo =
db().lookupObject<basicThermo>("thermophysicalProperties");
return
talpha().boundaryField()[patch().index()]
*thermo.Cp()().boundaryField()[patch().index()];
}
else if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
{
return patch().lookupPatchField<volScalarField, scalar>(KName_);
}
else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_))
{
const symmTensorField& KWall =
patch().lookupPatchField<volSymmTensorField, scalar>(KName_);
vectorField n = patch().nf();
return n & KWall & n;
}
else
{
FatalErrorIn
(
"turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const"
) << "Did not find field " << KName_
<< " on mesh " << mesh.name() << " patch " << patch().name()
<< endl
<< "Please set 'K' to 'none', a valid volScalarField"
<< " or a valid volSymmTensorField." << exit(FatalError);
return scalarField(0);
}
}
void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
{
if (updated())
@ -283,7 +233,7 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
);
// Swap to obtain full local values of neighbour K*delta
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
@ -294,7 +244,7 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
nbrKDelta
);
tmp<scalarField> myKDelta = K()*patch().deltaCoeffs();
tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs();
// Calculate common wall temperature. Reuse *this to store common value.
scalarField Twall
@ -326,7 +276,7 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
// (*this-intFld())
// * patch().deltaCoeffs();
scalar Q = gSum(K()*patch().magSf()*snGrad());
scalar Q = gSum(K(*this)*patch().magSf()*snGrad());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
@ -354,7 +304,7 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::write
fixedValueFvPatchScalarField::write(os);
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
<< token::END_STATEMENT << nl;
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
temperatureCoupledBase::write(os);
}

View File

@ -37,14 +37,14 @@ Description
{
type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T;
K K; // or none
K lookup;
KName K; // or none
value uniform 300;
}
Needs to be on underlying directMapped(Wall)FvPatch.
Note: if K is "none" looks up RASModel and basicThermo, otherwise expects
the solver to calculate a 'K' field.
Note: see temperatureCoupledBase on ways to specify K.
Note: runs in parallel with arbitrary decomposition. Uses directMapped
functionality to calculate exchange.
@ -64,6 +64,7 @@ SourceFiles
#define turbulentTemperatureCoupledBaffleFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "temperatureCoupledBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -76,16 +77,14 @@ namespace Foam
class turbulentTemperatureCoupledBaffleFvPatchScalarField
:
public fixedValueFvPatchScalarField
public fixedValueFvPatchScalarField,
public temperatureCoupledBase
{
// Private data
//- Name of field on the neighbour region
const word neighbourFieldName_;
//- Name of thermal conductivity field
const word KName_;
// Private Member Functions
@ -161,9 +160,6 @@ public:
// Member functions
//- Get corresponding K field
tmp<scalarField> K() const;
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();

View File

@ -28,9 +28,6 @@ License
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "directMappedPatchBase.H"
#include "regionProperties.H"
#include "basicThermo.H"
#include "RASModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,8 +49,8 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
neighbourFieldName_("undefined-neighbourFieldName"),
KName_("undefined-K")
temperatureCoupledBase(patch(), "undefined", "undefined-K"),
neighbourFieldName_("undefined-neighbourFieldName")
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
@ -71,8 +68,8 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
neighbourFieldName_(ptf.neighbourFieldName_),
KName_(ptf.KName_)
temperatureCoupledBase(patch(), ptf.KMethod(), ptf.KName()),
neighbourFieldName_(ptf.neighbourFieldName_)
{}
@ -85,8 +82,8 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
neighbourFieldName_(dict.lookup("neighbourFieldName")),
KName_(dict.lookup("K"))
temperatureCoupledBase(patch(), dict),
neighbourFieldName_(dict.lookup("neighbourFieldName"))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
@ -134,60 +131,13 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
)
:
mixedFvPatchScalarField(wtcsf, iF),
neighbourFieldName_(wtcsf.neighbourFieldName_),
KName_(wtcsf.KName_)
temperatureCoupledBase(patch(), wtcsf.KMethod(), wtcsf.KName()),
neighbourFieldName_(wtcsf.neighbourFieldName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField>
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::K() const
{
const fvMesh& mesh = patch().boundaryMesh().mesh();
if (KName_ == "none")
{
const compressible::RASModel& model =
db().lookupObject<compressible::RASModel>("RASProperties");
const basicThermo& thermo =
db().lookupObject<basicThermo>("thermophysicalProperties");
return
model.alphaEff()().boundaryField()[patch().index()]
*thermo.Cp()().boundaryField()[patch().index()];
}
else if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
{
return patch().lookupPatchField<volScalarField, scalar>(KName_);
}
else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_))
{
const symmTensorField& KWall =
patch().lookupPatchField<volSymmTensorField, scalar>(KName_);
vectorField n = patch().nf();
return n & KWall & n;
}
else
{
FatalErrorIn
(
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::K()"
" const"
) << "Did not find field " << KName_
<< " on mesh " << mesh.name() << " patch " << patch().name()
<< endl
<< "Please set 'K' to 'none', a valid volScalarField"
<< " or a valid volSymmTensorField." << exit(FatalError);
return scalarField(0);
}
}
void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
{
if (updated())
@ -240,7 +190,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
);
// Swap to obtain full local values of neighbour K*delta
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
@ -251,7 +201,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
nbrKDelta
);
tmp<scalarField> myKDelta = K()*patch().deltaCoeffs();
tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs();
// Both sides agree on
@ -281,7 +231,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
if (debug)
{
scalar Q = gSum(K()*patch().magSf()*snGrad());
scalar Q = gSum(K(*this)*patch().magSf()*snGrad());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
@ -307,7 +257,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::write
mixedFvPatchScalarField::write(os);
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
<< token::END_STATEMENT << nl;
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
temperatureCoupledBase::write(os);
}

View File

@ -38,14 +38,18 @@ Description
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
neighbourFieldName T;
K K; // or none
K lookup;
KName K;
value uniform 300;
}
Needs to be on underlying directMapped(Wall)FvPatch.
Note: if K is "none" looks up RASModel and basicThermo, otherwise expects
the solver to calculate a 'K' field.
Note: K : heat conduction at patch. Gets supplied how to lookup/calculate K:
- 'lookup' : lookup volScalarField (or volSymmTensorField) with name
- 'basicThermo' : use basicThermo and compressible::RASmodel to calculate K
- 'solidThermo' : use basicSolidThermo K()
- 'directionalSolidThermo' directionalK()
Note: runs in parallel with arbitrary decomposition. Uses directMapped
functionality to calculate exchange.
@ -64,9 +68,8 @@ SourceFiles
#ifndef turbulentTemperatureCoupledBaffleMixedFvPatchScalarField_H
#define turbulentTemperatureCoupledBaffleMixedFvPatchScalarField_H
//#include "fvPatchFields.H"
#include "mixedFvPatchFields.H"
//#include "fvPatch.H"
#include "temperatureCoupledBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -81,16 +84,14 @@ namespace compressible
class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
:
public mixedFvPatchScalarField
public mixedFvPatchScalarField,
public temperatureCoupledBase
{
// Private data
//- Name of field on the neighbour region
const word neighbourFieldName_;
//- Name of thermal conductivity field
const word KName_;
public:
@ -164,9 +165,6 @@ public:
// Member functions
//- Get corresponding K field
tmp<scalarField> K() const;
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();

View File

@ -51,10 +51,11 @@ laminar::laminar
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
turbulenceModel(rho, U, phi, thermophysicalModel)
turbulenceModel(rho, U, phi, thermophysicalModel, turbulenceModelName)
{}
@ -65,10 +66,14 @@ autoPtr<laminar> laminar::New
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
{
return autoPtr<laminar>(new laminar(rho, U, phi, thermophysicalModel));
return autoPtr<laminar>
(
new laminar(rho, U, phi, thermophysicalModel, turbulenceModelName)
);
}

View File

@ -66,7 +66,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);
@ -78,7 +79,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -47,9 +47,21 @@ turbulenceModel::turbulenceModel
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
:
regIOobject
(
IOobject
(
turbulenceModelName,
U.time().constant(),
U.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
)
),
runTime_(U.time()),
mesh_(U.mesh()),
@ -67,7 +79,8 @@ autoPtr<turbulenceModel> turbulenceModel::New
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel,
const word& turbulenceModelName
)
{
// get model name, but do not register the dictionary
@ -99,7 +112,7 @@ autoPtr<turbulenceModel> turbulenceModel::New
(
"turbulenceModel::New(const volScalarField&, "
"const volVectorField&, const surfaceScalarField&, "
"basicThermo&)"
"basicThermo&, const word&)"
) << "Unknown turbulenceModel type "
<< modelType << nl << nl
<< "Valid turbulenceModel types:" << endl
@ -109,7 +122,7 @@ autoPtr<turbulenceModel> turbulenceModel::New
return autoPtr<turbulenceModel>
(
cstrIter()(rho, U, phi, thermophysicalModel)
cstrIter()(rho, U, phi, thermophysicalModel, turbulenceModelName)
);
}

View File

@ -68,6 +68,8 @@ namespace compressible
\*---------------------------------------------------------------------------*/
class turbulenceModel
:
public regIOobject
{
protected:
@ -112,9 +114,10 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName
),
(rho, U, phi, thermoPhysicalModel)
(rho, U, phi, thermoPhysicalModel, turbulenceModelName)
);
@ -126,7 +129,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = typeName
);
@ -138,7 +142,8 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
const basicThermo& thermoPhysicalModel
const basicThermo& thermoPhysicalModel,
const word& turbulenceModelName = typeName
);
@ -224,6 +229,13 @@ public:
//- Read LESProperties or RASProperties dictionary
virtual bool read() = 0;
//- Default dummy write function
virtual bool writeData(Ostream&) const
{
return true;
}
};

View File

@ -55,10 +55,11 @@ DeardorffDiffStress::DeardorffDiffStress
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName
)
:
LESModel(typeName, U, phi, transport),
LESModel(typeName, U, phi, transport, turbulenceModelName),
GenSGSStress(U, phi, transport),
ck_

View File

@ -100,7 +100,8 @@ public:
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -40,10 +40,11 @@ GenEddyVisc::GenEddyVisc
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName
)
:
LESModel(word("GenEddyVisc"), U, phi, transport),
LESModel(word("GenEddyVisc"), U, phi, transport, turbulenceModelName),
ce_
(

View File

@ -81,7 +81,8 @@ public:
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -40,10 +40,11 @@ GenSGSStress::GenSGSStress
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName
)
:
LESModel(word("GenSGSStress"), U, phi, transport),
LESModel(word("GenSGSStress"), U, phi, transport, turbulenceModelName),
ce_
(

View File

@ -85,7 +85,8 @@ public:
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -57,10 +57,11 @@ LESModel::LESModel
const word& type,
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName
)
:
turbulenceModel(U, phi, transport),
turbulenceModel(U, phi, transport, turbulenceModelName),
IOdictionary
(
@ -94,7 +95,8 @@ autoPtr<LESModel> LESModel::New
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName
)
{
// get model name, but do not register the dictionary
@ -128,7 +130,8 @@ autoPtr<LESModel> LESModel::New
"("
"const volVectorField&, "
"const surfaceScalarField& ,"
"transportModel&"
"transportModel&, "
"const word&"
")"
) << "Unknown LESModel type "
<< modelType << nl << nl
@ -137,7 +140,10 @@ autoPtr<LESModel> LESModel::New
<< exit(FatalError);
}
return autoPtr<LESModel>(cstrIter()(U, phi, transport));
return autoPtr<LESModel>
(
cstrIter()(U, phi, transport, turbulenceModelName)
);
}
@ -158,7 +164,22 @@ void LESModel::correct()
bool LESModel::read()
{
if (regIOobject::read())
//if (regIOobject::read())
// Bit of trickery : we are both IOdictionary ('RASProperties') and
// an regIOobject from the turbulenceModel level. Problem is to distinguish
// between the two - we only want to reread the IOdictionary.
bool ok = IOdictionary::readData
(
IOdictionary::readStream
(
IOdictionary::type()
)
);
IOdictionary::close();
if (ok)
{
if (const dictionary* dictPtr = subDictPtr(type() + "Coeffs"))
{

View File

@ -120,9 +120,10 @@ public:
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName
),
(U, phi, transport)
(U, phi, transport, turbulenceModelName)
);
@ -134,7 +135,8 @@ public:
const word& type,
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName
);
@ -145,7 +147,8 @@ public:
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -55,10 +55,11 @@ LRRDiffStress::LRRDiffStress
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName
)
:
LESModel(typeName, U, phi, transport),
LESModel(typeName, U, phi, transport, turbulenceModelName),
GenSGSStress(U, phi, transport),
ck_

View File

@ -99,7 +99,8 @@ public:
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName = turbulenceModel::typeName
);

View File

@ -55,10 +55,11 @@ Smagorinsky::Smagorinsky
(
const volVectorField& U,
const surfaceScalarField& phi,
transportModel& transport
transportModel& transport,
const word& turbulenceModelName
)
:
LESModel(typeName, U, phi, transport),
LESModel(typeName, U, phi, transport, turbulenceModelName),
GenEddyVisc(U, phi, transport),
ck_

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