From baabe4700ba0c672e71834ef3aa9b9d94a57ee0d Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Wed, 17 Jul 2019 10:37:18 +0100 Subject: [PATCH] Clean-up of porous heat transfer --- .../cfdTools/general/porousMedia/porousZone.C | 25 +++++++++------- .../general/porousMedia/porousZoneTemplates.C | 29 ++++++++++++++----- .../general/porousMedia/porousZones.C | 13 +++++++-- .../general/porousMedia/porousZones.H | 4 +-- 4 files changed, 50 insertions(+), 21 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C index b6df454f7..fb137ca7b 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C @@ -216,10 +216,10 @@ Foam::porousZone::porousZone dictPtr->lookup("nCellsAuxInlet") >> nCellsAuxInlet_; dictPtr->lookup("TauxRelax") >> Tauxrelax_; Info<< "Maux = " << Maux_ << - " ,Taux = " << Taux_ << - " ,caux = " << caux_ << - " ,nCellsAuxInlet = " << nCellsAuxInlet_ << - " ,Qepsilon = " << Qepsilon_ << nl; + ", Taux = " << Taux_ << + ", caux = " << caux_ << + ", nCellsAuxInlet = " << nCellsAuxInlet_ << + ", Qepsilon = " << Qepsilon_ << nl; } else { @@ -470,7 +470,8 @@ void Foam::porousZone::macroCellOrder const surfaceScalarField& phi ) 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 vectorField& cellsCellCenter = mesh_.cellCentres(); @@ -545,7 +546,7 @@ void Foam::porousZone::macroCellOrder { Macroi[cellsOrdered[i]] = i; Tauxi[cellsOrdered[i]] = Taux_; - + if ((i > 1) && (i % nVerticalCells == 0)) { ++counter; @@ -596,7 +597,8 @@ void Foam::porousZone::macroCellOrder } scalarField& posFluxi = posFlux.internalField(); - // - Calculating mass flow through each cell + + // Calculating mass flow through each cell forAll (cellsOrdered, i) { const labelList& cellFaces = mesh_.cells()[cellsOrdered[i]]; @@ -616,14 +618,16 @@ void Foam::porousZone::macroCellOrder { if (phi.internalField()[faceI] < 0.0) { - posFluxi[cellsOrdered[i]] += -phi.internalField()[faceI]; + posFluxi[cellsOrdered[i]] += + -phi.internalField()[faceI]; } } } else { 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) { @@ -633,7 +637,8 @@ void Foam::porousZone::macroCellOrder if (phi.boundaryField()[patchI][faceIL] > 0.0) { - posFluxi[cellsOrdered[i]] += phi.boundaryField()[patchI][faceIL]; + posFluxi[cellsOrdered[i]] += + phi.boundaryField()[patchI][faceIL]; } } } diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C index a0e1b703f..f8ea6f152 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C @@ -149,7 +149,6 @@ void Foam::porousZone::addHeatSource const scalarField Tauxi_old = Tauxi; // create storePrevIter() const scalarField dT = Tauxi - T; - const label nMacro(nCellsAuxInlet_*nVerticalCells_); scalarList Tmacro(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]]; - 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]]; - dTaux[macro] = Qcell/(c_aux*qm_auxi); // deltaTaux in each macro(cell) - QSource[cells[i]] += Qcell/(rho_pri*c_pri); // adding Heat to equation - QSum += Qcell; // summing for total heat of HX + + // deltaTaux in each macro(cell) + 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()); Tmacro[0] = T_aux; forAll (Tmacro, i) { - if (i > 0) Tmacro[i] = Tmacro[i-1] - dTaux[i-1]; - if ((i > 0) && (i % nVerticalCells_ == 0)) Tmacro[i] = T_aux; + if (i > 0) + { + Tmacro[i] = Tmacro[i-1] - dTaux[i-1]; + } + + if ((i > 0) && (i % nVerticalCells_ == 0)) + { + Tmacro[i] = T_aux; + } } reduce(QSum, sumOp()); diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C index 9101dc44a..4dbf54086 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C @@ -101,11 +101,20 @@ void Foam::porousZones::addHeatResistance { 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 ( volScalarField& Taux, diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.H b/src/finiteVolume/cfdTools/general/porousMedia/porousZones.H index 9779e7272..29f7bb584 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.H +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZones.H @@ -177,10 +177,10 @@ public: const surfaceScalarField& phi ) const; - //- read modified data + //- Read modified data virtual bool readData(Istream&); - //- write data + //- Write data bool writeData(Ostream&, bool subDict = true) const; };