Add blockLduInterfaceField to coupled patches. This enables general multi-processor support for blockLduMatrix.

This commit is contained in:
Ivor Clifford 2010-10-14 17:20:36 -04:00
parent 781878cd02
commit 719616503d
7 changed files with 153 additions and 8 deletions

View file

@ -397,6 +397,29 @@ interfaces() const
}
template<class Type, template<class> class PatchField, class GeoMesh>
typename Foam::BlockLduInterfaceFieldPtrsList<Type>::Type
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
blockInterfaces() const
{
typename BlockLduInterfaceFieldPtrsList<Type>::Type interfaces(this->size());
forAll (interfaces, patchi)
{
if (isA<BlockLduInterfaceField<Type> >(this->operator[](patchi)))
{
interfaces.set
(
patchi,
&refCast<const BlockLduInterfaceField<Type> >(this->operator[](patchi))
);
}
}
return interfaces;
}
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField::
writeEntry(const word& keyword, Ostream& os) const

View file

@ -45,6 +45,7 @@ SourceFiles
#include "DimensionedField.H"
#include "FieldField.H"
#include "lduInterfaceFieldPtrsList.H"
#include "BlockLduInterfaceFieldPtrsList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -192,6 +193,10 @@ public:
// pointing to interfaces being set
lduInterfaceFieldPtrsList interfaces() const;
//- Return a list of pointers for each patch field with only those
// pointing to block-coupled interfaces being set
typename BlockLduInterfaceFieldPtrsList<Type>::Type blockInterfaces() const;
//- Write boundary field as dictionary entry
void writeEntry(const word& keyword, Ostream& os) const;

View file

@ -40,7 +40,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
const DimensionedField<Type, volMesh>& iF
)
:
lduInterfaceField(refCast<const lduInterface>(p)),
BlockLduInterfaceField<Type>(refCast<const lduInterface>(p)),
fvPatchField<Type>(p, iF)
{}
@ -53,7 +53,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
const Field<Type>& f
)
:
lduInterfaceField(refCast<const lduInterface>(p)),
BlockLduInterfaceField<Type>(refCast<const lduInterface>(p)),
fvPatchField<Type>(p, iF, f)
{}
@ -67,7 +67,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
const bool valueRequired
)
:
lduInterfaceField(refCast<const lduInterface>(p)),
BlockLduInterfaceField<Type>(refCast<const lduInterface>(p)),
fvPatchField<Type>(p, iF, dict, valueRequired)
{}
@ -81,7 +81,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
const fvPatchFieldMapper& mapper
)
:
lduInterfaceField(refCast<const lduInterface>(p)),
BlockLduInterfaceField<Type>(refCast<const lduInterface>(p)),
fvPatchField<Type>(ptf, p, iF, mapper)
{}
@ -92,7 +92,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
const coupledFvPatchField<Type>& ptf
)
:
lduInterfaceField(refCast<const lduInterface>(ptf.patch())),
BlockLduInterfaceField<Type>(refCast<const lduInterface>(ptf.patch())),
fvPatchField<Type>(ptf)
{}
@ -104,7 +104,7 @@ coupledFvPatchField<Type>::coupledFvPatchField
const DimensionedField<Type, volMesh>& iF
)
:
lduInterfaceField(refCast<const lduInterface>(ptf.patch())),
BlockLduInterfaceField<Type>(refCast<const lduInterface>(ptf.patch())),
fvPatchField<Type>(ptf, iF)
{}

View file

@ -36,7 +36,8 @@ SourceFiles
#ifndef coupledFvPatchField_H
#define coupledFvPatchField_H
#include "lduInterfaceField.H"
#include "BlockLduInterfaceField.H"
#include "CoeffField.H"
#include "fvPatchField.H"
#include "coupledFvPatch.H"
@ -52,7 +53,7 @@ namespace Foam
template<class Type>
class coupledFvPatchField
:
public lduInterfaceField,
public BlockLduInterfaceField<Type>,
public fvPatchField<Type>
{
@ -188,6 +189,32 @@ public:
const Pstream::commsTypes commsType
) const = 0;
// Block coupled interface functionality
//- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate
(
const Field<Type>&,
Field<Type>&,
const BlockLduMatrix<Type>&,
const CoeffField<Type>&,
const Pstream::commsTypes commsType
) const
{}
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
const Field<Type>&,
Field<Type>&,
const BlockLduMatrix<Type>&,
const CoeffField<Type>&,
const Pstream::commsTypes commsType
) const
{
notImplemented("coupledFvPatchField<Type>::updateInterfaceMatrix for block matrices")
}
//- Write
virtual void write(Ostream&) const;
};

View file

@ -194,6 +194,32 @@ public:
const Pstream::commsTypes commsType
) const;
// Block coupled interface functionality
//- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate
(
const Field<Type>&,
Field<Type>&,
const BlockLduMatrix<Type>&,
const CoeffField<Type>&,
const Pstream::commsTypes commsType
) const
{}
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
const Field<Type>&,
Field<Type>&,
const BlockLduMatrix<Type>&,
const CoeffField<Type>&,
const Pstream::commsTypes commsType
) const
{
notImplemented("processorFvPatchField<Type>::updateInterfaceMatrix for block matrices")
}
//- Processor coupled interface functions
//- Return processor number

View file

@ -77,6 +77,48 @@ void processorFvPatchField<scalar>::updateInterfaceMatrix
}
template<>
void processorFvPatchField<scalar>::initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField&,
const BlockLduMatrix<scalar>&,
const CoeffField<scalar>&,
const Pstream::commsTypes commsType
) const
{
procPatch_.compressedSend
(
commsType,
patch().patchInternalField(psiInternal)()
);
}
template<>
void processorFvPatchField<scalar>::updateInterfaceMatrix
(
const scalarField&,
scalarField& result,
const BlockLduMatrix<scalar>&,
const CoeffField<scalar>& coeffs,
const Pstream::commsTypes commsType
) const
{
scalarField pnf
(
procPatch_.compressedReceive<scalar>(commsType, this->size())()
);
const unallocLabelList& faceCells = patch().faceCells();
const scalarField& scalarCoeffs = coeffs.asScalar();
forAll(faceCells, facei)
{
result[faceCells[facei]] -= scalarCoeffs[facei]*pnf[facei];
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View file

@ -28,6 +28,7 @@ License
#define processorFvPatchScalarField_H
#include "processorFvPatchField.H"
#include "scalarCoeffField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,6 +61,27 @@ void processorFvPatchField<scalar>::updateInterfaceMatrix
) const;
template<>
void processorFvPatchField<scalar>::initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField&,
const BlockLduMatrix<scalar>&,
const CoeffField<scalar>&,
const Pstream::commsTypes commsType
) const;
template<>
void processorFvPatchField<scalar>::updateInterfaceMatrix
(
const scalarField&,
scalarField& result,
const BlockLduMatrix<scalar>&,
const CoeffField<scalar>& coeffs,
const Pstream::commsTypes commsType
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam