Skip to content

Commit

Permalink
bug fix (#857)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol authored Nov 25, 2023
1 parent 1fea26b commit fd552f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -370,22 +370,14 @@ public void run(UUID id) {
trays.get(i + 1).getLiquidOutStream());
((SimpleTray) trays.get(i)).run(id);
}
// for (int i = 1; i <= numberOfTrays - 1; i++) {
// int replaceStream = trays.get(i).getNumberOfInputStreams() - 2;
// if (i == (numberOfTrays - 1)) {
// replaceStream = trays.get(i).getNumberOfInputStreams() - 1;
// }
// ((Mixer) trays.get(i)).replaceStream(replaceStream, trays.get(i - 1).getGasOutStream());
// ((SimpleTray) trays.get(i)).run(id);
// }
for (int i = 0; i < numberOfTrays; i++) {
err += Math.abs(
oldtemps[i] - ((MixerInterface) trays.get(i)).getThermoSystem().getTemperature());
}
logger.info("error iter " + err + " iteration " + iter);
// System.out.println("error iter " + err + " iteration " + iter);
// massBalanceCheck();
} while (err > 1e-4 && err < errOld && iter < maxNumberOfIterations); // &&
} while (err > 1e-4 && err < errOld && iter < maxNumberOfIterations); // &&
// !massBalanceCheck());
// massBalanceCheck();
// componentMassBalanceCheck("water");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
import java.awt.BorderLayout;
import java.awt.Container;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import neqsim.api.ioc.CalculationResult;
import neqsim.thermo.component.ComponentHydrate;
import neqsim.thermo.system.SystemInterface;
Expand Down Expand Up @@ -146,7 +143,7 @@ public void TPVflash(double volumeSpec, String unit) {
public void TPflash() {
double flowRate = system.getTotalNumberOfMoles();
double minimumFlowRate = 1e-50;
if (flowRate < 1e-3) {
if (flowRate < 1e-5) {
system.setTotalNumberOfMoles(1.0);
system.init(1);
}
Expand All @@ -157,13 +154,13 @@ public void TPflash() {
} else {
run();
}
if (flowRate < 1e-3) {
if (flowRate < 1e-5) {
if (flowRate < minimumFlowRate) {
system.setTotalNumberOfMoles(minimumFlowRate);
} else {
system.setTotalNumberOfMoles(flowRate);
}
system.init(2);
system.init(1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ public void stabilityAnalysis() {
if (iter <= 150 || !system.isImplementedCompositionDeriativesofFugacity()) {
if (iter % 7 == 0 && useaccsubst) {
double vec1 = 0.0;

double vec2 = 0.0;
double prod1 = 0.0;
double prod2 = 0.0;
Expand Down Expand Up @@ -841,6 +840,10 @@ public void stabilityAnalysis2() {
}
}
} while ((Math.abs(err) > 1e-9 || err > errOld) && iter < 200);
if (iter > 198) {
System.out.println("too many iterations....." + err);
new Exception("to many iterations ");
}
// logger.info("err: " + err + " ITER " + iter);
double xTrivialCheck0 = 0.0;
double xTrivialCheck1 = 0.0;
Expand Down

0 comments on commit fd552f7

Please sign in to comment.