constrainPressure: Updated to use the more efficient patch-based MRF::relative function
This commit is contained in:
@ -43,50 +43,37 @@ void Foam::constrainPressure
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = p.mesh();
|
const fvMesh& mesh = p.mesh();
|
||||||
|
|
||||||
volScalarField::GeometricBoundaryField& pBf = p.boundaryField();
|
volScalarField::GeometricBoundaryField& pBf = p.boundaryField();
|
||||||
|
|
||||||
bool hasFixedFluxBCs = false;
|
const volVectorField::GeometricBoundaryField& UBf = U.boundaryField();
|
||||||
forAll(pBf, patchi)
|
|
||||||
{
|
|
||||||
if (isA<fixedFluxPressureFvPatchScalarField>(pBf[patchi]))
|
|
||||||
{
|
|
||||||
hasFixedFluxBCs = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasFixedFluxBCs)
|
|
||||||
{
|
|
||||||
const surfaceScalarField::GeometricBoundaryField& phiHbyABf =
|
const surfaceScalarField::GeometricBoundaryField& phiHbyABf =
|
||||||
phiHbyA.boundaryField();
|
phiHbyA.boundaryField();
|
||||||
const typename RAUType::GeometricBoundaryField& rhorAUBf =
|
const typename RAUType::GeometricBoundaryField& rhorAUBf =
|
||||||
rhorAU.boundaryField();
|
rhorAU.boundaryField();
|
||||||
|
const surfaceVectorField::GeometricBoundaryField& SfBf =
|
||||||
|
mesh.Sf().boundaryField();
|
||||||
const surfaceScalarField::GeometricBoundaryField& magSfBf =
|
const surfaceScalarField::GeometricBoundaryField& magSfBf =
|
||||||
mesh.magSf().boundaryField();
|
mesh.magSf().boundaryField();
|
||||||
|
|
||||||
// Pre-compute tho relative flux for all patches: currently MRFZone does
|
|
||||||
// not support computing the relative flux for individual patches
|
|
||||||
FieldField<fvsPatchField, scalar> phiRelBf
|
|
||||||
(
|
|
||||||
MRF.relative(mesh.Sf().boundaryField() & U.boundaryField())
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(pBf, patchi)
|
forAll(pBf, patchi)
|
||||||
{
|
{
|
||||||
if (isA<fixedFluxPressureFvPatchScalarField>(pBf[patchi]))
|
if (isA<fixedFluxPressureFvPatchScalarField>(pBf[patchi]))
|
||||||
{
|
{
|
||||||
refCast<fixedFluxPressureFvPatchScalarField>(pBf[patchi])
|
refCast<fixedFluxPressureFvPatchScalarField>
|
||||||
.updateCoeffs
|
(
|
||||||
|
pBf[patchi]
|
||||||
|
).updateCoeffs
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
phiHbyABf[patchi]
|
phiHbyABf[patchi]
|
||||||
- rho.boundaryField()[patchi]*phiRelBf[patchi]
|
- rho.boundaryField()[patchi]
|
||||||
|
*MRF.relative(SfBf[patchi] & UBf[patchi], patchi)
|
||||||
)
|
)
|
||||||
/(magSfBf[patchi]*rhorAUBf[patchi])
|
/(magSfBf[patchi]*rhorAUBf[patchi])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -68,6 +68,13 @@ public:
|
|||||||
{
|
{
|
||||||
return U;
|
return U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return the argument unchanged
|
||||||
|
template<class Type>
|
||||||
|
inline const Type& relative(const Type& U, const label patchi) const
|
||||||
|
{
|
||||||
|
return U;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user