Add prepared gravity subsystem and second-order trial correction
This commit is contained in:
@@ -664,12 +664,25 @@ export namespace mean_field::solver::linear {
|
||||
if (m_communicator == MPI_COMM_NULL) {
|
||||
throw std::invalid_argument("MFEM FGMRES requires a non-null MPI communicator.");
|
||||
}
|
||||
if (operation.Height() <= 0 || operation.Width() <= 0 || operation.Height() != operation.Width() ||
|
||||
preconditioner.Height() != operation.Width() || preconditioner.Width() != operation.Height()) {
|
||||
const bool localDimensionsAreValid =
|
||||
operation.Height() >= 0 && operation.Width() >= 0 && operation.Height() == operation.Width() &&
|
||||
preconditioner.Height() == operation.Width() && preconditioner.Width() == operation.Height();
|
||||
if (!AllRanksAgree(localDimensionsAreValid, m_communicator)) {
|
||||
throw std::invalid_argument(
|
||||
"MFEM FGMRES requires compatible square operator and preconditioner dimensions."
|
||||
"MFEM FGMRES requires compatible square "
|
||||
"operator and preconditioner dimensions."
|
||||
);
|
||||
}
|
||||
// A partition may own no local unknowns while still taking
|
||||
// part in distributed operator applications and reductions.
|
||||
const long long localSize = operation.Height();
|
||||
long long globalSize = 0;
|
||||
if (MPI_Allreduce(&localSize, &globalSize, 1, MPI_LONG_LONG, MPI_SUM, m_communicator) != MPI_SUCCESS) {
|
||||
throw std::runtime_error("MFEM FGMRES could not determine its global system size.");
|
||||
}
|
||||
if (globalSize == 0) {
|
||||
throw std::invalid_argument("MFEM FGMRES requires a globally nonempty system.");
|
||||
}
|
||||
|
||||
m_rightHandSide = 0.0;
|
||||
m_operationAction = 0.0;
|
||||
@@ -699,6 +712,10 @@ export namespace mean_field::solver::linear {
|
||||
return m_communicator;
|
||||
}
|
||||
|
||||
[[nodiscard]] FGMRES GetConfiguration() const {
|
||||
return FGMRES{m_options};
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsReady() const {
|
||||
return m_operation != nullptr && m_preconditioner != nullptr && m_communicator != MPI_COMM_NULL &&
|
||||
m_operation->Height() == m_operation->Width() &&
|
||||
|
||||
Reference in New Issue
Block a user