Improved new-style MRF

This commit is contained in:
Hrvoje Jasak 2017-06-08 14:53:33 +01:00
parent 4ac325ab77
commit 0fe89520a2
2 changed files with 41 additions and 3 deletions

View file

@ -695,7 +695,43 @@ void Foam::MRFZone::meshPhi
surfaceScalarField& phi
) const
{
phi += meshVelocity();
const surfaceScalarField& meshVel = meshVelocity();
register label faceI, patchFaceI;
scalarField& phiIn = phi.internalField();
const scalarField& meshVelIn = meshVel.internalField();
forAll (internalFaces_, i)
{
faceI = internalFaces_[i];
phiIn[faceI] = meshVelIn[faceI];
}
// Included patches
forAll (includedFaces_, patchI)
{
forAll (includedFaces_[patchI], i)
{
patchFaceI = includedFaces_[patchI][i];
phi.boundaryField()[patchI][patchFaceI] =
meshVel.boundaryField()[patchI][patchFaceI];
}
}
// Excluded patches
forAll (excludedFaces_, patchI)
{
forAll (excludedFaces_[patchI], i)
{
patchFaceI = excludedFaces_[patchI][i];
phi.boundaryField()[patchI][patchFaceI] =
meshVel.boundaryField()[patchI][patchFaceI];
}
}
}

View file

@ -62,7 +62,7 @@ void Foam::MRFZone::relativeRhoFlux
{
patchFaceI = includedFaces_[patchI][i];
phi.boundaryField()[patchI][patchFaceI] = 0;
phi.boundaryField()[patchI][patchFaceI] = 0.0;
}
}
@ -102,7 +102,7 @@ void Foam::MRFZone::absoluteRhoFlux
{
faceI = internalFaces_[i];
phiIn[faceI] += meshVelIn[faceI];
phiIn[faceI] += rho[faceI]*meshVelIn[faceI];
}
// Included patches
@ -113,6 +113,7 @@ void Foam::MRFZone::absoluteRhoFlux
patchFaceI = includedFaces_[patchI][i];
phi.boundaryField()[patchI][patchFaceI] +=
rho.boundaryField()[patchI][patchFaceI]*
meshVel.boundaryField()[patchI][patchFaceI];
}
}
@ -125,6 +126,7 @@ void Foam::MRFZone::absoluteRhoFlux
patchFaceI = excludedFaces_[patchI][i];
phi.boundaryField()[patchI][patchFaceI] +=
rho.boundaryField()[patchI][patchFaceI]*
meshVel.boundaryField()[patchI][patchFaceI];
}
}