Rythmos - Transient Integration for Differential Equations  Version of the Day
 All Classes Functions Variables Typedefs Pages
Rythmos_TimeStepNonlinearSolver_decl.hpp
1 //@HEADER
2 // ***********************************************************************
3 //
4 // Rythmos Package
5 // Copyright (2006) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
25 //
26 // ***********************************************************************
27 //@HEADER
28 
29 
30 #ifndef RYTHMOS_TIME_STEP_NONLINEAR_SOLVER_DECL_HPP
31 #define RYTHMOS_TIME_STEP_NONLINEAR_SOLVER_DECL_HPP
32 
33 #include "Rythmos_Types.hpp"
34 #include "Thyra_NonlinearSolverBase.hpp"
35 
36 namespace Rythmos {
37 
38 
49 template <class Scalar>
50 class TimeStepNonlinearSolver : public Thyra::NonlinearSolverBase<Scalar> {
51 public:
52 
54  typedef Teuchos::ScalarTraits<Scalar> ST;
56  typedef typename ST::magnitudeType ScalarMag;
58  typedef Teuchos::ScalarTraits<ScalarMag> SMT;
59 
62 
65 
67 
70 
72  void setParameterList(RCP<ParameterList> const& paramList);
74  RCP<ParameterList> getNonconstParameterList();
76  RCP<ParameterList> unsetParameterList();
78  RCP<const ParameterList> getParameterList() const;
80  RCP<const ParameterList> getValidParameters() const;
81 
83 
86 
88  void setModel(
89  const RCP<const Thyra::ModelEvaluator<Scalar> > &model
90  );
92  RCP<const Thyra::ModelEvaluator<Scalar> > getModel() const;
94  Thyra::SolveStatus<Scalar> solve(
95  Thyra::VectorBase<Scalar> *x,
96  const Thyra::SolveCriteria<Scalar> *solveCriteria,
97  Thyra::VectorBase<Scalar> *delta = NULL
98  );
100  bool supportsCloning() const;
102  RCP<Thyra::NonlinearSolverBase<Scalar> >
103  cloneNonlinearSolver() const;
105  RCP<const Thyra::VectorBase<Scalar> > get_current_x() const;
107  bool is_W_current() const;
109  RCP<Thyra::LinearOpWithSolveBase<Scalar> >
110  get_nonconst_W(const bool forceUpToDate);
112  RCP<const Thyra::LinearOpWithSolveBase<Scalar> > get_W() const;
114  void set_W_is_current(bool W_is_current);
115 
117 
118 private:
119 
120  // private object data members
121 
122  RCP<ParameterList> paramList_;
123  RCP<const Thyra::ModelEvaluator<Scalar> > model_;
124  RCP<Thyra::LinearOpWithSolveBase<Scalar> > J_;
125  RCP<Thyra::VectorBase<Scalar> > current_x_;
126  bool J_is_current_;
127 
128  double defaultTol_;
129  int defaultMaxIters_;
130  double nonlinearSafetyFactor_;
131  double linearSafetyFactor_;
132  double RMinFraction_;
133  bool throwOnLinearSolveFailure_;
134 
135  // static class data members
136 
137  static const std::string DefaultTol_name_;
138  static const double DefaultTol_default_;
139 
140  static const std::string DefaultMaxIters_name_;
141  static const int DefaultMaxIters_default_;
142 
143  static const std::string NonlinearSafetyFactor_name_;
144  static const double NonlinearSafetyFactor_default_;
145 
146  static const std::string LinearSafetyFactor_name_;
147  static const double LinearSafetyFactor_default_;
148 
149  static const std::string RMinFraction_name_;
150  static const double RMinFraction_default_;
151 
152  static const std::string ThrownOnLinearSolveFailure_name_;
153  static const bool ThrownOnLinearSolveFailure_default_;
154 
155 };
156 
157 
162 template <class Scalar>
163 RCP<TimeStepNonlinearSolver<Scalar> > timeStepNonlinearSolver();
164 
165 
170 template <class Scalar>
171 RCP<TimeStepNonlinearSolver<Scalar> >
172 timeStepNonlinearSolver(const RCP<ParameterList> &pl);
173 
174 } // namespace Rythmos
175 
176 
177 #endif // RYTHMOS_TIME_STEP_NONLINEAR_SOLVER_DECL_HPP
Simple undampended Newton solver designed to solve time step equations in accurate times-tepping meth...
RCP< const Thyra::LinearOpWithSolveBase< Scalar > > get_W() const
void setModel(const RCP< const Thyra::ModelEvaluator< Scalar > > &model)
RCP< const Thyra::VectorBase< Scalar > > get_current_x() const
RCP< const Thyra::ModelEvaluator< Scalar > > getModel() const
RCP< Thyra::NonlinearSolverBase< Scalar > > cloneNonlinearSolver() const
Thyra::SolveStatus< Scalar > solve(Thyra::VectorBase< Scalar > *x, const Thyra::SolveCriteria< Scalar > *solveCriteria, Thyra::VectorBase< Scalar > *delta=NULL)
RCP< const ParameterList > getParameterList() const
RCP< Thyra::LinearOpWithSolveBase< Scalar > > get_nonconst_W(const bool forceUpToDate)
RCP< const ParameterList > getValidParameters() const
void setParameterList(RCP< ParameterList > const &paramList)