feat(solver/preconditioner): Implements preconditioner system
The system matrix for a problem may be poorly conditioned, preconditioners are supposed to efficiently estimate the inverse of the system matrix so that a simpler problem, with the approximate identity matrix may be solved instead. The problem is that the best approach to this varies with different fields. The preconditioner system implements infrastructure to define seperate preconditioners for different fields which are then composed together.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "serif/solver/preconditioner/contract.hpp"
|
||||
|
||||
namespace serif::solver::preconditioner::strategies::inverse
|
||||
{
|
||||
/** @brief Directly solve a small dense system; optionally reject an unreliable infinity-norm condition estimate. */
|
||||
struct DenseDirect final
|
||||
{
|
||||
static constexpr ApplicationContract application_contract{ApplicationContract::fixed_linear};
|
||||
double minimum_reciprocal_condition{0.0};
|
||||
};
|
||||
} // namespace serif::solver::preconditioner::strategies::inverse
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "serif/solver/preconditioner/contract.hpp"
|
||||
|
||||
namespace serif::solver::preconditioner::strategies::inverse
|
||||
{
|
||||
/** @brief Invert each diagonal entry independently. */
|
||||
struct Diagonal final
|
||||
{
|
||||
static constexpr ApplicationContract application_contract{ApplicationContract::fixed_linear};
|
||||
};
|
||||
} // namespace serif::solver::preconditioner::strategies::inverse
|
||||
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "serif/solver/preconditioner/contract.hpp"
|
||||
|
||||
namespace serif::solver::preconditioner::strategies::inverse
|
||||
{
|
||||
/** @brief Apply a fixed number of BoomerAMG cycles from zero, preserving a fixed linear inverse. */
|
||||
struct FixedAMG final
|
||||
{
|
||||
static constexpr ApplicationContract application_contract{ApplicationContract::fixed_linear};
|
||||
int cycles{1};
|
||||
};
|
||||
} // namespace serif::solver::preconditioner::strategies::inverse
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "serif/solver/preconditioner/contract.hpp"
|
||||
|
||||
namespace serif::solver::preconditioner::strategies::inverse
|
||||
{
|
||||
/**
|
||||
* @brief Exact inverse of the assembled block through a sparse LU factorization, prepared once per state.
|
||||
* @note The backend is chosen at build time with the sparse_direct Meson option (Apple Accelerate on macOS 15.5+,
|
||||
* SuiteSparse UMFPACK elsewhere, or none); without one, preparation fails rather than falling back to another
|
||||
* inverse. backend::mfem::sparse_direct_available() reports it at run time. Suited to blocks of tens of
|
||||
* thousands of rows, where one factorization and its triangular solves are much cheaper than repeated
|
||||
* multigrid cycles. The symbolic analysis is reused across Newton steps while the sparsity pattern is
|
||||
* unchanged (bitwise the same factorization), and batched applications (ArrayMult) solve their right-hand
|
||||
* sides together, which agrees with single solves to rounding.
|
||||
*/
|
||||
struct SparseDirect final
|
||||
{
|
||||
static constexpr ApplicationContract application_contract{ApplicationContract::fixed_linear};
|
||||
};
|
||||
} // namespace serif::solver::preconditioner::strategies::inverse
|
||||
Reference in New Issue
Block a user