[Trilinos-Users] How can I print every iteration details in Belos solver?
Thornquist, Heidi K
hkthorn at sandia.gov
Thu Jun 26 09:13:58 MDT 2008
Hi,
To get the residual information for every iteration regardless of convergence, you need to add “+Belos::StatusTestDetails” to your verbosity.
Thanks,
Heidi
On 6/26/08 6:36 AM, "刘俊" <ax.equal.b at gmail.com> wrote:
Hi,
I am now testing ex1.cpp of Belos, but I can't print out every iteration details,
I have set the verbosity according to the manual,but it does not work. It print only the final results.
some code as follow:
..........
int verbosity = Belos::Errors+Belos::Warnings+Belos::Debug+Belos::IterationDetails;
Teuchos::RCP<Teuchos::ParameterList> myPL = Teuchos::rcp( new Teuchos::ParameterList() );
myPL->set( "Verbosity", verbosity );
myPL->set( "Block Size", blocksize );
myPL->set( "Maximum Iterations", 100 );
myPL->set( "Convergence Tolerance", 1.0e-8 );
myPL->set("Output Frequency",1);
Belos::BlockCGSolMgr<double,MV,OP> mySolver(myProblem, myPL);//CG方法
....................
the output:
--------------------------
Belos Example: Block CG
Problem info:
* Solving problem laplace_2d
* Number of global elements : -1
* Type of Map : linear
* Number of PDEs : 1
Belos::StatusTestOutput: Passed
(Num calls,Mod test,State test): (30, 1, Passed)
Passed.......OR Combination ->
OK...........Number of Iterations = 29 < 100
Converged....(2-Norm Imp Res Vec) / (2-Norm Res0)
residual [ 0 ] = 5.43159e-09 < 1e-08
residual [ 1 ] = 1.27115e-08 > 1e-08
Belos::StatusTestOutput: Passed
(Num calls,Mod test,State test): (32, 1, Passed)
Passed.......OR Combination ->
OK...........Number of Iterations = 30 < 100
Converged....(2-Norm Imp Res Vec) / (2-Norm Res0)
residual [ 0 ] = 5.43159e-09 < 1e-08
residual [ 1 ] = 4.938e-09 < 1e-08
Belos::BlockCGSolMgr::solve() converged!
////////////
I want to print the information about iteration as in AztecOO solver,such as:
*******************************************************
***** Problem: Epetra::CrsMatrix
***** Preconditioned CG solution
***** No preconditioning
***** No scaling
*******************************************************
iter: 0 residual = 1.000000e+00
iter: 1 residual = 2.990580e-01
iter: 2 residual = 1.203293e-01
iter: 3 residual = 7.955944e-02
iter: 4 residual = 4.113928e-02
iter: 5 residual = 2.821794e-02
iter: 6 residual = 3.141783e-02
iter: 7 residual = 3.228408e-02
iter: 8 residual = 2.419115e-02
iter: 9 residual = 1.694050e-02
iter: 10 residual = 1.324365e-02
iter: 11 residual = 7.659560e-03
iter: 12 residual = 4.284702e-03
iter: 13 residual = 2.637796e-03
iter: 14 residual = 1.648559e-03
iter: 15 residual = 1.207106e-03
iter: 16 residual = 9.482598e-04
iter: 17 residual = 6.114811e-04
iter: 18 residual = 3.355039e-04
iter: 19 residual = 2.229069e-04
iter: 20 residual = 9.825301e-05
iter: 21 residual = 6.336427e-05
iter: 22 residual = 3.948687e-05
iter: 23 residual = 1.821252e-05
iter: 24 residual = 1.239958e-05
iter: 25 residual = 7.315337e-06
iter: 26 residual = 3.092389e-06
iter: 27 residual = 1.322761e-06
iter: 28 residual = 5.867232e-07
iter: 29 residual = 2.594566e-07
iter: 30 residual = 8.810022e-08
iter: 31 residual = 3.242696e-08
iter: 32 residual = 9.748573e-09
Solution time: 0.000000 (sec.)
total iterations: 32
Solver performed 32iterations.
Norm of the true residual = 2.43177e-07
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://software.sandia.gov/mailman/private/trilinos-users/attachments/20080626/51b48cd0/attachment.html
More information about the Trilinos-Users
mailing list