OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
nrsolver.h
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
35 
36 #ifndef nrsolver_h
37 #define nrsolver_h
38 
39 #include <set>
40 #include <vector>
41 
42 #include "sparselinsystemnm.h"
43 #include "sparsenonlinsystemnm.h"
44 #include "sparsemtrx.h"
45 #include "floatarray.h"
46 #include "linesearch.h"
47 
48 #include <memory>
49 #include <map>
50 
52 
53 #define _IFT_NRSolver_Name "nrsolver"
54 #define _IFT_NRSolver_maxiter "maxiter"
55 #define _IFT_NRSolver_miniterations "miniter"
56 #define _IFT_NRSolver_minsteplength "minsteplength"
57 #define _IFT_NRSolver_manrmsteps "manrmsteps"
58 #define _IFT_NRSolver_lstype "lstype"
59 #define _IFT_NRSolver_ddm "ddm"
60 #define _IFT_NRSolver_ddv "ddv"
61 #define _IFT_NRSolver_ddfunc "ddltf"
62 #define _IFT_NRSolver_linesearch "linesearch"
63 #define _IFT_NRSolver_rtolv "rtolv"
64 #define _IFT_NRSolver_rtolf "rtolf"
65 #define _IFT_NRSolver_rtold "rtold"
66 #define _IFT_NRSolver_calcstiffbeforeres "calcstiffbeforeres"
67 #define _IFT_NRSolver_constrainedNRalpha "constrainednralpha"
68 #define _IFT_NRSolver_constrainedNRminiter "constrainednrminiter"
69 #define _IFT_NRSolver_maxinc "maxinc"
70 #define _IFT_NRSolver_forceScale "forcescale"
71 #define _IFT_NRSolver_forceScaleDofs "forcescaledofs"
72 
73 
74 namespace oofem {
75 class Domain;
76 class EngngModel;
77 
95 class OOFEM_EXPORT NRSolver : public SparseNonLinearSystemNM
96 {
97 protected:
98  enum nrsolver_ModeType { nrsolverModifiedNRM, nrsolverFullNRM, nrsolverAccelNRM };
99 
100  int nsmax, minIterations;
105 
107  std :: unique_ptr< SparseLinearSystemNM > linSolver;
121 
135  bool lsFlag;
137  std :: unique_ptr< LineSearchNM > linesearchSolver;
146 
151 
155 
157  std :: map<int, double> dg_forceScale;
158 
160 public:
161  NRSolver(Domain * d, EngngModel * m);
162  virtual ~NRSolver();
163 
164  // Overloaded methods:
165  virtual NM_Status solve(SparseMtrx &k, FloatArray &R, FloatArray *R0,
166  FloatArray &X, FloatArray &dX, FloatArray &F,
167  const FloatArray &internalForcesEBENorm, double &l, referenceLoadInputModeType rlm,
168  int &nite, TimeStep *);
169  virtual void printState(FILE *outputStream);
170 
171  virtual IRResultType initializeFrom(InputRecord *ir);
172  virtual const char *giveClassName() const { return "NRSolver"; }
173  virtual const char *giveInputRecordName() const { return _IFT_NRSolver_Name; }
174 
175  virtual void setDomain(Domain *d) {
176  this->domain = d;
177  if ( linSolver ) {
178  linSolver->setDomain(d);
179  }
180  if ( linesearchSolver ) {
181  linesearchSolver->setDomain(d);
182  }
183  }
184  virtual void reinitialize() {
185  if ( linSolver ) {
186  linSolver->reinitialize();
187  }
188  }
189 
190  virtual SparseLinearSystemNM *giveLinearSolver();
191 
192 protected:
194  LineSearchNM *giveLineSearchSolver();
195 
197  void initPrescribedEqs();
198  void applyConstraintsToStiffness(SparseMtrx &k);
199  void applyConstraintsToLoadIncrement(int nite, const SparseMtrx &k, FloatArray &R,
201 
206  bool checkConvergence(FloatArray &RT, FloatArray &F, FloatArray &rhs, FloatArray &ddX, FloatArray &X,
207  double RRT, const FloatArray &internalForcesEBENorm, int nite, bool &errorOutOfRange);
208 };
209 } // end namespace oofem
210 #endif // nrsolver_h
LinSystSolverType
The values of this type should be related not to specific solvers, but more to specific packages that...
Class and object Domain.
Definition: domain.h:115
double constrainedNRalpha
Scale factor for dX, dX_new = alpha * dX.
Definition: nrsolver.h:143
Base class for all matrices stored in sparse format.
Definition: sparsemtrx.h:60
int numberOfPrescribedDofs
number of prescribed displacement
Definition: nrsolver.h:113
This class implements Newton-Raphson Method, derived from abstract NumericalMethod class for solving ...
Definition: nrsolver.h:95
IntArray prescribedDofs
Array of pairs identifying prescribed dofs (node, dof)
Definition: nrsolver.h:123
This base class is an abstraction for all numerical methods solving sparse linear system of equations...
virtual const char * giveClassName() const
Definition: nrsolver.h:172
virtual void setDomain(Domain *d)
Definition: nrsolver.h:175
FloatArray rtold
Relative iterative displacement change tolerance for each group.
Definition: nrsolver.h:150
bool lsFlag
Flag indicating whether to use line-search.
Definition: nrsolver.h:135
std::unique_ptr< LineSearchNM > linesearchSolver
Line search solver.
Definition: nrsolver.h:137
std::unique_ptr< SparseLinearSystemNM > linSolver
linear system solver
Definition: nrsolver.h:107
unsigned long NM_Status
Mask defining NumMetod Status; which can be asked after finishing computation by Numerical Method...
Definition: nmstatus.h:44
Class implementing an array of integers.
Definition: intarray.h:61
std::map< int, double > dg_forceScale
Optional user supplied scale of forces used in convergence check.
Definition: nrsolver.h:157
LinSystSolverType solverType
linear system solver ID
Definition: nrsolver.h:109
int constrainedNRminiter
Minimum number of iterations before constraint is activated.
Definition: nrsolver.h:145
double minStepLength
Definition: nrsolver.h:101
long SparseMtrxVersionType
Definition: sparsemtrx.h:63
FloatArray rtolf
Relative unbalanced force tolerance for each group.
Definition: nrsolver.h:148
referenceLoadInputModeType
The following parameter allows to specify how the reference load vector is obtained from given totalL...
#define _IFT_NRSolver_Name
Definition: nrsolver.h:53
FloatArray forceErrVecOld
Definition: nrsolver.h:154
Class representing vector of real numbers.
Definition: floatarray.h:82
bool mCalcStiffBeforeRes
Flag indicating if the stiffness should be evaluated before the residual in the first iteration...
Definition: nrsolver.h:139
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
bool constrainedNRFlag
Flag indicating whether to use constrained Newton.
Definition: nrsolver.h:141
Class representing the general Input Record.
Definition: inputrecord.h:101
FloatArray forceErrVec
Definition: nrsolver.h:153
IntArray prescribedEqs
Array of prescribed equations.
Definition: nrsolver.h:129
nrsolver_ModeType NR_OldMode
Definition: nrsolver.h:102
bool prescribedDofsFlag
Flag indicating that some dofs are controlled under displacement control.
Definition: nrsolver.h:120
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
virtual void reinitialize()
Reinitializes the receiver.
Definition: nrsolver.h:184
SparseMtrx::SparseMtrxVersionType smConstraintVersion
sparse matrix version, used to control constrains application to stiffness
Definition: nrsolver.h:111
the oofem namespace is to define a context or scope in which all oofem names are defined.
FloatArray lastReactions
Computed reactions. They are stored in order to print them in printState method.
Definition: nrsolver.h:133
int prescribedDisplacementTF
Load Time Function of prescribed values.
Definition: nrsolver.h:127
bool prescribedEqsInitFlag
Flag indicating that prescribedEqs were initialized.
Definition: nrsolver.h:131
double maxIncAllowed
Definition: nrsolver.h:159
Class representing solution step.
Definition: timestep.h:80
This base class is an abstraction for all numerical methods solving sparse nonlinear system of equati...
virtual const char * giveInputRecordName() const
Definition: nrsolver.h:173
FloatArray prescribedDofsValues
Array of prescribed values.
Definition: nrsolver.h:125
This base class is an abstraction/implementation for numerical method solving line search optimizatio...
Definition: linesearch.h:60

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011