Skip to content

Commit b46223f

Browse files
committed
refact: simplify EOS subclass constructor
1 parent 720ebe4 commit b46223f

28 files changed

+30
-106
lines changed

src/main/java/neqsim/thermo/component/ComponentInterface.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1835,7 +1835,7 @@ public default double getLogFugacityCoefficient() {
18351835
* Setter for field <code>solidCheck</code>.
18361836
* </p>
18371837
*
1838-
* @param checkForSolids Set true to check for solid phase and do solid phase calculations.
1838+
* @param checkForSolids Set true to do solid phase check and calculations
18391839
*/
18401840
public void setSolidCheck(boolean checkForSolids);
18411841

src/main/java/neqsim/thermo/system/SystemBWRSEos.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public SystemBWRSEos(double T, double P) {
4646
* @param checkForSolids Set true to do solid phase check and calculations
4747
*/
4848
public SystemBWRSEos(double T, double P, boolean checkForSolids) {
49-
super(T, P);
50-
this.solidPhaseCheck = checkForSolids;;
49+
super(T, P, checkForSolids);
5150
modelName = "BWRS-EOS";
5251
attractiveTermNumber = 0;
5352

@@ -83,11 +82,6 @@ public SystemBWRSEos clone() {
8382
logger.error("Cloning failed.", ex);
8483
}
8584

86-
// clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
87-
// for(int i = 0; i < numberOfPhases; i++) {
88-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
89-
// }
90-
9185
return clonedSystem;
9286
}
9387
}

src/main/java/neqsim/thermo/system/SystemDesmukhMather.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public SystemDesmukhMather(double T, double P) {
4444
* @param checkForSolids Set true to do solid phase check and calculations
4545
*/
4646
public SystemDesmukhMather(double T, double P, boolean checkForSolids) {
47-
super(T, P);
48-
this.solidPhaseCheck = checkForSolids;;
47+
super(T, P, checkForSolids);
4948
attractiveTermNumber = 0;
5049
modelName = "Desmukh-Mather-model";
5150

src/main/java/neqsim/thermo/system/SystemDuanSun.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public SystemDuanSun(double T, double P) {
4848
* @param checkForSolids Set true to do solid phase check and calculations
4949
*/
5050
public SystemDuanSun(double T, double P, boolean checkForSolids) {
51-
super(T, P);
52-
this.solidPhaseCheck = checkForSolids;;
51+
super(T, P, checkForSolids);
5352
attractiveTermNumber = 0;
5453
modelName = "Duan-Sun-model";
5554

src/main/java/neqsim/thermo/system/SystemElectrolyteCPA.java

-4
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ public SystemElectrolyteCPA clone() {
5252
logger.error("Cloning failed.", ex);
5353
}
5454

55-
// for(int i = 0; i < numberOfPhases; i++) {
56-
// clonedSystem.phaseArray[i] =(PhaseElectrolyteCPA) phaseArray[i].clone();
57-
// }
58-
5955
return clonedSystem;
6056
}
6157
}

src/main/java/neqsim/thermo/system/SystemElectrolyteCPAstatoil.java

-4
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ public SystemElectrolyteCPAstatoil clone() {
5252
logger.error("Cloning failed.", ex);
5353
}
5454

55-
// for(int i = 0; i < numberOfPhases; i++) {
56-
// clonedSystem.phaseArray[i] =(PhaseElectrolyteCPA) phaseArray[i].clone();
57-
// }
58-
5955
return clonedSystem;
6056
}
6157
}

src/main/java/neqsim/thermo/system/SystemEos.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package neqsim.thermo.system;
22

33
/**
4+
* Base class for system with EOS.
45
*
56
* @author Even Solbraa
67
*/
@@ -23,13 +24,9 @@ public SystemEos() {
2324
*
2425
* @param T The temperature in unit Kelvin
2526
* @param P The pressure in unit bara (absolute pressure)
27+
* @param checkForSolids Set true to do solid phase check and calculations
2628
*/
27-
public SystemEos(double T, double P) {
28-
this(T, P, false);
29-
}
30-
3129
public SystemEos(double T, double P, boolean checkForSolids) {
32-
super(T, P);
33-
this.solidPhaseCheck = checkForSolids;
30+
super(T, P, checkForSolids);
3431
}
3532
}

src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEos.java

-6
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ public SystemFurstElectrolyteEos clone() {
5050
logger.error("Cloning failed.", ex);
5151
}
5252

53-
// clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
54-
// for(int i = 0; i < numberOfPhases; i++) {
55-
// clonedSystem.phaseArray[i] = (PhaseModifiedFurstElectrolyteEos)
56-
// phaseArray[i].clone();
57-
// }
58-
5953
return clonedSystem;
6054
}
6155
}

src/main/java/neqsim/thermo/system/SystemFurstElectrolyteEosMod2004.java

-6
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ public SystemFurstElectrolyteEosMod2004 clone() {
5050
logger.error("Cloning failed.", ex);
5151
}
5252

53-
// clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
54-
// for(int i = 0; i < numberOfPhases; i++) {
55-
// clonedSystem.phaseArray[i] = (PhaseModifiedFurstElectrolyteEos)
56-
// phaseArray[i].clone();
57-
// }
58-
5953
return clonedSystem;
6054
}
6155
}

src/main/java/neqsim/thermo/system/SystemGERG2004Eos.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public SystemGERG2004Eos(double T, double P) {
4444
* @param checkForSolids Set true to do solid phase check and calculations
4545
*/
4646
public SystemGERG2004Eos(double T, double P, boolean checkForSolids) {
47-
super(T, P);
48-
this.solidPhaseCheck = checkForSolids;;
47+
super(T, P, checkForSolids);
4948
modelName = "GERG2004-EOS";
5049

5150
for (int i = 0; i < numberOfPhases; i++) {

src/main/java/neqsim/thermo/system/SystemGEWilson.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public SystemGEWilson(double T, double P) {
4444
* @param checkForSolids Set true to do solid phase check and calculations
4545
*/
4646
public SystemGEWilson(double T, double P, boolean checkForSolids) {
47-
super(T, P);
48-
this.solidPhaseCheck = checkForSolids;;
47+
super(T, P, checkForSolids);
4948
attractiveTermNumber = 0;
5049
modelName = "UNIFAC-GE-model";
5150

@@ -77,10 +76,6 @@ public SystemGEWilson clone() {
7776
logger.error("Cloning failed.", ex);
7877
}
7978

80-
// for(int i = 0; i < numberOfPhases; i++) {
81-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
82-
// }
83-
8479
return clonedSystem;
8580
}
8681
}

src/main/java/neqsim/thermo/system/SystemKentEisenberg.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public SystemKentEisenberg(double T, double P) {
4444
* @param checkForSolids Set true to do solid phase check and calculations
4545
*/
4646
public SystemKentEisenberg(double T, double P, boolean checkForSolids) {
47-
super(T, P);
48-
this.solidPhaseCheck = checkForSolids;;
47+
super(T, P, checkForSolids);
4948
attractiveTermNumber = 0;
5049
modelName = "Kent Eisenberg-model";
5150

@@ -77,10 +76,6 @@ public SystemKentEisenberg clone() {
7776
logger.error("Cloning failed.", ex);
7877
}
7978

80-
// for(int i = 0; i < numberOfPhases; i++) {
81-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
82-
// }
83-
8479
return clonedSystem;
8580
}
8681
}

src/main/java/neqsim/thermo/system/SystemNRTL.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public SystemNRTL(double T, double P) {
4444
* @param checkForSolids Set true to do solid phase check and calculations
4545
*/
4646
public SystemNRTL(double T, double P, boolean checkForSolids) {
47-
super(T, P);
48-
this.solidPhaseCheck = checkForSolids;;
47+
super(T, P, checkForSolids);
4948
attractiveTermNumber = 0;
5049
modelName = "NRTL-GE-model";
5150

@@ -77,10 +76,6 @@ public SystemNRTL clone() {
7776
logger.error("Cloning failed.", ex);
7877
}
7978

80-
// for(int i = 0; i < numberOfPhases; i++) {
81-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
82-
// }
83-
8479
return clonedSystem;
8580
}
8681
}

src/main/java/neqsim/thermo/system/SystemPrEos.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public SystemPrEos(double T, double P) {
3838
* @param checkForSolids Set true to do solid phase check and calculations
3939
*/
4040
public SystemPrEos(double T, double P, boolean checkForSolids) {
41-
super(T, P);
42-
this.solidPhaseCheck = checkForSolids;;
41+
super(T, P, checkForSolids);
4342
attractiveTermNumber = 1;
4443
modelName = "PR-EOS";
4544
getCharacterization().setTBPModel("PedersenPR");
@@ -76,10 +75,6 @@ public SystemPrEos clone() {
7675
logger.error("Cloning failed.", ex);
7776
}
7877

79-
// clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
80-
// for(int i = 0; i < numberOfPhases; i++) {
81-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
82-
// }
8378
return clonedSystem;
8479
}
8580
}

src/main/java/neqsim/thermo/system/SystemPrEos1978.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public SystemPrEos1978(double T, double P) {
4444
* @param checkForSolids Set true to do solid phase check and calculations
4545
*/
4646
public SystemPrEos1978(double T, double P, boolean checkForSolids) {
47-
super(T, P);
48-
this.solidPhaseCheck = checkForSolids;;
47+
super(T, P, checkForSolids);
4948
attractiveTermNumber = 13;
5049
modelName = "PR1978-EOS";
5150

@@ -81,11 +80,6 @@ public SystemPrEos1978 clone() {
8180
logger.error("Cloning failed.", ex);
8281
}
8382

84-
// clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
85-
// for(int i = 0; i < numberOfPhases; i++) {
86-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
87-
// }
88-
8983
return clonedSystem;
9084
}
9185
}

src/main/java/neqsim/thermo/system/SystemRKEos.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ public SystemRKEos(double T, double P) {
4343
* @param checkForSolids Set true to do solid phase check and calculations
4444
*/
4545
public SystemRKEos(double T, double P, boolean checkForSolids) {
46-
super(T, P);
47-
this.solidPhaseCheck = checkForSolids;;
46+
super(T, P, checkForSolids);
4847
attractiveTermNumber = 5;
4948
modelName = "RK-EOS";
5049

src/main/java/neqsim/thermo/system/SystemSrkEos.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public SystemSrkEos(double T, double P) {
3838
* @param checkForSolids Set true to do solid phase check and calculations
3939
*/
4040
public SystemSrkEos(double T, double P, boolean checkForSolids) {
41-
super(T, P);
42-
this.solidPhaseCheck = checkForSolids;;
41+
super(T, P, checkForSolids);
4342
modelName = "SRK-EOS";
4443
getCharacterization().setTBPModel("PedersenSRK");
4544
attractiveTermNumber = 0;
@@ -76,10 +75,6 @@ public SystemSrkEos clone() {
7675
logger.error("Cloning failed.", ex);
7776
}
7877

79-
// clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
80-
// for(int i = 0; i < numberOfPhases; i++) {
81-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
82-
// }
8378
return clonedSystem;
8479
}
8580
}

src/main/java/neqsim/thermo/system/SystemTSTEos.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public SystemTSTEos(double T, double P) {
4646
* @param checkForSolids Set true to do solid phase check and calculations
4747
*/
4848
public SystemTSTEos(double T, double P, boolean checkForSolids) {
49-
super(T, P);
50-
this.solidPhaseCheck = checkForSolids;;
49+
super(T, P, checkForSolids);
5150
attractiveTermNumber = 14;
5251
modelName = "TST-EOS";
5352

@@ -83,11 +82,6 @@ public SystemTSTEos clone() {
8382
logger.error("Cloning failed.", ex);
8483
}
8584

86-
// clonedSystem.phaseArray = (PhaseInterface[]) phaseArray.clone();
87-
// for(int i = 0; i < numberOfPhases; i++) {
88-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
89-
// }
90-
9185
return clonedSystem;
9286
}
9387
}

src/main/java/neqsim/thermo/system/SystemThermo.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ public SystemThermo() {
150150
*
151151
* @param T The temperature in unit Kelvin
152152
* @param P The pressure in unit bara (absolute pressure)
153+
* @param checkForSolids Set true to do solid phase check and calculations
153154
*/
154-
public SystemThermo(double T, double P) {
155+
public SystemThermo(double T, double P, boolean checkForSolids) {
155156
this();
156157
if (T < 0.0) {
157158
neqsim.util.exception.InvalidInputException ex =
@@ -166,6 +167,8 @@ public SystemThermo(double T, double P) {
166167
"SystemThermo", "P", "is negative");
167168
throw new RuntimeException(ex);
168169
}
170+
171+
this.solidPhaseCheck = checkForSolids;
169172
}
170173

171174
/** {@inheritDoc} */
@@ -547,6 +550,7 @@ public SystemThermo clone() {
547550
for (int i = 0; i < getMaxNumberOfPhases(); i++) {
548551
clonedSystem.phaseArray[i] = phaseArray[i].clone();
549552
}
553+
550554
return clonedSystem;
551555
}
552556

src/main/java/neqsim/thermo/system/SystemUNIFAC.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ public SystemUNIFAC(double T, double P) {
4545
* @param checkForSolids Set true to do solid phase check and calculations
4646
*/
4747
public SystemUNIFAC(double T, double P, boolean checkForSolids) {
48-
super(T, P);
49-
this.solidPhaseCheck = checkForSolids;;
48+
super(T, P, checkForSolids);
5049
attractiveTermNumber = 0;
5150
modelName = "UNIFAC-GE-model";
5251
solidPhaseCheck = checkForSolids;
@@ -79,10 +78,6 @@ public SystemUNIFAC clone() {
7978
logger.error("Cloning failed.", ex);
8079
}
8180

82-
// for(int i = 0; i < numberOfPhases; i++) {
83-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
84-
// }
85-
8681
return clonedSystem;
8782
}
8883
}

src/main/java/neqsim/thermo/system/SystemUNIFACpsrk.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public SystemUNIFACpsrk(double T, double P) {
4444
* @param checkForSolids Set true to do solid phase check and calculations
4545
*/
4646
public SystemUNIFACpsrk(double T, double P, boolean checkForSolids) {
47-
super(T, P);
48-
this.solidPhaseCheck = checkForSolids;;
47+
super(T, P, checkForSolids);
4948
attractiveTermNumber = 0;
5049
modelName = "UNIFAC-GE-model";
5150
solidPhaseCheck = checkForSolids;
@@ -78,10 +77,6 @@ public SystemUNIFACpsrk clone() {
7877
logger.error("Cloning failed.", ex);
7978
}
8079

81-
// for(int i = 0; i < numberOfPhases; i++) {
82-
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
83-
// }
84-
8580
return clonedSystem;
8681
}
8782
}

src/main/java/neqsim/thermodynamicOperations/ThermodynamicOperations.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public void TPflash() {
169169
* TPflash.
170170
* </p>
171171
*
172-
* @param checkForSolids Set true to check for solid phase and do solid phase calculations.
172+
* @param checkForSolids Set true to do solid phase check and calculations
173173
*/
174174
public void TPflash(boolean checkForSolids) {
175175
operation = new neqsim.thermodynamicOperations.flashOps.TPflash(system, checkForSolids);

src/main/java/neqsim/thermodynamicOperations/flashOps/Flash.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public abstract class Flash extends BaseOperation {
4747
double[] tm;
4848
int lowestGibbsEnergyPhase = 0;
4949
sysNewtonRhapsonTPflash secondOrderSolver;
50-
/** Set true to check for solid phase and do solid phase calculations. */
50+
/** Set true to do solid phase check and calculations */
5151
protected boolean solidCheck = false;
5252
protected boolean stabilityCheck = false;
5353
protected boolean findLowestGibbsPhaseIsChecked = false;

src/main/java/neqsim/thermodynamicOperations/flashOps/SolidFlash.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void setSolidComponent(int i) {
5656
* </p>
5757
*
5858
* @param system a {@link neqsim.thermo.system.SystemInterface} object
59-
* @param checkForSolids Set true to check for solid phase and do solid phase calculations.
59+
* @param checkForSolids Set true to do solid phase check and calculations
6060
*/
6161
public SolidFlash(SystemInterface system, boolean checkForSolids) {
6262
super(system, checkForSolids);

src/main/java/neqsim/thermodynamicOperations/flashOps/TPflash.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public TPflash(SystemInterface system) {
5555
* </p>
5656
*
5757
* @param system a {@link neqsim.thermo.system.SystemInterface} object
58-
* @param checkForSolids Set true to check for solid phase and do solid phase calculations.
58+
* @param checkForSolids Set true to do solid phase check and calculations
5959
*/
6060
public TPflash(SystemInterface system, boolean checkForSolids) {
6161
this(system);

0 commit comments

Comments
 (0)