ENH: Further updates to interRegionHeatTransfer models

This commit is contained in:
andy
2013-01-09 10:32:06 +00:00
parent bd5170286b
commit ee92749434
5 changed files with 37 additions and 34 deletions

View File

@ -113,7 +113,7 @@ void Foam::fv::option::setCellSet()
{
case smPoints:
{
Info<< indent << "- selecting cells using points" << endl;
IInfo<< "- selecting cells using points" << endl;
labelHashSet selectedCells;
@ -142,8 +142,7 @@ void Foam::fv::option::setCellSet()
}
case smCellSet:
{
Info<< indent << "- selecting cells using cellSet "
<< cellSetName_ << endl;
IInfo<< "- selecting cells using cellSet " << cellSetName_ << endl;
cellSet selectedCells(mesh_, cellSetName_);
cells_ = selectedCells.toc();
@ -152,8 +151,8 @@ void Foam::fv::option::setCellSet()
}
case smCellZone:
{
Info<< indent << "- selecting cells using cellZone "
<< cellSetName_ << endl;
IInfo<< "- selecting cells using cellZone " << cellSetName_ << endl;
label zoneID = mesh_.cellZones().findZoneID(cellSetName_);
if (zoneID == -1)
{
@ -170,7 +169,8 @@ void Foam::fv::option::setCellSet()
{
if (active_)
{
Info<< indent << "- selecting inter region mapping" << endl;
IInfo<< "- selecting inter region mapping" << endl;
const fvMesh& nbrMesh =
mesh_.time().lookupObject<fvMesh>(nbrRegionName_);
@ -197,8 +197,7 @@ void Foam::fv::option::setCellSet()
else
{
FatalErrorIn("option::setCellSet()")
<< "regions do not overlap "
<< nbrMesh.name()
<< "regions do not overlap " << nbrMesh.name()
<< " in region " << mesh_.name() << nl
<< exit(FatalError);
}
@ -207,7 +206,7 @@ void Foam::fv::option::setCellSet()
}
case smAll:
{
Info<< indent << "- selecting all cells" << endl;
IInfo<< "- selecting all cells" << endl;
cells_ = identity(mesh_.nCells());
break;
@ -232,8 +231,7 @@ void Foam::fv::option::setCellSet()
}
reduce(V_, sumOp<scalar>());
Info<< indent << "- selected "
<< returnReduce(cells_.size(), sumOp<label>())
IInfo<< "- selected " << returnReduce(cells_.size(), sumOp<label>())
<< " cell(s) with volume " << V_ << nl << endl;
}
}
@ -256,17 +254,13 @@ Foam::fv::option::option
active_(readBool(dict_.lookup("active"))),
timeStart_(-1.0),
duration_(0.0),
selectionMode_
(
selectionModeTypeNames_.read(dict_.lookup("selectionMode"))
),
selectionMode_(selectionModeTypeNames_.read(dict_.lookup("selectionMode"))),
cellSetName_("none"),
V_(0.0),
secondaryToPrimaryInterpPtr_(),
nbrModelName_("none"),
nbrRegionName_("none"),
master_(false),
fieldNames_(),
applied_()
{
@ -275,12 +269,12 @@ Foam::fv::option::option
if (dict_.readIfPresent("timeStart", timeStart_))
{
dict_.lookup("duration") >> duration_;
Info<< indent << "- applying source at time " << timeStart_
IInfo<< "- applying source at time " << timeStart_
<< " for duration " << duration_ << endl;
}
else
{
Info<< indent<< "- applying source for all time" << endl;
IInfo<< "- applying source for all time" << endl;
}
setSelection(dict_);
@ -302,7 +296,7 @@ Foam::autoPtr<Foam::fv::option> Foam::fv::option::New
{
word modelType(coeffs.lookup("type"));
Info<< "Selecting source model type " << modelType << endl;
IInfo<< "Selecting source model type " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
@ -311,9 +305,8 @@ Foam::autoPtr<Foam::fv::option> Foam::fv::option::New
{
FatalErrorIn
(
"option::New(const name&, const dictionary&, const fvMesh&)"
) << "Unknown Model type " << modelType
<< nl << nl
"option::New(const word&, const dictionary&, const fvMesh&)"
) << "Unknown Model type " << modelType << nl << nl
<< "Valid model types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);

View File

@ -93,6 +93,7 @@ Foam::fv::tabulatedHeatTransfer::tabulatedHeatTransfer
)
:
interRegionHeatTransferModel(name, modelType, dict, mesh),
UName_(coeffs_.lookupOrDefault<word>("UName", "U")),
hTable_(),
AoV_(),
startTimeName_(mesh.time().timeName())
@ -112,7 +113,7 @@ Foam::fv::tabulatedHeatTransfer::calculateHtc()
{
const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName());
const volVectorField& UNbr = nbrMesh.lookupObject<volVectorField>("U");
const volVectorField& UNbr = nbrMesh.lookupObject<volVectorField>(UName_);
scalarField UMagNbrMapped(htc_.internalField().size(), 0.0);
@ -124,7 +125,7 @@ Foam::fv::tabulatedHeatTransfer::calculateHtc()
eqOp<scalar>()
);
const volVectorField& U = mesh_.lookupObject<volVectorField>("U");
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
scalarField& htcc = htc_.internalField();

View File

@ -25,9 +25,9 @@ Class
Foam::fv::tabulatedHeatTransfer
Description
Tabulated heat transfer model. The heat exchange area must be
provided. The 2D table look for heat transfer coefficients uses the
primary and secondary region velocities
Tabulated heat transfer model. The heat exchange area per unit volume
must be provided. The 2D table returns the heat transfer coefficient
by querying the local and neighbour region velocities
\*---------------------------------------------------------------------------*/
@ -57,6 +57,9 @@ private:
// Private data
//- Name of velocity field; default = U
word UName_;
//- 2D look up table
autoPtr<interpolation2DTable<scalar> > hTable_;
@ -107,7 +110,7 @@ public:
virtual void writeData(Ostream&) const;
//- Read dictionary
virtual bool read(const dictionary& dict) ;
virtual bool read(const dictionary& dict);
};

View File

@ -55,6 +55,7 @@ Foam::fv::variableHeatTransfer::variableHeatTransfer
)
:
interRegionHeatTransferModel(name, modelType, dict, mesh),
UName_(coeffs_.lookupOrDefault<word>("UName", "U")),
a_(0),
b_(0),
c_(0),
@ -64,11 +65,11 @@ Foam::fv::variableHeatTransfer::variableHeatTransfer
{
if (master_)
{
a_ = readScalar(dict_.lookup("a"));
b_ = readScalar(dict_.lookup("b"));
c_ = readScalar(dict_.lookup("c"));
ds_ = readScalar(dict_.lookup("ds"));
Pr_ = readScalar(dict_.lookup("Pr"));
a_ = readScalar(coeffs_.lookup("a"));
b_ = readScalar(coeffs_.lookup("b"));
c_ = readScalar(coeffs_.lookup("c"));
ds_ = readScalar(coeffs_.lookup("ds"));
Pr_ = readScalar(coeffs_.lookup("Pr"));
AoV_.reset
(
new volScalarField
@ -108,7 +109,7 @@ Foam::fv::variableHeatTransfer::calculateHtc()
const fluidThermo& nbrThermo =
nbrMesh.lookupObject<fluidThermo>("thermophysicalProperties");
const volVectorField& U = nbrMesh.lookupObject<volVectorField>("U");
const volVectorField& U = nbrMesh.lookupObject<volVectorField>(UName_);
const volScalarField Re(mag(U)*ds_*nbrThermo.rho()/nbrTurb.mut());
@ -149,6 +150,8 @@ bool Foam::fv::variableHeatTransfer::read(const dictionary& dict)
{
if (option::read(dict))
{
coeffs_.readIfPresent("UName", UName_);
coeffs_.readIfPresent("a", a_);
coeffs_.readIfPresent("b", b_);
coeffs_.readIfPresent("c", c_);

View File

@ -65,6 +65,9 @@ private:
// Private data
//- Name of velocity field; default = U
word UName_;
//- Model constants
scalar a_;
scalar b_;