Skip to content

Grid HYPRE

Sam Reeve edited this page Sep 12, 2024 · 2 revisions

Overview

Cabana::Grid provides an interface to the HYPRE library for structured solvers and preconditioners.

Implementation

Cabana_Grid_HypreStructuredSolver.hpp

Examples

Usage

    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

Clone this wiki locally