3
3
*
4
4
* Created on 1.april 2024
5
5
*/
6
-
7
6
package neqsim .thermodynamicoperations .flashops ;
8
7
8
+ import static neqsim .thermo .ThermodynamicModelSettings .phaseFractionMinimumLimit ;
9
9
import java .io .Serializable ;
10
10
import java .util .Arrays ;
11
11
import org .apache .logging .log4j .LogManager ;
@@ -85,10 +85,9 @@ public double calcBetaMichelsen2001(double[] K, double[] z)
85
85
throws neqsim .util .exception .IsNaNException ,
86
86
neqsim .util .exception .TooManyIterationsException {
87
87
int i ;
88
- double tolerance = neqsim .thermo .ThermodynamicModelSettings .phaseFractionMinimumLimit ;
89
88
double midler = 0 ;
90
- double minBeta = tolerance ;
91
- double maxBeta = 1.0 - tolerance ;
89
+ double minBeta = phaseFractionMinimumLimit ;
90
+ double maxBeta = 1.0 - phaseFractionMinimumLimit ;
92
91
double g0 = -1.0 ;
93
92
double g1 = 1.0 ;
94
93
@@ -108,10 +107,10 @@ public double calcBetaMichelsen2001(double[] K, double[] z)
108
107
// logger.debug("Max beta " + maxBeta + " min beta " + minBeta);
109
108
110
109
if (g0 < 0 ) {
111
- return tolerance ;
110
+ return phaseFractionMinimumLimit ;
112
111
}
113
112
if (g1 > 0 ) {
114
- return 1.0 - tolerance ;
113
+ return 1.0 - phaseFractionMinimumLimit ;
115
114
}
116
115
117
116
double nybeta = (minBeta + maxBeta ) / 2.0 ;
@@ -191,10 +190,10 @@ public double calcBetaMichelsen2001(double[] K, double[] z)
191
190
}
192
191
step = gbeta / deriv ;
193
192
} while (Math .abs (step ) >= 1.0e-11 && iterations < maxIterations );
194
- if (nybeta <= tolerance ) {
195
- nybeta = tolerance ;
196
- } else if (nybeta >= 1.0 - tolerance ) {
197
- nybeta = 1.0 - tolerance ;
193
+ if (nybeta <= phaseFractionMinimumLimit ) {
194
+ nybeta = phaseFractionMinimumLimit ;
195
+ } else if (nybeta >= 1.0 - phaseFractionMinimumLimit ) {
196
+ nybeta = 1.0 - phaseFractionMinimumLimit ;
198
197
}
199
198
beta [0 ] = nybeta ;
200
199
beta [1 ] = 1.0 - nybeta ;
@@ -229,7 +228,6 @@ public double calcBetaMichelsen2001(double[] K, double[] z)
229
228
public double calcBetaNielsen2023 (double [] K , double [] z )
230
229
throws neqsim .util .exception .IsNaNException ,
231
230
neqsim .util .exception .TooManyIterationsException {
232
- double tolerance = neqsim .thermo .ThermodynamicModelSettings .phaseFractionMinimumLimit ;
233
231
double g0 = -1.0 ;
234
232
double g1 = 1.0 ;
235
233
@@ -239,10 +237,10 @@ public double calcBetaNielsen2023(double[] K, double[] z)
239
237
}
240
238
241
239
if (g0 < 0 ) {
242
- return tolerance ;
240
+ return phaseFractionMinimumLimit ;
243
241
}
244
242
if (g1 > 0 ) {
245
- return 1.0 - tolerance ;
243
+ return 1.0 - phaseFractionMinimumLimit ;
246
244
}
247
245
248
246
double V = 0.5 ;
@@ -329,10 +327,10 @@ public double calcBetaNielsen2023(double[] K, double[] z)
329
327
V = 1 - V ;
330
328
}
331
329
332
- if (V <= tolerance ) {
333
- V = tolerance ;
334
- } else if (V >= 1.0 - tolerance ) {
335
- V = 1.0 - tolerance ;
330
+ if (V <= phaseFractionMinimumLimit ) {
331
+ V = phaseFractionMinimumLimit ;
332
+ } else if (V >= 1.0 - phaseFractionMinimumLimit ) {
333
+ V = 1.0 - phaseFractionMinimumLimit ;
336
334
}
337
335
338
336
beta [0 ] = V ;
@@ -380,10 +378,9 @@ public final double calcBetaS(SystemInterface system) throws neqsim.util.excepti
380
378
ComponentInterface [] compArray = system .getPhase (0 ).getComponents ();
381
379
382
380
int i ;
383
- double tolerance = neqsim .thermo .ThermodynamicModelSettings .phaseFractionMinimumLimit ;
384
381
double midler = 0 ;
385
- double minBeta = tolerance ;
386
- double maxBeta = 1.0 - tolerance ;
382
+ double minBeta = phaseFractionMinimumLimit ;
383
+ double maxBeta = 1.0 - phaseFractionMinimumLimit ;
387
384
double g0 = -1.0 ;
388
385
double g1 = 1.0 ;
389
386
@@ -401,13 +398,13 @@ public final double calcBetaS(SystemInterface system) throws neqsim.util.excepti
401
398
}
402
399
403
400
if (g0 < 0 ) {
404
- this .beta [1 ] = 1.0 - tolerance ;
405
- this .beta [0 ] = tolerance ;
401
+ this .beta [1 ] = 1.0 - phaseFractionMinimumLimit ;
402
+ this .beta [0 ] = phaseFractionMinimumLimit ;
406
403
return this .beta [0 ];
407
404
}
408
405
if (g1 > 0 ) {
409
- this .beta [1 ] = tolerance ;
410
- this .beta [0 ] = 1.0 - tolerance ;
406
+ this .beta [1 ] = phaseFractionMinimumLimit ;
407
+ this .beta [0 ] = 1.0 - phaseFractionMinimumLimit ;
411
408
return this .beta [0 ];
412
409
}
413
410
@@ -496,12 +493,12 @@ public final double calcBetaS(SystemInterface system) throws neqsim.util.excepti
496
493
step = gbeta / deriv ;
497
494
} while (Math .abs (step ) >= 1.0e-10 && iterations < maxIterations ); // &&
498
495
499
- if (nybeta <= tolerance ) {
496
+ if (nybeta <= phaseFractionMinimumLimit ) {
500
497
// this.phase = 1;
501
- nybeta = tolerance ;
502
- } else if (nybeta >= 1.0 - tolerance ) {
498
+ nybeta = phaseFractionMinimumLimit ;
499
+ } else if (nybeta >= 1.0 - phaseFractionMinimumLimit ) {
503
500
// this.phase = 0;
504
- nybeta = 1.0 - tolerance ;
501
+ nybeta = 1.0 - phaseFractionMinimumLimit ;
505
502
// superheated vapour
506
503
} else {
507
504
// this.phase = 2;
0 commit comments