Serac  0.1
Serac is an implicit thermal strucural mechanics simulation code.
Public Member Functions | Static Public Member Functions | List of all members
serac::EquationSolver Class Reference

This class manages the objects typically required to solve a nonlinear set of equations arising from discretization of a PDE of the form F(x) = 0. Specifically, it has. More...

#include <equation_solver.hpp>

Public Member Functions

 EquationSolver (std::unique_ptr< mfem::NewtonSolver > nonlinear_solver, std::unique_ptr< mfem::Solver > linear_solver, std::unique_ptr< mfem::Solver > preconditioner=nullptr)
 
 EquationSolver (NonlinearSolverOptions nonlinear_opts={}, LinearSolverOptions lin_opts={}, MPI_Comm comm=MPI_COMM_WORLD)
 Construct an equation solver object using nonlinear and linear solver option structs. More...
 
void setOperator (const mfem::Operator &op)
 
void solve (mfem::Vector &x) const
 
mfem::NewtonSolver & nonlinearSolver ()
 
const mfem::NewtonSolver & nonlinearSolver () const
 
mfem::Solver & linearSolver ()
 
const mfem::Solver & linearSolver () const
 
mfem::Solver * preconditioner ()
 
const mfem::Solver * preconditioner () const
 

Static Public Member Functions

static void defineInputFileSchema (axom::inlet::Container &container)
 

Detailed Description

This class manages the objects typically required to solve a nonlinear set of equations arising from discretization of a PDE of the form F(x) = 0. Specifically, it has.

  1. An mfem::NewtonSolver containing the nonlinear solution operator
  2. An mfem::Solver containing a linear solver that is used by the nonlinear solution operator and adjoint solvers
  3. An optional mfem::Solver containing a preconditioner for the linear solution operator

This EquationSolver manages these objects together to ensure they all exist when called by their associated physics simulation module.

An equation solver can either be constructed by supplying pre-built nonlinear and linear solvers with a preconditioner, or it can be constructed using serac::NonlinearSolverOptions and serac::LinearSolverOptions structs with the serac::mfem_ext::buildEquationSolver factory method.

Definition at line 42 of file equation_solver.hpp.

Constructor & Destructor Documentation

◆ EquationSolver() [1/2]

serac::EquationSolver::EquationSolver ( std::unique_ptr< mfem::NewtonSolver >  nonlinear_solver,
std::unique_ptr< mfem::Solver >  linear_solver,
std::unique_ptr< mfem::Solver >  preconditioner = nullptr 
)

Constructs a new nonlinear equation solver

Parameters
[in]nonlinear_solverA constructed nonlinear solver
[in]linear_solverA constructed linear solver to be called by the nonlinear algorithm and adjoint equation solves
[in]preconditionerAn optional constructed precondition to aid the linear solver

Definition at line 24 of file equation_solver.cpp.

◆ EquationSolver() [2/2]

serac::EquationSolver::EquationSolver ( NonlinearSolverOptions  nonlinear_opts = {},
LinearSolverOptions  lin_opts = {},
MPI_Comm  comm = MPI_COMM_WORLD 
)

Construct an equation solver object using nonlinear and linear solver option structs.

Parameters
nonlinear_optsThe options to configure the nonlinear solution scheme
lin_optsThe options to configure the underlying linear solution scheme to be used by the nonlinear solver
commThe MPI communicator for the supplied nonlinear operators and HypreParVectors

Definition at line 15 of file equation_solver.cpp.

Member Function Documentation

◆ defineInputFileSchema()

void serac::EquationSolver::defineInputFileSchema ( axom::inlet::Container &  container)
static

Input file parameters specific to this class

Definition at line 345 of file equation_solver.cpp.

◆ linearSolver() [1/2]

mfem::Solver& serac::EquationSolver::linearSolver ( )
inline

Returns the underlying linear solver object

Returns
A non-owning reference to the underlying linear solver

Definition at line 98 of file equation_solver.hpp.

◆ linearSolver() [2/2]

const mfem::Solver& serac::EquationSolver::linearSolver ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 103 of file equation_solver.hpp.

◆ nonlinearSolver() [1/2]

mfem::NewtonSolver& serac::EquationSolver::nonlinearSolver ( )
inline

Returns the underlying solver object

Returns
A non-owning reference to the underlying nonlinear solver

Definition at line 87 of file equation_solver.hpp.

◆ nonlinearSolver() [2/2]

const mfem::NewtonSolver& serac::EquationSolver::nonlinearSolver ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 92 of file equation_solver.hpp.

◆ preconditioner() [1/2]

mfem::Solver* serac::EquationSolver::preconditioner ( )
inline

Returns the underlying preconditioner

Returns
A pointer to the underlying preconditioner
Note
This may be null if a preconditioner is not given

Definition at line 110 of file equation_solver.hpp.

◆ preconditioner() [2/2]

const mfem::Solver* serac::EquationSolver::preconditioner ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 115 of file equation_solver.hpp.

◆ setOperator()

void serac::EquationSolver::setOperator ( const mfem::Operator &  op)

Updates the solver with the provided operator

Parameters
[in]opThe operator (nonlinear system of equations) to use, "F" in F(x) = 0
Note
This operator is required to return an mfem::HypreParMatrix from its GetGradient method. This is due to the use of Hypre-based linear solvers.

Definition at line 36 of file equation_solver.cpp.

◆ solve()

void serac::EquationSolver::solve ( mfem::Vector &  x) const

Solves the system F(x) = 0

Parameters
[in,out]xSolution to the system of nonlinear equations
Note
The input value of x will be used as an initial guess for iterative nonlinear solution methods

Definition at line 47 of file equation_solver.cpp.


The documentation for this class was generated from the following files: