Skip to content

Commit

Permalink
added tests for saturation calculations (#991)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol authored Apr 26, 2024
1 parent 861a079 commit 1a922be
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package neqsim.thermodynamicOperations.flashOps.saturationOps;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicOperations.ThermodynamicOperations;

public class bubblePointPressureFlashTest {
@Test
void testRun() {

SystemSrkEos fluid0_HC = new SystemSrkEos();
fluid0_HC.addComponent("methane", 0.7);
fluid0_HC.addComponent("ethane", 0.1);
fluid0_HC.addComponent("propane", 0.1);
fluid0_HC.addComponent("n-butane", 0.1);
fluid0_HC.setMixingRule("classic");

fluid0_HC.setPressure(10.0, "bara");
fluid0_HC.setTemperature(-50.0, "C");

ThermodynamicOperations ops = new ThermodynamicOperations(fluid0_HC);
try {
ops.bubblePointPressureFlash(false);
} catch (Exception e) {
e.printStackTrace();
}
assertEquals(65.150271897839, fluid0_HC.getPressure(), 1e-2);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package neqsim.thermodynamicOperations.flashOps.saturationOps;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicOperations.ThermodynamicOperations;

public class bubblePointTemperatureFlashTest {
@Test
void testRun() {
SystemSrkEos fluid0_HC = new SystemSrkEos();
fluid0_HC.addComponent("methane", 0.7);
fluid0_HC.addComponent("ethane", 0.1);
fluid0_HC.addComponent("propane", 0.1);
fluid0_HC.addComponent("n-butane", 0.1);
fluid0_HC.setMixingRule("classic");

fluid0_HC.setPressure(10.0, "bara");
fluid0_HC.setTemperature(-150.0, "C");

ThermodynamicOperations ops = new ThermodynamicOperations(fluid0_HC);
try {
ops.bubblePointTemperatureFlash();
} catch (Exception e) {
e.printStackTrace();
}
assertEquals(-117.7205968083, fluid0_HC.getTemperature("C"), 1e-2);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package neqsim.thermodynamicOperations.flashOps.saturationOps;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicOperations.ThermodynamicOperations;

public class dewPointPressureFlashTest {
@Test
void testRun() {


SystemSrkEos fluid0_HC = new SystemSrkEos();
fluid0_HC.addComponent("methane", 0.7);
fluid0_HC.addComponent("ethane", 0.1);
fluid0_HC.addComponent("propane", 0.1);
fluid0_HC.addComponent("n-butane", 0.1);
fluid0_HC.setMixingRule("classic");

fluid0_HC.setPressure(10.0, "bara");
fluid0_HC.setTemperature(0.0, "C");

ThermodynamicOperations ops = new ThermodynamicOperations(fluid0_HC);
try {
ops.dewPointPressureFlash();
} catch (Exception e) {
e.printStackTrace();
}
assertEquals(9.332383561, fluid0_HC.getPressure(), 1e-2);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package neqsim.thermodynamicOperations.flashOps.saturationOps;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicOperations.ThermodynamicOperations;

public class dewPointTemperatureFlashTest {
@Test
void testRun() {
SystemSrkEos fluid0_HC = new SystemSrkEos();
fluid0_HC.addComponent("methane", 0.7);
fluid0_HC.addComponent("ethane", 0.1);
fluid0_HC.addComponent("propane", 0.1);
fluid0_HC.addComponent("n-butane", 0.1);
fluid0_HC.setMixingRule("classic");

fluid0_HC.setPressure(10.0, "bara");
fluid0_HC.setTemperature(0.0, "C");

ThermodynamicOperations ops = new ThermodynamicOperations(fluid0_HC);
try {
ops.dewPointTemperatureFlash();
} catch (Exception e) {
e.printStackTrace();
}
assertEquals(1.7007677589821242, fluid0_HC.getTemperature("C"), 1e-2);

}
}

0 comments on commit 1a922be

Please sign in to comment.