Advanced Multi-Physics (AMP)
On-Line Documentation
SASolver.h
Go to the documentation of this file.
1#ifndef included_AMP_SASolver_H_
2#define included_AMP_SASolver_H_
3
4#include "AMP/matrices/CSRMatrix.h"
5#include "AMP/matrices/data/CSRLocalMatrixData.h"
6#include "AMP/matrices/data/CSRMatrixData.h"
7#include "AMP/solvers/SolverFactory.h"
8#include "AMP/solvers/SolverStrategy.h"
9#include "AMP/solvers/SolverStrategyParameters.h"
10#include "AMP/solvers/amg/Aggregation.h"
11#include "AMP/solvers/amg/AggregationSettings.h"
12#include "AMP/solvers/amg/Aggregator.h"
13#include "AMP/solvers/amg/Cycle.h"
14#include "AMP/solvers/amg/Relaxation.h"
15#include "AMP/utils/Database.h"
16#include "AMP/vectors/Variable.h"
17
18#include <memory>
19#include <vector>
20
21namespace AMP::Solver::AMG {
22
24public:
25 explicit SASolver( std::shared_ptr<SolverStrategyParameters> );
26
27 static std::unique_ptr<SolverStrategy>
28 createSolver( std::shared_ptr<SolverStrategyParameters> params )
29 {
30 return std::make_unique<SASolver>( params );
31 }
32
33 std::string type() const override { return "SASolver"; }
34
35 void registerOperator( std::shared_ptr<Operator::Operator> ) override;
36
37 void getFromInput( std::shared_ptr<Database> );
38
39 void apply( std::shared_ptr<const LinearAlgebra::Vector> f,
40 std::shared_ptr<LinearAlgebra::Vector> u ) override;
41
42protected:
43 // **** settings applicable to solver as a whole **** //
60
61 // **** settings that can change level-by-level **** //
69 std::string d_agg_type;
75 std::shared_ptr<AMP::Database> d_pre_relax_db;
77 std::shared_ptr<AMP::Database> d_post_relax_db;
78
80 std::vector<AMG::KCycleLevel> d_levels;
82 std::shared_ptr<AMG::Aggregator> d_aggregator;
84 std::shared_ptr<AMG::RelaxationParameters> d_pre_relax_params;
86 std::shared_ptr<AMG::RelaxationParameters> d_post_relax_params;
88 std::shared_ptr<SolverStrategyParameters> d_coarse_solver_params;
90 std::unique_ptr<SolverStrategy> d_coarse_solver;
91
95 void setLevelOptions( const size_t lvl );
96
97 void setup( std::shared_ptr<LinearAlgebra::Variable> xVar,
98 std::shared_ptr<LinearAlgebra::Variable> bVar );
99
101
102 std::unique_ptr<SolverStrategy>
104 std::shared_ptr<Operator::Operator> A,
105 std::shared_ptr<AMG::RelaxationParameters> params );
106
107 void smoothP_JacobiL1( std::shared_ptr<LinearAlgebra::Matrix> A,
108 std::shared_ptr<LinearAlgebra::Matrix> &P ) const;
109};
110
111} // namespace AMP::Solver::AMG
112
113#endif
std::shared_ptr< AMP::Solver::SolverStrategy > shared_ptr
MemoryType
Enum to store pointer type.
Definition Memory.h:21
Settings for the Kappa K-cycle.
Definition Cycle.h:84
Utilities::MemoryType d_mem_loc
Memory location for all given operator and all internally created operators.
Definition SASolver.h:45
std::shared_ptr< AMG::RelaxationParameters > d_post_relax_params
Parameters read from d_post_relax_db.
Definition SASolver.h:86
std::unique_ptr< SolverStrategy > createRelaxation(size_t lvl, std::shared_ptr< Operator::Operator > A, std::shared_ptr< AMG::RelaxationParameters > params)
bool d_save_to_file
flag to save hierarchy after setup phase
Definition SASolver.h:55
size_t d_min_coarse_global
Smallest number of global rows allowed in operator, terminates hierarchy.
Definition SASolver.h:51
std::vector< AMG::KCycleLevel > d_levels
storage for all levels in hierarchy
Definition SASolver.h:80
void setup(std::shared_ptr< LinearAlgebra::Variable > xVar, std::shared_ptr< LinearAlgebra::Variable > bVar)
void apply(std::shared_ptr< const LinearAlgebra::Vector > f, std::shared_ptr< LinearAlgebra::Vector > u) override
float d_prol_spec_lower
Lower bound on spectrum for prolongator smoother, must be in (0,1)
Definition SASolver.h:65
SASolver(std::shared_ptr< SolverStrategyParameters >)
size_t d_max_levels
Maximum depth of AMG hierarchy.
Definition SASolver.h:47
void registerOperator(std::shared_ptr< Operator::Operator >) override
std::shared_ptr< AMP::Database > d_post_relax_db
Database defining post-cycle relaxation solver.
Definition SASolver.h:77
std::string d_agg_type
Aggregation method for producing tentative prolongator.
Definition SASolver.h:69
std::shared_ptr< SolverStrategyParameters > d_coarse_solver_params
Parameters defining coarse level solver.
Definition SASolver.h:88
std::shared_ptr< AMG::RelaxationParameters > d_pre_relax_params
Parameters read from d_pre_relax_db.
Definition SASolver.h:84
std::shared_ptr< AMG::Aggregator > d_aggregator
Aggregator, may be replaced as level-by-level settings are updated.
Definition SASolver.h:82
CoarsenSettings d_coarsen_settings
Settings applicable to all coarsening methods.
Definition SASolver.h:71
std::string type() const override
Return the name of the solver.
Definition SASolver.h:33
void getFromInput(std::shared_ptr< Database >)
PairwiseCoarsenSettings d_pair_coarsen_settings
Settings specific to pairwise coarsening method.
Definition SASolver.h:73
void smoothP_JacobiL1(std::shared_ptr< LinearAlgebra::Matrix > A, std::shared_ptr< LinearAlgebra::Matrix > &P) const
std::string d_save_to_file_name
base path+name for saving hierarchy
Definition SASolver.h:59
int d_min_coarse_local
Smallest number of locally owned rows allowed in operator, terminates hierarchy.
Definition SASolver.h:49
void setLevelOptions(const size_t lvl)
set level-by-level options to match specific level DB if found
int d_num_smooth_prol
Number of smoothing steps applied to tentative prolongator.
Definition SASolver.h:63
bool d_save_to_file_on_ftc
flag to save hierarchy after failure to converge
Definition SASolver.h:57
void resetLevelOptions()
reset level-by-level options to overall defaults from outer DB
static std::unique_ptr< SolverStrategy > createSolver(std::shared_ptr< SolverStrategyParameters > params)
Definition SASolver.h:28
KappaKCycle::settings d_cycle_settings
Cycle type, tolerance, kappa value.
Definition SASolver.h:53
float d_prol_trunc
Truncation parameter for pruning smoothed prolongator, removes [-trunc,trunc].
Definition SASolver.h:67
std::unique_ptr< SolverStrategy > d_coarse_solver
Coarse level solver.
Definition SASolver.h:90
std::shared_ptr< AMP::Database > d_pre_relax_db
Database defining pre-cycle relaxation solver.
Definition SASolver.h:75



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:41.
Comments on this page