Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Dec 3, 2024
1 parent 2baa2a2 commit f7027b2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException,
// check for trivial solution
double diffx = 0.0;
for (int i = 0; i < clonedSystem.getPhase(0).getNumberOfComponents(); i++) {
diffx += Math.abs(clonedSystem.getPhase(0).getComponent(i).getx()
- clonedSystem.getPhase(1).getComponent(i).getx());
diffx += Math.abs(clonedSystem.getPhase(j).getComponent(i).getx()
- minimumGibbsEnergySystem.getPhase(0).getComponent(i).getx());
}
if (diffx < 1e-10) {
tm[0] = 0.0;
Expand All @@ -310,6 +310,7 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException,
logger.info("error in stability anlysis");
system.init(0);
}

if (Double.isNaN(tm[j])) {
tm[j] = 0;
}
Expand Down Expand Up @@ -357,7 +358,7 @@ public boolean stabilityCheck() {
} else {
RachfordRice rachfordRice = new RachfordRice();
try {
system.setBeta(rachfordRice.calcBeta(system.getKvector(), system.getzvector()));
system.setBeta(rachfordRice.calcBeta(system.getKvector(), minimumGibbsEnergySystem.getzvector()));
} catch (Exception ex) {
if (!Double.isNaN(rachfordRice.getBeta()[0])) {
system.setBeta(rachfordRice.getBeta()[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package neqsim.thermodynamicoperations.flashops;

import java.io.Serializable;
import java.util.Arrays;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.thermo.component.ComponentInterface;
Expand Down Expand Up @@ -195,6 +196,8 @@ public double calcBetaMichelsen2001(double[] K, double[] z)
beta[1] = 1.0 - nybeta;

if (iterations >= maxIterations) {
logger.debug("K " + Arrays.toString(K));
logger.debug("z " + Arrays.toString(z));
throw new neqsim.util.exception.TooManyIterationsException(new RachfordRice(),
"calcBetaMichelsen2001", maxIterations);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ private SystemInterface getTestSystem() {
testSystem.addComponent("methane", 0.900);
testSystem.addComponent("ethane", 0.100);
testSystem.addComponent("n-heptane", 1.00);
testSystem.createDatabase(true);
testSystem.setMixingRule(2);
return testSystem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ public void runTEGProcessTest2() {
* coolerhOTteg3.getOutletStream().getFlowRate("kg/hr")); System.out.println("leantoresirc " +
* leanTEGtoabs.getFlowRate("kg/hr"));
*/
assertEquals(1.6574913669263535E-5, dehydratedGas.getFluid().getComponent("water").getx(),
assertEquals(1.5449593316401103E-5, dehydratedGas.getFluid().getComponent("water").getx(),
1e-6);
}

Expand Down

0 comments on commit f7027b2

Please sign in to comment.