https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMMatrixFreeAMS.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#ifdef MOOSE_MFEM_ENABLED
11
12#include "MFEMMatrixFreeAMS.h"
13#include "MFEMProblem.h"
14
16
19{
21 params.addClassDescription("MFEM matrix-free auxiliary-space Maxwell preconditioner for the "
22 "iterative solution of MFEM equation systems.");
23 params.addParam<MFEMScalarCoefficientName>(
24 "alpha_coefficient",
25 "1.",
26 "Name of scalar coefficient used in curl-curl component of target equation system.");
27 params.addParam<MFEMScalarCoefficientName>(
28 "beta_coefficient",
29 "1.",
30 "Name of scalar coefficient used in mass component of target equation system.");
31 params.addParam<unsigned int>(
32 "inner_pi_iterations", 2, "Number of CG iterations on auxiliary Pi space.");
33 params.addParam<unsigned int>(
34 "inner_g_iterations", 2, "Number of CG iterations on auxiliary G space.");
35 // mfem::MatrixFreeAMS is always an LOR solver
36 params.setParameters("low_order_refined", true);
37 params.suppressParameter<bool>("low_order_refined");
38 return params;
39}
40
42 : Moose::MFEM::LORLinearSolverBase<mfem::MatrixFreeAMS>(parameters),
43 _alpha_coef(getScalarCoefficient("alpha_coefficient")),
44 _beta_coef(getScalarCoefficient("beta_coefficient")),
45 _inner_pi_its(getParam<unsigned int>("inner_pi_iterations")),
46 _inner_g_its(getParam<unsigned int>("inner_g_iterations"))
47{
49}
50
51void
53{
54 // Deferred: construction of the mfem::MatrixFreeAMS solver is postponed until the operator is set
55}
56
57void
58MFEMMatrixFreeAMS::SetOperatorImpl(const mfem::Operator & op)
59{
60 _solver = std::make_unique<mfem::MatrixFreeAMS>(*_a,
61 const_cast<mfem::Operator &>(op),
62 *_a->ParFESpace(),
65 nullptr,
69}
70
71template <>
72void
77
78#endif
registerMooseObject("MooseApp", MFEMMatrixFreeAMS)
void ErrorVector unsigned int
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn't required or valid in the derived class...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
void setParameters(const std::string &name, const T &value, Ts... extra_input_parameters)
Given a series of parameters names and values, sets each name to the corresponding value.
Wrapper for mfem::MatrixFreeAMS solver.
mfem::Coefficient & _beta_coef
virtual void SetOperatorImpl(const mfem::Operator &op) override
Updates the solver at the operator level.
MFEMMatrixFreeAMS(const InputParameters &)
void ConstructSolver() override
Override in derived classes to construct and set the solver options.
static InputParameters validParams()
mfem::Coefficient & _alpha_coef
virtual void UpdateEquationSystemContext() override
Update the solver following any changes to the weak form it is responsible for solving.
std::unique_ptr< mfem::Solver > _solver
Solver to be used for the problem.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...