fvMatrix: Added properly parallel matrix scaling operation

Note that the previous version which allows matrix scaling by a
dimensionedScalarField is not currently correct for asymmetric matrices in
parallel and the transfer of the scaling factor values from the neighbouring
processors is required.
This commit is contained in:
Henry 2011-03-21 10:52:54 +00:00
parent 0f3d393ec5
commit 5e020d39a1
2 changed files with 38 additions and 0 deletions

View File

@ -1180,6 +1180,43 @@ void Foam::fvMatrix<Type>::operator*=
}
template<class Type>
void Foam::fvMatrix<Type>::operator*=
(
const volScalarField& vsf
)
{
dimensions_ *= vsf.dimensions();
lduMatrix::operator*=(vsf.field());
source_ *= vsf.field();
forAll(vsf.boundaryField(), patchI)
{
const fvPatchScalarField& psf = vsf.boundaryField()[patchI];
if (psf.coupled())
{
internalCoeffs_[patchI] *= psf.patchInternalField();
boundaryCoeffs_[patchI] *= psf.patchNeighbourField();
}
else
{
internalCoeffs_[patchI] *= psf.patchInternalField();
boundaryCoeffs_[patchI] *= psf;
}
}
if (faceFluxCorrectionPtr_)
{
FatalErrorIn
(
"fvMatrix<Type>::operator*="
"(const DimensionedField<scalar, volMesh>&)"
) << "cannot scale a matrix containing a faceFluxCorrection"
<< abort(FatalError);
}
}
template<class Type>
void Foam::fvMatrix<Type>::operator*=
(

View File

@ -460,6 +460,7 @@ public:
void operator*=(const DimensionedField<scalar, volMesh>&);
void operator*=(const tmp<DimensionedField<scalar, volMesh> >&);
void operator*=(const volScalarField&);
void operator*=(const tmp<volScalarField>&);
void operator*=(const dimensioned<scalar>&);