Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update flash stability #1206

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/log4j2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
#appender.console.filter.threshold.level = DEBUG

# Root Logger
rootLogger.level = DEBUG
rootLogger.level = OFF
rootLogger.appenderRef.stdout.ref = STDOUT
24 changes: 13 additions & 11 deletions src/main/java/neqsim/thermodynamicoperations/flashops/Flash.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public int findLowestGibbsEnergyPhase() {
} else {
lowestGibbsEnergyPhase = 1;
}
// logger.info("Lowest Gibbs energy phase determined: Phase {}", lowestGibbsEnergyPhase);
// logger.info("Lowest Gibbs energy phase determined: Phase {}",
// lowestGibbsEnergyPhase);

findLowestGibbsPhaseIsChecked = true;
}
Expand All @@ -88,7 +89,7 @@ public int findLowestGibbsEnergyPhase() {
* stabilityAnalysis.
* </p>
*
* @throws neqsim.util.exception.IsNaNException if any.
* @throws neqsim.util.exception.IsNaNException if any.
* @throws neqsim.util.exception.TooManyIterationsException if any.
*/
public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException,
Expand Down Expand Up @@ -211,8 +212,7 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException,
} else {
// succsessive substitution
for (int i = 0; i < clonedSystem.getPhases()[0].getNumberOfComponents(); i++) {
logWi[i] =
d[i] - clonedSystem.getPhase(j).getComponent(i).getLogFugacityCoefficient();
logWi[i] = d[i] - clonedSystem.getPhase(j).getComponent(i).getLogFugacityCoefficient();
error[j] += Math.abs((logWi[i] - oldlogw[i]) / oldlogw[i]);
Wi[j][i] = Math.exp(logWi[i]);
}
Expand Down Expand Up @@ -262,9 +262,10 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException,
deltalogWi[i] = logWi[i] - oldlogw[i];
clonedSystem.getPhase(j).getComponent(i).setx(Wi[j][i] / sumw[j]);
}
// logger.info("fnorm " + f.norm1() + " err " + error[j] + " iterations " + iterations
// logger.info("fnorm " + f.norm1() + " err " + error[j] + " iterations " +
// iterations
// + " phase " + j);
} while ((f.norm1() > 1e-6 && iterations < maxiterations || error[j] > 1e-6)
} while ((f.norm1() > 1e-6 && error[j] > 1e-9 && iterations < maxiterations)
|| (iterations % 7) == 0 || iterations < 3);
// (error[j]<oldErr && oldErr<oldOldErr) &&
// logger.info("err " + error[j]);
Expand Down Expand Up @@ -414,9 +415,8 @@ public void solidPhaseFlash() {
if (system.getPhase(0).getComponent(k).doSolidCheck()) {
tempVar[k] = system.getPhase(0).getComponent(k).getz();
for (int i = 0; i < system.getNumberOfPhases() - 1; i++) {
tempVar[k] -=
system.getBeta(i) * system.getPhases()[3].getComponent(k).getFugacityCoefficient()
/ system.getPhase(i).getComponent(k).getFugacityCoefficient();
tempVar[k] -= system.getBeta(i) * system.getPhases()[3].getComponent(k).getFugacityCoefficient()
/ system.getPhase(i).getComponent(k).getFugacityCoefficient();
}

if (tempVar[k] > 0.0 && tempVar[k] > frac) {
Expand Down Expand Up @@ -485,7 +485,8 @@ public void solidPhaseFlash() {

/** {@inheritDoc} */
@Override
public void printToFile(String name) {}
public void printToFile(String name) {
}

/** {@inheritDoc} */
@Override
Expand All @@ -501,5 +502,6 @@ public String[][] getResultTable() {

/** {@inheritDoc} */
@Override
public void addData(String name, double[][] data) {}
public void addData(String name, double[][] data) {
}
}
Loading