Skip to content

Commit

Permalink
refact: systemthermo.initAnalytic(int type, int phase)
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Feb 27, 2024
1 parent a8904b1 commit 1362aaf
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/main/java/neqsim/thermo/system/SystemThermo.java
Original file line number Diff line number Diff line change
Expand Up @@ -1930,31 +1930,21 @@ public void initAnalytic(int type, int phase) {
}

if (isPhase(phase)) {
if (type == 0) {
getPhase(phase).init(getTotalNumberOfMoles(), numberOfComponents, 0,
phaseType[phaseIndex[phase]], beta[phaseIndex[phase]]);
} else if (type == 1) {
getPhase(phase).init(getTotalNumberOfMoles(), numberOfComponents, 1,
phaseType[phaseIndex[phase]], beta[phaseIndex[phase]]);

getPhase(phase).init(getTotalNumberOfMoles(), numberOfComponents, 0,
phaseType[phaseIndex[phase]], beta[phaseIndex[phase]]);
if (type > 0) {
for (int j = 0; j < numberOfComponents; j++) {
getPhase(phase).getComponents()[j].fugcoef(getPhase(phase));
}
} else if (type == 2) {
getPhase(phase).init(getTotalNumberOfMoles(), numberOfComponents, 2,
phaseType[phaseIndex[phase]], beta[phaseIndex[phase]]);

}
if (type > 1) {
for (int j = 0; j < numberOfComponents; j++) {
getPhase(phase).getComponents()[j].fugcoef(getPhase(phase));
getPhase(phase).getComponents()[j].logfugcoefdT(getPhase(phase));
getPhase(phase).getComponents()[j].logfugcoefdP(getPhase(phase));
}
} else if (type == 3) {
getPhase(phase).init(getTotalNumberOfMoles(), numberOfComponents, 3,
phaseType[phaseIndex[phase]], beta[phaseIndex[phase]]);

}
if (type > 2) {
for (int j = 0; j < numberOfComponents; j++) {
getPhase(phase).getComponents()[j].fugcoef(getPhase(phase));
getPhase(phase).getComponents()[j].logfugcoefdT(getPhase(phase));
getPhase(phase).getComponents()[j].logfugcoefdP(getPhase(phase));
getPhase(phase).getComponents()[j].logfugcoefdN(getPhase(phase));
Expand All @@ -1967,6 +1957,7 @@ public void initAnalytic(int type, int phase) {
tmpPhase.setType(PhaseType.OIL);
}
}

this.isInitialized = true;
}

Expand Down

0 comments on commit 1362aaf

Please sign in to comment.