23 const std::string AztecSolver_name =
"Aztec Solver";
25 const std::string AztecPreconditioner_name =
"Aztec Preconditioner";
28 AZTEC_PREC_NONE, AZTEC_PREC_ILU, AZTEC_PREC_ILUT, AZTEC_PREC_JACOBI,
29 AZTEC_PREC_SYMMGS, AZTEC_PREC_POLY, AZTEC_PREC_LSPOLY
40 const std::string Overlap_name =
"Overlap";
42 const std::string GraphFill_name =
"Graph Fill";
44 const std::string DropTolerance_name =
"Drop Tolerance";
46 const std::string FillFactor_name =
"Fill Factor";
48 const std::string Steps_name =
"Steps";
50 const std::string PolynomialOrder_name =
"Polynomial Order";
52 const std::string RCMReordering_name =
"RCM Reordering";
54 const std::string Orthogonalization_name =
"Orthogonalization";
56 const std::string SizeOfKrylovSubspace_name =
"Size of Krylov Subspace";
58 const std::string ConvergenceTest_name =
"Convergence Test";
60 const std::string IllConditioningThreshold_name =
"Ill-Conditioning Threshold";
62 const std::string OutputFrequency_name =
"Output Frequency";
73 using Teuchos::getIntegralValue;
74 using Teuchos::getParameter;
81 solver->SetAztecOption(
83 ,getIntegralValue<int>(*pl,AztecSolver_name)
87 getIntegralValue<EAztecPreconditioner>(
88 *pl,AztecPreconditioner_name
95 solver->SetAztecOption(AZ_precond,AZ_none);
96 pl->
set(AztecPreconditioner_name,
"none");
99 solver->SetAztecOption(AZ_precond,AZ_dom_decomp);
100 solver->SetAztecOption(AZ_overlap,getParameter<int>(*pl,Overlap_name));
101 solver->SetAztecOption(AZ_subdomain_solve,AZ_ilu);
102 solver->SetAztecOption(AZ_graph_fill,getParameter<int>(*pl,GraphFill_name));
103 pl->
set(AztecPreconditioner_name,
"ilu");
105 case AZTEC_PREC_ILUT:
106 solver->SetAztecOption(AZ_precond,AZ_dom_decomp);
107 solver->SetAztecOption(AZ_overlap,getParameter<int>(*pl,Overlap_name));
108 solver->SetAztecOption(AZ_subdomain_solve,AZ_ilut);
109 solver->SetAztecParam(AZ_drop,getParameter<double>(*pl,DropTolerance_name));
110 solver->SetAztecParam(AZ_ilut_fill,getParameter<double>(*pl,FillFactor_name));
111 pl->
set(AztecPreconditioner_name,
"ilut");
113 case AZTEC_PREC_JACOBI:
114 solver->SetAztecOption(AZ_precond,AZ_Jacobi);
115 solver->SetAztecOption(AZ_poly_ord,getParameter<int>(*pl,Steps_name));
116 pl->
set(AztecPreconditioner_name,
"Jacobi");
118 case AZTEC_PREC_SYMMGS:
119 solver->SetAztecOption(AZ_precond,AZ_sym_GS);
120 solver->SetAztecOption(AZ_poly_ord,getParameter<int>(*pl,Steps_name));
121 pl->
set(AztecPreconditioner_name,
"Symmetric Gauss-Seidel");
123 case AZTEC_PREC_POLY:
124 solver->SetAztecOption(AZ_precond,AZ_Neumann);
125 solver->SetAztecOption(AZ_poly_ord,getParameter<int>(*pl,PolynomialOrder_name));
126 pl->
set(AztecPreconditioner_name,
"Polynomial");
128 case AZTEC_PREC_LSPOLY:
129 solver->SetAztecOption(AZ_precond,AZ_ls);
130 solver->SetAztecOption(AZ_poly_ord,getParameter<int>(*pl,PolynomialOrder_name));
131 pl->
set(AztecPreconditioner_name,
"Least-squares Polynomial");
137 solver->SetAztecOption(
139 ,getIntegralValue<int>(*pl,RCMReordering_name)
142 solver->SetAztecOption(
144 ,getIntegralValue<int>(*pl,Orthogonalization_name)
147 solver->SetAztecOption(AZ_kspace,getParameter<int>(*pl,SizeOfKrylovSubspace_name));
149 solver->SetAztecOption(
151 ,getIntegralValue<int>(*pl,ConvergenceTest_name)
154 solver->SetAztecParam(
155 AZ_ill_cond_thresh, getParameter<double>(*pl,IllConditioningThreshold_name)
158 solver->SetAztecOption(
159 AZ_output, getParameter<int>(*pl,OutputFrequency_name)
164 #endif // TEUCHOS_DEBUG
179 using Teuchos::tuple;
180 using Teuchos::setStringToIntegralParameter;
181 using Teuchos::setIntParameter;
182 using Teuchos::setDoubleParameter;
197 RCP<ParameterList> pl = validAztecOOParams;
198 if(pl.get())
return pl;
199 pl = validAztecOOParams =
rcp(
new ParameterList());
201 setStringToIntegralParameter<int>(
202 AztecSolver_name,
"GMRES",
203 "Type of linear solver algorithm to use.",
204 tuple<std::string>(
"CG",
"GMRES",
"CGS",
"TFQMR",
"BiCGStab",
"LU",
"GMRESR",
"FixedPoint"),
205 tuple<int>(AZ_cg,AZ_gmres,AZ_cgs,AZ_tfqmr,AZ_bicgstab,AZ_lu,AZ_GMRESR,AZ_fixed_pt),
208 setStringToIntegralParameter<EAztecPreconditioner>(
209 AztecPreconditioner_name,
"ilu",
210 "Type of internal preconditioner to use.\n"
211 "Note! this preconditioner will only be used if the input operator\n"
212 "supports the Epetra_RowMatrix interface and the client does not pass\n"
213 "in an external preconditioner!",
215 "none",
"ilu",
"ilut",
"Jacobi",
216 "Symmetric Gauss-Seidel",
"Polynomial",
"Least-squares Polynomial"
218 tuple<EAztecPreconditioner>(
219 AZTEC_PREC_NONE,AZTEC_PREC_ILU,AZTEC_PREC_ILUT,AZTEC_PREC_JACOBI,
220 AZTEC_PREC_SYMMGS,AZTEC_PREC_POLY,AZTEC_PREC_LSPOLY
226 "The amount of overlap used for the internal \"ilu\" and \"ilut\" preconditioners.",
231 "The amount of fill allowed for the internal \"ilu\" preconditioner.",
235 DropTolerance_name, 0.0,
236 "The tolerance below which an entry from the factors of an internal \"ilut\"\n"
237 "preconditioner will be dropped.",
241 FillFactor_name, 1.0,
242 "The amount of fill allowed for an internal \"ilut\" preconditioner.",
247 "Number of steps taken for the \"Jacobi\" or the \"Symmetric Gauss-Seidel\"\n"
248 "internal preconditioners for each preconditioner application.",
252 PolynomialOrder_name, 3,
253 "The order for of the polynomials used for the \"Polynomial\" and\n"
254 "\"Least-squares Polynomial\" internal preconditioners.",
257 setStringToIntegralParameter<int>(
258 RCMReordering_name,
"Disabled",
259 "Determines if RCM reordering is used with the internal\n"
260 "\"ilu\" or \"ilut\" preconditioners.",
261 tuple<std::string>(
"Enabled",
"Disabled"),
265 setStringToIntegralParameter<int>(
266 Orthogonalization_name,
"Classical",
267 "The type of orthogonalization to use with the \"GMRES\" solver.",
268 tuple<std::string>(
"Classical",
"Modified"),
269 tuple<int>(AZ_classic,AZ_modified),
273 SizeOfKrylovSubspace_name, 300,
274 "The maximum size of the Krylov subspace used with \"GMRES\" before\n"
275 "a restart is performed.",
278 setStringToIntegralParameter<int>(
279 ConvergenceTest_name,
"r0",
280 "The convergence test to use for terminating the iterative solver.",
281 tuple<std::string>(
"r0",
"rhs",
"Anorm",
"no scaling",
"sol"),
282 tuple<int>(AZ_r0,AZ_rhs,AZ_Anorm,AZ_noscaled,AZ_sol),
286 IllConditioningThreshold_name, 1e+11,
287 "The threshold tolerance above which a system is considered\n"
292 OutputFrequency_name, 0,
293 "The number of iterations between each output of the solver's progress.",
void setAztecOOParameters(Teuchos::ParameterList *pl, AztecOO *solver)
Setup an AztecOO solver object with a set of parameters.
static void addConverter(RCP< const ParameterEntryValidator > validator, RCP< ValidatorXMLConverter > converterToAdd)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
std::istringstream & operator>>(std::istringstream &in, TwoDArray< T > &array)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void validateParametersAndSetDefaults(ParameterList const &validParamList, int const depth=1000)
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
Teuchos::RCP< const Teuchos::ParameterList > getValidAztecOOParameters()
Return the list of all valid AztecOO parameters (to validate against).
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)