Skip to content
Snippets Groups Projects
Commit 4194ae50 authored by andy's avatar andy
Browse files

ENH: Updated interRegionHeatTransferModel

parent 373fdb1d
No related branches found
No related tags found
No related merge requests found
...@@ -110,10 +110,16 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel ...@@ -110,10 +110,16 @@ Foam::fv::interRegionHeatTransferModel::interRegionHeatTransferModel
0.0 0.0
), ),
zeroGradientFvPatchScalarField::typeName zeroGradientFvPatchScalarField::typeName
) ),
semiImplicit_(false)
{ {
coeffs_.lookup("fieldNames") >> fieldNames_; if (active())
applied_.setSize(fieldNames_.size(), false); {
coeffs_.lookup("fieldNames") >> fieldNames_;
applied_.setSize(fieldNames_.size(), false);
coeffs_.lookup("semiImplicit") >> semiImplicit_;
}
} }
...@@ -127,108 +133,108 @@ Foam::fv::interRegionHeatTransferModel::~interRegionHeatTransferModel() ...@@ -127,108 +133,108 @@ Foam::fv::interRegionHeatTransferModel::~interRegionHeatTransferModel()
void Foam::fv::interRegionHeatTransferModel::addSup void Foam::fv::interRegionHeatTransferModel::addSup
( (
fvMatrix<scalar>& eEqn, fvMatrix<scalar>& eqn,
const label fieldI const label fieldI
) )
{ {
if (secondaryToPrimaryInterpPtr_.valid()) if (!secondaryToPrimaryInterpPtr_.valid())
{ {
if (firstIter_) return;
{
check(); }
firstIter_ = false;
} if (firstIter_)
{
check();
firstIter_ = false;
}
const volScalarField& h = eEqn.psi(); const volScalarField& h = eqn.psi();
tmp<volScalarField> tTmapped tmp<volScalarField> tTmapped
(
new volScalarField
( (
new volScalarField IOobject
( (
IOobject mesh_.name() + "::Tmapped",
( mesh_.time().timeName(),
"Tmapped" + mesh_.name(),
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_, mesh_,
dimensionedScalar("T", dimTemperature, 0.0) IOobject::NO_READ,
) IOobject::NO_WRITE
); ),
mesh_,
dimensionedScalar("T", dimTemperature, 0.0)
)
);
volScalarField& Tmapped = tTmapped(); volScalarField& Tmapped = tTmapped();
const fvMesh& secondaryMesh = const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(mapRegionName_);
mesh_.time().lookupObject<fvMesh>(mapRegionName_);
const volScalarField& Tsecondary = const volScalarField& Tnbr = nbrMesh.lookupObject<volScalarField>("T");
secondaryMesh.lookupObject<volScalarField>("T");
secondaryToPrimaryInterpPtr_->interpolateInternalField
(
Tmapped,
Tnbr,
meshToMesh::MAP,
eqOp<scalar>()
);
if (!master_)
{
secondaryToPrimaryInterpPtr_->interpolateInternalField secondaryToPrimaryInterpPtr_->interpolateInternalField
( (
Tmapped, htc_,
Tsecondary, secIrht_->calculateHtc(),
meshToMesh::MAP, meshToMesh::CELL_VOLUME_WEIGHT,
eqOp<scalar>() eqOp<scalar>()
); );
}
if (!master_) if (debug)
{ {
secondaryToPrimaryInterpPtr_->interpolateInternalField Info<< " Volumetric integral of htc : "
( << fvc::domainIntegrate(htc_).value()
htc_, << endl;
secIrht_->calculateHtc(),
meshToMesh::CELL_VOLUME_WEIGHT,
eqOp<scalar>()
);
}
if (debug)
{
Info<< " Volumetric integral of htc : "
<< fvc::domainIntegrate(htc_).value()
<< endl;
}
if (debug && mesh_.time().outputTime()) if (mesh_.time().outputTime())
{ {
Tmapped.write(); Tmapped.write();
htc_.write(); htc_.write();
} }
}
if (semiImplicit_)
{
if (h.dimensions() == dimEnergy/dimMass) if (h.dimensions() == dimEnergy/dimMass)
{ {
const fluidThermo& primaryThermo = const fluidThermo& thermo =
mesh_.lookupObject<fluidThermo>("thermophysicalProperties"); mesh_.lookupObject<fluidThermo>("thermophysicalProperties");
eEqn += htc_*Tmapped - fvm::Sp(htc_/primaryThermo.Cp(), h); eqn += htc_*Tmapped - fvm::SuSp(htc_/thermo.Cp(), h);
if (debug) if (debug)
{ {
Info<< " Energy exchange from region " << secondaryMesh.name() const dimensionedScalar energy =
<< " To " << mesh_.name() << " : " fvc::domainIntegrate(htc_*(h/thermo.Cp() - Tmapped));
<< fvc::domainIntegrate
( Info<< "Energy exchange from region " << nbrMesh.name()
htc_*(h/primaryThermo.Cp() - Tmapped) << " To " << mesh_.name() << " : " << energy.value()
).value()
<< endl; << endl;
} }
} }
else if (h.dimensions() == dimTemperature) else if (h.dimensions() == dimTemperature)
{ {
eEqn += htc_*Tmapped - fvm::Sp(htc_, h); eqn += htc_*Tmapped - fvm::SuSp(htc_, h);
if (debug)
{
Info<< " Enegy exchange from region " << secondaryMesh.name()
<< " To " << mesh_.name() << " : "
<< fvc::domainIntegrate(htc_*(h - Tmapped)).value()
<< endl;
}
} }
} }
else
{
const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
eqn += htc_*(Tmapped - T);
}
} }
...@@ -239,16 +245,15 @@ void Foam::fv::interRegionHeatTransferModel::writeData(Ostream& os) const ...@@ -239,16 +245,15 @@ void Foam::fv::interRegionHeatTransferModel::writeData(Ostream& os) const
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
os.writeKeyword("secondarySourceName") << secondarySourceName_ os.writeKeyword("secondarySourceName") << secondarySourceName_
<< 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
<< nl;
if (dict_.found("note")) if (dict_.found("note"))
{ {
os.writeKeyword("note") << string(dict_.lookup("note")) os.writeKeyword("note") << string(dict_.lookup("note"))
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
} }
dict_.write(os);
} }
......
...@@ -78,6 +78,9 @@ protected: ...@@ -78,6 +78,9 @@ protected:
// registered on the master mesh // registered on the master mesh
volScalarField htc_; volScalarField htc_;
//- Flag to activate semi-implicit coupling
bool semiImplicit_;
public: public:
...@@ -113,7 +116,7 @@ public: ...@@ -113,7 +116,7 @@ public:
} }
//-Source term to fvMatrix<scalar> //-Source term to fvMatrix<scalar>
virtual void addSup(fvMatrix<scalar>& eEqn, const label fieldI); virtual void addSup(fvMatrix<scalar>& eqn, const label fieldI);
//- Calculate heat transfer coefficient //- Calculate heat transfer coefficient
virtual const tmp<volScalarField> calculateHtc() = 0; virtual const tmp<volScalarField> calculateHtc() = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment