ENH: Updated tabulated heat transfer inter-region model

This commit is contained in:
andy
2013-01-08 17:54:12 +00:00
parent c7ded8226e
commit e5e195a9ee
2 changed files with 65 additions and 47 deletions

View File

@ -24,8 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "tabulatedHeatTransfer.H" #include "tabulatedHeatTransfer.H"
#include "turbulenceModel.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -45,6 +43,45 @@ namespace fv
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
const Foam::interpolation2DTable<Foam::scalar>&
Foam::fv::tabulatedHeatTransfer::hTable()
{
if (!hTable_.valid())
{
hTable_.reset(new interpolation2DTable<scalar>(coeffs_));
}
return hTable_();
}
const Foam::volScalarField& Foam::fv::tabulatedHeatTransfer::AoV()
{
if (!AoV_.valid())
{
AoV_.reset
(
new volScalarField
(
IOobject
(
"AoV",
startTimeName_,
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
);
}
return AoV_();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::tabulatedHeatTransfer::tabulatedHeatTransfer Foam::fv::tabulatedHeatTransfer::tabulatedHeatTransfer
@ -57,34 +94,9 @@ Foam::fv::tabulatedHeatTransfer::tabulatedHeatTransfer
: :
interRegionHeatTransferModel(name, modelType, dict, mesh), interRegionHeatTransferModel(name, modelType, dict, mesh),
hTable_(), hTable_(),
area_() AoV_(),
{ startTimeName_(mesh.time().timeName())
if (master_) {}
{
hTable_.reset
(
new interpolation2DTable<scalar>
(
dict.subDict(typeName + "Coeffs")
)
);
area_.reset
(
new volScalarField
(
IOobject
(
"area",
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
@ -95,35 +107,33 @@ Foam::fv::tabulatedHeatTransfer::~tabulatedHeatTransfer()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::tmp<Foam::volScalarField> const Foam::tmp<Foam::volScalarField>
Foam::fv::tabulatedHeatTransfer::calculateHtc() Foam::fv::tabulatedHeatTransfer::calculateHtc()
{ {
const fvMesh& secondaryMesh = const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(mapRegionName());
mesh_.time().lookupObject<fvMesh>(mapRegionName());
const volVectorField& Usecondary = const volVectorField& UNbr = nbrMesh.lookupObject<volVectorField>("U");
secondaryMesh.lookupObject<volVectorField>("U");
scalarField UMagMapped(htc_.internalField().size(), 0.0); scalarField UMagNbrMapped(htc_.internalField().size(), 0.0);
secondaryToPrimaryInterpPtr_->interpolateInternalField secondaryToPrimaryInterpPtr_->interpolateInternalField
( (
UMagMapped, UMagNbrMapped,
mag(Usecondary), mag(UNbr),
meshToMesh::MAP, meshToMesh::MAP,
eqOp<scalar>() eqOp<scalar>()
); );
const volVectorField& U = mesh_.lookupObject<volVectorField>("U"); const volVectorField& U = mesh_.lookupObject<volVectorField>("U");
forAll (htc_.internalField(), i) scalarField& htcc = htc_.internalField();
forAll(htcc, i)
{ {
htc_.internalField()[i] = htcc[i] = hTable()(mag(U[i]), UMagNbrMapped[i]);
hTable_->operator()(mag(U[i]), UMagMapped[i]);
} }
htc_.internalField() = htc_*area_/mesh_.V(); htcc = htcc*AoV()*secondaryToPrimaryInterpPtr_->V()/mesh_.V();
return htc_; return htc_;
} }
@ -134,9 +144,9 @@ void Foam::fv::tabulatedHeatTransfer::writeData(Ostream& os) const
os << indent << token::BEGIN_BLOCK << incrIndent << nl; os << indent << token::BEGIN_BLOCK << incrIndent << nl;
interRegionHeatTransferModel::writeData(os); interRegionHeatTransferModel::writeData(os);
os << indent << "tabulatedHeatTransfer"; os << indent << type() + "Coeffs" << nl;
dict_.write(os); coeffs_.write(os);
os << decrIndent << indent << token::END_BLOCK << endl; os << decrIndent << indent << token::END_BLOCK << endl;
} }

View File

@ -60,8 +60,17 @@ private:
//- 2D look up table //- 2D look up table
autoPtr<interpolation2DTable<scalar> > hTable_; autoPtr<interpolation2DTable<scalar> > hTable_;
//- Area of heat exchange //- Area per unit volume of heat exchanger
autoPtr<volScalarField> area_; autoPtr<volScalarField> AoV_;
//- Heat transfer coefficient table
const interpolation2DTable<scalar>& hTable();
//- Field of area divided by volume
const volScalarField& AoV();
//- Start time name
const word startTimeName_;
public: public:
@ -99,7 +108,6 @@ public:
//- Read dictionary //- Read dictionary
virtual bool read(const dictionary& dict) ; virtual bool read(const dictionary& dict) ;
}; };