Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_RKButcherTableauBuilder_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_RKButcherTableauBuilder_impl_hpp
10 #define Tempus_RKButcherTableauBuilder_impl_hpp
11 
14 
15 namespace Tempus {
16 
17 // Nonmember constructor
18 template<class Scalar>
19 Teuchos::RCP<RKButcherTableauBuilder<Scalar> > rKButcherTableauBuilder()
20 {
21  Teuchos::RCP<RKButcherTableauBuilder<Scalar> >
22  rkbtfn = rcp(new RKButcherTableauBuilder<Scalar>() );
23  return rkbtfn;
24 }
25 // Nonmember helper function
26 template<class Scalar>
27 Teuchos::RCP<RKButcherTableau<Scalar> > createRKBT(
28  const std::string& rkbt_name, Teuchos::RCP<Teuchos::ParameterList> pl)
29 {
30  Teuchos::RCP<RKButcherTableauBuilder<Scalar> >
31  rkbtfn = rKButcherTableauBuilder<Scalar>();
32  Teuchos::RCP<RKButcherTableau<Scalar> > rkbt = rkbtfn->create(rkbt_name);
33  rkbt->setParameterList(pl);
34  return rkbt;
35 }
36 
37 template<class Scalar>
39 {
40  this->initializeDefaults_();
41 }
42 
43 template<class Scalar>
45  const Teuchos::RCP<const Teuchos::AbstractFactory<RKButcherTableau<Scalar> > >
46  &rkbtFactory,
47  const std::string &rkbtFactoryName
48  )
49 {
50  builder_.setObjectFactory(rkbtFactory, rkbtFactoryName);
51 }
52 
53 template<class Scalar>
55  Teuchos::RCP<Teuchos::ParameterList> const& paramList
56  )
57 {
58  builder_.setParameterList(paramList);
59 }
60 
61 template<class Scalar>
62 Teuchos::RCP<Teuchos::ParameterList>
64 {
65  return builder_.getNonconstParameterList();
66 }
67 
68 
69 template<class Scalar>
70 Teuchos::RCP<Teuchos::ParameterList>
72 {
73  return builder_.unsetParameterList();
74 }
75 
76 
77 template<class Scalar>
78 Teuchos::RCP<const Teuchos::ParameterList>
80 {
81  return builder_.getParameterList();
82 }
83 
84 
85 template<class Scalar>
86 Teuchos::RCP<const Teuchos::ParameterList>
88 {
89  return builder_.getValidParameters();
90 }
91 
92 template<class Scalar>
93 Teuchos::RCP<RKButcherTableau<Scalar> >
95  const std::string &rkbt_name
96  ) const
97 {
98  return builder_.create(rkbt_name);
99 }
100 
101 template<class Scalar>
103 {
104 
105  using Teuchos::abstractFactoryStd;
106 
107  builder_.setObjectName("Tempus::RKButcherTableau");
108  builder_.setObjectTypeName("Runge Kutta Butcher Tableau Type");
109 
110  //
111  // RK Butcher Tableaus:
112  //
113 
114  // Explicit
115  builder_.setObjectFactory(
116  abstractFactoryStd< RKButcherTableau<Scalar>,
118  "General ERK");
119 
120  builder_.setObjectFactory(
121  abstractFactoryStd< RKButcherTableau<Scalar>,
123  "RK Forward Euler");
124 
125  builder_.setObjectFactory(
126  abstractFactoryStd< RKButcherTableau<Scalar>,
128  "RK Explicit 2 Stage 2nd order by Runge");
129 
130  builder_.setObjectFactory(
131  abstractFactoryStd< RKButcherTableau<Scalar>,
133  "RK Explicit Trapezoidal");
134 
135  builder_.setObjectFactory(
136  abstractFactoryStd< RKButcherTableau<Scalar>,
138  "RK Explicit 3 Stage 3rd order");
139 
140  builder_.setObjectFactory(
141  abstractFactoryStd< RKButcherTableau<Scalar>,
143  "RK Explicit 3 Stage 3rd order by Heun");
144 
145  builder_.setObjectFactory(
146  abstractFactoryStd< RKButcherTableau<Scalar>,
148  "RK Explicit 3 Stage 3rd order TVD");
149 
150  builder_.setObjectFactory(
151  abstractFactoryStd< RKButcherTableau<Scalar>,
153  "RK Explicit 4 Stage 3rd order by Runge");
154 
155  builder_.setObjectFactory(
156  abstractFactoryStd< RKButcherTableau<Scalar>,
158  "RK Explicit 5 Stage 3rd order by Kinnmark and Gray");
159 
160  builder_.setObjectFactory(
161  abstractFactoryStd< RKButcherTableau<Scalar>,
163  "RK Explicit 4 Stage");
164 
165  builder_.setObjectFactory(
166  abstractFactoryStd< RKButcherTableau<Scalar>,
168  "RK Explicit 3/8 Rule");
169 
170  builder_.setObjectFactory(
171  abstractFactoryStd< RKButcherTableau<Scalar>,
173  "Bogacki-Shampine 3(2) Pair");
174 
175  builder_.setObjectFactory(
176  abstractFactoryStd< RKButcherTableau<Scalar>,
178  "Merson 4(5) Pair");
179 
180  // Implicit
181  builder_.setObjectFactory(
182  abstractFactoryStd< RKButcherTableau<Scalar>,
184  "RK Backward Euler");
185 
186  builder_.setObjectFactory(
187  abstractFactoryStd< RKButcherTableau<Scalar>,
189  "IRK 1 Stage Theta Method");
190 
191  builder_.setObjectFactory(
192  abstractFactoryStd< RKButcherTableau<Scalar>,
194  "Implicit Midpoint");
195 
196  builder_.setObjectFactory(
197  abstractFactoryStd< RKButcherTableau<Scalar>,
199  "EDIRK 2 Stage Theta Method");
200 
201  // SDIRK
202  builder_.setObjectFactory(
203  abstractFactoryStd< RKButcherTableau<Scalar>,
205  "General DIRK");
206 
207  builder_.setObjectFactory(
208  abstractFactoryStd< RKButcherTableau<Scalar>,
210  "SDIRK 1 Stage 1st order");
211 
212  builder_.setObjectFactory(
213  abstractFactoryStd< RKButcherTableau<Scalar>,
215  "SDIRK 2 Stage 2nd order");
216 
217  builder_.setObjectFactory(
218  abstractFactoryStd< RKButcherTableau<Scalar>,
220  "SDIRK 2 Stage 3rd order");
221 
222  builder_.setObjectFactory(
223  abstractFactoryStd< RKButcherTableau<Scalar>,
225  "SDIRK 3 Stage 4th order");
226 
227  builder_.setObjectFactory(
228  abstractFactoryStd< RKButcherTableau<Scalar>,
230  "SDIRK 5 Stage 4th order");
231 
232  builder_.setObjectFactory(
233  abstractFactoryStd< RKButcherTableau<Scalar>,
235  "SDIRK 5 Stage 5th order");
236 
237  builder_.setObjectFactory(
238  abstractFactoryStd< RKButcherTableau<Scalar>,
240  "SDIRK 2(1) Pair");
241 
242  // EDIRK
243  builder_.setObjectFactory(
244  abstractFactoryStd< RKButcherTableau<Scalar>,
246  "EDIRK 2 Stage 3rd order");
247 
248  // IRK
249  builder_.setObjectFactory(
250  abstractFactoryStd< RKButcherTableau<Scalar>,
252  "RK Implicit 1 Stage 2nd order Gauss");
253 
254  builder_.setObjectFactory(
255  abstractFactoryStd< RKButcherTableau<Scalar>,
257  "RK Implicit 2 Stage 4th order Gauss");
258 
259  builder_.setObjectFactory(
260  abstractFactoryStd< RKButcherTableau<Scalar>,
262  "RK Implicit 3 Stage 6th order Gauss");
263 
264  builder_.setObjectFactory(
265  abstractFactoryStd< RKButcherTableau<Scalar>,
267  "RK Implicit 2 Stage 4th Order Hammer & Hollingsworth");
268 
269  builder_.setObjectFactory(
270  abstractFactoryStd< RKButcherTableau<Scalar>,
272  "RK Implicit 3 Stage 6th Order Kuntzmann & Butcher");
273 
274  // This RKBT does not pass convergence testing, so we're disbaling it for now.
275 // builder_.setObjectFactory(
276 // abstractFactoryStd< RKButcherTableau<Scalar>, Implicit4Stage8thOrderKuntzmannButcher_RKBT<Scalar> >(),
277 // "RK Implicit 4 Stage 8th Order Kuntzmann & Butcher");
278 
279  builder_.setObjectFactory(
280  abstractFactoryStd< RKButcherTableau<Scalar>,
282  "RK Implicit 1 Stage 1st order Radau left");
283 
284  builder_.setObjectFactory(
285  abstractFactoryStd< RKButcherTableau<Scalar>,
287  "RK Implicit 2 Stage 3rd order Radau left");
288 
289  builder_.setObjectFactory(
290  abstractFactoryStd< RKButcherTableau<Scalar>,
292  "RK Implicit 3 Stage 5th order Radau left");
293 
294  builder_.setObjectFactory(
295  abstractFactoryStd< RKButcherTableau<Scalar>,
297  "RK Implicit 1 Stage 1st order Radau right");
298 
299  builder_.setObjectFactory(
300  abstractFactoryStd< RKButcherTableau<Scalar>,
302  "RK Implicit 2 Stage 3rd order Radau right");
303 
304  builder_.setObjectFactory(
305  abstractFactoryStd< RKButcherTableau<Scalar>,
307  "RK Implicit 3 Stage 5th order Radau right");
308 
309  builder_.setObjectFactory(
310  abstractFactoryStd< RKButcherTableau<Scalar>,
312  "RK Implicit 2 Stage 2nd order Lobatto A");
313 
314  builder_.setObjectFactory(
315  abstractFactoryStd< RKButcherTableau<Scalar>,
317  "RK Implicit 3 Stage 4th order Lobatto A");
318 
319  builder_.setObjectFactory(
320  abstractFactoryStd< RKButcherTableau<Scalar>,
322  "RK Implicit 4 Stage 6th order Lobatto A");
323 
324  builder_.setObjectFactory(
325  abstractFactoryStd< RKButcherTableau<Scalar>,
327  "RK Implicit 2 Stage 2nd order Lobatto B");
328 
329  builder_.setObjectFactory(
330  abstractFactoryStd< RKButcherTableau<Scalar>,
332  "RK Implicit 3 Stage 4th order Lobatto B");
333 
334  builder_.setObjectFactory(
335  abstractFactoryStd< RKButcherTableau<Scalar>,
337  "RK Implicit 4 Stage 6th order Lobatto B");
338 
339  builder_.setObjectFactory(
340  abstractFactoryStd< RKButcherTableau<Scalar>,
342  "RK Implicit 2 Stage 2nd order Lobatto C");
343 
344  builder_.setObjectFactory(
345  abstractFactoryStd< RKButcherTableau<Scalar>,
347  "RK Implicit 3 Stage 4th order Lobatto C");
348 
349  builder_.setObjectFactory(
350  abstractFactoryStd< RKButcherTableau<Scalar>,
352  "RK Implicit 4 Stage 6th order Lobatto C");
353 
354  builder_.setDefaultObject("None");
355 
356 }
357 
358 } // namespace Tempus
359 
360 
361 #endif // Tempus_RKButcherTableauBuilder_impl_hpp
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
RK Explicit 3 Stage 3rd order TVD.
RK Explicit 2 Stage 2nd order by Runge.
Backward Euler Runge-Kutta Butcher Tableau.
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &paramList)
Teuchos::RCP< RKButcherTableauBuilder< Scalar > > rKButcherTableauBuilder()
void setRKButcherTableauFactory(const Teuchos::RCP< const Teuchos::AbstractFactory< RKButcherTableau< Scalar > > > &rkbtFactory, const std::string &rkbtFactoryName)
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
General Explicit Runge-Kutta Butcher Tableau.
Forward Euler Runge-Kutta Butcher Tableau.
Runge-Kutta 4th order Butcher Tableau.
Explicit RK 3/8th Rule Butcher Tableau.
Teuchos::RCP< const Teuchos::ParameterList > getParameterList() const
Teuchos::RCP< RKButcherTableau< Scalar > > createRKBT(const std::string &rkbt_name, Teuchos::RCP< Teuchos::ParameterList > pl)
Explicit RK Bogacki-Shampine Butcher Tableau.
Teuchos::RCP< RKButcherTableau< Scalar > > create(const std::string &rkbt_name="") const
General Implicit Runge-Kutta Butcher Tableau.
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
RK Explicit 3 Stage 3rd order by Heun.
RK Explicit 5 Stage 3rd order by Kinnmark and Gray.
RK Explicit 4 Stage 3rd order by Runge.
Runge-Kutta Builder class. This factory creates RKButcherTableau objects given the description string...
Explicit RK Merson Butcher Tableau.