Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_Stepper_impl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_Stepper_impl_hpp
10 #define Tempus_Stepper_impl_hpp
11 
12 
13 namespace Tempus {
14 
15 
17  Teuchos::RCP<Teuchos::ParameterList> pl, std::string stepperType)
18 {
19  pl->setName("Default Stepper - " + stepperType);
20  pl->set<std::string>("Stepper Type", stepperType);
21 
22  pl->set<bool>("Use FSAL", false,
23  "The First-Step-As-Last (FSAL) principle is the situation where the\n"
24  "last function evaluation, f(x^{n-1},t^{n-1}) [a.k.a. xDot^{n-1}],\n"
25  "can be used for the first function evaluation, f(x^n,t^n)\n"
26  "[a.k.a. xDot^n]. For RK methods, this applies to the stages.\n"
27  "\n"
28  "Often the FSAL priniciple can be used to save an evaluation.\n"
29  "However there are cases when it cannot be used, e.g., operator\n"
30  "splitting where other steppers/operators have modified the solution,\n"
31  "x^*, and thus require the function evaluation, f(x^*, t^{n-1}).\n"
32  "\n"
33  "It should be noted that when the FSAL priniciple can be used\n"
34  "(can set useFSAL=true), setting useFSAL=false will give the\n"
35  "same solution but at additional expense. However, the reverse\n"
36  "is not true. When the FSAL priniciple can not be used\n"
37  "(need to set useFSAL=false), setting useFSAL=true will produce\n"
38  "incorrect solutions.\n"
39  "\n"
40  "Default in general for explicit and implicit steppers is false,\n"
41  "but individual steppers can override this default.");
42 
43  pl->set<std::string>("Initial Condition Consistency", "None",
44  "This indicates which type of consistency should be applied to\n"
45  "the initial conditions (ICs):\n"
46  "\n"
47  " 'None' - Do nothing to the ICs provided in the SolutionHistory.\n"
48  " 'Zero' - Set the derivative of the SolutionState to zero in the\n"
49  " SolutionHistory provided, e.g., xDot^0 = 0, or \n"
50  " xDotDot^0 = 0.\n"
51  " 'App' - Use the application's ICs, e.g., getNominalValues().\n"
52  " 'Consistent' - Make the initial conditions for x and xDot\n"
53  " consistent with the governing equations, e.g.,\n"
54  " xDot = f(x,t), and f(x, xDot, t) = 0. For implicit\n"
55  " ODEs, this requires a solve of f(x, xDot, t) = 0 for\n"
56  " xDot, and another Jacobian and residual may be\n"
57  " needed, e.g., boundary conditions on xDot may need\n"
58  " to replace boundary conditions on x.\n"
59  "\n"
60  "In general for explicit steppers, the default is 'Consistent',\n"
61  "because it is fairly cheap with just one residual evaluation.\n"
62  "In general for implicit steppers, the default is 'None', because\n"
63  "the application often knows its IC and can set it the initial\n"
64  "SolutionState. Also, as noted above, 'Consistent' may require\n"
65  "another Jacobian from the application. Individual steppers may\n"
66  "override these defaults.");
67 
68  pl->set<bool>("Initial Condition Consistency Check", true,
69  "Check if the initial condition, x and xDot, is consistent with the\n"
70  "governing equations, xDot = f(x,t), or f(x, xDot, t) = 0.\n"
71  "\n"
72  "In general for explicit and implicit steppers, the default is true,\n"
73  "because it is fairly cheap with just one residual evaluation.\n"
74  "Individual steppers may override this default.");
75 }
76 
77 
78 Teuchos::RCP<Teuchos::ParameterList> defaultSolverParameters()
79 {
80  using Teuchos::RCP;
81  using Teuchos::ParameterList;
82 
83  // NOX Solver ParameterList
84  RCP<ParameterList> noxPL = Teuchos::parameterList();
85 
86  // Direction ParameterList
87  RCP<ParameterList> directionPL = Teuchos::parameterList();
88  directionPL->set<std::string>("Method", "Newton");
89  RCP<ParameterList> newtonPL = Teuchos::parameterList();
90  newtonPL->set<std::string>("Forcing Term Method", "Constant");
91  newtonPL->set<bool> ("Rescue Bad Newton Solve", 1);
92  directionPL->set("Newton", *newtonPL);
93  noxPL->set("Direction", *directionPL);
94 
95  // Line Search ParameterList
96  RCP<ParameterList> lineSearchPL = Teuchos::parameterList();
97  lineSearchPL->set<std::string>("Method", "Full Step");
98  RCP<ParameterList> fullStepPL = Teuchos::parameterList();
99  fullStepPL->set<double>("Full Step", 1);
100  lineSearchPL->set("Full Step", *fullStepPL);
101  noxPL->set("Line Search", *lineSearchPL);
102 
103  noxPL->set<std::string>("Nonlinear Solver", "Line Search Based");
104 
105  // Printing ParameterList
106  RCP<ParameterList> printingPL = Teuchos::parameterList();
107  printingPL->set<int>("Output Precision", 3);
108  printingPL->set<int>("Output Processor", 0);
109  RCP<ParameterList> outputPL = Teuchos::parameterList();
110  outputPL->set<bool>("Error", 1);
111  outputPL->set<bool>("Warning", 1);
112  outputPL->set<bool>("Outer Iteration", 0);
113  outputPL->set<bool>("Parameters", 0);
114  outputPL->set<bool>("Details", 0);
115  outputPL->set<bool>("Linear Solver Details", 1);
116  outputPL->set<bool>("Stepper Iteration", 1);
117  outputPL->set<bool>("Stepper Details", 1);
118  outputPL->set<bool>("Stepper Parameters", 1);
119  printingPL->set("Output Information", *outputPL);
120  noxPL->set("Printing", *printingPL);
121 
122  // Solver Options ParameterList
123  RCP<ParameterList> solverOptionsPL = Teuchos::parameterList();
124  solverOptionsPL->set<std::string>("Status Test Check Type", "Minimal");
125  noxPL->set("Solver Options", *solverOptionsPL);
126 
127  // Status Tests ParameterList
128  RCP<ParameterList> statusTestsPL = Teuchos::parameterList();
129  statusTestsPL->set<std::string>("Test Type", "Combo");
130  statusTestsPL->set<std::string>("Combo Type", "OR");
131  statusTestsPL->set<int>("Number of Tests", 2);
132  RCP<ParameterList> test0PL = Teuchos::parameterList();
133  test0PL->set<std::string>("Test Type", "NormF");
134  test0PL->set<double>("Tolerance", 1e-08);
135  statusTestsPL->set("Test 0", *test0PL);
136  RCP<ParameterList> test1PL = Teuchos::parameterList();
137  test1PL->set<std::string>("Test Type", "MaxIters");
138  test1PL->set<int>("Maximum Iterations", 10);
139  statusTestsPL->set("Test 1", *test1PL);
140  noxPL->set("Status Tests", *statusTestsPL);
141 
142  // Solver ParameterList
143  RCP<ParameterList> solverPL = Teuchos::parameterList();
144  solverPL->set("NOX", *noxPL);
145 
146  return solverPL;
147 }
148 
149 } // namespace Tempus
150 #endif // Tempus_Stepper_impl_hpp
Teuchos::RCP< Teuchos::ParameterList > defaultSolverParameters()
Returns the default solver ParameterList for implicit Steppers.
void getValidParametersBasic(Teuchos::RCP< Teuchos::ParameterList > pl, std::string stepperType)
Provide basic parameters to Steppers.