www.mooseframework.org
PhysicsBasedPreconditioner.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #pragma once
11 
12 // MOOSE includes
13 #include "MoosePreconditioner.h"
14 
15 // libMesh includes
16 #include "libmesh/preconditioner.h"
17 #include "libmesh/linear_implicit_system.h"
18 #include "libmesh/enum_preconditioner_type.h"
19 
20 // C++ includes
21 #include <vector>
22 
23 // Forward declarations
29 {
30 public:
35 
38 
43  // FIXME: use better name
44  void addSystem(unsigned int var,
45  std::vector<unsigned int> off_diag,
47 
52  virtual void apply(const NumericVector<Number> & x, NumericVector<Number> & y);
53 
57  virtual void clear();
58 
62  virtual void init();
63 
69  virtual void setup();
70 
71 protected:
75  std::vector<LinearImplicitSystem *> _systems;
77  std::vector<std::unique_ptr<Preconditioner<Number>>> _preconditioners;
79  std::vector<unsigned int> _solve_order;
81  std::vector<PreconditionerType> _pre_type;
83  std::vector<std::vector<unsigned int>> _off_diag;
84 
92  std::vector<std::vector<SparseMatrix<Number> *>> _off_diag_mats;
93 };
virtual void setup()
This is called every time the "operator might have changed".
virtual void apply(const NumericVector< Number > &x, NumericVector< Number > &y)
Computes the preconditioned vector "y" based on input "x".
std::vector< std::vector< unsigned int > > _off_diag
Holds which off diagonal blocks to compute.
PreconditionerType type() const
NonlinearSystemBase & _nl
The nonlinear system this PBP is associated with (convenience reference)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::vector< PreconditionerType > _pre_type
Which preconditioner to use for each solve.
std::vector< LinearImplicitSystem * > _systems
List of linear system that build up the preconditioner.
virtual void clear()
Release all memory and clear data structures.
Base class for MOOSE preconditioners.
virtual void init()
Initialize data structures if not done so already.
Nonlinear system to be solved.
AMG_PRECOND
Preconditioner(const libMesh::Parallel::Communicator &comm)
static InputParameters validParams()
Constructor.
PhysicsBasedPreconditioner(const InputParameters &params)
Implements a segregated solve preconditioner.
std::vector< std::vector< SparseMatrix< Number > * > > _off_diag_mats
Holds pointers to the off-diagonal matrices.
void addSystem(unsigned int var, std::vector< unsigned int > off_diag, PreconditionerType type=AMG_PRECOND)
Add a diagonal system + possibly off-diagonals ones as well, also specifying type of preconditioning...
PreconditionerType
std::vector< std::unique_ptr< Preconditioner< Number > > > _preconditioners
Holds one Preconditioner object per small system to solve.
std::vector< unsigned int > _solve_order
Holds the order the blocks are solved for.