BUG: basicSolidThermo: calculate derived quantity K

This commit is contained in:
mattijs
2012-02-29 11:24:04 +00:00
parent 5ebf6ca2f8
commit 1577a3a005
13 changed files with 389 additions and 574 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -146,12 +146,12 @@ void thermoBaffle2D::solveEnergy()
TEqn -= fvc::div(phiMesh);
}
Info<< "T gas min/max = " << min(T_).value() << ", "
<< max(T_).value() << endl;
TEqn.relax();
TEqn.solve();
Info<< "T gas min/max = " << min(T_).value() << ", "
<< max(T_).value() << endl;
thermo_->correct();
}
@ -362,7 +362,7 @@ void thermoBaffle2D::info() const
(
mag(regionMesh().Sf().boundaryField()[patchI])
* pT.snGrad()
* thermo_->K().boundaryField()[patchI]
* thermo_->K(patchI)
) << endl;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -257,20 +257,6 @@ const Foam::volScalarField& Foam::basicSolidThermo::emissivity() const
}
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()");
@ -287,7 +273,7 @@ const Foam::basicSolidMixture& Foam::basicSolidThermo::composition() const
Foam::tmp<Foam::volScalarField> Foam::basicSolidThermo::hs() const
{
notImplemented("basicSolidThermo::hs()");
notImplemented("basicSolidThermo::hs() const");
return volScalarField::null();
}
@ -295,31 +281,11 @@ Foam::tmp<Foam::volScalarField> Foam::basicSolidThermo::hs() const
Foam::tmp<Foam::scalarField> Foam::basicSolidThermo::hs(const label patchI)
const
{
notImplemented("basicSolidThermo::hs(const label)");
notImplemented("basicSolidThermo::hs(const label) const");
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();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -144,36 +144,36 @@ public:
// 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]
const volScalarField& T() const;
virtual const volScalarField& T() const;
//- non-const access for T
volScalarField& T();
virtual volScalarField& T();
//- Density [kg/m^3]
virtual const volScalarField& rho() const;
//- non-const access for rho
volScalarField& rho();
virtual volScalarField& rho();
//- Absorption coefficient [1/m]
virtual const volScalarField& kappa() const;
//- Emissivity coefficient
virtual const volScalarField& sigmaS() const;
//- Emissivity coefficient [1/m]
virtual const volScalarField& emissivity() const;
// Derived thermal properties
//- Thermal conductivity [W/m/K]
virtual tmp<volScalarField> K() const = 0;
//- Thermal conductivity [W/m/K]
virtual tmp<volSymmTensorField> directionalK() const = 0;
//- Specific heat capacity [J/kg/K]
virtual tmp<volScalarField> Cp() const = 0;
@ -186,8 +186,11 @@ public:
// Per patch calculation
//- Density [kg/m3]
virtual tmp<scalarField> rho(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;
//- Specific heat capacity [J/kg/K)]
virtual tmp<scalarField> Cp(const label patchI) const = 0;
@ -195,24 +198,9 @@ public:
//- 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<scalarField> emissivity(const label) const = 0;
// I-O
//- Write the basicSolidThermo properties

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -132,34 +132,13 @@ void Foam::constSolidThermo::correct()
{}
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::Cp() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"Cp",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
constCp_
)
);
}
const Foam::volScalarField& Foam::constSolidThermo::K() const
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::K() const
{
return K_;
}
const Foam::volSymmTensorField& Foam::constSolidThermo::directionalK() const
Foam::tmp<Foam::volSymmTensorField> Foam::constSolidThermo::directionalK() const
{
dimensionedSymmTensor t
(
@ -194,6 +173,27 @@ const Foam::volSymmTensorField& Foam::constSolidThermo::directionalK() const
}
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::Cp() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"Cp",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
constCp_
)
);
}
Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::Hf() const
{
return tmp<volScalarField>
@ -215,38 +215,6 @@ Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::Hf() const
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::rho
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constRho_.value()
)
);
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Cp
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constCp_.value()
)
);
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::K
(
const label patchI
@ -281,6 +249,22 @@ Foam::tmp<Foam::symmTensorField> Foam::constSolidThermo::directionalK
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Cp
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constCp_.value()
)
);
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Hf
(
const label patchI
@ -297,54 +281,6 @@ Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Hf
}
Foam::tmp<Foam::scalarField> Foam::constSolidThermo::emissivity
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
T_.boundaryField()[patchI].size(),
constEmissivity_.value()
)
);
}
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"));

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -107,16 +107,13 @@ public:
virtual void correct();
// Acces functions
// Derived thermal properties
//- Constant access to K
virtual const volScalarField& K() const;
//- Thermal conductivity [W/m/K]
virtual tmp<volScalarField> K() const;
//- Thermal conductivity [W/(m.K)]
virtual const volSymmTensorField& directionalK() const;
// Derived properties
//- Thermal conductivity [W/m/K]
virtual tmp<volSymmTensorField> directionalK() const;
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> Cp() const;
@ -127,29 +124,18 @@ public:
// Per patch calculation
//- Density [kg/m3]
virtual tmp<scalarField> rho(const label patchI) const;
//- Specific heat capacity [J/kg/K)]
virtual tmp<scalarField> Cp(const label patchI) const;
//- Thermal conductivity [W//m/K]
virtual tmp<scalarField> K(const label patchI) const;
//- Thermal conductivity [W//m/K]
virtual tmp<symmTensorField>directionalK(const label) 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;
//- 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;
// I-O

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -136,12 +136,10 @@ void Foam::directionalKSolidThermo::init()
{
KValues_ = Field<vector>(subDict(typeName + "Coeffs").lookup("KValues"));
const fvMesh& mesh = K().mesh();
// Determine transforms for cell centres
forAll(mesh.C(), cellI)
forAll(mesh_.C(), cellI)
{
vector dir = mesh.C()[cellI] - coordSys_.origin();
vector dir = mesh_.C()[cellI] - coordSys_.origin();
dir /= mag(dir);
// Define local coordinate system with
@ -158,9 +156,9 @@ void Foam::directionalKSolidThermo::init()
ccTransforms_[cellI] = cs.R();
}
forAll(mesh.C().boundaryField(), patchI)
forAll(mesh_.C().boundaryField(), patchI)
{
const fvPatchVectorField& patchC = mesh.C().boundaryField()[patchI];
const fvPatchVectorField& patchC = mesh_.C().boundaryField()[patchI];
fvPatchTensorField& patchT = ccTransforms_.boundaryField()[patchI];
tensorField tc(patchT.size());
@ -192,13 +190,13 @@ void Foam::directionalKSolidThermo::init()
IOobject
(
"Kxx",
mesh.time().timeName(),
mesh,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
mesh_,
dimless
);
Kxx.internalField() = transform
@ -230,13 +228,13 @@ void Foam::directionalKSolidThermo::init()
IOobject
(
"Kyy",
mesh.time().timeName(),
mesh,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
mesh_,
dimless
);
Kyy.internalField() = transform
@ -268,13 +266,13 @@ void Foam::directionalKSolidThermo::init()
IOobject
(
"Kzz",
mesh.time().timeName(),
mesh,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
mesh_,
dimless
);
Kzz.internalField() = transform
@ -363,7 +361,7 @@ void Foam::directionalKSolidThermo::correct()
}
const Foam::volSymmTensorField&
Foam::tmp<Foam::volSymmTensorField>
Foam::directionalKSolidThermo::directionalK() const
{
return directionalK_;
@ -398,105 +396,6 @@ void Foam::directionalKSolidThermo::calculate()
}
const Foam::volScalarField& Foam::directionalKSolidThermo::K() const
{
forAll(KValues_, i)
{
const vector& v = KValues_[i];
if
(
v.x() != v.y()
|| v.x() != v.z()
|| v.y() != v.z()
)
{
FatalErrorIn("directionalKSolidThermo::K() const")
<< "Supplied K values " << KValues_
<< " are not isotropic." << exit(FatalError);
}
}
// Get temperature interpolated properties (principal directions)
Field<vector> localK
(
interpolateXY
(
T_.internalField(),
TValues_,
KValues_
)
);
tmp<volScalarField> tK
(
new volScalarField
(
IOobject
(
"K",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimEnergy/dimTime/(dimLength*dimTemperature)
)
);
volScalarField& K = tK();
K.internalField() = interpolateXY
(
T_.internalField(),
TValues_,
KValues_.component(0)()
);
forAll(K.boundaryField(), patchI)
{
K.boundaryField()[patchI] == this->K(patchI)();
}
return tK;
}
Foam::tmp<Foam::scalarField> Foam::directionalKSolidThermo::K
(
const label patchI
) const
{
forAll(KValues_, i)
{
const vector& v = KValues_[i];
if
(
v.x() != v.y()
|| v.x() != v.z()
|| v.y() != v.z()
)
{
FatalErrorIn("directionalKSolidThermo::K() const")
<< "Supplied K values " << KValues_
<< " are not isotropic." << exit(FatalError);
}
}
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
KValues_.component(0)()
)
)
);
}
Foam::tmp<Foam::symmTensorField> Foam::directionalKSolidThermo::directionalK
(
const label patchI

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -116,16 +116,24 @@ public:
//- Access functions
//- Thermal conductivity [W/(m.K)]
virtual const volSymmTensorField& directionalK() const;
//- Thermal conductivity [W/m/K]
virtual tmp<volScalarField> K() const
{
notImplemented("directionalKSolidThermo::K() const");
return tmp<volScalarField>(NULL);
}
//- Iostropic thermal conductivity [W/(m.K)]
virtual const volScalarField& K() const;
//- Thermal conductivity [W/m/K]
virtual tmp<volSymmTensorField> directionalK() const;
// Per patch calculation
// Per patch calculation
//- Thermal conductivity [W//m/K]
virtual tmp<scalarField> K(const label patchI) const;
virtual tmp<scalarField> K(const label patchI) const
{
notImplemented("directionalKSolidThermo::K(const label) const");
return tmp<scalarField>(NULL);
}
//- Thermal conductivity [W//m/K]
virtual tmp<symmTensorField> directionalK(const label) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,6 +27,88 @@ License
#include "interpolateXY.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::rho
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
rhoValues_
)
)
);
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::emissivity
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
emissivityValues_
)
)
);
}
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_
)
)
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::interpolatedSolidThermo::interpolatedSolidThermo
@ -57,6 +139,7 @@ Foam::interpolatedSolidThermo::interpolatedSolidThermo
calculate();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::interpolatedSolidThermo::~interpolatedSolidThermo()
@ -195,26 +278,6 @@ Foam::tmp<Foam::volScalarField> Foam::interpolatedSolidThermo::Hf() const
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::rho
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
rhoValues_
)
)
);
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::Cp
(
const label patchI
@ -255,66 +318,6 @@ Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::Hf
}
Foam::tmp<Foam::scalarField> Foam::interpolatedSolidThermo::emissivity
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
emissivityValues_
)
)
);
}
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(dict_);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -60,6 +60,21 @@ private:
const dictionary dict_;
// Helper functions
//- Density [kg/m3]
tmp<scalarField> rho(const label patchI) const;
//- Scatter coefficient [1/m]
tmp<scalarField> sigmaS(const label) const;
//- Absorption coefficient [1/m]
tmp<scalarField> kappa(const label) const;
//- Emissivity []
tmp<scalarField> emissivity(const label) const;
public:
// Constructors
@ -98,24 +113,12 @@ public:
// 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;
//- Heat of formation [J/kg]
virtual tmp<scalarField> Hf(const label patchI) const;
//- 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;
// I-O

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -100,7 +100,6 @@ Foam::isotropicKSolidThermo::isotropicKSolidThermo(const fvMesh& mesh)
void Foam::isotropicKSolidThermo::correct()
{
// Correct K
K_.internalField() = interpolateXY
(
@ -111,31 +110,30 @@ void Foam::isotropicKSolidThermo::correct()
forAll(K_.boundaryField(), patchI)
{
K_.boundaryField()[patchI] == this->K(patchI)();
K_.boundaryField()[patchI] == interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
KValues_
);
}
interpolatedSolidThermo::calculate();
}
Foam::tmp<Foam::volScalarField> Foam::isotropicKSolidThermo::K() const
{
return K_;
}
Foam::tmp<Foam::scalarField> Foam::isotropicKSolidThermo::K
(
const label patchI
) const
{
return tmp<scalarField>
(
new scalarField
(
interpolateXY
(
T_.boundaryField()[patchI],
TValues_,
KValues_
)
)
);
return K_.boundaryField()[patchI];
}
@ -154,6 +152,7 @@ bool Foam::isotropicKSolidThermo::writeData(Ostream& os) const
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) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -87,17 +87,30 @@ public:
// Access functions
//- Constant access to K
virtual const volScalarField& K() const
{
return K_;
}
virtual tmp<volScalarField> K() const;
//- Thermal conductivity [W/m/K]
virtual tmp<volSymmTensorField> directionalK() const
{
notImplemented("directionalKSolidThermo::directionalK() const");
return tmp<volSymmTensorField>(NULL);
}
// Per patch calculation
//- 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
{
notImplemented
(
"directionalKSolidThermo::directionalK(const label) const"
);
return tmp<symmTensorField>(NULL);
}
// I-O

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -63,6 +63,96 @@ void Foam::solidMixtureThermo<MixtureType>::calculate()
}
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 labelUList& 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>::sigmaS
(
const label patchI
) const
{
const scalarField& patchT = T_.boundaryField()[patchI];
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const labelUList& 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 labelUList& 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 labelUList& 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;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class MixtureType>
@ -117,6 +207,7 @@ Foam::solidMixtureThermo<MixtureType>::solidMixtureThermo
calculate();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class MixtureType>
@ -134,7 +225,7 @@ void Foam::solidMixtureThermo<MixtureType>::correct()
template<class MixtureType>
const Foam::volScalarField& Foam::solidMixtureThermo<MixtureType>::K() const
Foam::tmp<Foam::volScalarField> Foam::solidMixtureThermo<MixtureType>::K() const
{
return K_;
}
@ -261,7 +352,7 @@ Foam::solidMixtureThermo<MixtureType>::Hf() const
template<class MixtureType>
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::rho
Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::K
(
const label patchI
) const
@ -270,15 +361,15 @@ Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::rho
const polyPatch& pp = mesh_.boundaryMesh()[patchI];
const labelUList& cells = pp.faceCells();
tmp<scalarField> tRho(new scalarField(patchT.size()));
scalarField& Rho = tRho();
tmp<scalarField> tK(new scalarField(patchT.size()));
scalarField& K = tK();
forAll(patchT, celli)
{
Rho[celli] = MixtureType::rho(patchT[celli], cells[celli]);
K[celli] = MixtureType::K(patchT[celli], cells[celli]);
}
return tRho;
return tK;
}
@ -326,28 +417,6 @@ Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::hs
}
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 labelUList& 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
(
@ -370,74 +439,6 @@ Foam::tmp<Foam::scalarField> Foam::solidMixtureThermo<MixtureType>::Hf
}
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 labelUList& 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 labelUList& 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 labelUList& 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()
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -68,6 +68,16 @@ private:
void calculate();
// Per patch helpers to get mixture properties on a patch
tmp<scalarField> rho(const label patchI) const;
tmp<scalarField> sigmaS(const label patchI) const;
tmp<scalarField> kappa(const label patchI) const;
tmp<scalarField> emissivity(const label patchI) const;
public:
//- Runtime type information
@ -89,6 +99,9 @@ public:
// Member functions
//- Update properties
virtual void correct();
//- Return the compostion of the solid mixture
virtual MixtureType& composition()
{
@ -101,32 +114,44 @@ public:
return *this;
}
//- Update properties
virtual void correct();
// Access functions
// Derived thermal properties
//- Thermal conductivity [W/m/K]
virtual const volScalarField& K() const;
virtual tmp<volScalarField> K() const;
//- Thermal conductivity [W/m/K]
virtual tmp<volSymmTensorField> directionalK() const
{
notImplemented("solidMixtureThermo::directionalK() const");
return tmp<volSymmTensorField>(NULL);
}
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> Cp() const;
//- Sensible enthalpy [J/(kg.K)]
virtual tmp<volScalarField> hs() const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
// Derived properties
// Per patch calculation
//- Specific heat capacity [J/(kg.K)]
virtual tmp<volScalarField> Cp() const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<scalarField> K(const label patchI) const;
//- Heat of formation [J/kg]
virtual tmp<volScalarField> Hf() const;
//- Thermal conductivity [W/(m.K)]
virtual tmp<symmTensorField> directionalK(const label) const
{
notImplemented
(
"solidMixtureThermo::directionalK(const label) const"
);
return tmp<symmTensorField>(NULL);
}
//- 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;
@ -134,21 +159,9 @@ public:
//- 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();