From 3d979afaf7dbca5c317739d72b17a0b43f99f1f7 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Mon, 9 Jan 2017 18:46:51 +0000 Subject: [PATCH] Updated block assembly of MRF and porous zones --- .../solvers/coupled/MRFPorousFoam/UEqn.H | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/applications/solvers/coupled/MRFPorousFoam/UEqn.H b/applications/solvers/coupled/MRFPorousFoam/UEqn.H index 80e70f3a5..c40bb8ef2 100644 --- a/applications/solvers/coupled/MRFPorousFoam/UEqn.H +++ b/applications/solvers/coupled/MRFPorousFoam/UEqn.H @@ -5,6 +5,9 @@ fvc::div(phi) ); + // Update boundary velocity for consistency with the flux + mrfZones.correctBoundaryVelocity(U); + // Momentum equation fvVectorMatrix UEqn ( @@ -67,28 +70,38 @@ const scalarField& V = mesh.V().field(); - // Note: this insertion should only happen in porous cell zones - // A rewrite of the porousZones class interface is needed. + // Note: insertion should only happen in porous cell zones // HJ, 14/Mar/2016 - forAll (TUIn, cellI) + + register label cellI; + + forAll (pZones, pZoneI) { - const scalar& cellV = V[cellI]; + const labelList& curZoneCells = pZones[pZoneI].zone(); - const tensor& cellTU = TUIn[cellI]; + // Loop over all cells in the zone + forAll (curZoneCells, zcI) + { + cellI = curZoneCells[zcI]; - CoeffField::squareType& cellDD = DD[cellI]; + const scalar& cellV = V[cellI]; - cellDD(0, 0) += cellV*cellTU.xx(); - cellDD(0, 1) += cellV*cellTU.xy(); - cellDD(0, 2) += cellV*cellTU.xz(); + const tensor& cellTU = TUIn[cellI]; - cellDD(1, 0) += cellV*cellTU.yx(); - cellDD(1, 1) += cellV*cellTU.yy(); - cellDD(2, 2) += cellV*cellTU.yz(); + CoeffField::squareType& cellDD = DD[cellI]; - cellDD(2, 0) += cellV*cellTU.zx(); - cellDD(2, 1) += cellV*cellTU.zy(); - cellDD(2, 2) += cellV*cellTU.zz(); + cellDD(0, 0) += cellV*cellTU.xx(); + cellDD(0, 1) += cellV*cellTU.xy(); + cellDD(0, 2) += cellV*cellTU.xz(); + + cellDD(1, 0) += cellV*cellTU.yx(); + cellDD(1, 1) += cellV*cellTU.yy(); + cellDD(2, 2) += cellV*cellTU.yz(); + + cellDD(2, 0) += cellV*cellTU.zx(); + cellDD(2, 1) += cellV*cellTU.zy(); + cellDD(2, 2) += cellV*cellTU.zz(); + } } } }