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

View File

@ -131,14 +131,14 @@ protected:
// Data for smMapRegion only // Data for smMapRegion only
//- Mesh to mesh mapping for map optiom //- Mesh to mesh mapping for map option
autoPtr<meshToMesh> secondaryToPrimaryInterpPtr_; autoPtr<meshToMesh> secondaryToPrimaryInterpPtr_;
//- Name of the source in the secondary mesh //- Name of the model in the neighbour mesh
word secondarySourceName_; word nbrModelName_;
//- Name of the region to map //- Name of the neighbour region to map
word mapRegionName_; word nbrRegionName_;
//- Master or slave region //- Master or slave region
bool master_; bool master_;
@ -288,16 +288,16 @@ public:
//- Return const access to the total cell volume //- Return const access to the total cell volume
inline scalar V() const; inline scalar V() const;
//- Return const access to the secondarySourceName //- Return const access to the neighbour model name
inline const word secondarySourceName() const; 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 //- Return const access to the mapToMap Ptr
inline const autoPtr<meshToMesh> inline const autoPtr<meshToMesh>
secondaryToPrimaryInterpPtr() const; secondaryToPrimaryInterpPtr() const;
//- Return const referenc to the mapRegion
inline const word mapRegionName() const;
//- Return const access to the cell set //- Return const access to the cell set
inline const labelList& cells() const; 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() void Foam::fv::interRegionHeatTransferModel::check()
{ {
const fvMesh& secondaryMesh = const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName_);
mesh_.time().lookupObject<fvMesh>(mapRegionName_);
const optionList& IObsl = const optionList& fvOptions = nbrMesh.lookupObject<optionList>("fvOptions");
secondaryMesh.lookupObject<optionList>("sourcesProperties");
const PtrList<option>& bsl = IObsl; bool nbrModelFound = false;
bool secSourceFound(false); forAll(fvOptions, i)
forAll(bsl, 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; break;
} }
} }
if (!secSourceFound) if (!nbrModelFound)
{ {
FatalErrorIn("interRegionHeatTransferModel::check()") FatalErrorIn("interRegionHeatTransferModel::check()")
<< "Secondary source name not found" << secondarySourceName_ << "Secondary source name not found" << nbrModelName_
<< " in region " << secondaryMesh.name() << " in region " << nbrMesh.name() << nl
<< nl
<< exit(FatalError); << exit(FatalError);
} }
} }
@ -90,13 +85,13 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel
) )
: :
option(name, modelType, dict, mesh), option(name, modelType, dict, mesh),
secIrht_(), nbrModel_(),
firstIter_(true), firstIter_(true),
htc_ htc_
( (
IOobject IOobject
( (
"htc", type() + ".htc",
mesh.time().timeName(), mesh.time().timeName(),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
@ -140,7 +135,6 @@ void Foam::fv::interRegionHeatTransferModel::addSup
if (!secondaryToPrimaryInterpPtr_.valid()) if (!secondaryToPrimaryInterpPtr_.valid())
{ {
return; return;
} }
if (firstIter_) if (firstIter_)
@ -157,7 +151,7 @@ void Foam::fv::interRegionHeatTransferModel::addSup
( (
IOobject IOobject
( (
mesh_.name() + "::Tmapped", type() + ".Tmapped",
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
@ -170,7 +164,7 @@ void Foam::fv::interRegionHeatTransferModel::addSup
volScalarField& Tmapped = tTmapped(); 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"); const volScalarField& Tnbr = nbrMesh.lookupObject<volScalarField>("T");
@ -187,7 +181,7 @@ void Foam::fv::interRegionHeatTransferModel::addSup
secondaryToPrimaryInterpPtr_->interpolateInternalField secondaryToPrimaryInterpPtr_->interpolateInternalField
( (
htc_, htc_,
secIrht_->calculateHtc(), nbrModel_->calculateHtc(),
meshToMesh::CELL_VOLUME_WEIGHT, meshToMesh::CELL_VOLUME_WEIGHT,
eqOp<scalar>() eqOp<scalar>()
); );
@ -241,9 +235,9 @@ void Foam::fv::interRegionHeatTransferModel::addSup
void Foam::fv::interRegionHeatTransferModel::writeData(Ostream& os) const void Foam::fv::interRegionHeatTransferModel::writeData(Ostream& os) const
{ {
os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl; os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl;
os.writeKeyword("mapRegionName") << mapRegionName_ os.writeKeyword("nbrRegionName") << nbrRegionName_
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
os.writeKeyword("secondarySourceName") << secondarySourceName_ os.writeKeyword("nbrModeleName") << nbrModelName_
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
os.writeKeyword("master") << master_ << token::END_STATEMENT << nl; os.writeKeyword("master") << master_ << token::END_STATEMENT << nl;
os.writeKeyword("semiImplicit") << semiImplicit_ << token::END_STATEMENT os.writeKeyword("semiImplicit") << semiImplicit_ << token::END_STATEMENT

View File

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

View File

@ -110,7 +110,7 @@ Foam::fv::tabulatedHeatTransfer::~tabulatedHeatTransfer()
const Foam::tmp<Foam::volScalarField> const Foam::tmp<Foam::volScalarField>
Foam::fv::tabulatedHeatTransfer::calculateHtc() 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"); const volVectorField& UNbr = nbrMesh.lookupObject<volVectorField>("U");

View File

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