https://mooseframework.inl.gov
LumpedPreconditioner.h
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 #pragma once
11 
12 // MOOSE includes
13 #include "NonlinearSystem.h"
14 #include "FEProblem.h"
15 #include "PetscSupport.h"
16 
17 // libMesh includes
18 #include "libmesh/sparse_matrix.h"
19 #include "libmesh/nonlinear_solver.h"
20 #include "libmesh/preconditioner.h"
21 
22 // Forward declarations
24 
30 {
31 public:
32  LumpedPreconditioner(const NumericVector<Real> & diag_inverse)
33  : Preconditioner(diag_inverse.comm()), _diag_inverse(diag_inverse)
34  {
35  }
36 
37  virtual void init() override
38  {
39  // No more initialization needed here
40  _is_initialized = true;
41  }
42 
43  virtual void apply(const NumericVector<Real> & x, NumericVector<Real> & y) override
44  {
45  y.pointwise_mult(_diag_inverse, x);
46  }
47 
48 protected:
50  const NumericVector<Real> & _diag_inverse;
51 };
const Parallel::Communicator & comm() const
virtual void init() override
Preconditioner(const libMesh::Parallel::Communicator &comm)
const NumericVector< Real > & _diag_inverse
The inverse of the diagonal of the lumped matrix.
LumpedPreconditioner(const NumericVector< Real > &diag_inverse)
virtual void apply(const NumericVector< Real > &x, NumericVector< Real > &y) override
Class to that applies the lumped mass matrix preconditioner in the ExplicitTimeIntegrator.