Update for non-blocking comms. NOTE: Scheduled comms are broken for coupled matrix
This commit is contained in:
parent
c6ffe26776
commit
44ee06943a
3 changed files with 124 additions and 18 deletions
|
@ -195,7 +195,8 @@ void Foam::coupledLduMatrix::initMatrixInterfaces
|
|||
const lduInterfaceFieldPtrsListList& interfaces,
|
||||
const FieldField<Field, scalar>& x,
|
||||
FieldField<Field, scalar>& result,
|
||||
const direction cmpt
|
||||
const direction cmpt,
|
||||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
const PtrList<lduMatrix>& matrices = *this;
|
||||
|
@ -205,7 +206,7 @@ void Foam::coupledLduMatrix::initMatrixInterfaces
|
|||
// interfaces. The reason is that non-processor coupled
|
||||
// interfaces require a complex comms pattern involving more than
|
||||
// pairwise communications.
|
||||
// Under normal circumstances this is achieved naturall, since
|
||||
// Under normal circumstances this is achieved naturally, since
|
||||
// processor interfaces come last on the list and other coupled
|
||||
// interfaces execute complex comms at init() level.
|
||||
// For coupled matrices, the update loop needs to be split over
|
||||
|
@ -244,22 +245,66 @@ void Foam::coupledLduMatrix::initMatrixInterfaces
|
|||
(
|
||||
Pstream::defaultCommsType()
|
||||
),
|
||||
false
|
||||
switchToLhs
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Pstream::defaultCommsType() == Pstream::scheduled)
|
||||
{
|
||||
// ERROR: Does not work with scheduled comms.
|
||||
// To investigate. HJ, 11/Jun/2015
|
||||
forAll (matrices, rowI)
|
||||
{
|
||||
const lduSchedule& patchSchedule =
|
||||
matrices[rowI].patchSchedule();
|
||||
|
||||
// Loop over the "global" patches are on the list of
|
||||
// interfaces but beyond the end of the schedule
|
||||
// which only handles "normal" patches
|
||||
for
|
||||
(
|
||||
label interfaceI = patchSchedule.size()/2;
|
||||
interfaceI < interfaces.size();
|
||||
interfaceI++
|
||||
)
|
||||
{
|
||||
if (interfaces[rowI].set(interfaceI))
|
||||
{
|
||||
if
|
||||
(
|
||||
!isA<processorLduInterfaceField>
|
||||
(
|
||||
interfaces[rowI][interfaceI]
|
||||
)
|
||||
)
|
||||
{
|
||||
interfaces[rowI][interfaceI].
|
||||
initInterfaceMatrixUpdate
|
||||
(
|
||||
x[rowI],
|
||||
result[rowI],
|
||||
matrices[rowI],
|
||||
coupleCoeffs[rowI][interfaceI],
|
||||
cmpt,
|
||||
static_cast<const Pstream::commsTypes>
|
||||
(
|
||||
Pstream::defaultCommsType()
|
||||
),
|
||||
switchToLhs
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
matrices[rowI].initMatrixInterfaces
|
||||
(
|
||||
coupleCoeffs[rowI],
|
||||
interfaces[rowI],
|
||||
x[rowI],
|
||||
result[rowI],
|
||||
cmpt
|
||||
);
|
||||
FatalErrorIn("void coupledLduMatrix::initMatrixInterfaces")
|
||||
<< "Unsuported communications type "
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,12 +340,67 @@ void Foam::coupledLduMatrix::initMatrixInterfaces
|
|||
(
|
||||
Pstream::defaultCommsType()
|
||||
),
|
||||
false
|
||||
switchToLhs
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Pstream::defaultCommsType() == Pstream::scheduled)
|
||||
{
|
||||
// ERROR: Does not work with scheduled comms.
|
||||
// To investigate. HJ, 11/Jun/2015
|
||||
forAll (matrices, rowI)
|
||||
{
|
||||
const lduSchedule& patchSchedule =
|
||||
matrices[rowI].patchSchedule();
|
||||
|
||||
// Loop over the "global" patches are on the list of
|
||||
// interfaces but beyond the end of the schedule
|
||||
// which only handles "normal" patches
|
||||
for
|
||||
(
|
||||
label interfaceI = patchSchedule.size()/2;
|
||||
interfaceI < interfaces.size();
|
||||
interfaceI++
|
||||
)
|
||||
{
|
||||
if (interfaces[rowI].set(interfaceI))
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorLduInterfaceField>
|
||||
(
|
||||
interfaces[rowI][interfaceI]
|
||||
)
|
||||
)
|
||||
{
|
||||
interfaces[rowI][interfaceI].
|
||||
initInterfaceMatrixUpdate
|
||||
(
|
||||
x[rowI],
|
||||
result[rowI],
|
||||
matrices[rowI],
|
||||
coupleCoeffs[rowI][interfaceI],
|
||||
cmpt,
|
||||
static_cast<const Pstream::commsTypes>
|
||||
(
|
||||
Pstream::defaultCommsType()
|
||||
),
|
||||
switchToLhs
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("void coupledLduMatrix::initMatrixInterfaces")
|
||||
<< "Unsuported communications type "
|
||||
<< Pstream::commsTypeNames[Pstream::defaultCommsType()]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,7 +411,8 @@ void Foam::coupledLduMatrix::updateMatrixInterfaces
|
|||
const lduInterfaceFieldPtrsListList& interfaces,
|
||||
const FieldField<Field, scalar>& x,
|
||||
FieldField<Field, scalar>& result,
|
||||
const direction cmpt
|
||||
const direction cmpt,
|
||||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
const PtrList<lduMatrix>& matrices = *this;
|
||||
|
@ -324,7 +425,8 @@ void Foam::coupledLduMatrix::updateMatrixInterfaces
|
|||
interfaces[rowI],
|
||||
x[rowI],
|
||||
result[rowI],
|
||||
cmpt
|
||||
cmpt,
|
||||
switchToLhs
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,8 @@ public:
|
|||
const lduInterfaceFieldPtrsListList& interfaces,
|
||||
const FieldField<Field, scalar>& x,
|
||||
FieldField<Field, scalar>& result,
|
||||
const direction cmpt
|
||||
const direction cmpt,
|
||||
const bool switchToLhs = false
|
||||
) const;
|
||||
|
||||
//- Update coupled interfaces for matrix operations
|
||||
|
@ -138,7 +139,8 @@ public:
|
|||
const lduInterfaceFieldPtrsListList& interfaces,
|
||||
const FieldField<Field, scalar>& x,
|
||||
FieldField<Field, scalar>& result,
|
||||
const direction cmpt
|
||||
const direction cmpt,
|
||||
const bool switchToLhs = false
|
||||
) const;
|
||||
|
||||
};
|
||||
|
|
|
@ -340,7 +340,8 @@ void Foam::coupledGaussSeidelPrecon::precondition
|
|||
interfaces_,
|
||||
x,
|
||||
bPrime_,
|
||||
cmpt
|
||||
cmpt,
|
||||
true // switch to lhs
|
||||
);
|
||||
|
||||
matrix_.updateMatrixInterfaces
|
||||
|
@ -349,7 +350,8 @@ void Foam::coupledGaussSeidelPrecon::precondition
|
|||
interfaces_,
|
||||
x,
|
||||
bPrime_,
|
||||
cmpt
|
||||
cmpt,
|
||||
true // switch to lhs
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue