GMRES in AztecOO vs NOX::Epetra::LinearSystemAztecOO
Created by: guoluanjing
Hello there,
I'm modifying a legacy code in our group for reactive transport simulations. The original code only used the linear solver of GMRES from Trilinos and did the nonlinear iterations by ourselves. Now I'm trying to use NOX package to do the nonlinear solve as well as to use some advanced solution methods such as Matrix Free option that is available in NOX.
In order to verify I'm implementing it correctly, I'm using the user-provided Jacobian option and passing in the same Jacobian matrix and residual vector as those in the original code (This I have checked by outputting the matrix and vector right before they were passed into the solver). I've tried my best to make sure I've set the same options for the linear solver (I will list them below). But I've seen different pathways for iterations and got different results for the first nonlinear iteration (as seen below). It takes 8 iterations for the original code and 377 for the current code to converge, to different results (and the current code converged to negative concentration values while the original code converged to, I believe, correct positive values).
My question is: 1) have I indeed used the same linear solver options? and 2) if yes, what is causing the differences?
Thanks a lot, Luanjing
Original linear solver options:
SetAztecOption(AZ_solver, AZ_gmres);
SetAztecOption(AZ_reorder, 1);
SetAztecOption(AZ_kspace, MAX_LINEAR_IT);
SetAztecOption(AZ_orthog, AZ_modified);
SetAztecOption(AZ_precond, AZ_dom_decomp);
SetAztecOption(AZ_subdomain_solve, AZ_ilut);
SetAztecOption(AZ_conv, AZ_r0);
SetAztecOption(AZ_output, 1);
-
Call to Iterate function: Iterate(J, Y, R, MAX_LINEAR_IT, LINEAR_SOLVER_TOL); (Note: Y->PutScalar(0.); )
Current linear solver parameter list:
Teuchos::ParameterList& lsParams = newtonParams.sublist("Linear Solver");
lsParams.set("Aztec Solver", "GMRES");
lsParams.set("Max Iterations", MAX_LINEAR_IT);
lsParams.set("Size of Krylov Subspace", MAX_LINEAR_IT);
lsParams.set("Orthogonalization", "Modified");
lsParams.set("Tolerance", LINEAR_SOLVER_TOL);
lsParams.set("Zero Initial Guess", true);
lsParams.set("Output Frequency", AZ_all);
lsParams.set("Preconditioner", "None");
lsParams.set("Aztec Preconditioner", "ilut");
lsParams.set("RCM Reordering", "Enabled");
Iteration pathway for original code: ******************************************************* ***** Problem: Epetra::VbrMatrix ***** Preconditioned GMRES solution ***** ILUT( fill-in = 1.000e+00, drop = 0.000e+00) ***** without overlap ***** No scaling ***** NOTE: convergence VARIES when the total number of ***** processors is changed. ******************************************************* iter: 0 residual = 1.000000e+00
***** Condition number estimate for subdomain preconditioner on PE 0 = 1.0000e+00
*******************************************************
***** ilut: The ilut factors require 1.000e+00 times
***** the memory of the overlapped subdomain matrix.
*******************************************************
iter: 1 residual = 1.061256e-03
iter: 2 residual = 4.328148e-04
iter: 3 residual = 3.521890e-04
iter: 4 residual = 2.305014e-04
iter: 5 residual = 7.785169e-05
Solver: gmres
number of iterations: 5
Recursive residual = 7.7852e+04
Calculated Norms Requested Norm
-------------------------------------------- --------------
||r||_2 / ||r0||_2: 7.785169e-05 1.000000e-06
Iteration pathway for the current code: ******************************************************* ***** Problem: Epetra::VbrMatrix ***** Preconditioned GMRES solution ***** No preconditioning ***** No scaling *******************************************************
iter: 0 residual = 1.000000e+00
iter: 1 residual = 4.100260e-03
iter: 2 residual = 3.994221e-03
iter: 3 residual = 3.980341e-03
iter: 4 residual = 3.961234e-03
iter: 5 residual = 3.606947e-03
Solver: gmres
number of iterations: 5
Recursive residual = 3.6070e+06
Calculated Norms Requested Norm
-------------------------------------------- --------------
||r||_2 / ||r0||_2: 3.606947e-03 1.000000e-06