HybridADRSolver
Loading...
Searching...
No Matches
matrix_based_solver.h
Go to the documentation of this file.
1
5
6#ifndef HYBRIDADRSOLVER_MATRIX_BASED_SOLVER_H
7#define HYBRIDADRSOLVER_MATRIX_BASED_SOLVER_H
8
10#include "core/solver.h"
11#include "core/types.h"
12
13namespace HybridADRSolver {
14using namespace dealii;
15
16// Forward declarations
17template <int dim> struct ScratchData;
18struct CopyData;
19
29template <int dim> class MatrixBasedSolver : public ParallelSolverBase<dim> {
30public:
38 MatrixBasedSolver(const ProblemInterface<dim>& problem, unsigned int degree,
39 MPI_Comm comm,
40 const SolverParameters& params = SolverParameters());
41
42 void run(unsigned int n_refinements) override;
43
44 SolverType get_solver_type() const override {
46 }
47
48 std::string get_name() const override { return "Matrix-Based Solver"; }
49
53 const LADistributed::MPI::SparseMatrix& get_system_matrix() const {
54 return system_matrix;
55 }
56
60 double compute_memory_usage() const;
61
65 double compute_l2_error();
66
67protected:
68 void setup_dofs() override;
69 void assemble_system() override;
70 void solve() override;
71 void output_results(unsigned int cycle) const override;
72
73private:
74 const ProblemInterface<dim>& problem;
75 unsigned int fe_degree;
76
77 LADistributed::MPI::SparseMatrix system_matrix;
78 LADistributed::MPI::Vector system_rhs;
79 LADistributed::MPI::Vector solution;
80};
81
82} // namespace HybridADRSolver
83
84#endif // HYBRIDADRSOLVER_MATRIX_BASED_SOLVER_H
std::string get_name() const override
Definition matrix_based_solver.h:48
void solve() override
Definition matrix_based_solver.cpp:269
void setup_dofs() override
Definition matrix_based_solver.cpp:117
void run(unsigned int n_refinements) override
Definition matrix_based_solver.cpp:351
double compute_l2_error()
Compute the L2 error of the solution.
Definition matrix_based_solver.cpp:313
void output_results(unsigned int cycle) const override
Definition matrix_based_solver.cpp:332
const LADistributed::MPI::SparseMatrix & get_system_matrix() const
Definition matrix_based_solver.h:53
void assemble_system() override
Definition matrix_based_solver.cpp:158
double compute_memory_usage() const
Compute memory usage in MB.
Definition matrix_based_solver.cpp:104
SolverType get_solver_type() const override
Definition matrix_based_solver.h:44
MatrixBasedSolver(const ProblemInterface< dim > &problem, unsigned int degree, MPI_Comm comm, const SolverParameters &params=SolverParameters())
Definition matrix_based_solver.cpp:96
ParallelSolverBase(MPI_Comm comm, SolverParameters params, bool construct_mg_hierarchy=false)
Definition solver.h:145
Abstract interface for defining a physical problem.
Definition problem_definition.h:39
Definition problem_definition.h:25
SolverType
Definition types.h:34
@ MatrixBased
Definition types.h:34
Defines the problem interface and a concrete Advection-Diffusion-Reaction (ADR) problem.
Abstract base class for all solvers.
Definition matrix_based_solver.cpp:75
Scratch data for the WorkStream assembly (Optimized).
Definition matrix_based_solver.cpp:30
Common type definitions for the hybrid solver framework.