ENH: Updated interRegionHeatTransferModel

This commit is contained in:
andy
2013-01-09 09:05:31 +00:00
parent 097b40f8a2
commit 89e573b7f5
7 changed files with 56 additions and 64 deletions

View File

@ -86,8 +86,8 @@ void Foam::fv::option::setSelection(const dictionary& dict)
}
case smMapRegion:
{
dict_.lookup("secondarySourceName") >> secondarySourceName_;
dict_.lookup("mapRegionName") >> mapRegionName_;
dict_.lookup("nbrModelName") >> nbrModelName_;
dict_.lookup("nbrRegionName") >> nbrRegionName_;
master_ = readBool(dict_.lookup("master"));
break;
}
@ -128,7 +128,7 @@ void Foam::fv::option::setCellSet()
label globalCellI = returnReduce(cellI, maxOp<label>());
if (globalCellI < 0)
{
WarningIn("option::setCellIds()")
WarningIn("option::setCellSet()")
<< "Unable to find owner cell for point " << points_[i]
<< endl;
@ -171,13 +171,13 @@ void Foam::fv::option::setCellSet()
if (active_)
{
Info<< indent << "- selecting inter region mapping" << endl;
const fvMesh& secondaryMesh =
mesh_.time().lookupObject<fvMesh>(mapRegionName_);
const fvMesh& nbrMesh =
mesh_.time().lookupObject<fvMesh>(nbrRegionName_);
boundBox primaryBB(mesh_.points(), false);
boundBox secondaryBB(secondaryMesh.points(), false);
boundBox BB(mesh_.points(), false);
boundBox nbrBB(nbrMesh.points(), false);
if (secondaryBB.overlaps(primaryBB))
if (nbrBB.overlaps(BB))
{
// Dummy patches
wordList cuttingPatches;
@ -187,7 +187,7 @@ void Foam::fv::option::setCellSet()
(
new meshToMesh
(
secondaryMesh,
nbrMesh,
mesh_,
patchMap,
cuttingPatches
@ -197,10 +197,9 @@ void Foam::fv::option::setCellSet()
else
{
FatalErrorIn("option::setCellSet()")
<< "regions dont overlap "
<< secondaryMesh.name()
<< " in region " << mesh_.name()
<< nl
<< "regions do not overlap "
<< nbrMesh.name()
<< " in region " << mesh_.name() << nl
<< exit(FatalError);
}
}
@ -215,7 +214,7 @@ void Foam::fv::option::setCellSet()
}
default:
{
FatalErrorIn("option::setCellIds()")
FatalErrorIn("option::setCellSet()")
<< "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
@ -264,8 +263,8 @@ Foam::fv::option::option
cellSetName_("none"),
V_(0.0),
secondaryToPrimaryInterpPtr_(),
secondarySourceName_("none"),
mapRegionName_("none"),
nbrModelName_("none"),
nbrRegionName_("none"),
master_(false),
fieldNames_(),

View File

@ -131,14 +131,14 @@ protected:
// Data for smMapRegion only
//- Mesh to mesh mapping for map optiom
//- Mesh to mesh mapping for map option
autoPtr<meshToMesh> secondaryToPrimaryInterpPtr_;
//- Name of the source in the secondary mesh
word secondarySourceName_;
//- Name of the model in the neighbour mesh
word nbrModelName_;
//- Name of the region to map
word mapRegionName_;
//- Name of the neighbour region to map
word nbrRegionName_;
//- Master or slave region
bool master_;
@ -288,16 +288,16 @@ public:
//- Return const access to the total cell volume
inline scalar V() const;
//- Return const access to the secondarySourceName
inline const word secondarySourceName() const;
//- Return const access to the neighbour model name
inline const word& nbrModelName() const;
//- Return const access to the neighbour region name
inline const word& nbrRegionName() const;
//- Return const access to the mapToMap Ptr
inline const autoPtr<meshToMesh>
secondaryToPrimaryInterpPtr() const;
//- Return const referenc to the mapRegion
inline const word mapRegionName() const;
//- Return const access to the cell set
inline const labelList& cells() const;

View File

@ -126,9 +126,15 @@ inline Foam::scalar& Foam::fv::option::duration()
}
inline const Foam::word Foam::fv::option::secondarySourceName() const
inline const Foam::word& Foam::fv::option::nbrModelName() const
{
return secondarySourceName_;
return nbrModelName_;
}
inline const Foam::word& Foam::fv::option::nbrRegionName() const
{
return nbrRegionName_;
}
@ -139,10 +145,4 @@ Foam::fv::option::secondaryToPrimaryInterpPtr() const
}
inline const Foam::word Foam::fv::option::mapRegionName() const
{
return mapRegionName_;
}
// ************************************************************************* //

View File

@ -45,35 +45,30 @@ namespace fv
void Foam::fv::interRegionHeatTransferModel::check()
{
const fvMesh& secondaryMesh =
mesh_.time().lookupObject<fvMesh>(mapRegionName_);
const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName_);
const optionList& IObsl =
secondaryMesh.lookupObject<optionList>("sourcesProperties");
const optionList& fvOptions = nbrMesh.lookupObject<optionList>("fvOptions");
const PtrList<option>& bsl = IObsl;
bool nbrModelFound = false;
bool secSourceFound(false);
forAll(bsl, i)
forAll(fvOptions, i)
{
if (bsl[i].name() == secondarySourceName_)
if (fvOptions[i].name() == nbrModelName_)
{
secIrht_ = &const_cast<interRegionHeatTransferModel&>
nbrModel_ = &const_cast<interRegionHeatTransferModel&>
(
refCast<const interRegionHeatTransferModel>(bsl[i])
refCast<const interRegionHeatTransferModel>(fvOptions[i])
);
secSourceFound = true;
nbrModelFound = true;
break;
}
}
if (!secSourceFound)
if (!nbrModelFound)
{
FatalErrorIn("interRegionHeatTransferModel::check()")
<< "Secondary source name not found" << secondarySourceName_
<< " in region " << secondaryMesh.name()
<< nl
<< "Secondary source name not found" << nbrModelName_
<< " in region " << nbrMesh.name() << nl
<< exit(FatalError);
}
}
@ -90,13 +85,13 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel
)
:
option(name, modelType, dict, mesh),
secIrht_(),
nbrModel_(),
firstIter_(true),
htc_
(
IOobject
(
"htc",
type() + ".htc",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
@ -140,7 +135,6 @@ void Foam::fv::interRegionHeatTransferModel::addSup
if (!secondaryToPrimaryInterpPtr_.valid())
{
return;
}
if (firstIter_)
@ -157,7 +151,7 @@ void Foam::fv::interRegionHeatTransferModel::addSup
(
IOobject
(
mesh_.name() + "::Tmapped",
type() + ".Tmapped",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
@ -170,7 +164,7 @@ void Foam::fv::interRegionHeatTransferModel::addSup
volScalarField& Tmapped = tTmapped();
const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(mapRegionName_);
const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName_);
const volScalarField& Tnbr = nbrMesh.lookupObject<volScalarField>("T");
@ -187,7 +181,7 @@ void Foam::fv::interRegionHeatTransferModel::addSup
secondaryToPrimaryInterpPtr_->interpolateInternalField
(
htc_,
secIrht_->calculateHtc(),
nbrModel_->calculateHtc(),
meshToMesh::CELL_VOLUME_WEIGHT,
eqOp<scalar>()
);
@ -195,7 +189,7 @@ void Foam::fv::interRegionHeatTransferModel::addSup
if (debug)
{
Info<< " Volumetric integral of htc : "
Info<< "Volumetric integral of htc: "
<< fvc::domainIntegrate(htc_).value()
<< endl;
@ -241,9 +235,9 @@ void Foam::fv::interRegionHeatTransferModel::addSup
void Foam::fv::interRegionHeatTransferModel::writeData(Ostream& os) const
{
os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl;
os.writeKeyword("mapRegionName") << mapRegionName_
os.writeKeyword("nbrRegionName") << nbrRegionName_
<< token::END_STATEMENT << nl;
os.writeKeyword("secondarySourceName") << secondarySourceName_
os.writeKeyword("nbrModeleName") << nbrModelName_
<< token::END_STATEMENT << nl;
os.writeKeyword("master") << master_ << token::END_STATEMENT << nl;
os.writeKeyword("semiImplicit") << semiImplicit_ << token::END_STATEMENT

View File

@ -57,8 +57,8 @@ private:
// Private data
//- Pointer to secondary interRegionHeatTransferModel
interRegionHeatTransferModel* secIrht_;
//- Pointer to neighbour interRegionHeatTransferModel
interRegionHeatTransferModel* nbrModel_;
//- First iteration
bool firstIter_;

View File

@ -110,7 +110,7 @@ Foam::fv::tabulatedHeatTransfer::~tabulatedHeatTransfer()
const Foam::tmp<Foam::volScalarField>
Foam::fv::tabulatedHeatTransfer::calculateHtc()
{
const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(mapRegionName());
const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName());
const volVectorField& UNbr = nbrMesh.lookupObject<volVectorField>("U");

View File

@ -96,12 +96,11 @@ Foam::fv::variableHeatTransfer::~variableHeatTransfer()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::tmp<Foam::volScalarField>
Foam::fv::variableHeatTransfer::calculateHtc()
{
const fvMesh& nbrMesh =
mesh_.time().lookupObject<fvMesh>(mapRegionName());
mesh_.time().lookupObject<fvMesh>(nbrRegionName());
const compressible::turbulenceModel& nbrTurb =
nbrMesh.lookupObject<compressible::turbulenceModel>("turbulenceModel");