twoPhaseEulerFoam: rationalize handling of fixed-flux BC update

This commit is contained in:
Henry 2015-05-09 23:45:15 +01:00
parent 227f3a33f5
commit bfb726aba3
6 changed files with 39 additions and 44 deletions

View file

@ -91,27 +91,9 @@ while (pimple.correct())
// Update continuity errors due to temperature changes // Update continuity errors due to temperature changes
#include "correctContErrs.H" #include "correctContErrs.H"
// Correct flux BCs to be consistent with the velocity BCs // Correct fixed-flux BCs to be consistent with the velocity BCs
forAll(mesh.boundary(), patchi) mrfZones.correctBoundaryFlux(U1, phi1);
{ mrfZones.correctBoundaryFlux(U2, phi2);
if (isA<fixedValueFvsPatchScalarField>(phi1.boundaryField()[patchi]))
{
phi1.boundaryField()[patchi] ==
mrfZones.relative
(
mesh.Sf().boundaryField() & U1.boundaryField()
)()[patchi];
}
if (isA<fixedValueFvsPatchScalarField>(phi2.boundaryField()[patchi]))
{
phi2.boundaryField()[patchi] ==
mrfZones.relative
(
mesh.Sf().boundaryField() & U2.boundaryField()
)()[patchi];
}
}
volVectorField HbyA1 volVectorField HbyA1
( (

View file

@ -99,26 +99,8 @@ while (pimple.correct())
surfaceScalarField rhof2(fvc::interpolate(rho2)); surfaceScalarField rhof2(fvc::interpolate(rho2));
// Correct fixed-flux BCs to be consistent with the velocity BCs // Correct fixed-flux BCs to be consistent with the velocity BCs
forAll(mesh.boundary(), patchi) mrfZones.correctBoundaryFlux(U1, phi1);
{ mrfZones.correctBoundaryFlux(U2, phi2);
if (isA<fixedValueFvsPatchScalarField>(phi1.boundaryField()[patchi]))
{
phi1.boundaryField()[patchi] ==
mrfZones.relative
(
mesh.Sf().boundaryField() & U1.boundaryField()
)()[patchi];
}
if (isA<fixedValueFvsPatchScalarField>(phi2.boundaryField()[patchi]))
{
phi2.boundaryField()[patchi] ==
mrfZones.relative
(
mesh.Sf().boundaryField() & U2.boundaryField()
)()[patchi];
}
}
surfaceScalarField alpharAUf1 surfaceScalarField alpharAUf1
( (

View file

@ -526,7 +526,6 @@ void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const
{ {
const vector Omega = this->Omega(); const vector Omega = this->Omega();
// Included patches // Included patches
forAll(includedFaces_, patchi) forAll(includedFaces_, patchi)
{ {

View file

@ -246,7 +246,7 @@ public:
surfaceScalarField& phi surfaceScalarField& phi
) const; ) const;
//- Correct the boundary velocity for the roation of the MRF region //- Correct the boundary velocity for the rotation of the MRF region
void correctBoundaryVelocity(volVectorField& U) const; void correctBoundaryVelocity(volVectorField& U) const;

View file

@ -25,6 +25,7 @@ License
#include "MRFZoneList.H" #include "MRFZoneList.H"
#include "volFields.H" #include "volFields.H"
#include "fixedValueFvsPatchFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -310,6 +311,30 @@ void Foam::MRFZoneList::correctBoundaryVelocity(volVectorField& U) const
} }
void Foam::MRFZoneList::correctBoundaryFlux
(
const volVectorField& U,
surfaceScalarField& phi
) const
{
FieldField<fvsPatchField, scalar> phibf
(
relative(mesh_.Sf().boundaryField() & U.boundaryField())
);
forAll(mesh_.boundary(), patchi)
{
if
(
isA<fixedValueFvsPatchScalarField>(phi.boundaryField()[patchi])
)
{
phi.boundaryField()[patchi] == phibf[patchi];
}
}
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<< Foam::Ostream& Foam::operator<<

View file

@ -160,9 +160,16 @@ public:
surfaceScalarField& phi surfaceScalarField& phi
) const; ) const;
//- Correct the boundary velocity for the roation of the MRF region //- Correct the boundary velocity for the rotation of the MRF region
void correctBoundaryVelocity(volVectorField& U) const; void correctBoundaryVelocity(volVectorField& U) const;
//- Correct the boundary flux for the rotation of the MRF region
void correctBoundaryFlux
(
const volVectorField& U,
surfaceScalarField& phi
) const;
// I-O // I-O