@@ -158,6 +158,8 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException,
158
158
}
159
159
iterations = 0 ;
160
160
fNorm = 1.0e10 ;
161
+ boolean acceleration = true ;
162
+ double olderror = 1.0e10 ;
161
163
162
164
do {
163
165
iterations ++;
@@ -191,7 +193,8 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException,
191
193
break ;
192
194
}
193
195
}
194
- if (iterations % 7 == 0 && fNorm < fNormOld && !secondOrderStabilityAnalysis ) {
196
+ if (iterations % 7 == 0 && fNorm < fNormOld && !secondOrderStabilityAnalysis
197
+ && acceleration ) {
195
198
double vec1 = 0.0 ;
196
199
197
200
double vec2 = 0.0 ;
@@ -211,6 +214,9 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException,
211
214
error [j ] += Math .abs ((logWi [i ] - oldlogw [i ]) / oldlogw [i ]);
212
215
Wi [j ][i ] = Math .exp (logWi [i ]);
213
216
}
217
+ if (error [j ] > olderror ) {
218
+ acceleration = false ;
219
+ }
214
220
} else {
215
221
// succsessive substitution
216
222
for (int i = 0 ; i < clonedSystem .getPhases ()[0 ].getNumberOfComponents (); i ++) {
@@ -268,14 +274,15 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException,
268
274
// logger.info("fnorm " + f.norm1() + " err " + error[j] + " iterations " +
269
275
// iterations
270
276
// + " phase " + j);
271
- } while ((f .norm1 () > 1e-6 && error [j ] > 1e-9 && iterations < maxiterations )
277
+ // logger.info("error " + error[j]);
278
+ olderror = error [j ];
279
+ } while ((f .norm1 () > 1e-3 && error [j ] > 1e-3 && iterations < maxiterations )
272
280
|| (iterations % 7 ) == 0 || iterations < 3 );
273
281
// (error[j]<oldErr && oldErr<oldOldErr) &&
274
282
// logger.info("err " + error[j]);
275
283
// logger.info("iterations " + iterations);
276
284
// logger.info("f.norm1() " + f.norm1());
277
285
if (iterations >= maxiterations ) {
278
- logger .error ("err staability check " + error [j ]);
279
286
throw new neqsim .util .exception .TooManyIterationsException ("too many iterations" , null ,
280
287
maxiterations );
281
288
}
0 commit comments