OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
calmls.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 #ifndef calmls_h
36 #define calmls_h
37 
38 #include <set>
39 #include <vector>
40 #include <memory>
41 
42 #include "sparselinsystemnm.h"
43 #include "sparsenonlinsystemnm.h"
44 #include "floatarray.h"
45 #include "intarray.h"
46 #include "dofiditem.h"
47 
49 
50 #define _IFT_CylindricalALM_Name "calm"
51 #define _IFT_CylindricalALM_psi "psi"
52 #define _IFT_CylindricalALM_maxiter "maxiter"
53 #define _IFT_CylindricalALM_maxrestarts "maxrestarts"
54 #define _IFT_CylindricalALM_minsteplength "minsteplength"
55 #define _IFT_CylindricalALM_steplength "steplength"
56 #define _IFT_CylindricalALM_initialsteplength "initialsteplength"
57 #define _IFT_CylindricalALM_forcedinitialsteplength "forcedinitialsteplength"
58 #define _IFT_CylindricalALM_reqiterations "reqiterations"
59 #define _IFT_CylindricalALM_miniterations "miniter"
60 #define _IFT_CylindricalALM_manrmsteps "manrmsteps"
61 #define _IFT_CylindricalALM_hpcmode "hpcmode"
62 #define _IFT_CylindricalALM_hpc "hpc"
63 #define _IFT_CylindricalALM_hpcw "hpcw"
64 #define _IFT_CylindricalALM_lstype "lstype"
65 #define _IFT_CylindricalALM_linesearch "linesearch"
66 #define _IFT_CylindricalALM_lsearchtol "lsearchtol"
67 #define _IFT_CylindricalALM_lsearchamp "lsearchamp"
68 #define _IFT_CylindricalALM_lsearchmaxeta "lsearchmaxeta"
69 #define _IFT_CylindricalALM_nccdg "nccdg"
70 #define _IFT_CylindricalALM_ccdg "ccdg"
71 #define _IFT_CylindricalALM_rtolv "rtolv"
72 #define _IFT_CylindricalALM_rtolf "rtolf"
73 #define _IFT_CylindricalALM_rtold "rtold"
74 
75 
76 
77 namespace oofem {
78 class Domain;
79 class EngngModel;
80 class ParallelContext;
81 
82 #define calm_SMALL_NUM 1.e-20
83 #define calm_SMALL_ERROR_NUM 1.e-6
84 
144 class OOFEM_EXPORT CylindricalALM : public SparseNonLinearSystemNM
145 {
146 protected:
149  calm_hpc_off = 0,
152  };
153 
159  };
160 
161  typedef std :: set< DofIDItem > __DofIDSet;
162 
163  int nsmax;
165  double Psi;
166  double deltaL, minStepLength, maxStepLength;
167  int solved, numberOfRequiredIterations;
171 
174 
185 
187  std :: unique_ptr< SparseLinearSystemNM > linSolver;
190 
192  int lsFlag;
194  double ls_tolerance;
196  double amplifFactor;
198  double maxEta, minEta;
199 
200  // Support for evaluation of error norms for user defined dof-groups.
202  int nccdg;
204  std :: vector< __DofIDSet >ccDofGroups;
211 
212 public:
213  CylindricalALM(Domain * d, EngngModel * m);
214  virtual ~CylindricalALM();
215 
216  // Overloaded methods:
217  virtual NM_Status solve(SparseMtrx &K, FloatArray &R, FloatArray *R0,
218  FloatArray &X, FloatArray &dX, FloatArray &F,
219  const FloatArray &internalForcesEBENorm, double &ReachedLambda, referenceLoadInputModeType rlm,
220  int &nite, TimeStep *);
221  virtual double giveCurrentStepLength() { return deltaL; }
222  virtual void setStepLength(double s) { deltaL = s; }
223  virtual IRResultType initializeFrom(InputRecord *ir);
224  virtual bool referenceLoad() const { return true; }
225  virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj = NULL);
226  virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj = NULL);
227  virtual void setDomain(Domain *d) {
228  this->domain = d;
229  if ( linSolver ) {
230  linSolver->setDomain(d);
231  }
232  }
233  virtual void reinitialize() {
234  calm_hpc_init = 1;
235  if ( linSolver ) {
236  linSolver->reinitialize();
237  }
238  }
239  virtual const char *giveClassName() const { return "CylindricalALM"; }
240  virtual const char *giveInputRecordName() const { return _IFT_CylindricalALM_Name; }
241 
242  virtual SparseLinearSystemNM *giveLinearSolver();
243 
244 protected:
245  void convertHPCMap();
246 
250  int computeDeltaLambda(double &deltaLambda, const FloatArray &dX, const FloatArray &deltaXt,
251  const FloatArray &deltaX_, const FloatArray &R, double RR, double eta,
252  double deltaL, double DeltaLambda0, int neq);
253 
254  void search(int istep, FloatArray &prod, FloatArray &eta, double amp,
255  double maxeta, double mineta, int &status);
256 
258  bool checkConvergence(const FloatArray &R, const FloatArray *R0, const FloatArray &F,
259  const FloatArray &X, const FloatArray &ddX,
260  double Lambda, double RR0, double RR, double drProduct,
261  const FloatArray &internalForcesEBENorm, int nite, bool &errorOutOfRange);
262 
264  void do_lineSearch(FloatArray &X, const FloatArray &XInitial, const FloatArray &deltaX_, const FloatArray &deltaXt,
265  const FloatArray &dXm1, FloatArray &dX, FloatArray &ddX,
266  const FloatArray &R, const FloatArray *R0, const FloatArray &F,
267  double &DeltaLambda, double &DeltaLambdam1, double &deltaLambda,
268  double &Lambda, double &ReachedLambda, double RR, double &drProduct, TimeStep *tStep);
269 };
270 } // end namespace oofem
271 #endif // calmls_h
LinSystSolverType
The values of this type should be related not to specific solvers, but more to specific packages that...
int nccdg
Number of convergence criteria dof groups.
Definition: calmls.h:202
Class and object Domain.
Definition: domain.h:115
virtual bool referenceLoad() const
Returns true if reference loads are used (i.e.
Definition: calmls.h:224
virtual void setDomain(Domain *d)
Definition: calmls.h:227
Base class for all matrices stored in sparse format.
Definition: sparsemtrx.h:60
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
Definition: datastream.h:54
virtual const char * giveClassName() const
Definition: calmls.h:239
virtual void setStepLength(double s)
Sets the step length.
Definition: calmls.h:222
FloatArray rtolf
Relative unbalanced force tolerance for each group.
Definition: calmls.h:206
This base class is an abstraction for all numerical methods solving sparse linear system of equations...
double minStepLength
Definition: calmls.h:166
Linearized ALM (only displacements), taking into account only selected dofs with given weight...
Definition: calmls.h:151
FloatArray calm_HPCWeights
Definition: calmls.h:178
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
calm_ControlType calm_Control
Definition: calmls.h:177
int lsFlag
Line search flag.
Definition: calmls.h:192
double amplifFactor
Line search amplification factor.
Definition: calmls.h:196
Keeps the old tangent.
Definition: calmls.h:156
std::vector< __DofIDSet > ccDofGroups
Convergence criteria dof groups.
Definition: calmls.h:204
Implementation of sparse nonlinear solver with indirect control.
Definition: calmls.h:144
FloatArray rtold
Relative iterative displacement change tolerance for each group.
Definition: calmls.h:208
calm_NR_ModeType calm_NR_OldMode
Definition: calmls.h:168
virtual const char * giveInputRecordName() const
Definition: calmls.h:240
referenceLoadInputModeType
The following parameter allows to specify how the reference load vector is obtained from given totalL...
std::unique_ptr< SparseLinearSystemNM > linSolver
Linear system solver.
Definition: calmls.h:187
virtual double giveCurrentStepLength()
Returns step length.
Definition: calmls.h:221
FloatArray calm_HPCDmanWeightSrcArray
Input array of dofman weights (for hpcmode 2).
Definition: calmls.h:184
int minIterations
Minimum hard number of iteration.s.
Definition: calmls.h:173
#define _IFT_CylindricalALM_Name
Definition: calmls.h:50
Class representing vector of real numbers.
Definition: floatarray.h:82
Full ALM with quadratic constrain, taking into account only selected dofs.
Definition: calmls.h:150
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
Class representing the general Input Record.
Definition: inputrecord.h:101
This class provides an communication context for distributed memory parallelism.
ParallelContext * parallel_context
Parallel context for computing norms, dot products and such.
Definition: calmls.h:210
calm_NR_ModeType
Controlling mode of Newton-Raphson Method.
Definition: calmls.h:155
IntArray calm_HPCIndirectDofMask
Array containing equation numbers of dofs under indirect control.
Definition: calmls.h:180
Updates the tangent every iteration.
Definition: calmls.h:157
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Definition: contextmode.h:43
IntArray calm_HPCDmanDofSrcArray
Input array containing dofmanagers and corresponding dof numbers under indirect control.
Definition: calmls.h:182
double ls_tolerance
Line search tolerance.
Definition: calmls.h:194
Abstract base class representing the "problem" under consideration.
Definition: engngm.h:181
Updates the tangent after a few steps.
Definition: calmls.h:158
the oofem namespace is to define a context or scope in which all oofem names are defined.
calm_ControlType
CALM mode type; determines the calm step length control.
Definition: calmls.h:148
int calm_hpc_init
Variables for HyperPlaneControl.
Definition: calmls.h:176
Class representing solution step.
Definition: timestep.h:80
LinSystSolverType solverType
linear system solver ID.
Definition: calmls.h:189
This base class is an abstraction for all numerical methods solving sparse nonlinear system of equati...
std::set< DofIDItem > __DofIDSet
Definition: calmls.h:161
virtual void reinitialize()
Reinitializes the receiver.
Definition: calmls.h:233

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:27 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011