OOFEM 3.0
Loading...
Searching...
No Matches
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 - 2025 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"
44#include "sparsemtrx.h"
45#include "floatarray.h"
46#include "linesearch.h"
47#include "convergedreason.h"
48
49#include <memory>
50#include <map>
51
53
54#define _IFT_NRSolver_Name "nrsolver"
55#define _IFT_NRSolver_maxiter "maxiter"
56#define _IFT_NRSolver_miniterations "miniter"
57#define _IFT_NRSolver_minsteplength "minsteplength"
58#define _IFT_NRSolver_manrmsteps "manrmsteps"
59#define _IFT_NRSolver_lstype "lstype"
60#define _IFT_NRSolver_ddm "ddm"
61#define _IFT_NRSolver_ddv "ddv"
62#define _IFT_NRSolver_ddfunc "ddltf"
63#define _IFT_NRSolver_linesearch "linesearch"
64#define _IFT_NRSolver_rtolv "rtolv"
65#define _IFT_NRSolver_rtolf "rtolf"
66#define _IFT_NRSolver_rtold "rtold"
67#define _IFT_NRSolver_calcstiffbeforeres "calcstiffbeforeres"
68#define _IFT_NRSolver_constrainedNRalpha "constrainednralpha"
69#define _IFT_NRSolver_constrainedNRminiter "constrainednrminiter"
70#define _IFT_NRSolver_maxinc "maxinc"
71#define _IFT_NRSolver_forceScale "forcescale"
72#define _IFT_NRSolver_forceScaleDofs "forcescaledofs"
73#define _IFT_NRSolver_solutionDependentExternalForces "soldepextforces"
75
76namespace oofem {
77class Domain;
78class EngngModel;
79
98{
99protected:
101
107
109 std :: unique_ptr< SparseLinearSystemNM >linSolver;
113 SparseMtrx :: SparseMtrxVersionType smConstraintVersion;
123
137 bool lsFlag;
139 std :: unique_ptr< LineSearchNM >linesearchSolver;
148
153
157
160
161
162
164 std :: map< int, double >dg_forceScale;
165
167public:
169 virtual ~NRSolver();
170
171 // Overloaded methods:
173 FloatArray &X, FloatArray &dX, FloatArray &F,
174 const FloatArray &internalForcesEBENorm, double &l, referenceLoadInputModeType rlm,
175 int &nite, TimeStep *) override;
176 void printState(FILE *outputStream) override;
177
178 void initializeFrom(InputRecord &ir) override;
179 const char *giveClassName() const override { return "NRSolver"; }
180 virtual const char *giveInputRecordName() const { return _IFT_NRSolver_Name; }
181
182 void setDomain(Domain *d) override {
183 this->domain = d;
184 if ( linSolver ) {
185 linSolver->setDomain(d);
186 }
187 if ( linesearchSolver ) {
188 linesearchSolver->setDomain(d);
189 }
190 }
191 void reinitialize() override {
192 if ( linSolver ) {
193 linSolver->reinitialize();
194 }
195 }
196
197 SparseLinearSystemNM *giveLinearSolver() override;
198
199protected:
201 LineSearchNM *giveLineSearchSolver();
202
204 void initPrescribedEqs();
205 void applyConstraintsToStiffness(SparseMtrx &k);
206 void applyConstraintsToLoadIncrement(int nite, const SparseMtrx &k, FloatArray &R,
207 referenceLoadInputModeType rlm, TimeStep *tStep);
208
213 bool checkConvergence(FloatArray &RT, FloatArray &F, FloatArray &rhs, FloatArray &ddX, FloatArray &X,
214 double RRT, const FloatArray &internalForcesEBENorm, int nite, bool &errorOutOfRange);
215};
216} // end namespace oofem
217#endif // nrsolver_h
NRSolver(Domain *d, EngngModel *m)
FloatArray lastReactions
Computed reactions. They are stored in order to print them in printState method.
Definition nrsolver.h:135
double minStepLength
Definition nrsolver.h:103
int constrainedNRminiter
Minimum number of iterations before constraint is activated.
Definition nrsolver.h:147
FloatArray prescribedDofsValues
Array of prescribed values.
Definition nrsolver.h:127
double maxIncAllowed
Definition nrsolver.h:166
SparseMtrx::SparseMtrxVersionType smConstraintVersion
sparse matrix version, used to control constrains application to stiffness
Definition nrsolver.h:113
std ::unique_ptr< LineSearchNM > linesearchSolver
Line search solver.
Definition nrsolver.h:139
void reinitialize() override
Definition nrsolver.h:191
LinSystSolverType solverType
linear system solver ID
Definition nrsolver.h:111
int prescribedDisplacementTF
Load Time Function of prescribed values.
Definition nrsolver.h:129
std ::unique_ptr< SparseLinearSystemNM > linSolver
linear system solver
Definition nrsolver.h:109
const char * giveClassName() const override
Definition nrsolver.h:179
virtual const char * giveInputRecordName() const
Definition nrsolver.h:180
ConvergedReason solve(SparseMtrx &k, FloatArray &R, FloatArray *R0, FloatArray &X, FloatArray &dX, FloatArray &F, const FloatArray &internalForcesEBENorm, double &l, referenceLoadInputModeType rlm, int &nite, TimeStep *) override
Definition nrsolver.C:205
double constrainedNRalpha
Scale factor for dX, dX_new = alpha * dX.
Definition nrsolver.h:145
void setDomain(Domain *d) override
Definition nrsolver.h:182
IntArray prescribedDofs
Array of pairs identifying prescribed dofs (node, dof).
Definition nrsolver.h:125
int numberOfPrescribedDofs
number of prescribed displacement
Definition nrsolver.h:115
bool prescribedDofsFlag
Definition nrsolver.h:122
IntArray prescribedEqs
Array of prescribed equations.
Definition nrsolver.h:131
FloatArray rtold
Relative iterative displacement change tolerance for each group.
Definition nrsolver.h:152
nrsolver_ModeType NR_OldMode
Definition nrsolver.h:104
bool solutionDependentExternalForcesFlag
Solution dependent external forces - updating then each NR iteration.
Definition nrsolver.h:159
std ::map< int, double > dg_forceScale
Optional user supplied scale of forces used in convergence check.
Definition nrsolver.h:164
bool prescribedEqsInitFlag
Flag indicating that prescribedEqs were initialized.
Definition nrsolver.h:133
FloatArray rtolf
Relative unbalanced force tolerance for each group.
Definition nrsolver.h:150
FloatArray forceErrVec
Definition nrsolver.h:155
bool lsFlag
Flag indicating whether to use line-search.
Definition nrsolver.h:137
void initializeFrom(InputRecord &ir) override
Definition nrsolver.C:103
bool mCalcStiffBeforeRes
Flag indicating if the stiffness should be evaluated before the residual in the first iteration.
Definition nrsolver.h:141
nrsolver_ModeType NR_Mode
Definition nrsolver.h:104
FloatArray forceErrVecOld
Definition nrsolver.h:156
void printState(FILE *outputStream) override
Definition nrsolver.C:572
bool constrainedNRFlag
Flag indicating whether to use constrained Newton.
Definition nrsolver.h:143
Domain * domain
Pointer to domain.
Definition nummet.h:84
SparseNonLinearSystemNM(Domain *d, EngngModel *m)
Constructor.
#define _IFT_NRSolver_Name
Definition nrsolver.h:54
#define OOFEM_EXPORT
Definition oofemcfg.h:7

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011