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 a6841f7 commit 72aa5e7
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
13 changes: 5 additions & 8 deletions src/main/java/neqsim/thermodynamicoperations/flashops/Flash.java
Original file line number Diff line number Diff line change
Expand Up @@ -295,26 +295,23 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException,
if (((tm[0] < tmLimit) || (tm[1] < tmLimit))
&& !(Double.isNaN(tm[0]) || (Double.isNaN(tm[1])))) {
for (int i = 0; i < clonedSystem.getPhases()[0].getNumberOfComponents(); i++) {
if (system.getPhases()[1].getComponent(i).getx() < 1e-100) {
if (system.getPhase(0).getComponent(i).getx() < 1e-100) {
continue;
}
if (tm[0] < tmLimit) {
system.getPhases()[1].getComponent(i).setK(clonedSystem.getPhase(0).getComponent(i).getx()
/ minimumGibbsEnergySystem.getComponent(i).getz());
/ clonedSystem.getPhase(1).getComponent(i).getx());
system.getPhases()[0].getComponent(i).setK(clonedSystem.getPhase(0).getComponent(i).getx()
/ minimumGibbsEnergySystem.getComponent(i).getz());
/ clonedSystem.getPhase(1).getComponent(i).getx());
} else if (tm[1] < tmLimit) {

system.getPhases()[1].getComponent(i).setK(minimumGibbsEnergySystem.getComponent(i).getz()
system.getPhases()[1].getComponent(i).setK(clonedSystem.getPhase(0).getComponent(i).getx()
/ clonedSystem.getPhase(1).getComponent(i).getx());
system.getPhases()[0].getComponent(i).setK(minimumGibbsEnergySystem.getComponent(i).getz()
system.getPhases()[0].getComponent(i).setK(clonedSystem.getPhase(0).getComponent(i).getx()
/ clonedSystem.getPhase(1).getComponent(i).getx());

} else {
logger.info("error in stability anlysis");
system.init(0);
}

if (Double.isNaN(tm[j])) {
tm[j] = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
package neqsim.thermodynamicoperations.flashops;

import java.io.Serializable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.thermo.component.ComponentInterface;
import neqsim.thermo.system.SystemInterface;

Expand All @@ -16,9 +18,10 @@
* @author Even Solbraa
*/
public class RachfordRice implements Serializable {
static Logger logger = LogManager.getLogger(PHsolidFlash.class);
private static final long serialVersionUID = 1000;
private double[] beta = new double[2];
private static String method = "Michelsen2001"; // alternative use Nielsen2023
private static String method = "Nielsen2023"; // alternative use Nielsen2023 or Michelsen2001

/**
* <p>
Expand Down Expand Up @@ -254,6 +257,9 @@ public double calcBetaNielsen2023(double[] K, double[] z)
} else if (K[i] > Kmax) {
Kmax = K[i];
}

logger.debug(Kmin);
logger.debug(Kmax);
}

double alphaMin = 1.0 / (1.0 - Kmax);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public void runProcessTEG() throws InterruptedException {

assertEquals(-19.1886678,
p.getMeasurementDevice("water dew point analyser3").getMeasuredValue("C"), 1e-1);
assertEquals(852.343183810,
assertEquals(219.669343395,
((Reboiler) ((DistillationColumn) p.getUnit("TEG regeneration column")).getReboiler())
.getDuty() / 1e3,
1e-2);
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.5322819175995646E-5, dehydratedGas.getFluid().getComponent("water").getx(),
assertEquals(1.6574913669263535E-5, dehydratedGas.getFluid().getComponent("water").getx(),
1e-6);
}

Expand Down Expand Up @@ -888,6 +888,6 @@ public void testRun_step() {
operations.add(coolerhOTteg3);
operations.add(leanTEGtoabs);
operations.add(recycleLeanTEG);
operations.run();
operations.run();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void testRunCalc() {
assertEquals(0.95756922523, CMEsim.getRelativeVolume()[0], 0.001);
assertEquals(0.99569265437, CMEsim.getRelativeVolume()[6], 0.001);
assertEquals(1.3572659252241415, CMEsim.getRelativeVolume()[12], 0.001);
assertEquals(2.1893764807, CMEsim.getYfactor()[12], 0.001);
assertEquals(2.19059853842015, CMEsim.getYfactor()[12], 0.001);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void testRunCalc() {
new double[] {400, 300.0, 200.0, 100.0});
double[][] expData = {{0.95, 0.99, 1.0, 1.1}};
CVDsim.setExperimentalData(expData);
assertEquals(2.284545214649, CVDsim.getRelativeVolume()[4], 0.001);
assertEquals(2.291239632886, CVDsim.getRelativeVolume()[4], 0.001);
}

@Test
Expand Down

0 comments on commit 72aa5e7

Please sign in to comment.