MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / search

Method search

SRC/analysis/algorithm/equiSolnAlgo/RegulaFalsiLineSearch.cpp:68–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68int
69RegulaFalsiLineSearch::search(double s0,
70 double s1,
71 LinearSOE &theSOE,
72 IncrementalIntegrator &theIntegrator)
73{
74 double r0 = 0.0;
75
76 if ( s0 != 0.0 )
77 r0 = fabs( s1 / s0 );
78
79 if (r0 <= tolerance )
80 return 0; // Line Search Not Required Residual Decrease Less Than Tolerance
81
82 if (s1 == s0)
83 return 0; // RegulaFalsi will have a divide-by-zero error if continue
84
85 // set some variables
86 double eta = 1.0;
87 double s = s1;
88 double etaU = 1.0;
89 double etaL = 0.0;
90 double sU = s1;
91 double sL = s0;
92 double r = r0;
93 double etaJ = 1.0;
94 double compoundFactor = 0.0;
95
96 const Vector &dU = theSOE.getX();
97
98 if (printFlag == 0) {
99 opserr << "RegulaFalsi Line Search - initial: "
100 << " eta(0) : " << eta << " , Ratio |s/s0| = " << r0 << endln;
101 }
102
103 // we first search for a bracket to a solution, i.e. we want sU * sL < 0.0
104 int count = 0;
105 while ((sU * sL > 0.0) && (etaU < maxEta)) {
106
107 count++;
108
109 /*
110 if (count == 1)
111 etaU = 0.5;
112 else
113 */
114 etaU = etaJ * 4.0;
115
116 //update the incremental difference in response and determine new unbalance
117 *x = dU;
118 double factor = etaU - etaJ;
119 compoundFactor += factor;
120 *x *= factor;
121
122 etaJ = etaU;
123
124 if (theIntegrator.update(*x) < 0) {
125 opserr << "WARNING BisectionLineSearch::search() -";

Callers

nothing calls this directly

Calls 5

getBMethod · 0.80
getXMethod · 0.45
updateMethod · 0.45
formUnbalanceMethod · 0.45
setXMethod · 0.45

Tested by

no test coverage detected