Skip to content

Grid Structured Solvers

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

Overview

Cabana::Grid provides a conjugate gradient structured solver for use with grid field data.

Implementation

Cabana_Grid_ReferenceStructuredSolver.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 );

    auto solver = Cabana::Grid::createReferenceConjugateGradient<double, memory_space>( *vector_layout );
    solver->setMatrixStencil( stencil );
    solver->setMatrixValues( *matrix_entries );
    solver->setPreconditionerStencil( diag_stencil );
    solver->setTolerance( 1.0e-11 );
    solver->setPrintLevel( 1 );
    solver->setup();
    solver->solve( *rhs, *lhs );

This is part of the Programming Guide series

Clone this wiki locally