/usr/include/trilinos/NOX_Direction_Newton.H is in libtrilinos-nox-dev 12.10.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | // $Id$
// $Source$
//@HEADER
// ************************************************************************
//
// NOX: An Object-Oriented Nonlinear Solver Package
// Copyright (2002) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Roger Pawlowski (rppawlo@sandia.gov) or
// Eric Phipps (etphipp@sandia.gov), Sandia National Laboratories.
// ************************************************************************
// CVS Information
// $Source$
// $Author$
// $Date$
// $Revision$
// ************************************************************************
//@HEADER
#ifndef NOX_DIRECTION_NEWTON_H
#define NOX_DIRECTION_NEWTON_H
#include "NOX_Direction_Generic.H" // base class
#include "Teuchos_ParameterList.hpp" // class data element
#include "Teuchos_RCP.hpp"
// Forward declaration
namespace NOX {
using std::string;
class Utils;
namespace Parameter {
class UserNorm;
}
}
namespace NOX {
namespace Direction {
//! %Newton direction computation
/*!
Computes the %Newton direction by solving the %Newton system.
\f[
Jd = -F
\f]
Here \f$J\f$ is the n x n Jacobian matrix at the current
iterate, \f$F\f$ is the n-vector representing the nonlinear
function at the current iterate, and \f$d\f$ is the n-vector
that we are solving for.
If we use an iterative linear solver for the %Newton system, then
this is called an <b>inexact %Newton method</b>. The tolerance used
to terminate the linear solve is called the <b>forcing term</b>.
The forcing term may be constant, or it may be <b>adjustable</b>.
In either case, at iteration \f$k\f$ we require,
\f[
\frac{\|J_k d_k - (-F_k)\|}{\|F_k\|} \leq \eta_k.
\f]
Here \f$\eta_k\f$ is the forcing term for iteration \f$k\f$.
\note This solution tolerance is to be enforced by the user's
implementation of NOX::Abstract::Group::computeNewton; it is passed
in as the "Tolerance" in the parameter list for that function.
Adjustable forcing terms were introduced by Eisenstat and Walker
(1982); here they are implemented as described in Pernice and Walker
(1998). We have two choices for adjustable forcing terms:
<ul>
<li><b>Type 1</b>
\f[
\eta_k = \left\vert \frac{\| F_k \| - \|J_{k-1} d_{k-1} - (-F_{k-1}) \| }
{\|F_{k-1}\|} \right\vert
\f]
With the following safeguards imposed:
\f[
\max\{\eta_{k-1}^{\frac{1 + \sqrt{5}}{2}}, \eta_{\min} \} \leq \eta_k \leq \eta_{\max}
\f]
<li><b>Type 2</b>
\f[
\eta_k = \gamma \left( \frac{\|F_k\|}{\|F_{k-1}\|} \right)^\alpha
\f]
With the following safeguards imposed:
\f[
\max\{\gamma \eta_{k-1}^{\alpha}, \eta_{\min} \} \leq \eta_k \leq \eta_{\max}
\f]
</ul>
<B>Parameters</B>
"Direction":
<ul>
<li> "Method" = "Newton" [required]
</ul>
"Direction"/"Newton":
<ul>
<li>"Forcing Term Method" - Method to compute the forcing term, i.e.,
the tolerance for the linear solver. Choices are:
<ul>
<li>"Constant" [default]
<li>"Type 1"
<li>"Type 2"
</ul>
<li>"Forcing Term Initial Tolerance" - \f$\eta_0\f$ (initial linear
solver tolerance). Defaults to 0.1.
<li>"Forcing Term Minimum Tolerance" - \f$\eta_{\min}\f$. Defaults to 1.0e-6.
<li>"Forcing Term Maximum Tolerance" - \f$\eta_{\max}\f$. Defaults to 0.01.
<li>"Forcing Term Alpha" - \f$\alpha\f$ (used only by "Type 2"). Defaults to 1.5.
<li>"Forcing Term Gamma" - \f$\gamma\f$ (used only by "Type 2"). Defaults to 0.9.
<li>"Rescue Bad %Newton Solve" (Boolean) - If set to true, we will use
the computed direction even if the linear solve does not achieve the
tolerance specified by the forcing term. Defaults to true.
</ul>
"Direction"/"Newton"/"Linear Solver":
<ul>
<li> "Tolerance" - Tolerance for the linear solve. This may be
adjusted automatically by the forcing calculation. Defaults to
1.0e-10. <em>Will be adjusted automatically by NOX if the "Forcing
Term Method" is "Type 1" or "Type 2".</em>
</ul>
\note
When using a forcing term, it's critically important the the residual
of the original system is used in the comparison. This can be an issue
if scaling or left preconditioning is applied to the linear system.
<b>References</b>
<ul>
<li>Michael Pernice and Homer F. Walker, <em>NITSOL: A %Newton Iterative
%Solver for Nonlinear Systems</em>, SISC 19(Jan 1998):302-318.
<li> S. C. Eisenstat and H. F. Walker, <em>Globally convergent inexact
%Newton methods</em>, SINUM 19(1982):400-408
</ul>
*/
class Newton : public Generic {
public:
//! Constructor
Newton(const Teuchos::RCP<NOX::GlobalData>& gd,
Teuchos::ParameterList& params);
//! Destructor
virtual ~Newton();
// derived
virtual bool reset(const Teuchos::RCP<NOX::GlobalData>& gd,
Teuchos::ParameterList& params);
// derived
virtual bool compute(NOX::Abstract::Vector& dir, NOX::Abstract::Group& grp,
const NOX::Solver::Generic& solver);
// derived
virtual bool compute(NOX::Abstract::Vector& dir, NOX::Abstract::Group& grp,
const NOX::Solver::LineSearchBased& solver);
protected:
//! Called each iteration to reset the forcing term (ie, the
//! convergence tolerance for the linear solver).
virtual bool resetForcingTerm(const NOX::Abstract::Group& soln,
const NOX::Abstract::Group& oldSoln,
int niter,
const NOX::Solver::Generic& solver);
private:
//! Print an error message
void throwError(const std::string& functionName, const std::string& errorMsg);
private:
//! Global data pointer. Keep this so the parameter list remains valid.
Teuchos::RCP<NOX::GlobalData> globalDataPtr;
//! Printing Utilities
Teuchos::RCP<NOX::Utils> utils;
//! "Direction" sublist with parameters for the direction vector
/*!
\note This is pointer rather than a reference to allow for the
reset function.
*/
Teuchos::ParameterList* paramsPtr;
//! Determined based on "Rescue Bad %Newton Solve".
bool doRescue;
//! Vector containing the predicted RHS
Teuchos::RCP<NOX::Abstract::Vector> predRhs;
//! Vector containing the computed direction
Teuchos::RCP<NOX::Abstract::Vector> stepDir;
//! Flag used to determine if adjustable forcing term is being used.
bool useAdjustableForcingTerm;
//! Current linear solve tolerance.
double eta_k;
//! Minimum linear solve tolerance.
double eta_min;
//! Maximum linear solve tolerance.
double eta_max;
//! Initial linear solve tolerance.
double eta_initial;
//! Name of the method used for calculating the inexact forcing term.
std::string method;
//! Parameter used for Type 2 forcing term calculation.
double alpha;
//! Parameter used for Type 2 forcing term calculation.
double gamma;
};
} // namespace Direction
} // namespace NOX
#endif
|