Clean-up of porous heat transfer

This commit is contained in:
Hrvoje Jasak 2019-07-17 10:37:18 +01:00
parent cac07ccaed
commit baabe4700b
4 changed files with 50 additions and 21 deletions

View file

@ -216,10 +216,10 @@ Foam::porousZone::porousZone
dictPtr->lookup("nCellsAuxInlet") >> nCellsAuxInlet_; dictPtr->lookup("nCellsAuxInlet") >> nCellsAuxInlet_;
dictPtr->lookup("TauxRelax") >> Tauxrelax_; dictPtr->lookup("TauxRelax") >> Tauxrelax_;
Info<< "Maux = " << Maux_ << Info<< "Maux = " << Maux_ <<
" ,Taux = " << Taux_ << ", Taux = " << Taux_ <<
" ,caux = " << caux_ << ", caux = " << caux_ <<
" ,nCellsAuxInlet = " << nCellsAuxInlet_ << ", nCellsAuxInlet = " << nCellsAuxInlet_ <<
" ,Qepsilon = " << Qepsilon_ << nl; ", Qepsilon = " << Qepsilon_ << nl;
} }
else else
{ {
@ -470,7 +470,8 @@ void Foam::porousZone::macroCellOrder
const surfaceScalarField& phi const surfaceScalarField& phi
) const ) const
{ {
Info << "Creating cellsOrdered list " << nl << endl; Info<< "Creating cellsOrdered list for porous heat transfer zone "
<< name_ << nl << endl;
const labelList& cells = mesh_.cellZones()[cellZoneID_]; const labelList& cells = mesh_.cellZones()[cellZoneID_];
const vectorField& cellsCellCenter = mesh_.cellCentres(); const vectorField& cellsCellCenter = mesh_.cellCentres();
@ -545,7 +546,7 @@ void Foam::porousZone::macroCellOrder
{ {
Macroi[cellsOrdered[i]] = i; Macroi[cellsOrdered[i]] = i;
Tauxi[cellsOrdered[i]] = Taux_; Tauxi[cellsOrdered[i]] = Taux_;
if ((i > 1) && (i % nVerticalCells == 0)) if ((i > 1) && (i % nVerticalCells == 0))
{ {
++counter; ++counter;
@ -596,7 +597,8 @@ void Foam::porousZone::macroCellOrder
} }
scalarField& posFluxi = posFlux.internalField(); scalarField& posFluxi = posFlux.internalField();
// - Calculating mass flow through each cell
// Calculating mass flow through each cell
forAll (cellsOrdered, i) forAll (cellsOrdered, i)
{ {
const labelList& cellFaces = mesh_.cells()[cellsOrdered[i]]; const labelList& cellFaces = mesh_.cells()[cellsOrdered[i]];
@ -616,14 +618,16 @@ void Foam::porousZone::macroCellOrder
{ {
if (phi.internalField()[faceI] < 0.0) if (phi.internalField()[faceI] < 0.0)
{ {
posFluxi[cellsOrdered[i]] += -phi.internalField()[faceI]; posFluxi[cellsOrdered[i]] +=
-phi.internalField()[faceI];
} }
} }
} }
else else
{ {
const label patchI = mesh_.boundaryMesh().whichPatch(faceI); const label patchI = mesh_.boundaryMesh().whichPatch(faceI);
const label faceIL = mesh_.boundaryMesh()[patchI].whichFace(faceI); const label faceIL =
mesh_.boundaryMesh()[patchI].whichFace(faceI);
if (patchI < 0) if (patchI < 0)
{ {
@ -633,7 +637,8 @@ void Foam::porousZone::macroCellOrder
if (phi.boundaryField()[patchI][faceIL] > 0.0) if (phi.boundaryField()[patchI][faceIL] > 0.0)
{ {
posFluxi[cellsOrdered[i]] += phi.boundaryField()[patchI][faceIL]; posFluxi[cellsOrdered[i]] +=
phi.boundaryField()[patchI][faceIL];
} }
} }
} }

View file

@ -149,7 +149,6 @@ void Foam::porousZone::addHeatSource
const scalarField Tauxi_old = Tauxi; // create storePrevIter() const scalarField Tauxi_old = Tauxi; // create storePrevIter()
const scalarField dT = Tauxi - T; const scalarField dT = Tauxi - T;
const label nMacro(nCellsAuxInlet_*nVerticalCells_); const label nMacro(nCellsAuxInlet_*nVerticalCells_);
scalarList Tmacro(nMacro, 0.0); scalarList Tmacro(nMacro, 0.0);
scalarList dTaux(nMacro, 0.0); scalarList dTaux(nMacro, 0.0);
@ -170,19 +169,35 @@ void Foam::porousZone::addHeatSource
{ {
scalar Qcell = Qeps*rho_pri*c_pri*posFlux[cells[i]]*dT[cells[i]]; scalar Qcell = Qeps*rho_pri*c_pri*posFlux[cells[i]]*dT[cells[i]];
Qauxi[cells[i]] = Qcell; // heat in each macro(cell) // heat in each macro(cell)
Qauxi[cells[i]] = Qcell;
// make an int out of a macro
const int macro = Macro[cells[i]]; const int macro = Macro[cells[i]];
dTaux[macro] = Qcell/(c_aux*qm_auxi); // deltaTaux in each macro(cell)
QSource[cells[i]] += Qcell/(rho_pri*c_pri); // adding Heat to equation // deltaTaux in each macro(cell)
QSum += Qcell; // summing for total heat of HX dTaux[macro] = Qcell/(c_aux*qm_auxi);
// adding Heat to equation
QSource[cells[i]] += Qcell/(rho_pri*c_pri);
// summing for total heat of HX
QSum += Qcell;
} }
reduce(dTaux, sumOp<scalarList>()); reduce(dTaux, sumOp<scalarList>());
Tmacro[0] = T_aux; Tmacro[0] = T_aux;
forAll (Tmacro, i) forAll (Tmacro, i)
{ {
if (i > 0) Tmacro[i] = Tmacro[i-1] - dTaux[i-1]; if (i > 0)
if ((i > 0) && (i % nVerticalCells_ == 0)) Tmacro[i] = T_aux; {
Tmacro[i] = Tmacro[i-1] - dTaux[i-1];
}
if ((i > 0) && (i % nVerticalCells_ == 0))
{
Tmacro[i] = T_aux;
}
} }
reduce(QSum, sumOp<scalar>()); reduce(QSum, sumOp<scalar>());

View file

@ -101,11 +101,20 @@ void Foam::porousZones::addHeatResistance
{ {
forAll(*this, i) forAll(*this, i)
{ {
operator[](i).addHeatResistance(hTEqn, T, Taux, Qaux, U, Macro, posFlux); operator[](i).addHeatResistance
(
hTEqn,
T,
Taux,
Qaux,
U,
Macro,
posFlux
);
} }
} }
//- Order cells for Dual Stream model // Order cells for Dual Stream model
void Foam::porousZones::macroCellOrder void Foam::porousZones::macroCellOrder
( (
volScalarField& Taux, volScalarField& Taux,

View file

@ -177,10 +177,10 @@ public:
const surfaceScalarField& phi const surfaceScalarField& phi
) const; ) const;
//- read modified data //- Read modified data
virtual bool readData(Istream&); virtual bool readData(Istream&);
//- write data //- Write data
bool writeData(Ostream&, bool subDict = true) const; bool writeData(Ostream&, bool subDict = true) const;
}; };