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.

create the preconditioner<br />

ML_Epetra::MultiLevelPreconditioner * MLPrec =<br />

new ML_Epetra::MultiLevelPreconditioner(*A, MLList, true);<br />

// visualize the effect of the ML preconditioner on a<br />

// random vector. We ask for 10 multilevel cycles<br />

MLPrec->VisualizeCycle(10);<br />

// visualize the effect of each level’s smoother on a<br />

// random vector. We ask for 5 steps of presmoothers,<br />

// and 1 step of postsmoother<br />

MLPrec->VisualizeSmoothers(5,1);<br />

(File ml_viz.cpp contains the compilable code.) We note that the parameters must be set<br />

before calling ComputePreconditioner(). See also Section 6.4.12 for the requirements on<br />

the coordinates vectors. Results will be written in the following files:<br />

• before-presmoother-eqX-levelY.vtk contains the random vector before the application<br />

of the presmoother, for equation X at level Y;<br />

• after-presmoother-eqX-levelY.vtk contains the random vector after the application<br />

of the presmoother, for equation X at level Y;<br />

• before-postsmoother-eqX-levelY.vtk contains the random vector before the application<br />

of the postsmoother, for equation X at level Y;<br />

• after-postsmoother-eqX-levelY.vtk contains the random vector after the application<br />

of the postsmoother, for equation X at level Y;<br />

• before-cycle-eqX-levelY.vtk contains the random vector before the application of<br />

the MLcycle, for equation X at the finest level;<br />

• after-cycle-eqX-levelY.vtk contains the random vector after the application of the<br />

ML cycle, for equation X at finest level.<br />

6.8 Print the Computational Stencil for a 2D Cartesian Grid<br />

Method PrintStencil2D() can be used to print out the computational stencil for problems<br />

defined on 2D Cartesian grids, if the nodes numbering follows the x-axis. The following<br />

fragment of code shows the use of this method:<br />

int Nx = 16; // nodes along the x-axis<br />

int Ny = 32; // nodes along the y-axis<br />

int NodeID = -1; // print the stencil for this node<br />

int EquationID = 0; // equation 0, useful for vector problems<br />

// MLPrec is a pointer to an already created<br />

// ML_Epetra::MultiLevelPreconditioner<br />

MLPrec->PrintStencil2D(Nx,Ny,NodeID, EquationID);<br />

42

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

Saved successfully!

Ooh no, something went wrong!