26.08.2015 Views

nonsymmetric dynamics

ML 5.0 Smoothed Aggregation User's Guide - Trilinos - Sandia ...

ML 5.0 Smoothed Aggregation User's Guide - Trilinos - Sandia ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

now compute the preconditioner<br />

MLPrec->ComputePreconditioner();<br />

// solve the linear system<br />

...<br />

// destroy the previously define preconditioner, and build a new one<br />

MLPrec->DestroyPreconditioner();<br />

// re-compute the elements of A<br />

// now re-compute the preconditioner, using either<br />

MLPrec->ComputePreconditioner();<br />

// or<br />

MLPrec->ReComputePreconditioner();<br />

// re-solve the linear system<br />

// .. finally destroy the object<br />

delete MLPrec;<br />

In this fragment of code, the user defines the ML preconditioner, but the preconditioner<br />

is created only with the call ComputePreconditioner(). This may be useful, for example,<br />

when ML is used in conjunction with nonlinear solvers (like Nox [17]). Method<br />

ReComputePreconditioner() can be used to recompute the preconditioner using already<br />

available information about the aggregates. ReComputePreconditioner() reuses the already<br />

computed tentative prolongator, then recomputes the smoothed prolongators and the<br />

other components of the hierarchy, like smoothers and coarse solver 11 .<br />

6.2 Example 2: ml 2level DD.cpp<br />

In the second example, a two level domain decomposition preconditioner is constructed.<br />

The coarse space is defined using aggregation. It is worthwhile to compare the parameters<br />

selected here to the default parameters stated in Table 6.<br />

File $ML HOME/examples/TwoLevelDD/ml 2level DD.cpp reports the entire code. In<br />

the example, the linear system matrix A, is an Epetra CrsMatrix corresponding to the<br />

discretization of a Laplacian on a 2D Cartesian grid. The solution vector and right-hand<br />

side are x and b respectively.<br />

The AztecOO linear problem is defined as<br />

Epetra_LinearProblem problem(&A, &x, &b);<br />

AztecOO solver(problem);<br />

We create the Teuchos parameter list as follows:<br />

ParameterList MLList;<br />

ML_Epetra::SetDefaults("DD", MLList);<br />

MLList.set("max levels",2);<br />

11 Note that the hierarchy produced by ReComputePreconditioner() can differ from that produced by<br />

ComputePreconditioner() for non-zero threshold values.<br />

16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!