Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation of Trilinos LA support for linear operators #12466

Open
jppelteret opened this issue Jun 15, 2021 · 0 comments
Open

Improve documentation of Trilinos LA support for linear operators #12466

jppelteret opened this issue Jun 15, 2021 · 0 comments

Comments

@jppelteret
Copy link
Member

jppelteret commented Jun 15, 2021

As recently indicated on the mailing list (re. "Linear operators - TrilinosWrappers"), the documentation on how to use linear operators in conjunction with the Trilinos LA classes is a bit sparse. Perhaps its worth putting in a couple of examples, like what's below, to indicate what's important when setting them up.

From https://github.com/dealii/dealii/blob/master/tests/lac/schur_complement_04.cc

using VectorType      = TrilinosWrappers::MPI::Vector;

// Note that the vector type has to be specified
// Also note that this call to linear_operator is
// actually to TrilinosWrappers::linear_operator
const auto lo_A = linear_operator<VectorType>(A);
const auto lo_B = linear_operator<VectorType>(B);
const auto lo_C = linear_operator<VectorType>(C);
const auto lo_D = linear_operator<VectorType>(D);

SolverControl                        solver_control_A(100, 1.0e-10);
TrilinosWrappers::SolverCG           solver_A(solver_control_A);
TrilinosWrappers::PreconditionJacobi preconditioner_A;
preconditioner_A.initialize(A);
   
const auto lo_A_inv = inverse_operator(lo_A, solver_A, preconditioner_A);
const auto lo_S   = schur_complement(lo_A_inv, lo_B, lo_C, lo_D);

and from https://github.com/dealii/dealii/blob/master/tests/lac/linear_operator_12a.cc

using VectorType = TrilinosWrappers::MPI::Vector;

SolverControl                      solver_control(1000, 1e-12);
SolverCG<VectorType>               solver(solver_control);
TrilinosWrappers::PreconditionSSOR preconditioner;
preconditioner.initialize(system_matrix);

const auto lo_A     = linear_operator<VectorType>(system_matrix);
const auto lo_A_inv = inverse_operator(lo_A, solver, preconditioner);

output = lo_A_inv * system_rhs;
constraints.distribute(output);

Also better document (e.g. in intro to linear operation section) the linear_operator variant that targets preconditioners:

const auto M = ...;
LA::MPI::PreconditionJacobi prec_M;
prec_M.initialize(M);
const auto op_pre = linear_operator<LA::MPI::Vector>(prec_M);

vs

const auto M = ...;
LA::MPI::PreconditionJacobi prec_M;
prec_M.initialize(M);
const auto op_pre = linear_operator<LA::MPI::Vector>(M, prec_M);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant