ENH: basicSolidThermo : first implementation of solid thermo

This commit is contained in:
mattijs
2010-06-11 10:36:41 +01:00
parent 4418d3f003
commit b7e17abf9e
16 changed files with 3270 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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