12 #ifndef MFEM_CONSTRAINED
13 #define MFEM_CONSTRAINED
23 class FiniteElementSpace;
25 class ParFiniteElementSpace;
94 Vector& x_and_lambda)
const;
236 { MFEM_ABORT(
"Operator cannot be reset!"); }
265 int dimension_=0,
bool reorder_=
false) :
267 dimension(dimension_), reorder(reorder_)
293 int dimension_=0,
bool reorder_=
false) :
295 dimension(dimension_), reorder(reorder_)
336 { MFEM_ABORT(
"Operator cannot be reset!"); }
552 bool parallel=
false);
void Eliminate(const Vector &in, Vector &out) const
Conjugate gradient method.
void Mult(const Vector &x, Vector &y) const override
Solve for given .
HypreParMatrix * penalized_mat
MPI_Comm GetComm() const
Return the associated MPI communicator, or MPI_COMM_NULL if no communicator is set.
virtual void SetOperator(const Operator &op) override
Also calls SetOperator for the preconditioner if there is one.
SparseMatrix * ParBuildNormalConstraints(ParFiniteElementSpace &fespace, Array< int > &constrained_att, Array< int > &constraint_rowstarts)
Parallel wrapper for BuildNormalConstraints.
Solve constrained system by solving original mixed system; see ConstrainedSolver. ...
EliminationSolver(HypreParMatrix &A, SparseMatrix &B, Array< int > &primary_dofs, Array< int > &secondary_dofs)
Constructor, with explicit splitting into primary/secondary dofs.
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
SparseMatrix * BuildNormalConstraints(FiniteElementSpace &fespace, Array< int > &constrained_att, Array< int > &constraint_rowstarts, bool parallel)
Build a matrix constraining normal components to zero.
SchurConstrainedHypreSolver(MPI_Comm comm, HypreParMatrix &hA_, HypreParMatrix &hB_, Solver *prec=nullptr, int dimension=0, bool reorder=false)
void SetPreconditioner(Solver &precond) override
This should be called before SetOperator.
EliminationProjection(const Operator &A, Array< Eliminator * > &eliminators)
An abstract class to solve the constrained system subject to the constraint .
Data type dense matrix using column-major storage.
virtual Solver * BuildPreconditioner() const override
Build preconditioner for penalized system.
virtual Solver * BuildPreconditioner() const override
Build preconditioner for penalized system.
Basic saddle-point solver with assembled blocks (ie, the operators are assembled HypreParMatrix objec...
Abstract parallel finite element space.
virtual IterativeSolver * BuildKrylov() const override
Select krylov solver for eliminated system.
HypreParMatrix * h_explicit_operator
Eliminator(const SparseMatrix &B, const Array< int > &lagrange_dofs, const Array< int > &primary_tdofs, const Array< int > &secondary_tdofs)
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
virtual Solver * BuildPreconditioner() const override
Build preconditioner for eliminated system.
PenaltyGMRESSolver(HypreParMatrix &A, SparseMatrix &B, double penalty_, int dimension=0, bool reorder=false)
virtual Solver * BuildPreconditioner() const =0
Build preconditioner for penalized system.
Array< Eliminator * > eliminators
ConstrainedSolver(MPI_Comm comm, Operator &A_, Operator &B_)
virtual void Mult(const Vector &f, Vector &x) const override
Solve for given .
void LagrangeSecondary(const Vector &in, Vector &out) const
Maps Lagrange multipliers to secondary dofs, applies .
void SetOperator(const Operator &op) override
Also calls SetOperator for the preconditioner if there is one.
The BoomerAMG solver in hypre.
Solve constrained system by eliminating the constraint; see ConstrainedSolver.
void BuildGTilde(const Vector &g, Vector >ilde) const
double f(const Vector &xvec)
A class to handle Block diagonal preconditioners in a matrix-free implementation. ...
PenaltyGMRESSolver(HypreParMatrix &A, HypreParMatrix &B, Vector &penalty_, int dimension=0, bool reorder=false)
Perform elimination of a single constraint.
virtual IterativeSolver * BuildKrylov() const =0
Select krylov solver for penalized system.
PenaltyPCGSolver(HypreParMatrix &A, SparseMatrix &B, double penalty_, int dimension=0, bool reorder=false)
void SetPrintLevel(int print_level)
virtual ~SchurConstrainedSolver()
const Array< int > & PrimaryDofs() const
void RecoverMultiplier(const Vector &primalrhs, const Vector &primalvars, Vector &lm) const
EliminationCGSolver(HypreParMatrix &A, SparseMatrix &B, Array< int > &constraint_rowstarts, int dimension_=0, bool reorder_=false)
virtual IterativeSolver * BuildKrylov() const override
Select krylov solver for eliminated system.
virtual void SetConstraintRHS(const Vector &r)
Set the right-hand side r for the constraint B x = r.
EliminationGMRESSolver(HypreParMatrix &A, SparseMatrix &B, Array< int > &constraint_rowstarts, int dimension_=0, bool reorder_=false)
void ExplicitAssembly(DenseMatrix &mat) const
Return explicitly assembled in mat.
Solve constrained system with penalty method; see ConstrainedSolver.
void EliminateTranspose(const Vector &in, Vector &out) const
Transpose of Eliminate(), applies .
void BuildExplicitOperator()
Internal utility routine; assembles eliminated matrix explicitly.
virtual ~SchurConstrainedHypreSolver()
~PenaltyConstrainedSolver()
PenaltyConstrainedSolver(HypreParMatrix &A, SparseMatrix &B, double penalty_)
Abstract base class for iterative solver.
void GetMultiplierSolution(Vector &lambda) const
Return the Lagrange multiplier solution in lambda.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
void SetOperator(const Operator &op) override
Also calls SetOperator for the preconditioner if there is one.
PenaltyPCGSolver(HypreParMatrix &A, HypreParMatrix &B, Vector &penalty_, int dimension=0, bool reorder=false)
virtual void LagrangeSystemMult(const Vector &f_and_r, Vector &x_and_lambda) const
Solve for (x, lambda) given (f, r)
SchurConstrainedSolver(MPI_Comm comm, Operator &A_, Operator &B_, Solver &primal_pc_)
virtual Solver * BuildPreconditioner() const =0
Build preconditioner for eliminated system.
The transpose of a given operator. Switches the roles of the methods Mult() and MultTranspose().
EliminationProjection * projector
void Mult(const Vector &x, Vector &y) const override
Solve for given .
virtual Solver * BuildPreconditioner() const override
Build preconditioner for eliminated system.
PenaltyGMRESSolver(HypreParMatrix &A, HypreParMatrix &B, double penalty_, int dimension=0, bool reorder=false)
virtual ~ConstrainedSolver()
PenaltyPCGSolver(HypreParMatrix &A, HypreParMatrix &B, double penalty_, int dimension=0, bool reorder=false)
constexpr int dimension
This example only works in 3D. Kernels for 2D are not implemented.
virtual void LagrangeSystemMult(const Vector &x, Vector &y) const override
Solve for (x, lambda) given (f, r)
virtual IterativeSolver * BuildKrylov() const =0
Select krylov solver for eliminated system.
void SetPreconditioner(Solver &precond) override
This should be called before SetOperator.
const Array< int > & LagrangeDofs() const
void SetSystemsOptions(int dim, bool order_bynodes=false)
BlockDiagonalPreconditioner * block_pc
SparseMatrix * AssembleExact() const
Assemble this projector as a (processor-local) SparseMatrix.
virtual IterativeSolver * BuildKrylov() const override
Select krylov solver for penalized system.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
Wrapper for hypre's ParCSR matrix class.
A class to handle Block systems in a matrix-free implementation.
void LagrangeSecondaryTranspose(const Vector &in, Vector &out) const
Transpose of LagrangeSecondary()
const Array< int > & SecondaryDofs() const
virtual IterativeSolver * BuildKrylov() const override
Select krylov solver for penalized system.