HybridADRSolver
Loading...
Searching...
No Matches
HybridADRSolver::MatrixFreeSolver< dim, fe_degree > Class Template Reference

Matrix-free solver with hybrid MPI+threading parallelization and GMG. More...

#include <matrix_free_solver.h>

Inheritance diagram for HybridADRSolver::MatrixFreeSolver< dim, fe_degree >:
Collaboration diagram for HybridADRSolver::MatrixFreeSolver< dim, fe_degree >:

Public Types

using Number = double
using LevelNumber = float
using VectorType = LinearAlgebra::distributed::Vector<Number>
using LevelVectorType = LinearAlgebra::distributed::Vector<LevelNumber>
using SystemMatrixType = ADROperator<dim, fe_degree, Number>
using LevelMatrixType = ADROperator<dim, fe_degree, LevelNumber>
using SmootherType
using SmootherPreconditionerType

Public Member Functions

 MatrixFreeSolver (const ProblemInterface< dim > &problem, MPI_Comm comm, const SolverParameters &params=SolverParameters())
 Constructor.
void run (unsigned int n_refinements) override
 Run the complete solve cycle.
SolverType get_solver_type () const override
 Returns the solver type identifier.
std::string get_name () const override
 Returns a descriptive name for this solver.
const SystemMatrixTypeget_system_operator () const
 Get the system operator (for analysis/debugging).
const VectorTypeget_solution () const
 Get the solution vector.
double compute_memory_usage () const
 Compute memory usage in MB.
double compute_l2_error () const
 Compute the L2 error against the exact solution.
Public Member Functions inherited from HybridADRSolver::ParallelSolverBase< dim >
 ParallelSolverBase (MPI_Comm comm, SolverParameters params, bool construct_mg_hierarchy=false)
virtual ~ParallelSolverBase ()=default
const TimingResultsget_timing_results () const

Protected Member Functions

void setup_dofs () override
void assemble_system () override
void solve () override
void output_results (unsigned int cycle) const override
void setup_matrix_free ()
 Setup the MatrixFree data structure for the finest level.
void setup_multigrid ()
 Setup the multigrid hierarchy.
void assemble_rhs ()
 Assemble the right-hand side vector.
void solve_gmres_gmg ()
 Solve using GMRES with GMG preconditioning.
void solve_cg_gmg ()
 Solve using CG with GMG preconditioning (for symmetric problems).
void solve_gmres_jacobi ()
 Solve using GMRES with Jacobi preconditioning (fallback).
void solve_cg_jacobi ()
 Solve using CG with Jacobi preconditioning (fallback).
Protected Member Functions inherited from HybridADRSolver::ParallelSolverBase< dim >
virtual void setup_grid (unsigned int n_refinements)

Additional Inherited Members

Protected Attributes inherited from HybridADRSolver::ParallelSolverBase< dim >
MPI_Comm mpi_communicator
unsigned int n_mpi_processes
unsigned int this_mpi_process
parallel::distributed::Triangulation< dim > triangulation
std::unique_ptr< FiniteElement< dim > > fe
DoFHandler< dim > dof_handler
std::unique_ptr< Mapping< dim > > mapping
AffineConstraints< double > constraints
IndexSet locally_owned_dofs
IndexSet locally_relevant_dofs
SolverParameters parameters
TimingResults timing_results
ConditionalOStream pcout
TimerOutput computing_timer
bool has_mg_hierarchy

Detailed Description

template<int dim, int fe_degree>
class HybridADRSolver::MatrixFreeSolver< dim, fe_degree >

Matrix-free solver with hybrid MPI+threading parallelization and GMG.

This class implements a matrix-free finite element solver that:

  • Uses MatrixFree for efficient operator application
  • Supports hybrid MPI (distributed) + threading (shared memory) parallelization
  • Implements Geometric Multigrid (GMG) preconditioning with Chebyshev smoother
  • Achieves better memory efficiency and cache utilization than matrix-based
Template Parameters
dimSpatial dimension
fe_degreePolynomial degree of finite elements

Member Typedef Documentation

◆ LevelMatrixType

template<int dim, int fe_degree>
using HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::LevelMatrixType = ADROperator<dim, fe_degree, LevelNumber>

◆ LevelNumber

template<int dim, int fe_degree>
using HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::LevelNumber = float

◆ LevelVectorType

template<int dim, int fe_degree>
using HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::LevelVectorType = LinearAlgebra::distributed::Vector<LevelNumber>

◆ Number

template<int dim, int fe_degree>
using HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::Number = double

◆ SmootherPreconditionerType

template<int dim, int fe_degree>
using HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::SmootherPreconditionerType
Initial value:
DiagonalMatrix<LevelVectorType>

◆ SmootherType

template<int dim, int fe_degree>
using HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::SmootherType
Initial value:
PreconditionChebyshev<LevelMatrixType, LevelVectorType>

◆ SystemMatrixType

template<int dim, int fe_degree>
using HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::SystemMatrixType = ADROperator<dim, fe_degree, Number>

◆ VectorType

template<int dim, int fe_degree>
using HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::VectorType = LinearAlgebra::distributed::Vector<Number>

Constructor & Destructor Documentation

◆ MatrixFreeSolver()

template<int dim, int fe_degree>
HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::MatrixFreeSolver ( const ProblemInterface< dim > & problem,
MPI_Comm comm,
const SolverParameters & params = SolverParameters() )

Constructor.

Parameters
problemThe PDE problem to solve
commMPI communicator
paramsSolver parameters

Member Function Documentation

◆ assemble_rhs()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::assemble_rhs ( )
protected

Assemble the right-hand side vector.

◆ assemble_system()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::assemble_system ( )
overrideprotectedvirtual

Assemble the system (matrix and/or RHS)

Implements HybridADRSolver::ParallelSolverBase< dim >.

◆ compute_l2_error()

template<int dim, int fe_degree>
double HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::compute_l2_error ( ) const

Compute the L2 error against the exact solution.

◆ compute_memory_usage()

template<int dim, int fe_degree>
double HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::compute_memory_usage ( ) const

Compute memory usage in MB.

◆ get_name()

template<int dim, int fe_degree>
std::string HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::get_name ( ) const
inlineoverridevirtual

Returns a descriptive name for this solver.

Implements HybridADRSolver::ParallelSolverBase< dim >.

◆ get_solution()

template<int dim, int fe_degree>
const VectorType & HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::get_solution ( ) const
inline

Get the solution vector.

◆ get_solver_type()

template<int dim, int fe_degree>
SolverType HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::get_solver_type ( ) const
inlineoverridevirtual

Returns the solver type identifier.

Implements HybridADRSolver::ParallelSolverBase< dim >.

◆ get_system_operator()

template<int dim, int fe_degree>
const SystemMatrixType & HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::get_system_operator ( ) const
inline

Get the system operator (for analysis/debugging).

◆ output_results()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::output_results ( unsigned int cycle) const
overrideprotectedvirtual

Output results to files

Parameters
cycleCurrent refinement cycle

Implements HybridADRSolver::ParallelSolverBase< dim >.

◆ run()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::run ( unsigned int n_refinements)
overridevirtual

Run the complete solve cycle.

Parameters
n_refinementsNumber of global mesh refinements

Implements HybridADRSolver::ParallelSolverBase< dim >.

◆ setup_dofs()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::setup_dofs ( )
overrideprotectedvirtual

Distribute degrees of freedom and setup constraints

Implements HybridADRSolver::ParallelSolverBase< dim >.

◆ setup_matrix_free()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::setup_matrix_free ( )
protected

Setup the MatrixFree data structure for the finest level.

◆ setup_multigrid()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::setup_multigrid ( )
protected

Setup the multigrid hierarchy.

◆ solve()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::solve ( )
overrideprotectedvirtual

Solve the linear system

Implements HybridADRSolver::ParallelSolverBase< dim >.

◆ solve_cg_gmg()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::solve_cg_gmg ( )
protected

Solve using CG with GMG preconditioning (for symmetric problems).

◆ solve_cg_jacobi()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::solve_cg_jacobi ( )
protected

Solve using CG with Jacobi preconditioning (fallback).

◆ solve_gmres_gmg()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::solve_gmres_gmg ( )
protected

Solve using GMRES with GMG preconditioning.

◆ solve_gmres_jacobi()

template<int dim, int fe_degree>
void HybridADRSolver::MatrixFreeSolver< dim, fe_degree >::solve_gmres_jacobi ( )
protected

Solve using GMRES with Jacobi preconditioning (fallback).


The documentation for this class was generated from the following files: