Merge branch 'cvm' of ssh://hunt//home/noisy3/OpenFOAM/OpenFOAM-dev into cvm

This commit is contained in:
graham
2010-12-13 14:38:10 +00:00
200 changed files with 7486 additions and 2640 deletions

View File

@ -27,6 +27,7 @@ PDRModels/XiGModels/basicXiSubG/basicXiSubG.C
laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C
/* PDRFoamAutoRefine.C */
PDRFoam.C
EXE = $(FOAM_APPBIN)/PDRFoam

View File

@ -25,8 +25,8 @@ Application
PDRFoam
Description
Compressible premixed/partially-premixed combustion solver with turbulence
modelling.
Solver for compressible premixed/partially-premixed combustion with
turbulence modelling.
Combusting RANS code using the b-Xi two-equation model.
Xi may be obtained by either the solution of the Xi transport
@ -35,7 +35,7 @@ Description
to be appropriate by comparison with the results from the
spectral model.
Strain effects are encorporated directly into the Xi equation
Strain effects are incorporated directly into the Xi equation
but not in the algebraic approximation. Further work need to be
done on this issue, particularly regarding the enhanced removal rate
caused by flame compression. Analysis using results of the spectral
@ -78,9 +78,9 @@ int main(int argc, char *argv[])
#include "readCombustionProperties.H"
#include "readGravitationalAcceleration.H"
#include "createFields.H"
#include "readPISOControls.H"
#include "initContinuityErrs.H"
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
scalar StCoNum = 0.0;
@ -94,7 +94,6 @@ int main(int argc, char *argv[])
#include "readTimeControls.H"
#include "readPISOControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
runTime++;

View File

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

View File

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

View File

@ -4,7 +4,7 @@
tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho();
tmp<volScalarField> tcp = thermo.cp();
tmp<volScalarField> tcp = thermo.Cp();
const volScalarField& cp = tcp();
tmp<volScalarField> tK = thermo.K();

View File

@ -4,11 +4,12 @@
tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho();
tmp<volScalarField> tcp = thermo.cp();
tmp<volScalarField> tcp = thermo.Cp();
const volScalarField& cp = tcp();
tmp<volScalarField> tK = thermo.K();
//tmp<volSymmTensorField> tK = thermo.directionalK();
const volScalarField& K = tK();
//const volSymmTensorField& K = tK();
volScalarField& T = thermo.T();

View File

@ -55,4 +55,35 @@ Foam::scalar Foam::solidRegionDiffNo
}
Foam::scalar Foam::solidRegionDiffNo
(
const fvMesh& mesh,
const Time& runTime,
const volScalarField& Cprho,
const volSymmTensorField& Kdirectional
)
{
scalar DiNum = 0.0;
scalar meanDiNum = 0.0;
volScalarField K = mag(Kdirectional);
//- Take care: can have fluid domains with 0 cells so do not test for
// zero internal faces.
surfaceScalarField KrhoCpbyDelta =
mesh.surfaceInterpolation::deltaCoeffs()
* fvc::interpolate(K)
/ fvc::interpolate(Cprho);
DiNum = gMax(KrhoCpbyDelta.internalField())*runTime.deltaT().value();
meanDiNum = (average(KrhoCpbyDelta)).value()*runTime.deltaT().value();
Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum
<< " max: " << DiNum << endl;
return DiNum;
}
// ************************************************************************* //

View File

@ -41,6 +41,15 @@ namespace Foam
const volScalarField& Cprho,
const volScalarField& K
);
scalar solidRegionDiffNo
(
const fvMesh& mesh,
const Time& runTime,
const volScalarField& Cprho,
const volSymmTensorField& K
);
}
#endif

View File

@ -18,6 +18,8 @@ if (finalIter)
Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
}
thermo.correct();
if (finalIter)
{
mesh.data::remove("finalIteration");

View File

@ -10,8 +10,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
@ -33,8 +33,8 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \

View File

@ -10,8 +10,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
@ -32,8 +32,8 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \

View File

@ -5,8 +5,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
@ -26,8 +26,8 @@ EXE_LIBS = \
-lcompressibleLESModels \
-lspecie \
-lbasicThermophysicalModels \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \

View File

@ -9,8 +9,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
@ -31,8 +31,8 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \

View File

@ -10,8 +10,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
@ -32,8 +32,8 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lthermophysicalFunctions \
-lreactionThermophysicalModels \
-lSLGThermo \

View File

@ -482,7 +482,7 @@ bool doCommand
topoSet& currentSet = currentSetPtr();
Info<< " Set:" << currentSet.name()
<< " Size:" << currentSet.size()
<< " Size:" << returnReduce(currentSet.size(), sumOp<label>())
<< " Action:" << actionName
<< endl;
@ -579,7 +579,9 @@ bool doCommand
);
Info<< " Writing " << currentSet.name()
<< " (size " << currentSet.size() << ") to "
<< " (size "
<< returnReduce(currentSet.size(), sumOp<label>())
<< ") to "
<< currentSet.instance()/currentSet.local()
/currentSet.name()
<< " and to vtk file " << vtkName << endl << endl;
@ -589,7 +591,9 @@ bool doCommand
else
{
Info<< " Writing " << currentSet.name()
<< " (size " << currentSet.size() << ") to "
<< " (size "
<< returnReduce(currentSet.size(), sumOp<label>())
<< ") to "
<< currentSet.instance()/currentSet.local()
/currentSet.name() << endl << endl;
}
@ -642,9 +646,9 @@ enum commandStatus
void printMesh(const Time& runTime, const polyMesh& mesh)
{
Info<< "Time:" << runTime.timeName()
<< " cells:" << mesh.nCells()
<< " faces:" << mesh.nFaces()
<< " points:" << mesh.nPoints()
<< " cells:" << mesh.globalData().nTotalCells()
<< " faces:" << mesh.globalData().nTotalFaces()
<< " points:" << mesh.globalData().nTotalPoints()
<< " patches:" << mesh.boundaryMesh().size()
<< " bb:" << mesh.bounds() << nl;
}

View File

@ -47,9 +47,9 @@ EXE_LIBS = \
-lrandomProcesses \
-lreactionThermophysicalModels \
-lsampling \
-lsolidMixture \
-lpointSolidMixture \
-lsolidParticle \
-lsolids \
-lpointSolids \
-lspecie \
-lsurfMesh \
-lsystemCall \

View File

@ -1,199 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::sumData
Description
Sums data while walking across cells. Used in collapsing fields.
SourceFiles
sumDataI.H
sumData.C
\*---------------------------------------------------------------------------*/
#ifndef sumData_H
#define sumData_H
#include "point.H"
#include "tensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyPatch;
class polyMesh;
/*---------------------------------------------------------------------------*\
Class sumData Declaration
\*---------------------------------------------------------------------------*/
class sumData
{
// Private data
//- Previous face
label oldFace_;
//- summed data
scalar sum_;
//- number of items summed
label count_;
public:
// Constructors
//- Construct null
inline sumData();
//- Construct from count
inline sumData
(
const label oldFace,
const scalar sum,
const label count
);
// Member Functions
// Access
inline label oldFace() const
{
return oldFace_;
}
inline scalar sum() const
{
return sum_;
}
inline label count() const
{
return count_;
}
// Needed by FaceCellWave
//- Check whether origin has been changed at all or
// still contains original (invalid) value.
inline bool valid() const;
//- Check for identical geometrical data. Used for cyclics checking.
inline bool sameGeometry
(
const polyMesh&,
const sumData&,
const scalar
) const;
//- Convert any absolute coordinates into relative to (patch)face
// centre
inline void leaveDomain
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const point& faceCentre
);
//- Reverse of leaveDomain
inline void enterDomain
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const point& faceCentre
);
//- Apply rotation matrix to any coordinates
inline void transform
(
const polyMesh&,
const tensor&
);
//- Influence of neighbouring face.
inline bool updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const sumData& neighbourInfo,
const scalar tol
);
//- Influence of neighbouring cell.
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const label neighbourCellI,
const sumData& neighbourInfo,
const scalar tol
);
//- Influence of different value on same face.
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const sumData& neighbourInfo,
const scalar tol
);
// Member Operators
// Needed for List IO
inline bool operator==(const sumData&) const;
inline bool operator!=(const sumData&) const;
// IOstream Operators
friend Ostream& operator<<(Ostream&, const sumData&);
friend Istream& operator>>(Istream&, sumData&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "sumDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,226 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "polyMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::sumData::sumData()
:
oldFace_(-1),
sum_(0.0),
count_(0)
{}
// Construct from components
inline Foam::sumData::sumData
(
const label oldFace,
const scalar sum,
const label count
)
:
oldFace_(oldFace),
sum_(sum),
count_(count)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline bool Foam::sumData::valid() const
{
return oldFace_ != -1;
}
// No geometric data so never any problem on cyclics
inline bool Foam::sumData::sameGeometry
(
const polyMesh&,
const sumData&,
const scalar
) const
{
return true;
}
// No geometric data.
inline void Foam::sumData::leaveDomain
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const point& faceCentre
)
{}
// No geometric data.
inline void Foam::sumData::transform
(
const polyMesh&,
const tensor& rotTensor
)
{}
// No geometric data.
inline void Foam::sumData::enterDomain
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const point& faceCentre
)
{
oldFace_ = -1;
}
// Update cell with neighbouring face information
inline bool Foam::sumData::updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const sumData& neighbourInfo,
const scalar tol
)
{
if (!valid())
{
FatalErrorIn("sumData::updateCell") << "problem"
<< abort(FatalError);
return false;
}
if (count_ == 0)
{
sum_ += neighbourInfo.sum();
count_ = neighbourInfo.count() + 1;
oldFace_ = neighbourFaceI;
return true;
}
else
{
return false;
}
}
// Update face with neighbouring cell information
inline bool Foam::sumData::updateFace
(
const polyMesh& mesh,
const label thisFaceI,
const label neighbourCellI,
const sumData& neighbourInfo,
const scalar tol
)
{
// From cell to its faces.
// Check that face is opposite the previous one.
const cell& cFaces = mesh.cells()[neighbourCellI];
label wantedFaceI = cFaces.opposingFaceLabel
(
neighbourInfo.oldFace(),
mesh.faces()
);
if (thisFaceI == wantedFaceI)
{
if (count_ != 0)
{
FatalErrorIn("sumData::updateFace") << "problem"
<< abort(FatalError);
return false;
}
sum_ += neighbourInfo.sum();
count_ = neighbourInfo.count();
oldFace_ = thisFaceI;
return true;
}
else
{
return false;
}
}
// Update face with coupled face information
inline bool Foam::sumData::updateFace
(
const polyMesh&,
const label thisFaceI,
const sumData& neighbourInfo,
const scalar tol
)
{
// From face to face (e.g. coupled faces)
if (count_ == 0)
{
sum_ += neighbourInfo.sum();
count_ = neighbourInfo.count();
oldFace_ = thisFaceI;
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool Foam::sumData::operator==(const Foam::sumData& rhs)
const
{
return
oldFace() == rhs.oldFace()
&& sum() == rhs.sum()
&& count() == rhs.count();
}
inline bool Foam::sumData::operator!=(const Foam::sumData& rhs)
const
{
return !(*this == rhs);
}
// ************************************************************************* //

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / O peration | Version: 1.7.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -95,18 +95,9 @@ sets
type face;
axis x;
//- flangeHex
//start (0 20 -20);
//end (0 20 10);
//- nablaCavity
//start (-1 0.05 0.005);
//end ( 1 0.05 0.005);
//- cavity
start (0.001 0.5101 0.00501);
end (2.01 0.5101 0.00501);
nPoints 10;
start (0.0001 0.0525 0.00501);
end (0.0999 0.0525 0.00501);
}
somePoints

View File

@ -212,7 +212,7 @@ int main(int argc, char *argv[])
// write bounding box corners
if (args.optionFound("blockMesh"))
{
pointField cornerPts = boundBox(surf.points()).corners();
pointField cornerPts = boundBox(surf.points()).points();
Info<<"// blockMeshDict info" << nl;

View File

@ -58,17 +58,17 @@ const scalar
Foam::KRR4::KRR4(const ODE& ode)
:
ODESolver(ode),
yTemp_(n_),
dydxTemp_(n_),
g1_(n_),
g2_(n_),
g3_(n_),
g4_(n_),
yErr_(n_),
dfdx_(n_),
dfdy_(n_, n_),
a_(n_, n_),
pivotIndices_(n_)
yTemp_(n_, 0.0),
dydxTemp_(n_, 0.0),
g1_(n_, 0.0),
g2_(n_, 0.0),
g3_(n_, 0.0),
g4_(n_, 0.0),
yErr_(n_, 0.0),
dfdx_(n_, 0.0),
dfdy_(n_, n_, 0.0),
a_(n_, n_, 0.0),
pivotIndices_(n_, 0.0)
{}

View File

@ -57,14 +57,14 @@ const scalar
Foam::RK::RK(const ODE& ode)
:
ODESolver(ode),
yTemp_(n_),
ak2_(n_),
ak3_(n_),
ak4_(n_),
ak5_(n_),
ak6_(n_),
yErr_(n_),
yTemp2_(n_)
yTemp_(n_, 0.0),
ak2_(n_, 0.0),
ak3_(n_, 0.0),
ak4_(n_, 0.0),
ak5_(n_, 0.0),
ak6_(n_, 0.0),
yErr_(n_, 0.0),
yTemp2_(n_, 0.0)
{}

View File

@ -50,17 +50,17 @@ namespace Foam
Foam::SIBS::SIBS(const ODE& ode)
:
ODESolver(ode),
a_(iMaxX_),
alpha_(kMaxX_, kMaxX_),
d_p_(n_, kMaxX_),
x_p_(kMaxX_),
err_(kMaxX_),
a_(iMaxX_, 0.0),
alpha_(kMaxX_, kMaxX_, 0.0),
d_p_(n_, kMaxX_, 0.0),
x_p_(kMaxX_, 0.0),
err_(kMaxX_, 0.0),
yTemp_(n_),
ySeq_(n_),
yErr_(n_),
dfdx_(n_),
dfdy_(n_, n_),
yTemp_(n_, 0.0),
ySeq_(n_, 0.0),
yErr_(n_, 0.0),
dfdx_(n_, 0.0),
dfdy_(n_, n_, 0.0),
first_(1),
epsOld_(-1.0)
{}

View File

@ -111,7 +111,7 @@ Foam::boundBox::boundBox(Istream& is)
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::pointField> Foam::boundBox::corners() const
Foam::tmp<Foam::pointField> Foam::boundBox::points() const
{
tmp<pointField> tPts = tmp<pointField>(new pointField(8));
pointField& pt = tPts();

View File

@ -177,7 +177,7 @@ public:
}
//- Return corner points in an order corresponding to a 'hex' cell
tmp<pointField> corners() const;
tmp<pointField> points() const;
// Query

View File

@ -165,6 +165,35 @@ const Foam::List<Foam::labelPair>& Foam::mapDistribute::schedule() const
}
void Foam::mapDistribute::checkReceivedSize
(
const label procI,
const label expectedSize,
const label receivedSize
)
{
if (receivedSize != expectedSize)
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << procI
<< " " << expectedSize << " but received "
<< receivedSize << " elements."
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct from components

View File

@ -93,6 +93,15 @@ class mapDistribute
mutable autoPtr<List<labelPair> > schedulePtr_;
// Private Member Functions
static void checkReceivedSize
(
const label procI,
const label expectedSize,
const label receivedSize
);
public:
// Constructors

View File

@ -111,25 +111,7 @@ void Foam::mapDistribute::distribute
IPstream fromNbr(Pstream::blocking, domain);
List<T> subField(fromNbr);
if (subField.size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< subField.size() << " elements."
<< abort(FatalError);
}
checkReceivedSize(domain, map.size(), subField.size());
forAll(map, i)
{
@ -160,46 +142,52 @@ void Foam::mapDistribute::distribute
forAll(schedule, i)
{
const labelPair& twoProcs = schedule[i];
// twoProcs is a swap pair of processors. The first one is the
// one that needs to send first and then receive.
label sendProc = twoProcs[0];
label recvProc = twoProcs[1];
if (Pstream::myProcNo() == sendProc)
{
// I am sender. Send to recvProc.
OPstream toNbr(Pstream::scheduled, recvProc);
toNbr << UIndirectList<T>(field, subMap[recvProc]);
// I am send first, receive next
{
OPstream toNbr(Pstream::scheduled, recvProc);
toNbr << UIndirectList<T>(field, subMap[recvProc]);
}
{
IPstream fromNbr(Pstream::scheduled, recvProc);
List<T> subField(fromNbr);
const labelList& map = constructMap[recvProc];
checkReceivedSize(recvProc, map.size(), subField.size());
forAll(map, i)
{
newField[map[i]] = subField[i];
}
}
}
else
{
// I am receiver. Receive from sendProc.
IPstream fromNbr(Pstream::scheduled, sendProc);
List<T> subField(fromNbr);
const labelList& map = constructMap[sendProc];
if (subField.size() != map.size())
// I am receive first, send next
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << sendProc
<< " " << map.size() << " but received "
<< subField.size() << " elements."
<< abort(FatalError);
IPstream fromNbr(Pstream::scheduled, sendProc);
List<T> subField(fromNbr);
const labelList& map = constructMap[sendProc];
checkReceivedSize(sendProc, map.size(), subField.size());
forAll(map, i)
{
newField[map[i]] = subField[i];
}
}
forAll(map, i)
{
newField[map[i]] = subField[i];
OPstream toNbr(Pstream::scheduled, sendProc);
toNbr << UIndirectList<T>(field, subMap[sendProc]);
}
}
}
@ -258,25 +246,7 @@ void Foam::mapDistribute::distribute
UIPstream str(domain, pBufs);
List<T> recvField(str);
if (recvField.size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< recvField.size() << " elements."
<< abort(FatalError);
}
checkReceivedSize(domain, map.size(), recvField.size());
forAll(map, i)
{
@ -379,29 +349,13 @@ void Foam::mapDistribute::distribute
if (domain != Pstream::myProcNo() && map.size())
{
if (recvFields[domain].size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< recvFields[domain].size() << " elements."
<< abort(FatalError);
}
const List<T>& subField = recvFields[domain];
checkReceivedSize(domain, map.size(), subField.size());
forAll(map, i)
{
field[map[i]] = recvFields[domain][i];
field[map[i]] = subField[i];
}
}
}
@ -502,25 +456,7 @@ void Foam::mapDistribute::distribute
IPstream fromNbr(Pstream::blocking, domain);
List<T> subField(fromNbr);
if (subField.size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< subField.size() << " elements."
<< abort(FatalError);
}
checkReceivedSize(domain, map.size(), subField.size());
forAll(map, i)
{
@ -551,46 +487,50 @@ void Foam::mapDistribute::distribute
forAll(schedule, i)
{
const labelPair& twoProcs = schedule[i];
// twoProcs is a swap pair of processors. The first one is the
// one that needs to send first and then receive.
label sendProc = twoProcs[0];
label recvProc = twoProcs[1];
if (Pstream::myProcNo() == sendProc)
{
// I am sender. Send to recvProc.
OPstream toNbr(Pstream::scheduled, recvProc);
toNbr << UIndirectList<T>(field, subMap[recvProc]);
// I am send first, receive next
{
OPstream toNbr(Pstream::scheduled, recvProc);
toNbr << UIndirectList<T>(field, subMap[recvProc]);
}
{
IPstream fromNbr(Pstream::scheduled, recvProc);
List<T> subField(fromNbr);
const labelList& map = constructMap[recvProc];
checkReceivedSize(recvProc, map.size(), subField.size());
forAll(map, i)
{
cop(newField[map[i]], subField[i]);
}
}
}
else
{
// I am receiver. Receive from sendProc.
IPstream fromNbr(Pstream::scheduled, sendProc);
List<T> subField(fromNbr);
const labelList& map = constructMap[sendProc];
if (subField.size() != map.size())
// I am receive first, send next
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << sendProc
<< " " << map.size() << " but received "
<< subField.size() << " elements."
<< abort(FatalError);
IPstream fromNbr(Pstream::scheduled, sendProc);
List<T> subField(fromNbr);
const labelList& map = constructMap[sendProc];
checkReceivedSize(sendProc, map.size(), subField.size());
forAll(map, i)
{
cop(newField[map[i]], subField[i]);
}
}
forAll(map, i)
{
cop(newField[map[i]], subField[i]);
OPstream toNbr(Pstream::scheduled, sendProc);
toNbr << UIndirectList<T>(field, subMap[sendProc]);
}
}
}
@ -649,25 +589,7 @@ void Foam::mapDistribute::distribute
UIPstream str(domain, pBufs);
List<T> recvField(str);
if (recvField.size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< recvField.size() << " elements."
<< abort(FatalError);
}
checkReceivedSize(domain, map.size(), recvField.size());
forAll(map, i)
{
@ -769,29 +691,13 @@ void Foam::mapDistribute::distribute
if (domain != Pstream::myProcNo() && map.size())
{
if (recvFields[domain].size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::distribute\n"
"(\n"
" const Pstream::commsTypes commsType,\n"
" const List<labelPair>& schedule,\n"
" const label constructSize,\n"
" const labelListList& subMap,\n"
" const labelListList& constructMap,\n"
" List<T>& field\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< recvFields[domain].size() << " elements."
<< abort(FatalError);
}
const List<T>& subField = recvFields[domain];
checkReceivedSize(domain, map.size(), subField.size());
forAll(map, i)
{
cop(field[map[i]], recvFields[domain][i]);
cop(field[map[i]], subField[i]);
}
}
}

View File

@ -21,12 +21,11 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "triangle.H"
#include "IOstreams.H"
#include "triPointRef.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -152,7 +151,37 @@ inline Point tetrahedron<Point, PointRef>::circumCentre() const
vector ba = b ^ a;
vector ca = c ^ a;
return a_ + 0.5*(a + (lambda*ba - mu*ca)/((c & ba) + ROOTVSMALL));
vector num = lambda*ba - mu*ca;
scalar denom = (c & ba);
if (Foam::mag(denom) < ROOTVSMALL)
{
// Degenerate tet. Use test of the individual triangles.
{
point triCentre = triPointRef(a_, b_, c_).circumCentre();
if (magSqr(d_ - triCentre) < magSqr(a_ - triCentre))
{
return triCentre;
}
}
{
point triCentre = triPointRef(a_, b_, d_).circumCentre();
if (magSqr(c_ - triCentre) < magSqr(a_ - triCentre))
{
return triCentre;
}
}
{
point triCentre = triPointRef(a_, c_, d_).circumCentre();
if (magSqr(b_ - triCentre) < magSqr(a_ - triCentre))
{
return triCentre;
}
}
return triPointRef(b_, c_, d_).circumCentre();
}
return a_ + 0.5*(a + num/denom);
}

View File

@ -39,7 +39,7 @@ Foam::IObasicSourceList::IObasicSourceList
"sourcesProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),

View File

@ -36,7 +36,10 @@ Foam::interpolationCellPoint<Type>::interpolationCellPoint
:
interpolation<Type>(psi),
psip_(volPointInterpolation::New(psi.mesh()).interpolate(psi))
{}
{
// Uses cellPointWeight to do interpolation which needs tet decomposition
(void)psi.mesh().tetBasePtIs();
}
// ************************************************************************* //

View File

@ -179,7 +179,7 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
treeBoundBox tempTransformedBb
(
transform.invTransform(cellBbsToExchange[bbI].corners())
transform.invTransform(cellBbsToExchange[bbI].points())
);
treeBoundBox extendedBb
@ -396,7 +396,7 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
treeBoundBox tempTransformedBb
(
transform.invTransform(wallFaceBbsToExchange[bbI].corners())
transform.invTransform(wallFaceBbsToExchange[bbI].points())
);
treeBoundBox extendedBb
@ -701,7 +701,7 @@ void Foam::InteractionLists<ParticleType>::findExtendedProcBbsInRange
(
transform.transform
(
allExtendedProcBbs[procI].corners()
allExtendedProcBbs[procI].points()
)
);
@ -748,7 +748,7 @@ void Foam::InteractionLists<ParticleType>::findExtendedProcBbsInRange
(
transform.transform
(
allExtendedProcBbs[procI].corners()
allExtendedProcBbs[procI].points()
)
);
@ -791,7 +791,7 @@ void Foam::InteractionLists<ParticleType>::findExtendedProcBbsInRange
(
transform.transform
(
allExtendedProcBbs[procI].corners()
allExtendedProcBbs[procI].points()
)
);

View File

@ -8,8 +8,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
@ -30,8 +30,8 @@ LIB_LIBS = \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lreactionThermophysicalModels \
-lSLGThermo \
-lcompressibleRASModels \

View File

@ -7,8 +7,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
@ -27,8 +27,8 @@ LIB_LIBS = \
-lpdf \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lpointSolids \
-lpointSolidMixture \
-lspecie \
-lbasicThermophysicalModels \
-lreactionThermophysicalModels \

View File

@ -100,7 +100,7 @@ const Foam::liquidMixture& Foam::CompositionModel<CloudType>::liquids() const
template<class CloudType>
const Foam::solidMixture& Foam::CompositionModel<CloudType>::solids() const
const Foam::pointSolidMixture& Foam::CompositionModel<CloudType>::solids() const
{
return thermo_.solids();
}

View File

@ -143,7 +143,7 @@ public:
const liquidMixture& liquids() const;
//- Return the global (additional) solids
const solidMixture& solids() const;
const pointSolidMixture& solids() const;
//- Return the list of phase properties
const phasePropertiesList& phaseProps() const;

View File

@ -486,7 +486,7 @@ void Foam::conformalVoronoiMesh::createFeaturePoints()
{
Info<< nl << "Creating bounding points" << endl;
pointField farPts = geometryToConformTo_.bounds().corners();
pointField farPts = geometryToConformTo_.bounds().points();
// Shift corners of bounds relative to origin
farPts -= geometryToConformTo_.bounds().midpoint();

View File

@ -35,6 +35,7 @@ License
#include "polyMesh.H"
#include "polyPatch.H"
#include "Time.H"
#include "mapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,34 +65,6 @@ namespace Foam
const NamedEnum<directMappedPatchBase::offsetMode, 3>
directMappedPatchBase::offsetModeNames_;
//- Private class for finding nearest
// - point+local index
// - sqr(distance)
// - processor
typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo;
class nearestEqOp
{
public:
void operator()(nearInfo& x, const nearInfo& y) const
{
if (y.first().hit())
{
if (!x.first().hit())
{
x = y;
}
else if (y.second().first() < x.second().first())
{
x = y;
}
}
}
};
}

View File

@ -70,8 +70,6 @@ SourceFiles
#include "pointField.H"
#include "Tuple2.H"
#include "pointIndexHit.H"
#include "mapDistribute.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -80,6 +78,7 @@ namespace Foam
class polyPatch;
class polyMesh;
class mapDistribute;
/*---------------------------------------------------------------------------*\
Class directMappedPatchBase Declaration
@ -106,6 +105,34 @@ public:
NORMAL // use face normal + distance
};
//- Helper class for finding nearest
// - point+local index
// - sqr(distance)
// - processor
typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo;
class nearestEqOp
{
public:
void operator()(nearInfo& x, const nearInfo& y) const
{
if (y.first().hit())
{
if (!x.first().hit())
{
x = y;
}
else if (y.second().first() < x.second().first())
{
x = y;
}
}
}
};
private:
// Private data

View File

@ -192,15 +192,19 @@ Foam::treeBoundBox::treeBoundBox(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::pointField Foam::treeBoundBox::points() const
Foam::tmp<Foam::pointField> Foam::treeBoundBox::points() const
{
pointField points(8);
tmp<pointField> tPts = tmp<pointField>(new pointField(8));
pointField& points = tPts();
forAll(points, octant)
{
points[octant] = corner(octant);
}
return points;
return tPts;
}

View File

@ -191,7 +191,7 @@ public:
inline scalar typDim() const;
//- vertex coordinates. In octant coding.
pointField points() const;
tmp<pointField> points() const;
// Check

View File

@ -25,10 +25,10 @@ License
#include "patchProbes.H"
#include "volFields.H"
#include "dictionary.H"
#include "Time.H"
#include "IOmanip.H"
#include "directMappedPatchBase.C"
// For 'nearInfo' helper class only
#include "directMappedPatchBase.H"
#include "meshSearch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -41,11 +41,10 @@ namespace Foam
void Foam::patchProbes::findElements(const fvMesh& mesh)
{
elementList_.clear();
elementList_.setSize(size());
// All the info for nearest. Construct to miss
List<nearInfo> nearest(this->size());
List<directMappedPatchBase::nearInfo> nearest(this->size());
// Octree based search engine
meshSearch meshSearchEngine(mesh, false);
@ -75,7 +74,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
// Find nearest.
Pstream::listCombineGather(nearest, nearestEqOp());
Pstream::listCombineGather(nearest, directMappedPatchBase::nearestEqOp());
Pstream::listCombineScatter(nearest);
if (debug)
@ -118,7 +117,6 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::patchProbes::patchProbes

View File

@ -37,11 +37,6 @@ SourceFiles
#ifndef patchProbes_H
#define patchProbes_H
#include "HashPtrTable.H"
#include "OFstream.H"
#include "polyMesh.H"
#include "pointField.H"
#include "volFieldsFwd.H"
#include "probes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -118,6 +118,8 @@ void Foam::faceOnlySet::calcSamples
const vector smallVec = tol*offset;
const scalar smallDist = mag(smallVec);
// Force calculation of minimum-tet decomposition.
(void) mesh().tetBasePtIs();
// Get all boundary intersections
List<pointIndexHit> bHits = searchEngine().intersections

View File

@ -53,7 +53,7 @@ void Foam::midPointSet::genSamples()
label sampleI = 0;
while(true)
while(true && size()>0)
{
// calculate midpoint between sampleI and sampleI+1 (if in same segment)
while

View File

@ -55,7 +55,7 @@ void Foam::midPointAndFaceSet::genSamples()
label sampleI = 0;
while(true)
while(true && size()>0)
{
// sampleI is start of segment

View File

@ -159,6 +159,9 @@ void Foam::polyLineSet::calcSamples
oldPoint = sampleCoords_[sampleI];
}
// Force calculation of minimum-tet decomposition.
(void) mesh().tetBasePtIs();
// current segment number
label segmentI = 0;

View File

@ -96,6 +96,14 @@ void Foam::sampledSets::combineSampledSets
)
);
if (Pstream::master() && allCurveDist.size() == 0)
{
WarningIn("sampledSets::combineSampledSets(..)")
<< "Sample set " << samplePts.name()
<< " has zero points." << endl;
}
// Sort curveDist and use to fill masterSamplePts
SortableList<scalar> sortedDist(allCurveDist);
indexSets[setI] = sortedDist.indices();
@ -226,17 +234,8 @@ void Foam::sampledSets::read(const dictionary& dict)
dict_.lookup("fields") >> fieldSelection_;
clearFieldGroups();
interpolationScheme_ = dict.lookupOrDefault<word>
(
"interpolationScheme",
"cell"
);
writeFormat_ = dict.lookupOrDefault<word>
(
"setFormat",
"null"
);
dict.lookup("interpolationScheme") >> interpolationScheme_;
dict.lookup("setFormat") >> writeFormat_;
PtrList<sampledSet> newList
(

View File

@ -236,6 +236,9 @@ void Foam::uniformSet::calcSamples
const vector smallVec = tol*offset;
const scalar smallDist = mag(smallVec);
// Force calculation of minimum-tet decomposition.
(void) mesh().tetBasePtIs();
// Get all boundary intersections
List<pointIndexHit> bHits = searchEngine().intersections
(

View File

@ -76,7 +76,7 @@ Foam::sampledPatchInternalField::interpolateField
// Send back sample points to processor that holds the cell.
// Mark cells with point::max so we know which ones we need
// to interpolate (since expensive).
vectorField samples(pp.faceCentres());
vectorField samples(samplePoints());
distMap.reverseDistribute(mesh().nCells(), point::max, samples);
Field<Type> patchVals(mesh().nCells());

View File

@ -220,17 +220,8 @@ void Foam::sampledSurfaces::read(const dictionary& dict)
dict.lookup("fields") >> fieldSelection_;
clearFieldGroups();
interpolationScheme_ = dict.lookupOrDefault<word>
(
"interpolationScheme",
"cell"
);
writeFormat_ = dict.lookupOrDefault<word>
(
"surfaceFormat",
"null"
);
dict.lookup("interpolationScheme") >> interpolationScheme_;
dict.lookup("surfaceFormat") >> writeFormat_;
// define the generic (geometry) writer
genericFormatter_ = surfaceWriter<bool>::New(writeFormat_);

View File

@ -5,8 +5,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \

View File

@ -3,11 +3,12 @@ cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso specie
wmake libso solid
wmake libso thermophysicalFunctions
wmake libso liquids
wmake libso liquidMixture
wmake libso solids
wmake libso solidMixture
wmake libso pointSolids
wmake libso pointSolidMixture
wmake libso basic
wmake libso reactionThermo

View File

@ -4,8 +4,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude
LIB_LIBS = \

View File

@ -72,7 +72,7 @@ Foam::SLGThermo::SLGThermo(const fvMesh& mesh, basicThermo& thermo)
if (thermo.found("solids"))
{
solids_ = solidMixture::New(thermo.subDict("solids"));
solids_ = pointSolidMixture::New(thermo.subDict("solids"));
Info<< " solids - " << solids_->components().size()
<< " components" << endl;
}
@ -128,13 +128,13 @@ const Foam::liquidMixture& Foam::SLGThermo::liquids() const
}
const Foam::solidMixture& Foam::SLGThermo::solids() const
const Foam::pointSolidMixture& Foam::SLGThermo::solids() const
{
if (!solids_.valid())
{
FatalErrorIn
(
"const Foam::solidMixture& Foam::SLGThermo::solids() const"
"const Foam::pointSolidtMixture& Foam::SLGThermo::solids() const"
) << "solids requested, but object is not allocated"
<< abort(FatalError);
}

View File

@ -49,7 +49,7 @@ SourceFiles
#include "basicThermo.H"
#include "basicMultiComponentMixture.H"
#include "liquidMixture.H"
#include "solidMixture.H"
#include "pointSolidMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -76,7 +76,7 @@ class SLGThermo
autoPtr<liquidMixture> liquids_;
//- Additional solid properties data
autoPtr<solidMixture> solids_;
autoPtr<pointSolidMixture> solids_;
public:
@ -108,7 +108,7 @@ public:
const liquidMixture& liquids() const;
//- Return reference to the global (additional) solids
const solidMixture& solids() const;
const pointSolidMixture& solids() const;
// Index retrieval

View File

@ -1,7 +1,13 @@
constSolidThermo/constSolidThermo.C
directionalSolidThermo/directionalSolidThermo.C
basicSolidThermo/basicSolidThermo.C
basicSolidThermo/basicSolidThermoNew.C
constSolidThermo/constSolidThermo.C
directionalKSolidThermo/directionalKSolidThermo.C
interpolatedSolidThermo/interpolatedSolidThermo.C
interpolatedSolidThermo/interpolateSolid/interpolateSolid.C
isotropicKSolidThermo/isotropicKSolidThermo.C
solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.C
solidMixtureThermo/solidMixtureThermo/solidMixtureThermos.C
LIB = $(FOAM_LIBBIN)/libbasicSolidThermo

View File

@ -1,7 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solid/lnInclude
LIB_LIBS = \
-lmeshTools \
-lfiniteVolume
-lfiniteVolume \
-lsolid

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,10 +23,11 @@ License
\*---------------------------------------------------------------------------*/
#include "basicSolidThermo.H"
#include "fvMesh.H"
#include "HashTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
namespace Foam
{
@ -34,6 +35,7 @@ namespace Foam
defineRunTimeSelectionTable(basicSolidThermo, mesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh)
@ -45,7 +47,7 @@ Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh)
"solidThermophysicalProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
@ -61,7 +63,60 @@ Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh)
IOobject::AUTO_WRITE
),
mesh
),
rho_
(
IOobject
(
"rho",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimMass/dimVolume
),
kappa_
(
IOobject
(
"kappa",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless/dimLength
),
sigmaS_
(
IOobject
(
"sigmaS",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless/dimLength
),
emissivity_
(
IOobject
(
"emissivity",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless
)
{}
@ -73,6 +128,117 @@ Foam::basicSolidThermo::~basicSolidThermo()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::volScalarField& Foam::basicSolidThermo::T()
{
return T_;
}
const Foam::volScalarField& Foam::basicSolidThermo::T() const
{
return T_;
}
const Foam::volScalarField& Foam::basicSolidThermo::rho() const
{
return rho_;
}
Foam::volScalarField& Foam::basicSolidThermo::rho()
{
return rho_;
}
const Foam::volScalarField& Foam::basicSolidThermo::kappa() const
{
return kappa_;
}
const Foam::volScalarField& Foam::basicSolidThermo::sigmaS() const
{
return sigmaS_;
}
const Foam::volScalarField& Foam::basicSolidThermo::emissivity() const
{
return emissivity_;
}
const Foam::volScalarField& Foam::basicSolidThermo::K() const
{
notImplemented("basicSolidThermo::K()");
return volScalarField::null();
}
const Foam::volSymmTensorField& Foam::basicSolidThermo::directionalK() const
{
notImplemented("basicSolidThermo::directionalK()");
return const_cast<volSymmTensorField&>(volSymmTensorField::null());
}
Foam::basicSolidMixture& Foam::basicSolidThermo::composition()
{
notImplemented("basicSolidThermo::composition()");
return *reinterpret_cast<basicSolidMixture*>(0);
}
const Foam::basicSolidMixture& Foam::basicSolidThermo::composition() const
{
notImplemented("basicSolidThermo::composition() const");
return *reinterpret_cast<const basicSolidMixture*>(0);
}
Foam::tmp<Foam::volScalarField> Foam::basicSolidThermo::hs() const
{
notImplemented("basicSolidThermo::hs()");
return volScalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicSolidThermo::hs(const label patchI)
const
{
notImplemented("basicSolidThermo::hs(const label)");
return scalarField::null();
}
Foam::tmp<Foam::scalarField> Foam::basicSolidThermo::K
(
const label patchI
)const
{
notImplemented("basicSolidThermo::K(const label)");
return scalarField::null();
}
Foam::tmp<Foam::symmTensorField> Foam::basicSolidThermo::directionalK
(
const label
)const
{
notImplemented("basicSolidThermo::directionalK(const label)");
return symmTensorField::null();
}
bool Foam::basicSolidThermo::read()
{
return regIOobject::read();
}
bool Foam::basicSolidThermo::writeData(Ostream& os) const
{
return true;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,20 +25,24 @@ Class
Foam::basicSolidThermo
Description
The thermophysical properties of a basicSolidThermo
Basic solid thermodynamic properties
SourceFiles
basicSolidThermo.C
newBasicSolidThermo.C
newBasicThermo.C
\*---------------------------------------------------------------------------*/
#ifndef basicSolidThermo_H
#define basicSolidThermo_H
#include "runTimeSelectionTables.H"
#include "volFields.H"
#include "runTimeSelectionTables.H"
#include "fvMesh.H"
#include "IOdictionary.H"
#include "autoPtr.H"
#include "basicSolidMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -46,21 +50,36 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicSolidThermo Declaration
Class basicSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class basicSolidThermo
:
public IOdictionary
{
protected:
// Protected data
const fvMesh& mesh_;
//- Temperature [K]
volScalarField T_;
// Fields
//- Temperature [K]
volScalarField T_;
//- Density [kg/m3]
volScalarField rho_;
//- Absorption coefficient [1/m]
volScalarField kappa_;
//- Scatter coeffcient [1/m]
volScalarField sigmaS_;
//- Emissivity coeffcient []
volScalarField emissivity_;
public:
@ -68,8 +87,7 @@ public:
//- Runtime type information
TypeName("basicSolidThermo");
//- Declare run-time constructor selection tables
// Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
@ -94,97 +112,102 @@ public:
virtual ~basicSolidThermo();
// Member Functions
// Member functions
//- Update properties
virtual void correct() = 0;
//- Return the composition of the solid mixture
virtual basicSolidMixture& composition();
// Physical constants which define the basicSolidThermo
//- Return the composition of the solid mixture
virtual const basicSolidMixture& composition() const;
// Access to thermodynamic state variables
//- Density [kg/m^3]
const volScalarField& rho() const;
//- Thermal conductivity [W/m/K]
virtual const volScalarField& K() const;
//- Thermal conductivity [W/m/K]
virtual const volSymmTensorField& directionalK() const;
//- Absorption coefficient [1/m]
const volScalarField& kappa() const;
//- Emissivity coefficient
const volScalarField& sigmaS() const;
//- Emissivity coefficient [1/m]
const volScalarField& emissivity() const;
//- Temperature [K]
inline const volScalarField& T() const;
const volScalarField& T() const;
//- Temperature [K]
inline volScalarField& T();
//- non-const access for T
volScalarField& T();
//- Density [kg/m3]
virtual tmp<volScalarField> rho() const = 0;
//- non-const access for rho
volScalarField& rho();
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> cp() const = 0;
//- Thermal conductivity [W/(m.K)]
virtual tmp<volScalarField> K() const = 0;
// Derived thermal properties
//- Thermal conductivity [W/(m.K)]
virtual tmp<volSymmTensorField> directionalK() const = 0;
//- Specific heat capacity [J/kg/K]
virtual tmp<volScalarField> Cp() const = 0;
//- Heat of formation [J/kg]
//- Sensible enthalpy [J/kg]
virtual tmp<volScalarField> hs() const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() 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;
//- Sensible enthalpy [J/kg]
virtual tmp<scalarField> hs(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) const;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) const = 0;
//- Scatter coefficient [1/m]
virtual tmp<scalarField> sigmaS(const label) const = 0;
//- Absorption coefficient [1/m]
virtual tmp<scalarField> kappa(const label) const = 0;
//- Emissivity []
virtual tmp<volScalarField> emissivity() const = 0;
virtual tmp<scalarField> emissivity(const label) const = 0;
// I-O
// Per patch calculation
//- Write the basicSolidThermo properties
virtual bool writeData(Ostream& os) const = 0;
//- 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
//- Read thermophysicalProperties dictionary
virtual bool read() = 0;
//- Ostream Operator
friend Ostream& operator<<(Ostream& os, const basicSolidThermo& s);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "basicSolidThermoI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

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

View File

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

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,14 +40,39 @@ namespace Foam
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)
dict_(subDict(typeName + "Coeffs")),
constK_(dimensionedScalar(dict_.lookup("K"))),
K_
(
IOobject
(
"K",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
constK_
),
constRho_(dimensionedScalar(dict_.lookup("rho"))),
constCp_(dimensionedScalar(dict_.lookup("Cp"))),
constHf_(dimensionedScalar(dict_.lookup("Hf"))),
constEmissivity_(dimensionedScalar(dict_.lookup("emissivity"))),
constKappa_(dimensionedScalar(dict_.lookup("kappa"))),
constSigmaS_(dimensionedScalar(dict_.lookup("sigmaS")))
{
read();
correct();
K_ = constK_;
rho_ = constRho_;
emissivity_ = constEmissivity_;
kappa_ = constKappa_;
sigmaS_ = constSigmaS_;
}
@ -63,7 +88,7 @@ void Foam::constSolidThermo::correct()
{}
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::rho() const
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::Cp() const
{
return tmp<volScalarField>
(
@ -71,28 +96,7 @@ Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::rho() const
(
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",
"Cp",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
@ -105,79 +109,13 @@ Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::cp() const
}
//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
const 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_
)
);
return K_;
}
//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
const Foam::volSymmTensorField& Foam::constSolidThermo::directionalK() const
{
dimensionedSymmTensor t
(
@ -233,27 +171,6 @@ Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::Hf() const
}
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
@ -270,7 +187,7 @@ Foam::tmp<Foam::scalarField> Foam::constSolidThermo::rho
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::cp
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Cp
(
const label patchI
) const
@ -359,6 +276,38 @@ Foam::tmp<Foam::scalarField> Foam::constSolidThermo::emissivity
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::kappa
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constKappa_.value()
)
);
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::sigmaS
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constSigmaS_.value()
)
);
}
bool Foam::constSolidThermo::read()
{
return read(subDict(typeName + "Coeffs"));
@ -368,17 +317,21 @@ bool Foam::constSolidThermo::read()
bool Foam::constSolidThermo::read(const dictionary& dict)
{
constRho_ = dimensionedScalar(dict.lookup("rho"));
constCp_ = dimensionedScalar(dict.lookup("cp"));
constCp_ = dimensionedScalar(dict.lookup("Cp"));
constK_ = dimensionedScalar(dict.lookup("K"));
constHf_ = dimensionedScalar(dict.lookup("Hf"));
constEmissivity_ = dimensionedScalar(dict.lookup("emissivity"));
constKappa_ = dimensionedScalar(dict_.lookup("kappa"));
constSigmaS_ = dimensionedScalar(dict_.lookup("sigmaS"));
Info<< "Constructed constSolidThermo with" << nl
<< " rho : " << constRho_ << nl
<< " cp : " << constCp_ << nl
<< " Cp : " << constCp_ << nl
<< " K : " << constK_ << nl
<< " Hf : " << constHf_ << nl
<< " emissivity : " << constEmissivity_ << nl
<< " kappa : " << constKappa_ << nl
<< " sigmaS : " << constSigmaS_ << nl
<< endl;
return true;
@ -389,9 +342,11 @@ 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("Cp") << constCp_ << token::END_STATEMENT << nl;
os.writeKeyword("K") << constK_ << token::END_STATEMENT << nl;
os.writeKeyword("Hf") << constHf_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << constKappa_ << token::END_STATEMENT << nl;
os.writeKeyword("sigmaS") << constSigmaS_ << token::END_STATEMENT << nl;
os.writeKeyword("emissivity") << constEmissivity_ << token::END_STATEMENT
<< nl;
return ok && os.good();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,29 +43,45 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class constSolidThermo Declaration
Class constSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class constSolidThermo
:
public basicSolidThermo
{
private:
// Private data
//- Dictionary
dictionary dict_;
//- Constant thermal conductivity [W/(m.K)]
dimensionedScalar constK_;
//- Thermal conductivity field[W/(m.K)]
volScalarField K_;
//- 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_;
//- Absorptivity [1/m]
dimensionedScalar constKappa_;
//- Scatter [1/m]
dimensionedScalar constSigmaS_;
public:
//- Runtime type information
@ -77,9 +93,8 @@ public:
//- Construct from mesh
constSolidThermo(const fvMesh& mesh);
// Destructor
virtual ~constSolidThermo();
//- Destructor
virtual ~constSolidThermo();
// Member Functions
@ -87,24 +102,23 @@ public:
//- Update properties
virtual void correct();
//- Density [kg/m3]
virtual tmp<volScalarField> rho() const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> cp() const;
// Acces functions
//- Constant access to K
virtual const volScalarField& K() const;
//- Thermal conductivity [W/(m.K)]
// Note: needs supplied K to be isotropic
virtual tmp<volScalarField> K() const;
virtual const volSymmTensorField& directionalK() const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<volSymmTensorField> directionalK() const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
// Derived properties
//- Emissivity []
virtual tmp<volScalarField> emissivity() const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> Cp() const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
// Per patch calculation
@ -112,19 +126,25 @@ public:
//- 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;
//- Specific heat capacity [J/kg/K)]
virtual tmp<scalarField> Cp(const label patchI) const;
//- Thermal conductivity [W/(m.K)]
//- 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;
//- Thermal conductivity [W//m/K]
virtual tmp<symmTensorField>directionalK(const label) const;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) const;
//- Emissivity []
//- Scatter coefficient [1/m]
virtual tmp<scalarField> sigmaS(const label) const;
//- Absorption coefficient [1/m]
virtual tmp<scalarField> kappa(const label) const;
//- Emissivity []
virtual tmp<scalarField> emissivity(const label) const;
@ -139,11 +159,8 @@ public:
//- Read solidThermophysicalProperties dictionary
bool read(const dictionary&);
// Ostream Operator
friend Ostream& operator<<(Ostream& os, const constSolidThermo& s);
//- Ostream Operator
friend Ostream& operator<<(Ostream& os, const constSolidThermo& s);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,9 +23,8 @@ License
\*---------------------------------------------------------------------------*/
#include "directionalSolidThermo.H"
#include "directionalKSolidThermo.H"
#include "addToRunTimeSelectionTable.H"
#include "interpolateXY.H"
#include "transform.H"
#include "transformField.H"
@ -33,11 +32,11 @@ License
namespace Foam
{
defineTypeNameAndDebug(directionalSolidThermo, 0);
defineTypeNameAndDebug(directionalKSolidThermo, 0);
addToRunTimeSelectionTable
(
basicSolidThermo,
directionalSolidThermo,
directionalKSolidThermo,
mesh
);
}
@ -45,9 +44,22 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::directionalSolidThermo::directionalSolidThermo(const fvMesh& mesh)
Foam::directionalKSolidThermo::directionalKSolidThermo(const fvMesh& mesh)
:
basicSolidThermo(mesh),
interpolatedSolidThermo(mesh, typeName + "Coeffs"),
directionalK_
(
IOobject
(
"K",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/dimTime/(dimLength*dimTemperature)
),
ccTransforms_
(
IOobject
@ -62,7 +74,7 @@ Foam::directionalSolidThermo::directionalSolidThermo(const fvMesh& mesh)
dimLength
)
{
read();
KValues_ = Field<vector>(subDict(typeName + "Coeffs").lookup("KValues"));
// Determine transforms for cell centres
forAll(mesh.C(), cellI)
@ -110,7 +122,7 @@ Foam::directionalSolidThermo::directionalSolidThermo(const fvMesh& mesh)
if (debug)
{
Info<< "directionalSolidThermo : dumping converted Kxx, Kyy, Kzz"
Info<< "directionalKSolidThermo : dumping converted Kxx, Kyy, Kzz"
<< endl;
{
volVectorField Kxx
@ -234,13 +246,13 @@ Foam::directionalSolidThermo::directionalSolidThermo(const fvMesh& mesh)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::directionalSolidThermo::~directionalSolidThermo()
Foam::directionalKSolidThermo::~directionalKSolidThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::symmTensor Foam::directionalSolidThermo::transformPrincipal
Foam::symmTensor Foam::directionalKSolidThermo::transformPrincipal
(
const tensor& tt,
const vector& st
@ -275,7 +287,7 @@ Foam::symmTensor Foam::directionalSolidThermo::transformPrincipal
}
void Foam::directionalSolidThermo::transformField
void Foam::directionalKSolidThermo::transformField
(
symmTensorField& fld,
const tensorField& tt,
@ -290,104 +302,23 @@ void Foam::directionalSolidThermo::transformField
}
void Foam::directionalSolidThermo::correct()
{}
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::rho() const
void Foam::directionalKSolidThermo::correct()
{
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;
calculate();
interpolatedSolidThermo::calculate();
}
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::cp() const
const Foam::volSymmTensorField&
Foam::directionalKSolidThermo::directionalK() 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;
return directionalK_;
}
Foam::tmp<Foam::volSymmTensorField> Foam::directionalSolidThermo::directionalK()
const
void Foam::directionalKSolidThermo::calculate()
{
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)
// Correct directionalK
Field<vector> localK
(
interpolateXY
@ -399,18 +330,21 @@ const
);
// Transform into global coordinate system
transformField(K.internalField(), ccTransforms_.internalField(), localK);
transformField
(
directionalK_.internalField(),
ccTransforms_.internalField(),
localK
);
forAll(K.boundaryField(), patchI)
forAll(directionalK_.boundaryField(), patchI)
{
K.boundaryField()[patchI] == this->directionalK(patchI)();
directionalK_.boundaryField()[patchI] == this->directionalK(patchI)();
}
return tK;
}
Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::K() const
const Foam::volScalarField& Foam::directionalKSolidThermo::K() const
{
forAll(KValues_, i)
{
@ -422,7 +356,7 @@ Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::K() const
|| v.y() != v.z()
)
{
FatalErrorIn("directionalSolidThermo::K() const")
FatalErrorIn("directionalKSolidThermo::K() const")
<< "Supplied K values " << KValues_
<< " are not isotropic." << exit(FatalError);
}
@ -473,119 +407,7 @@ Foam::tmp<Foam::volScalarField> Foam::directionalSolidThermo::K() const
}
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
Foam::tmp<Foam::scalarField> Foam::directionalKSolidThermo::K
(
const label patchI
) const
@ -600,7 +422,7 @@ Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::K
|| v.y() != v.z()
)
{
FatalErrorIn("directionalSolidThermo::K() const")
FatalErrorIn("directionalKSolidThermo::K() const")
<< "Supplied K values " << KValues_
<< " are not isotropic." << exit(FatalError);
}
@ -621,7 +443,7 @@ Foam::tmp<Foam::scalarField> Foam::directionalSolidThermo::K
}
Foam::tmp<Foam::symmTensorField> Foam::directionalSolidThermo::directionalK
Foam::tmp<Foam::symmTensorField> Foam::directionalKSolidThermo::directionalK
(
const label patchI
) const
@ -637,123 +459,31 @@ Foam::tmp<Foam::symmTensorField> Foam::directionalSolidThermo::directionalK
}
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()
bool Foam::directionalKSolidThermo::read()
{
return read(subDict(typeName + "Coeffs"));
}
bool Foam::directionalSolidThermo::read(const dictionary& dict)
bool Foam::directionalKSolidThermo::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);
}
}
KValues_ = Field<vector>(subDict(typeName + "Coeffs").lookup("KValues"));
return true;
}
bool Foam::directionalSolidThermo::writeData(Ostream& os) const
bool Foam::directionalKSolidThermo::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;
bool ok = interpolatedSolidThermo::writeData(os);
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)
Foam::Ostream& Foam::operator<<(Ostream& os, const directionalKSolidThermo& s)
{
s.writeData(os);
return os;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,21 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::directionalSolidThermo
Foam::directionalKSolidThermo
Description
Directional conductivity + table interpolation.
SourceFiles
directionalSolidThermo.C
directionalKSolidThermo.C
\*---------------------------------------------------------------------------*/
#ifndef directionalSolidThermo_H
#define directionalSolidThermo_H
#ifndef directionalKSolidThermo_H
#define directionalKSolidThermo_H
#include "basicSolidThermo.H"
#include "coordinateSystem.H"
#include "interpolatedSolidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,29 +44,21 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directionalSolidThermo Declaration
Class directionalKSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class directionalSolidThermo
class directionalKSolidThermo
:
public basicSolidThermo
public interpolatedSolidThermo
{
// Private data
//- Temperature samples
Field<scalar> TValues_;
//- Density at given temperatures
Field<scalar> rhoValues_;
Field<scalar> cpValues_;
//- Thermal conductivity [W/(m.K)]
volSymmTensorField directionalK_;
//- Thermal conductivity vector
Field<vector> KValues_;
Field<scalar> HfValues_;
Field<scalar> emissivityValues_;
//- Coordinate system used for the directional properties
coordinateSystem coordSys_;
@ -77,7 +69,11 @@ class directionalSolidThermo
// Private Member Functions
//- Transform principal values of symmTensor
symmTensor transformPrincipal(const tensor& tt, const vector& st) const;
symmTensor transformPrincipal
(
const tensor& tt,
const vector& st
) const;
//- Transform principal values of symmTensor
void transformField
@ -87,21 +83,24 @@ class directionalSolidThermo
const vectorField& st
) const;
//- Calculate properties
void calculate();
public:
//- Runtime type information
TypeName("directionalSolidThermo");
TypeName("directionalKSolidThermo");
// Constructors
//- Construct from mesh
directionalSolidThermo(const fvMesh& mesh);
directionalKSolidThermo(const fvMesh& mesh);
// Destructor
virtual ~directionalSolidThermo();
//- Destructor
virtual ~directionalKSolidThermo();
// Member Functions
@ -109,66 +108,40 @@ public:
//- Update properties
virtual void correct();
//- Density [kg/m3]
virtual tmp<volScalarField> rho() const;
//- Access functions
//- 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;
//- Thermal conductivity [W/(m.K)]
virtual const volSymmTensorField& directionalK() const;
//- Iostropic thermal conductivity [W/(m.K)]
virtual const volScalarField& K() 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
//- 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;
//- Thermal conductivity [W//m/K]
virtual tmp<symmTensorField> directionalK(const label) const;
// I-O
//- Write the directionalSolidThermo properties
//- Write the directionalKSolidThermo properties
virtual bool writeData(Ostream& os) const;
//- Read the directionalSolidThermo properties
//- Read the directionalKSolidThermo properties
virtual bool read();
//- Read the directionalSolidThermo properties
//- Read the directionalKSolidThermo properties
bool read(const dictionary& dict);
// Ostream Operator
friend Ostream& operator<<
(
Ostream& os,
const directionalSolidThermo& s
);
//- Ostream Operator
friend Ostream& operator<<
(
Ostream& os,
const directionalKSolidThermo& s
);
};

View File

@ -0,0 +1,112 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "interpolateSolid.H"
#include "interpolateXY.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::interpolateSolid::interpolateSolid(const dictionary& dict)
{
read(dict);
Info<< "Constructed directionalKSolidThermo with samples" << nl
<< " T : " << TValues_ << nl
<< " rho : " << rhoValues_ << nl
<< " cp : " << cpValues_ << nl
<< " Hf : " << HfValues_ << nl
<< " emissivity : " << emissivityValues_ << nl
<< " kappa : " << kappaValues_ << nl
<< " sigmaS : " << sigmaSValues_ << nl
<< endl;
if
(
(TValues_.size() != rhoValues_.size())
&& (TValues_.size() != cpValues_.size())
&& (TValues_.size() != rhoValues_.size())
&& (TValues_.size() != HfValues_.size())
&& (TValues_.size() != emissivityValues_.size())
)
{
FatalIOErrorIn("interpolateSolid::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("interpolateSolid::read()", dict)
<< "Temperature values are not in increasing order "
<< TValues_ << exit(FatalIOError);
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::interpolateSolid::~interpolateSolid()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::interpolateSolid::writeData(Ostream& os) const
{
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("HfValues") << HfValues_ << token::END_STATEMENT << nl;
os.writeKeyword("emissivityValues") << emissivityValues_ << nl;
os.writeKeyword("kappaValues") << kappaValues_ << nl;
os.writeKeyword("sigmaSValues") << sigmaSValues_
<< token::END_STATEMENT << nl;
return os.good();
}
bool Foam::interpolateSolid::read(const dictionary& dict)
{
TValues_ = Field<scalar>(dict.lookup("TValues"));
rhoValues_ = Field<scalar>(dict.lookup("rhoValues"));
cpValues_ = Field<scalar>(dict.lookup("cpValues"));
kappaValues_ = Field<scalar>(dict.lookup("kappaValues"));
sigmaSValues_ = Field<scalar>(dict.lookup("sigmaSValues"));
HfValues_ = Field<scalar>(dict.lookup("HfValues"));
emissivityValues_ = Field<scalar>(dict.lookup("emissivityValues"));
sigmaSValues_ = Field<scalar>(dict.lookup("sigmaSValues"));
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::interpolateSolid
Description
Helping class for T-interpolated solid thermo.
SourceFiles
interpolateSolid.C
\*---------------------------------------------------------------------------*/
#ifndef interpolateSolid_H
#define interpolateSolid_H
#include "volFields.H"
#include "dictionary.H"
#include "interpolateXY.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class interpolateSolid Declaration
\*---------------------------------------------------------------------------*/
class interpolateSolid
{
protected:
// Protected data
Field<scalar> TValues_;
Field<scalar> rhoValues_;
Field<scalar> cpValues_;
Field<scalar> HfValues_;
Field<scalar> emissivityValues_;
Field<scalar> kappaValues_;
Field<scalar> sigmaSValues_;
public:
// Constructors
//- Construct from mesh
interpolateSolid(const dictionary&);
//- Destructor
virtual ~interpolateSolid();
// Member Functions
// I-O
//- Read the interpolateSolid properties
bool read(const dictionary& dict);
//- Write the interpolateSolid properties
bool writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,28 +27,20 @@ License
#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)
Foam::interpolatedSolidThermo::interpolatedSolidThermo
(
const fvMesh& mesh,
const word dictName
)
:
basicSolidThermo(mesh)
basicSolidThermo(mesh),
interpolateSolid(subDict(dictName)),
dict_(subDict(dictName))
{
read();
correct();
calculate();
}
@ -60,55 +52,73 @@ Foam::interpolatedSolidThermo::~interpolatedSolidThermo()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::interpolatedSolidThermo::correct()
{}
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::rho() const
void Foam::interpolatedSolidThermo::calculate()
{
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
// Correct rho
rho_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
rhoValues_
);
forAll(rho.boundaryField(), patchI)
forAll(rho_.boundaryField(), patchI)
{
rho.boundaryField()[patchI] == this->rho(patchI)();
rho_.boundaryField()[patchI] == this->rho(patchI)();
}
return trho;
// Correct emissivity
emissivity_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
emissivityValues_
);
forAll(emissivity_.boundaryField(), patchI)
{
emissivity_.boundaryField()[patchI] == this->emissivity(patchI)();
}
// Correct absorptivity
kappa_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
kappaValues_
);
forAll(kappa_.boundaryField(), patchI)
{
kappa_.boundaryField()[patchI] == this->kappa(patchI)();
}
// Correct scatter
sigmaS_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
sigmaSValues_
);
forAll(sigmaS_.boundaryField(), patchI)
{
sigmaS_.boundaryField()[patchI] == this->sigmaS(patchI)();
}
}
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::cp() const
Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::Cp() const
{
tmp<volScalarField> tcp
tmp<volScalarField> tCp
(
new volScalarField
(
IOobject
(
"cp",
"Cp",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
@ -118,107 +128,21 @@ Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::cp() const
dimEnergy/(dimMass*dimTemperature)
)
);
volScalarField& cp = tcp();
volScalarField& Cp = tCp();
cp.internalField() = interpolateXY
Cp.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
cpValues_
);
forAll(cp.boundaryField(), patchI)
forAll(Cp.boundaryField(), patchI)
{
cp.boundaryField()[patchI] == this->cp(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;
return tCp;
}
@ -258,43 +182,6 @@ Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::Hf() const
}
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
@ -315,7 +202,7 @@ Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::rho
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::cp
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::Cp
(
const label patchI
) const
@ -335,53 +222,6 @@ Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::cp
}
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
@ -422,69 +262,63 @@ Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::emissivity
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::kappa
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
kappaValues_
)
)
);
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::sigmaS
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
sigmaSValues_
)
)
);
}
bool Foam::interpolatedSolidThermo::read()
{
return read(subDict(typeName + "Coeffs"));
return read(dict_);
}
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 ok = interpolateSolid::read(dict);
return ok;
}
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;
ok = interpolateSolid::writeData(os);
return ok && os.good();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::interpolatedSolidThermo
Description
Table interpolated solid thermo.
Table interpolated solid thermo
SourceFiles
interpolatedSolidThermo.C
@ -36,6 +36,7 @@ SourceFiles
#define interpolatedSolidThermo_H
#include "basicSolidThermo.H"
#include "interpolateSolid.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,67 +44,47 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class interpolatedSolidThermo Declaration
Class interpolatedSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class interpolatedSolidThermo
:
public basicSolidThermo
public basicSolidThermo,
public interpolateSolid
{
private:
// Private data
//- Temperature samples
Field<scalar> TValues_;
//- Dictionary
const dictionary dict_;
//- 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);
interpolatedSolidThermo(const fvMesh& mesh, const word);
// Destructor
virtual ~interpolatedSolidThermo();
//- Destructor
virtual ~interpolatedSolidThermo();
// Member Functions
//- Update properties
virtual void correct();
//- Calculate properties
void calculate();
//- Density [kg/m3]
virtual tmp<volScalarField> rho() const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> cp() const;
// Derived properties
//- Thermal conductivity [W/(m.K)]
virtual tmp<volScalarField> K() const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> Cp() 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;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
// Per patch calculation
@ -111,20 +92,19 @@ public:
//- 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;
//- Specific heat capacity [J/kg/K)]
virtual tmp<scalarField> Cp(const label patchI) const;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) const;
//- Emissivity []
//- Scatter coefficient [1/m]
virtual tmp<scalarField> sigmaS(const label) const;
//- Absorption coefficient [1/m]
virtual tmp<scalarField> kappa(const label) const;
//- Emissivity []
virtual tmp<scalarField> emissivity(const label) const;
@ -139,14 +119,12 @@ public:
//- Read the interpolatedSolidThermo properties
bool read(const dictionary& dict);
// Ostream Operator
friend Ostream& operator<<
(
Ostream& os,
const interpolatedSolidThermo& s
);
//- Ostream Operator
friend Ostream& operator<<
(
Ostream& os,
const interpolatedSolidThermo& s
);
};

View File

@ -0,0 +1,129 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "isotropicKSolidThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(isotropicKSolidThermo, 0);
addToRunTimeSelectionTable
(
basicSolidThermo,
isotropicKSolidThermo,
mesh
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::isotropicKSolidThermo::isotropicKSolidThermo(const fvMesh& mesh)
:
interpolatedSolidThermo(mesh, typeName + "Coeffs"),
K_
(
IOobject
(
"K",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimTime/(dimLength*dimTemperature)
),
KValues_ (Field<scalar>(subDict(typeName + "Coeffs").lookup("KValues")))
{
correct();
}
void Foam::isotropicKSolidThermo::correct()
{
// Correct K
K_.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
KValues_
);
forAll(K_.boundaryField(), patchI)
{
K_.boundaryField()[patchI] == this->K(patchI)();
}
interpolatedSolidThermo::calculate();
}
Foam::tmp<Foam::scalarField> Foam::isotropicKSolidThermo::K
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
KValues_
)
)
);
}
bool Foam::isotropicKSolidThermo::read()
{
KValues_ = Field<scalar>(subDict(typeName + "Coeffs").lookup("KValues"));
return true;
}
bool Foam::isotropicKSolidThermo::writeData(Ostream& os) const
{
os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl;
bool ok = interpolatedSolidThermo::writeData(os);
return ok && os.good();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::isotropicKSolidThermo::~isotropicKSolidThermo()
{}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,93 +22,92 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::interpolateSolidThermo
Foam::isotropicKSolidThermo
Description
The thermophysical properties of a interpolateSolidThermo
Directional conductivity + table interpolation.
SourceFiles
interpolateSolidThermo.C
isotropicKSolidThermo.C
\*---------------------------------------------------------------------------*/
#ifndef interpolateSolidThermo_H
#define interpolateSolidThermo_H
#ifndef directionalSolidThermo_H
#define directionalSolidThermo_H
#include "basicSolidThermo.H"
#include "interpolatedSolidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class basicSolidThermo;
Ostream& operator<<
(
Ostream&,
const basicSolidThermo&
);
/*---------------------------------------------------------------------------*\
Class interpolateSolidThermo Declaration
Class isotropicKSolidThermo Declaration
\*---------------------------------------------------------------------------*/
class interpolateSolidThermo
class isotropicKSolidThermo
:
public basicSolidThermo
public interpolatedSolidThermo
{
// Private data
//- Temperature points for which there are values
const Field<scalar> TValues_;
//- Thermal conductivity [W/(m.K)]
volScalarField K_;
//- Density at given temperatures
const Field<scalar> rhoValues_;
//- Thermal conductivity vector
Field<scalar> KValues_;
const Field<scalar> cpValues_;
const Field<symmTensor> KValues_;
const Field<scalar> HfValues_;
const Field<scalar> emissivityValues_;
public:
//- Runtime type information
TypeName("interpolateSolidThermo");
TypeName("isotropicKSolidThermo");
// Constructors
//- Construct from mesh
interpolateSolidThermo(const fvMesh& mesh, const dictionary& dict);
// Destructor
virtual ~interpolateSolidThermo();
isotropicKSolidThermo(const fvMesh& mesh);
// Member Functions
//- Destructor
virtual ~isotropicKSolidThermo();
// Member functions
//- Update properties
virtual void correct();
// Access functions
// I-O
//- Write the interpolateSolidThermo properties
virtual void write(Ostream& os) const;
//- Constant access to K
virtual const volScalarField& K() const
{
return K_;
}
// Ostream Operator
// Per patch calculation
//- Thermal conductivity [W//m/K]
virtual tmp<scalarField> K(const label patchI) const;
// I-O
//- Read solidThermophysicalProperties dictionary
virtual bool read();
//- Write properties
virtual bool writeData(Ostream& os) const;
//- Ostream Operator
friend Ostream& operator<<
(
Ostream& os,
const interpolateSolidThermo& s
const isotropicKSolidThermo& s
);
};

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "basicSolidMixture.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::basicSolidMixture::basicSolidMixture
(
const wordList& solidNames,
const fvMesh& mesh
)
:
components_(solidNames),
Y_(components_.size())
{
forAll(components_, i)
{
IOobject header
(
"Y" + components_[i],
mesh.time().timeName(),
mesh,
IOobject::NO_READ
);
// check if field exists and can be read
if (header.headerOk())
{
Y_.set
(
i,
new volScalarField
(
IOobject
(
"Y" + components_[i],
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
);
}
else
{
volScalarField Ydefault
(
IOobject
(
"Ydefault",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
Y_.set
(
i,
new volScalarField
(
IOobject
(
"Y" + components_[i],
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
Ydefault
)
);
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::basicSolidMixture
Description
Foam::basicSolidMixture
\*---------------------------------------------------------------------------*/
#ifndef basicSolidMixture_H
#define basicSolidMixture_H
#include "volFields.H"
#include "speciesTable.H"
#include "PtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class basicSolidMixture Declaration
\*---------------------------------------------------------------------------*/
class basicSolidMixture
{
protected:
// Protected data
typedef speciesTable solidsTable;
//- The names of the solids
solidsTable components_;
//- Solid mass fractions
PtrList<volScalarField> Y_;
public:
// Constructors
//- Construct from word list and mesh
basicSolidMixture
(
const wordList& solidNames,
const fvMesh&
);
//- Destructor
virtual ~basicSolidMixture()
{}
// Member Functions
//- Return the solid table
const solidsTable& components() const
{
return components_;
}
//- Return the mass-fraction fields
inline PtrList<volScalarField>& Y();
//- Return the const mass-fraction fields
inline const PtrList<volScalarField>& Y() const;
//- Return the mass-fraction field for a specie given by index
inline volScalarField& Y(const label i);
//- Return the const mass-fraction field for a specie given by index
inline const volScalarField& Y(const label i) const;
//- Return the mass-fraction field for a specie given by name
inline volScalarField& Y(const word& specieName);
//- Return the const mass-fraction field for a specie given by name
inline const volScalarField& Y(const word& specieName) const;
//- Does the mixture include this specie?
inline bool contains(const word& specieName) const;
// Derived cell based properties.
//- Density
virtual scalar rho(scalar T, label celli) const = 0;
//- Absorption coefficient
virtual scalar kappa(scalar T, label celli) const = 0;
//- Scatter coefficient
virtual scalar sigmaS(scalar T, label celli) const = 0;
//- Thermal conductivity
virtual scalar K(scalar T, label celli) const = 0;
//- Emissivity coefficient
virtual scalar emissivity(scalar T, label celli) const = 0;
//- Formation enthalpy
virtual scalar hf(scalar T, label celli) const = 0;
//- Sensible enthalpy
virtual scalar hs(scalar T, label celli) const = 0;
//- Total enthalpy
virtual scalar h(scalar T, label celli) const = 0;
//- Specific heat capacity
virtual scalar Cp(scalar T, label celli) const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
# include "basicSolidMixtureI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,250 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "multiComponentSolidMixture.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ThermoSolidType>
void Foam::multiComponentSolidMixture<ThermoSolidType>::correctMassFractions()
{
volScalarField Yt = Y_[0];
for (label n=1; n<Y_.size(); n++)
{
Yt += Y_[n];
}
forAll(Y_, n)
{
Y_[n] /= Yt;
}
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::X
(
label iComp, label celli, scalar T
) const
{
scalar rhoInv = 0.0;
forAll(solidData_, i)
{
rhoInv += Y_[i][celli]/solidData_[i].rho(T);
}
scalar X = Y_[iComp][celli]/solidData_[iComp].rho(T);
return (X/rhoInv);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ThermoSolidType>
Foam::multiComponentSolidMixture<ThermoSolidType>::multiComponentSolidMixture
(
const dictionary& thermoSolidDict,
const fvMesh& mesh
)
:
basicSolidMixture
(
thermoSolidDict.lookup("solidComponents"),
mesh
),
solidData_(components_.size())
{
forAll(components_, i)
{
solidData_.set
(
i,
new ThermoSolidType
(
thermoSolidDict.subDict(components_[i] + "Coeffs")
)
);
}
correctMassFractions();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::rho
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].rho(T)*X(i, celli, T);
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::hf
(
scalar, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].hf()*Y_[i][celli];
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::hs
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].hs(T)*Y_[i][celli];
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::h
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].h(T)*Y_[i][celli];
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::kappa
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].kappa(T)*X(i, celli, T);
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::sigmaS
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].sigmaS(T)*X(i, celli, T);
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::K
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].K(T)*X(i, celli, T);
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::emissivity
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].emissivity(T)*Y_[i][celli];
}
return tmp;
}
template<class ThermoSolidType>
Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::Cp
(
scalar T, label celli
) const
{
scalar tmp = 0.0;
forAll(solidData_, i)
{
tmp += solidData_[i].Cp(T)*Y_[i][celli];
}
return tmp;
}
template<class ThermoSolidType>
void Foam::multiComponentSolidMixture<ThermoSolidType>::read
(
const dictionary& thermoDict
)
{
forAll(components_, i)
{
solidData_[i] =
ThermoSolidType(thermoDict.subDict(components_[i] + "Coeffs"));
}
}
// ************************************************************************* //

View File

@ -0,0 +1,141 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::multiComponentSolidMixture
Description
Foam::multiComponentSolidMixture
\*---------------------------------------------------------------------------*/
#ifndef multiComponentSolidMixture_H
#define multiComponentSolidMixture_H
#include "PtrList.H"
#include "autoPtr.H"
#include "basicSolidMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class multiComponentSolidMixture Declaration
\*---------------------------------------------------------------------------*/
template<class ThermoSolidType>
class multiComponentSolidMixture
:
public basicSolidMixture
{
// Private data
//- Solid data
PtrList<ThermoSolidType> solidData_;
// Private Member Functions
//- Correct the mass fractions to sum to 1
void correctMassFractions();
//- Return molar fraction for component i in celli and at T
scalar X(label i, label celli, scalar T) const;
public:
// Constructors
//- Construct from dictionary and mesh
multiComponentSolidMixture(const dictionary&, const fvMesh&);
//- Destructor
virtual ~multiComponentSolidMixture()
{}
// Member Functions
//- Return the raw solid data
const PtrList<ThermoSolidType>& solidData() const
{
return solidData_;
}
//- Read dictionary
void read(const dictionary&);
// Cell-based properties
//- Density
virtual scalar rho(scalar T, label celli) const;
//- Absorption coefficient
virtual scalar kappa(scalar T, label celli) const;
//- Scatter coefficient
virtual scalar sigmaS(scalar T, label celli) const;
//- Thermal conductivity
virtual scalar K(scalar T, label celli) const;
//- Emissivity coefficient
virtual scalar emissivity(scalar T, label celli) const;
//- Formation enthalpy
virtual scalar hf(scalar T, label celli) const;
//- Sensible enthalpy
virtual scalar hs(scalar T, label celli) const;
//- Total enthalpy
virtual scalar h(scalar T, label celli) const;
//- Specific heat capacity
virtual scalar Cp(scalar T, label celli) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "multiComponentSolidMixture.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::reactingSolidMixture
Description
Foam::reactingSolidMixture
SourceFiles
reactingSolidMixture.C
\*---------------------------------------------------------------------------*/
#ifndef reactingSolidMixture_H
#define reactingSolidMixture_H
#include "multiComponentSolidMixture.H"
#include "solidReaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class reactingSolidMixture Declaration
\*---------------------------------------------------------------------------*/
template<class ThermoSolidType>
class reactingSolidMixture
:
public multiComponentSolidMixture<ThermoSolidType>,
public PtrList<solidReaction>
{
// Private Member Functions
//- Disallow default bitwise copy construct
reactingSolidMixture(const reactingSolidMixture&);
//- Disallow default bitwise assignment
void operator=(const reactingSolidMixture&);
public:
//- The type of thermo package this mixture is instantiated for
typedef ThermoSolidType thermoType;
// Constructors
//- Construct from dictionary and mesh
reactingSolidMixture(const dictionary&, const fvMesh&);
//- Destructor
virtual ~reactingSolidMixture()
{}
// Member functions
//- Read dictionary
void read(const dictionary&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "reactingSolidMixture.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,62 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::solidMixtureThermo
\*---------------------------------------------------------------------------*/
#ifndef makeSolidMixtureThermo_H
#define makeSolidMixtureThermo_H
#include "addToRunTimeSelectionTable.H"
#include "solidMixtureThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeSolidMixtureThermo(CThermo,MixtureThermo,Mixture,Transport,Radiation,Thermo,Rho)\
\
typedef MixtureThermo<Mixture<Transport<Radiation<Thermo<Rho> > > > > \
MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho; \
\
defineTemplateTypeNameAndDebugWithName \
( \
MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \
#MixtureThermo \
"<"#Mixture"<"#Transport"<"#Radiation"<"#Thermo"<"#Rho">>>>>", \
0 \
); \
\
addToRunTimeSelectionTable \
( \
CThermo, \
MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \
mesh \
); \
\
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,422 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "solidMixtureThermo.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class MixtureType>
void Foam::solidMixtureThermo<MixtureType>::calculate()
{
scalarField& rhoCells = rho_.internalField();
scalarField& KCells = K_.internalField();
scalarField& kappaCells = kappa_.internalField();
scalarField& sigmaSCells = sigmaS_.internalField();
scalarField& emissivityCells = emissivity_.internalField();
forAll(T_.internalField(), celli)
{
rhoCells[celli] = MixtureType::rho(T_[celli], celli);
kappaCells[celli] = MixtureType::kappa(T_[celli], celli);
sigmaSCells[celli] = MixtureType::sigmaS(T_[celli], celli);
KCells[celli] = MixtureType::K(T_[celli], celli);
emissivityCells[celli] = MixtureType::emissivity(T_[celli], celli);
}
forAll(T_.boundaryField(), patchI)
{
rho_.boundaryField()[patchI] == this->rho(patchI)();
K_.boundaryField()[patchI] == this->K(patchI)();
kappa_.boundaryField()[patchI] == this->kappa(patchI)();
sigmaS_.boundaryField()[patchI] == this->sigmaS(patchI)();
emissivity_.boundaryField()[patchI] == this->emissivity(patchI)();
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::solidMixtureThermo<MixtureType>::solidMixtureThermo
(
const fvMesh& mesh
)
:
basicSolidThermo(mesh),
MixtureType(*this, mesh),
K_
(
IOobject
(
"K",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimEnergy/dimTime/(dimLength*dimTemperature)
)
{
calculate();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
Foam::solidMixtureThermo<MixtureType>::~solidMixtureThermo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class MixtureType>
void Foam::solidMixtureThermo<MixtureType>::correct()
{
calculate();
}
template<class MixtureType>
const Foam::volScalarField& Foam::solidMixtureThermo<MixtureType>::K() const
{
return K_;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::solidMixtureThermo<MixtureType>::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();
forAll(T_.internalField(), celli)
{
Cp[celli] = MixtureType::Cp(T_[celli], celli);
}
forAll(Cp.boundaryField(), patchI)
{
Cp.boundaryField()[patchI] == this->Cp(patchI)();
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::solidMixtureThermo<MixtureType>::hs() const
{
tmp<volScalarField> ths
(
new volScalarField
(
IOobject
(
"Hs",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/(dimMass*dimTemperature)
)
);
volScalarField& hs = ths();
forAll(T_.internalField(), celli)
{
hs[celli] = MixtureType::hs(T_[celli], celli);
}
forAll(hs.boundaryField(), patchI)
{
hs.boundaryField()[patchI] == this->hs(patchI)();
}
return ths;
}
template<class MixtureType>
Foam::tmp<Foam::volScalarField>
Foam::solidMixtureThermo<MixtureType>::Hf() const
{
tmp<volScalarField> thF
(
new volScalarField
(
IOobject
(
"hF",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/(dimMass*dimTemperature)
)
);
volScalarField& hf = thF();
forAll(T_.internalField(), celli)
{
hf[celli] = MixtureType::hf(T_[celli], celli);
}
forAll(hf.boundaryField(), patchI)
{
hf.boundaryField()[patchI] == this->Hf(patchI)();
}
return thF;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::rho
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const unallocLabelList& cells = pp.faceCells();
tmp<scalarField> tRho(new scalarField(patchT.size()));
scalarField& Rho = tRho();
forAll(patchT, celli)
{
Rho[celli] = MixtureType::rho(patchT[celli], cells[celli]);
}
return tRho;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::Cp
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const unallocLabelList& cells = pp.faceCells();
tmp<scalarField> tCp(new scalarField(patchT.size()));
scalarField& Cp = tCp();
forAll(patchT, celli)
{
Cp[celli] = MixtureType::Cp(patchT[celli], cells[celli]);
}
return tCp;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::hs
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const unallocLabelList& cells = pp.faceCells();
tmp<scalarField> ths(new scalarField(patchT.size()));
scalarField& hs = ths();
forAll(patchT, celli)
{
hs[celli] = MixtureType::hs(patchT[celli], cells[celli]);
}
return ths;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::K
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const unallocLabelList& cells = pp.faceCells();
tmp<scalarField> tK(new scalarField(patchT.size()));
scalarField& K = tK();
forAll(patchT, celli)
{
K[celli] = MixtureType::K(patchT[celli], cells[celli]);
}
return tK;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::Hf
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const unallocLabelList& cells = pp.faceCells();
tmp<scalarField> tHf(new scalarField(patchT.size()));
scalarField& Hf = tHf();
forAll(patchT, celli)
{
Hf[celli] = MixtureType::hf(patchT[celli], cells[celli]);
}
return tHf;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::sigmaS
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const unallocLabelList& cells = pp.faceCells();
tmp<scalarField> tsigmaS(new scalarField(patchT.size()));
scalarField& sigmaS = tsigmaS();
forAll(patchT, celli)
{
sigmaS[celli] =
MixtureType::sigmaS(patchT[celli], cells[celli]);
}
return tsigmaS;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::kappa
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const unallocLabelList& cells = pp.faceCells();
tmp<scalarField> tKappa(new scalarField(patchT.size()));
scalarField& kappa = tKappa();
forAll(patchT, celli)
{
kappa[celli] =
MixtureType::kappa(patchT[celli], cells[celli]);
}
return tKappa;
}
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::emissivity
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const unallocLabelList& cells = pp.faceCells();
tmp<scalarField> te(new scalarField(patchT.size()));
scalarField& e = te();
forAll(patchT, celli)
{
e[celli] = MixtureType::emissivity(patchT[celli], cells[celli]);
}
return te;
}
template<class MixtureType>
bool Foam::solidMixtureThermo<MixtureType>::read()
{
if (basicSolidThermo::read())
{
MixtureType::read(*this);
return true;
}
else
{
return false;
}
}
template<class MixtureType>
bool Foam::solidMixtureThermo<MixtureType>::writeData(Ostream& os) const
{
bool ok = basicSolidThermo::writeData(os);
return ok && os.good();
}
// ************************************************************************* //

View File

@ -0,0 +1,172 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::solidMixtureThermo
Description
Foam::solidMixtureThermo
SourceFiles
solidMixtureThermo.C
\*---------------------------------------------------------------------------*/
#ifndef solidMixtureThermo_H
#define solidMixtureThermo_H
#include "basicSolidThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class solidMixtureThermo Declaration
\*---------------------------------------------------------------------------*/
template<class MixtureType>
class solidMixtureThermo
:
public basicSolidThermo,
public MixtureType
{
protected:
// Protected data
//- Thermal conductivity [W/m/K]
volScalarField K_;
private:
// Private Member Functions
//- Calculate K
void calculate();
public:
//- Runtime type information
TypeName("solidMixtureThermo");
// Constructors
//- Construct from mesh
solidMixtureThermo(const fvMesh&);
//- Destructor
virtual ~solidMixtureThermo();
// Member functions
//- Return the compostion of the solid mixture
virtual MixtureType& composition()
{
return *this;
}
//- Return the compostion of the solid mixture
virtual const MixtureType& composition() const
{
return *this;
}
//- Update properties
virtual void correct();
// Access functions
//- Thermal conductivity [W/m/K]
virtual const volScalarField& K() const;
// Derived properties
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> Cp() const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
//- Sensible enthalpy [J/(kg.K)]
virtual tmp<volScalarField> hs() const;
// Patches variables
//- 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;
//- Sensible enthalpy [J/(kg.K)]
virtual tmp<scalarField> hs(const label patchI) const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<scalarField> K(const label patchI) const;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) const;
//- Scatter coefficient [1/m]
virtual tmp<scalarField> sigmaS(const label patchI) const;
//- Absorptivity [1/m]
virtual tmp<scalarField> kappa(const label patchI) const;
//- Emissivity []
virtual tmp<scalarField> emissivity(const label patchI) const;
//- Read thermophysicalProperties dictionary
virtual bool read();
//- Write the basicSolidThermo properties
virtual bool writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "solidMixtureThermo.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,3 @@
pointSolidMixture/pointSolidMixture.C
LIB = $(FOAM_LIBBIN)/libpointSolidMixture

View File

@ -0,0 +1,3 @@
EXE_INC = \
-I${LIB_SRC}/thermophysicalModels/pointSolids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude

View File

@ -23,11 +23,11 @@ License
\*---------------------------------------------------------------------------*/
#include "solidMixture.H"
#include "pointSolidMixture.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidMixture::solidMixture
Foam::pointSolidMixture::pointSolidMixture
(
const dictionary& thermophysicalProperties
)
@ -49,12 +49,12 @@ Foam::solidMixture::solidMixture
forAll(components_, i)
{
properties_.set(i, solid::New(props.subDict(components_[i])));
properties_.set(i, pointSolid::New(props.subDict(components_[i])));
}
}
Foam::solidMixture::solidMixture(const solidMixture& s)
Foam::pointSolidMixture::pointSolidMixture(const pointSolidMixture& s)
:
components_(s.components_),
properties_(s.properties_.size())
@ -68,21 +68,21 @@ Foam::solidMixture::solidMixture(const solidMixture& s)
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::solidMixture> Foam::solidMixture::New
Foam::autoPtr<Foam::pointSolidMixture> Foam::pointSolidMixture::New
(
const dictionary& thermophysicalProperties
)
{
return autoPtr<solidMixture>(new solidMixture(thermophysicalProperties));
return autoPtr<pointSolidMixture>
(
new pointSolidMixture(thermophysicalProperties)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalarField Foam::solidMixture::X
(
const scalarField& Y
) const
Foam::scalarField Foam::pointSolidMixture::X(const scalarField& Y) const
{
scalarField X(Y.size());
scalar rhoInv = 0.0;
@ -96,10 +96,7 @@ Foam::scalarField Foam::solidMixture::X
}
Foam::scalar Foam::solidMixture::rho
(
const scalarField& X
) const
Foam::scalar Foam::pointSolidMixture::rho(const scalarField& X) const
{
scalar val = 0.0;
forAll(properties_, i)
@ -110,10 +107,7 @@ Foam::scalar Foam::solidMixture::rho
}
Foam::scalar Foam::solidMixture::Cp
(
const scalarField& Y
) const
Foam::scalar Foam::pointSolidMixture::Cp(const scalarField& Y) const
{
scalar val = 0.0;
forAll(properties_, i)

View File

@ -22,30 +22,30 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::solidMixture
Foam::pointSolidMixture
Description
A mixture of solids.
Note
The dictionary constructor searches for the entry @c solidComponents,
which is a wordList. The solid properties of each component can either
which is a wordList. The pointSolid properties of each component can either
be contained within a @c solidProperties sub-dictionary or (for legacy
purposes) can be found directly in the dictionary.
The @c solidProperties sub-dictionary entry should be used when possible
to avoid conflicts with identically named gas-phase entries.
SeeAlso
Foam::liquidMixture
Foam::pointSolidMixture
\*---------------------------------------------------------------------------*/
#ifndef solidMixture_H
#define solidMixture_H
#ifndef pointSolidMixture_H
#define pointSolidMixture_H
#include "scalarField.H"
#include "PtrList.H"
#include "solid.H"
#include "pointSolid.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,18 +54,18 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class solidMixture Declaration
Class pointSolidMixture Declaration
\*---------------------------------------------------------------------------*/
class solidMixture
class pointSolidMixture
{
// Private data
//- The names of the solids
List<word> components_;
//- The solid properties
PtrList<solid> properties_;
//- The pointSolid properties
PtrList<pointSolid> properties_;
public:
@ -73,39 +73,39 @@ public:
// Constructors
//- Construct from dictionary
solidMixture(const dictionary&);
pointSolidMixture(const dictionary&);
//- Construct copy
solidMixture(const solidMixture& lm);
pointSolidMixture(const pointSolidMixture& lm);
//- Construct and return a clone
virtual autoPtr<solidMixture> clone() const
virtual autoPtr<pointSolidMixture> clone() const
{
return autoPtr<solidMixture>(new solidMixture(*this));
return autoPtr<pointSolidMixture>(new pointSolidMixture(*this));
}
//- Destructor
virtual ~solidMixture()
virtual ~pointSolidMixture()
{}
// Selectors
//- Select construct from dictionary
static autoPtr<solidMixture> New(const dictionary&);
static autoPtr<pointSolidMixture> New(const dictionary&);
// Member Functions
//- Return the solid names
//- Return the pointSolid names
inline const List<word>& components() const
{
return components_;
}
//- Return the solid properties
inline const PtrList<solid>& properties() const
//- Return the pointSolid properties
inline const PtrList<pointSolid>& properties() const
{
return properties_;
}

View File

@ -31,16 +31,16 @@ License
namespace Foam
{
defineTypeNameAndDebug(C, 0);
addToRunTimeSelectionTable(solid, C,);
addToRunTimeSelectionTable(solid, C, Istream);
addToRunTimeSelectionTable(solid, C, dictionary);
addToRunTimeSelectionTable(pointSolid, C,);
addToRunTimeSelectionTable(pointSolid, C, Istream);
addToRunTimeSelectionTable(pointSolid, C, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::C::C()
:
solid(2010, 710, 0.04, 0.0, 1.0)
pointSolid(2010, 710, 0.04, 0.0, 1.0)
{
if (debug)
{
@ -51,27 +51,27 @@ Foam::C::C()
}
Foam::C::C(const solid& s)
Foam::C::C(const pointSolid& s)
:
solid(s)
pointSolid(s)
{}
Foam::C::C(Istream& is)
:
solid(is)
pointSolid(is)
{}
Foam::C::C(const dictionary& dict)
:
solid(dict)
pointSolid(dict)
{}
Foam::C::C(const C& s)
:
solid(s)
pointSolid(s)
{}
@ -79,7 +79,7 @@ Foam::C::C(const C& s)
void Foam::C::writeData(Ostream& os) const
{
solid::writeData(os);
pointSolid::writeData(os);
}

View File

@ -35,7 +35,7 @@ SourceFiles
#ifndef solid_C_H
#define solid_C_H
#include "solid.H"
#include "pointSolid.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +57,7 @@ Ostream& operator<<
class C
:
public solid
public pointSolid
{
public:
@ -70,8 +70,8 @@ public:
//- Construct null
C();
//- Construct from solid
C(const solid& s);
//- Construct from pointSolid
C(const pointSolid& s);
//- Construct from Istream
C(Istream& is);
@ -83,9 +83,9 @@ public:
C(const C& s);
//- Construct and return clone
virtual autoPtr<solid> clone() const
virtual autoPtr<pointSolid> clone() const
{
return autoPtr<solid>(new C(*this));
return autoPtr<pointSolid>(new C(*this));
}

View File

@ -31,16 +31,16 @@ License
namespace Foam
{
defineTypeNameAndDebug(CaCO3, 0);
addToRunTimeSelectionTable(solid, CaCO3,);
addToRunTimeSelectionTable(solid, CaCO3, Istream);
addToRunTimeSelectionTable(solid, CaCO3, dictionary);
addToRunTimeSelectionTable(pointSolid, CaCO3,);
addToRunTimeSelectionTable(pointSolid, CaCO3, Istream);
addToRunTimeSelectionTable(pointSolid, CaCO3, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::CaCO3::CaCO3()
:
solid(2710, 850, 1.3, 0.0, 1.0)
pointSolid(2710, 850, 1.3, 0.0, 1.0)
{
if (debug)
{
@ -51,27 +51,27 @@ Foam::CaCO3::CaCO3()
}
Foam::CaCO3::CaCO3(const solid& s)
Foam::CaCO3::CaCO3(const pointSolid& s)
:
solid(s)
pointSolid(s)
{}
Foam::CaCO3::CaCO3(Istream& is)
:
solid(is)
pointSolid(is)
{}
Foam::CaCO3::CaCO3(const dictionary& dict)
:
solid(dict)
pointSolid(dict)
{}
Foam::CaCO3::CaCO3(const CaCO3& s)
:
solid(s)
pointSolid(s)
{}
@ -79,7 +79,7 @@ Foam::CaCO3::CaCO3(const CaCO3& s)
void Foam::CaCO3::writeData(Ostream& os) const
{
solid::writeData(os);
pointSolid::writeData(os);
}

View File

@ -35,7 +35,7 @@ SourceFiles
#ifndef solid_CaCO3_H
#define solid_CaCO3_H
#include "solid.H"
#include "pointSolid.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +57,7 @@ Ostream& operator<<
class CaCO3
:
public solid
public pointSolid
{
public:
@ -71,8 +71,8 @@ public:
//- Construct null
CaCO3();
//- Construct from solid
CaCO3(const solid& s);
//- Construct from pointSolid
CaCO3(const pointSolid& s);
//- Construct from Istream
CaCO3(Istream& is);
@ -84,9 +84,9 @@ public:
CaCO3(const CaCO3& s);
//- Construct and return clone
virtual autoPtr<solid> clone() const
virtual autoPtr<pointSolid> clone() const
{
return autoPtr<solid>(new CaCO3(*this));
return autoPtr<pointSolid>(new CaCO3(*this));
}

View File

@ -0,0 +1,8 @@
pointSolid/pointSolid.C
pointSolid/pointSolidNew.C
ash/ash.C
C/C.C
CaCO3/CaCO3.C
LIB = $(FOAM_LIBBIN)/libpointSolids

View File

@ -31,16 +31,16 @@ License
namespace Foam
{
defineTypeNameAndDebug(ash, 0);
addToRunTimeSelectionTable(solid, ash,);
addToRunTimeSelectionTable(solid, ash, Istream);
addToRunTimeSelectionTable(solid, ash, dictionary);
addToRunTimeSelectionTable(pointSolid, ash,);
addToRunTimeSelectionTable(pointSolid, ash, Istream);
addToRunTimeSelectionTable(pointSolid, ash, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::ash::ash()
:
solid(2010, 710, 0.04, 0.0, 1.0)
pointSolid(2010, 710, 0.04, 0.0, 1.0)
{
if (debug)
{
@ -51,27 +51,27 @@ Foam::ash::ash()
}
Foam::ash::ash(const solid& s)
Foam::ash::ash(const pointSolid& s)
:
solid(s)
pointSolid(s)
{}
Foam::ash::ash(Istream& is)
:
solid(is)
pointSolid(is)
{}
Foam::ash::ash(const dictionary& dict)
:
solid(dict)
pointSolid(dict)
{}
Foam::ash::ash(const ash& s)
:
solid(s)
pointSolid(s)
{}
@ -79,7 +79,7 @@ Foam::ash::ash(const ash& s)
void Foam::ash::writeData(Ostream& os) const
{
solid::writeData(os);
pointSolid::writeData(os);
}

View File

@ -35,7 +35,7 @@ SourceFiles
#ifndef solid_ash_H
#define solid_ash_H
#include "solid.H"
#include "pointSolid.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +57,7 @@ Ostream& operator<<
class ash
:
public solid
public pointSolid
{
public:
@ -71,8 +71,8 @@ public:
//- Construct null
ash();
//- Construct from solid
ash(const solid& s);
//- Construct from pointSolid
ash(const pointSolid& s);
//- Construct from Istream
ash(Istream& is);
@ -84,9 +84,9 @@ public:
ash(const ash& s);
//- Construct and return clone
virtual autoPtr<solid> clone() const
virtual autoPtr<pointSolid> clone() const
{
return autoPtr<solid>(new ash(*this));
return autoPtr<pointSolid>(new ash(*this));
}

View File

@ -23,21 +23,21 @@ License
\*---------------------------------------------------------------------------*/
#include "solid.H"
#include "pointSolid.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(solid, 0);
defineRunTimeSelectionTable(solid,);
defineRunTimeSelectionTable(solid, Istream);
defineRunTimeSelectionTable(solid, dictionary);
defineTypeNameAndDebug(pointSolid, 0);
defineRunTimeSelectionTable(pointSolid,);
defineRunTimeSelectionTable(pointSolid, Istream);
defineRunTimeSelectionTable(pointSolid, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solid::solid
Foam::pointSolid::pointSolid
(
scalar rho,
scalar Cp,
@ -54,7 +54,7 @@ Foam::solid::solid
{}
Foam::solid::solid(Istream& is)
Foam::pointSolid::pointSolid(Istream& is)
:
rho_(readScalar(is)),
Cp_(readScalar(is)),
@ -64,7 +64,7 @@ Foam::solid::solid(Istream& is)
{}
Foam::solid::solid(const dictionary& dict)
Foam::pointSolid::pointSolid(const dictionary& dict)
:
rho_(readScalar(dict.lookup("rho"))),
Cp_(readScalar(dict.lookup("Cp"))),
@ -74,7 +74,7 @@ Foam::solid::solid(const dictionary& dict)
{}
Foam::solid::solid(const solid& s)
Foam::pointSolid::pointSolid(const pointSolid& s)
:
rho_(s.rho_),
Cp_(s.Cp_),
@ -86,7 +86,7 @@ Foam::solid::solid(const solid& s)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::solid::writeData(Ostream& os) const
void Foam::pointSolid::writeData(Ostream& os) const
{
os << rho_ << token::SPACE
<< Cp_ << token::SPACE
@ -98,7 +98,7 @@ void Foam::solid::writeData(Ostream& os) const
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const solid& s)
Foam::Ostream& Foam::operator<<(Ostream& os, const pointSolid& s)
{
s.writeData(os);
return os;

View File

@ -22,18 +22,18 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::solid
Foam::pointSolid
Description
The thermophysical properties of a solid
The thermophysical properties of a pointSolid
SourceFiles
solid.C
pointSolid.C
\*---------------------------------------------------------------------------*/
#ifndef solid_H
#define solid_H
#ifndef pointSolid_H
#define pointSolid_H
#include "typeInfo.H"
#include "autoPtr.H"
@ -45,20 +45,20 @@ SourceFiles
namespace Foam
{
class solid;
class pointSolid;
Ostream& operator<<
(
Ostream&,
const solid&
const pointSolid&
);
/*---------------------------------------------------------------------------*\
Class solid Declaration
Class pointSolid Declaration
\*---------------------------------------------------------------------------*/
class solid
class pointSolid
{
// Private data
@ -82,7 +82,7 @@ class solid
public:
//- Runtime type information
TypeName("solid");
TypeName("pointSolid");
// Declare run-time constructor selection tables
@ -90,7 +90,7 @@ public:
declareRunTimeSelectionTable
(
autoPtr,
solid,
pointSolid,
,
(),
()
@ -99,7 +99,7 @@ public:
declareRunTimeSelectionTable
(
autoPtr,
solid,
pointSolid,
Istream,
(Istream& is),
(is)
@ -108,7 +108,7 @@ public:
declareRunTimeSelectionTable
(
autoPtr,
solid,
pointSolid,
dictionary,
(const dictionary& dict),
(dict)
@ -118,7 +118,7 @@ public:
// Constructors
//- Construct from components
solid
pointSolid
(
scalar rho,
scalar Cp,
@ -128,38 +128,38 @@ public:
);
//- Construct from Istream
solid(Istream& is);
pointSolid(Istream& is);
//- Construct from dictionary
solid(const dictionary& dict);
pointSolid(const dictionary& dict);
//- Construct copy
solid(const solid& s);
pointSolid(const pointSolid& s);
//- Construct and return clone
virtual autoPtr<solid> clone() const
virtual autoPtr<pointSolid> clone() const
{
return autoPtr<solid>(new solid(*this));
return autoPtr<pointSolid>(new pointSolid(*this));
}
// Selectors
//- Return a pointer to a new solid created from input
static autoPtr<solid> New(Istream& is);
//- Return a pointer to a new pointSolid created from input
static autoPtr<pointSolid> New(Istream& is);
//- Return a pointer to a new solid created from dictionary
static autoPtr<solid> New(const dictionary& dict);
//- Return a pointer to a new pointSolid created from dictionary
static autoPtr<pointSolid> New(const dictionary& dict);
//- Destructor
virtual ~solid()
virtual ~pointSolid()
{}
// Member Functions
// Physical constants which define the solid
// Physical constants which define the pointSolid
//- Density [kg/m3]
inline scalar rho() const;
@ -185,13 +185,13 @@ public:
// I-O
//- Write the solid properties
//- Write the pointSolid properties
virtual void writeData(Ostream& os) const;
// Ostream Operator
friend Ostream& operator<<(Ostream& os, const solid& s);
friend Ostream& operator<<(Ostream& os, const pointSolid& s);
};
@ -201,7 +201,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "solidI.H"
#include "pointSolidI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -27,43 +27,43 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline Foam::scalar Foam::solid::rho() const
inline Foam::scalar Foam::pointSolid::rho() const
{
return rho_;
}
inline Foam::scalar Foam::solid::Cp() const
inline Foam::scalar Foam::pointSolid::Cp() const
{
return Cp_;
}
inline Foam::scalar Foam::solid::K() const
inline Foam::scalar Foam::pointSolid::K() const
{
return K_;
}
inline Foam::scalar Foam::solid::Hf() const
inline Foam::scalar Foam::pointSolid::Hf() const
{
return Hf_;
}
inline Foam::scalar Foam::solid::H(const scalar T) const
inline Foam::scalar Foam::pointSolid::H(const scalar T) const
{
return Hs(T) + Hf_;
}
inline Foam::scalar Foam::solid::Hs(const scalar T) const
inline Foam::scalar Foam::pointSolid::Hs(const scalar T) const
{
return Cp_*(T - specie::Tstd);
}
inline Foam::scalar Foam::solid::emissivity() const
inline Foam::scalar Foam::pointSolid::emissivity() const
{
return emissivity_;
}

View File

@ -23,16 +23,16 @@ License
\*---------------------------------------------------------------------------*/
#include "solid.H"
#include "pointSolid.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::solid> Foam::solid::New(Istream& is)
Foam::autoPtr<Foam::pointSolid> Foam::pointSolid::New(Istream& is)
{
if (debug)
{
Info<< "solid::New(Istream&): constructing solid" << endl;
Info<< "pointSolid::New(Istream&): constructing pointSolid" << endl;
}
const word solidType(is);
@ -45,14 +45,14 @@ Foam::autoPtr<Foam::solid> Foam::solid::New(Istream& is)
if (cstrIter == ConstructorTablePtr_->end())
{
FatalErrorIn("solid::New(Istream&)")
<< "Unknown solid type " << solidType << nl << nl
<< "Valid solid types are :" << endl
FatalErrorIn("pointSolid::New(Istream&)")
<< "Unknown pointSolid type " << solidType << nl << nl
<< "Valid pointSolid types are :" << endl
<< ConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<solid>(cstrIter()());
return autoPtr<pointSolid>(cstrIter()());
}
else if (coeffs == "coeffs")
{
@ -61,33 +61,34 @@ Foam::autoPtr<Foam::solid> Foam::solid::New(Istream& is)
if (cstrIter == IstreamConstructorTablePtr_->end())
{
FatalErrorIn("solid::New(Istream&)")
<< "Unknown solid type " << solidType << nl << nl
<< "Valid solid types are :" << endl
FatalErrorIn("pointSolid::New(Istream&)")
<< "Unknown pointSolid type " << solidType << nl << nl
<< "Valid pointSolid types are :" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<solid>(cstrIter()(is));
return autoPtr<pointSolid>(cstrIter()(is));
}
else
{
FatalErrorIn("solid::New(Istream&)")
<< "solid type " << solidType
FatalErrorIn("pointSolid::New(Istream&)")
<< "pointSolid type " << solidType
<< ", option " << coeffs << " given"
<< ", should be coeffs or defaultCoeffs"
<< exit(FatalError);
return autoPtr<solid>(NULL);
return autoPtr<pointSolid>(NULL);
}
}
Foam::autoPtr<Foam::solid> Foam::solid::New(const dictionary& dict)
Foam::autoPtr<Foam::pointSolid> Foam::pointSolid::New(const dictionary& dict)
{
if (debug)
{
Info<< "solid::New(const dictionary&): constructing solid" << endl;
Info<< "pointSolid::New(const dictionary&): constructing pointSolid"
<< endl;
}
const word solidType(dict.dictName());
@ -100,14 +101,14 @@ Foam::autoPtr<Foam::solid> Foam::solid::New(const dictionary& dict)
if (cstrIter == ConstructorTablePtr_->end())
{
FatalErrorIn("solid::New(const dictionary&)")
<< "Unknown solid type " << solidType << nl << nl
<< "Valid solid types are :" << endl
FatalErrorIn("pointSolid::New(const dictionary&)")
<< "Unknown pointSolid type " << solidType << nl << nl
<< "Valid pointSolid types are :" << endl
<< ConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<solid>(cstrIter()());
return autoPtr<pointSolid>(cstrIter()());
}
else
{
@ -116,14 +117,14 @@ Foam::autoPtr<Foam::solid> Foam::solid::New(const dictionary& dict)
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn("solid::New(const dictionary&)")
<< "Unknown solid type " << solidType << nl << nl
<< "Valid solid types are :" << endl
FatalErrorIn("pointSolid::New(const dictionary&)")
<< "Unknown pointSolid type " << solidType << nl << nl
<< "Valid pointSolid types are :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<solid>(cstrIter()(dict));
return autoPtr<pointSolid>(cstrIter()(dict));
}
}

View File

@ -0,0 +1,8 @@
rhoType/const/constRho.C
reaction/Reactions/solidReaction/solidReaction.C
reaction/reactions/makeSolidReactionThermoReactions.C
LIB = $(FOAM_LIBBIN)/libsolid

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