GEOS
MsrsbLevelBuilder.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2019 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2019 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2019 Total, S.A
8  * Copyright (c) 2019- GEOS/GEOSX Contributors
9  * All right reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
19 #ifndef GEOS_LINEARALGEBRA_MULTISCALE_MSRSBSTRATEGY_HPP
20 #define GEOS_LINEARALGEBRA_MULTISCALE_MSRSBSTRATEGY_HPP
21 
22 #include "linearAlgebra/common/PreconditionerBase.hpp"
26 
27 namespace geos
28 {
29 namespace multiscale
30 {
31 
36 template< typename LAI >
38 {
39 public:
40 
43 
45  using Vector = typename Base::Vector;
46 
48  using Matrix = typename Base::Matrix;
49 
55  explicit MsrsbLevelBuilder( string name, LinearSolverParameters params );
56 
63  virtual void initializeFineLevel( DomainPartition & domain,
65  MPI_Comm const & comm ) override;
66 
73  Matrix const & fineMatrix ) override;
74 
78  multiscale::MeshLevel & mesh() { return m_mesh; }
79 
83  multiscale::MeshLevel const & mesh() const { return m_mesh; }
84 
89  {
90  return m_location == FieldLocation::Node ? m_mesh.nodeManager() : m_mesh.cellManager();
91  }
92 
97  {
98  return m_location == FieldLocation::Node ? m_mesh.nodeManager() : m_mesh.cellManager();
99  }
100 
104  integer numComp() const { return m_dofManager.numComponents(); }
105 
111  virtual bool updateProlongation( Matrix const & fineMatrix ) override;
112 
113  virtual std::unique_ptr< PreconditionerBase< LAI > > makeCoarseSolver() const override;
114 
115 private:
116 
117  void createSmoothers();
118 
119  void writeProlongationForDebug() const;
120 
121  using Base::m_params;
122  using Base::m_name;
123  using Base::m_prolongation;
124  using Base::m_restriction;
125  using Base::m_matrix;
126  using Base::m_dofManager;
127  using Base::m_preSmoother;
128  using Base::m_postSmoother;
129  using Base::m_fineLevel;
130 
132  FieldLocation m_location = FieldLocation::Node;
133 
135  multiscale::MeshLevel m_mesh;
136 
138  array1d< globalIndex > m_boundaryDof;
139 
141  array1d< globalIndex > m_interiorDof;
142 
144  integer m_lastNumIter = std::numeric_limits< integer >::max();
145 
147  integer m_updateLag = 0;
148 };
149 
150 } // namespace multiscale
151 } // namespace geos
152 
153 #endif //GEOS_LINEARALGEBRA_MULTISCALE_MSRSBSTRATEGY_HPP
The DoFManager is responsible for allocating global dofs, constructing sparsity patterns,...
Definition: DofManager.hpp:45
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
integer numComponents(string const &fieldName) const
Base class for level builder implementations.
typename LAI::ParallelVector Vector
Alias for vector type.
typename LAI::ParallelMatrix Matrix
Alias for matrix type.
Multiscale mesh level.
Definition: MeshLevel.hpp:47
MeshObjectManager & cellManager()
Definition: MeshLevel.hpp:59
MeshObjectManager & nodeManager()
Definition: MeshLevel.hpp:69
Mesh object manager used in multiscale preconditioners to keep a simplified (node/cell only) represen...
Base class for MsRSB level builders.
multiscale::DofManager m_dofManager
DofManager for the matrix.
std::unique_ptr< Operator > m_restriction
Restriction (kept as abstract operator to allow for memory efficiency, e.g. when R = P^T)
LinearSolverParameters m_params
Linear solver top-level parameters.
MsrsbLevelBuilderBase const * m_fineLevel
Pointer to the fine level.
std::unique_ptr< PreconditionerBase< LAI > > m_postSmoother
Post-smoothing operator.
typename Base::Matrix Matrix
Alias for matrix type.
std::unique_ptr< PreconditionerBase< LAI > > m_preSmoother
Pre-smoothing operator.
typename Base::Vector Vector
Alias for vector type.
MsRSB level builder for single-physics problems.
multiscale::MeshLevel const & mesh() const
multiscale::MeshObjectManager const & manager() const
virtual std::unique_ptr< PreconditionerBase< LAI > > makeCoarseSolver() const override
Instantiate coarsest level solver.
multiscale::MeshObjectManager & manager()
virtual void initializeFineLevel(DomainPartition &domain, geos::DofManager const &dofManager, MPI_Comm const &comm) override
Initialize the finest level (level 0).
virtual void initializeCoarseLevel(LevelBuilderBase< LAI > &fineLevel, Matrix const &fineMatrix) override
Initialize a coarse level (levels 1 and above).
MsrsbLevelBuilder(string name, LinearSolverParameters params)
Constructor.
virtual bool updateProlongation(Matrix const &fineMatrix) override
Update current level's prolongation using a new previous level matrix.
FieldLocation
Enum defining the possible location of a field on the mesh.
@ Node
location is node (like displacements in finite elements)
int integer
Signed integer type.
Definition: DataTypes.hpp:81
Array< T, 1 > array1d
Alias for 1D array.
Definition: DataTypes.hpp:175
Set of parameters for a linear solver or preconditioner.