Skip to content

Commit

Permalink
refact: simplify SystemSrkCPA subclass constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Mar 15, 2024
1 parent 8775862 commit e38f402
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
8 changes: 2 additions & 6 deletions src/main/java/neqsim/thermo/system/SystemSrkCPAs.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public SystemSrkCPAs(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkCPAs(double T, double P, boolean checkForSolids) {
super(T, P);
this.solidPhaseCheck = checkForSolids;;
super(T, P, checkForSolids);
modelName = "CPAs-SRK-EOS";

// Recreates phases created in super constructor SystemSrkCPA
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhaseSrkCPAsOld();
phaseArray[i].setTemperature(T);
Expand Down Expand Up @@ -80,10 +80,6 @@ public SystemSrkCPAs clone() {
logger.error("Cloning failed.", ex);
}

// for(int i = 0; i < numberOfPhases; i++) {
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
// }

return clonedSystem;
}
}
9 changes: 3 additions & 6 deletions src/main/java/neqsim/thermo/system/SystemSrkCPAstatoil.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ public SystemSrkCPAstatoil(double T, double P) {
* @param checkForSolids Set true to do solid phase check and calculations
*/
public SystemSrkCPAstatoil(double T, double P, boolean checkForSolids) {
super(T, P);
this.solidPhaseCheck = checkForSolids;;
super(T, P, checkForSolids);
modelName = "CPAs-SRK-EOS-statoil";
attractiveTermNumber = 15;

// Recreates phases created in super constructor SystemSrkCPAs
for (int i = 0; i < numberOfPhases; i++) {
phaseArray[i] = new PhaseSrkCPAs();
phaseArray[i].setTemperature(T);
Expand Down Expand Up @@ -74,10 +75,6 @@ public SystemSrkCPAstatoil clone() {
logger.error("Cloning failed.", ex);
}

// for(int i = 0; i < numberOfPhases; i++) {
// clonedSystem.phaseArray[i] = (PhaseInterface) phaseArray[i].clone();
// }

return clonedSystem;
}
}

0 comments on commit e38f402

Please sign in to comment.