-
Notifications
You must be signed in to change notification settings - Fork 50
Grid HYPRE
Sam Reeve edited this page Sep 12, 2024
·
2 revisions
Cabana::Grid provides an interface to the HYPRE library for structured solvers and preconditioners.
Cabana_Grid_HypreStructuredSolver.hpp
auto vector_layout = Cabana::Grid::createArrayLayout( local_mesh, 1, Cell() );
auto lhs = Cabana::Grid::createArray<double, MemorySpace>( "lhs", vector_layout );
auto rhs = Cabana::Grid::createArray<double, MemorySpace>( "rhs", vector_layout );
std::string solver_type = "GMRES";
auto solver = Cabana::Grid::createHypreStructuredSolver<double, memory_space>(
solver_type, *vector_layout );
solver->setMatrixStencil( stencil );
solver->setMatrixValues( *matrix_entries );
solver->setTolerance( 1.0e-11 );
solver->setPrintLevel( 1 );
std::string precond_type = "Diagonal";
auto preconditioner = Cabana::Grid::createHypreStructuredSolver<double, memory_space>(
precond_type, *vector_layout, true );
solver->setPreconditioner( preconditioner );
solver->setup();
solver->solve( *rhs, *lhs );
This is part of the Programming Guide series
Cabana - A Co-Designed Library for Exascale Particle Simulations