|
| 1 | +/** |
| 2 | + * |
| 3 | + */ |
| 4 | +package neqsim.thermodynamicOperations.flashOps; |
| 5 | + |
| 6 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 7 | +import org.junit.jupiter.api.BeforeEach; |
| 8 | +import org.junit.jupiter.api.Test; |
| 9 | +import neqsim.thermodynamicOperations.ThermodynamicOperations; |
| 10 | + |
| 11 | +/** |
| 12 | + * @author ESOL |
| 13 | + * |
| 14 | + */ |
| 15 | +class TVFlashTest { |
| 16 | + |
| 17 | + static neqsim.thermo.system.SystemInterface testSystem = null; |
| 18 | + static neqsim.thermo.system.SystemInterface testSystem2 = null; |
| 19 | + static ThermodynamicOperations testOps = null; |
| 20 | + |
| 21 | + /** |
| 22 | + * @throws java.lang.Exception |
| 23 | + */ |
| 24 | + @BeforeEach |
| 25 | + void setUp() throws Exception { |
| 26 | + testSystem = new neqsim.thermo.system.SystemUMRPRUMCEos(293.15, 0.1); |
| 27 | + testSystem.addComponent("methane", 0.0); |
| 28 | + testSystem.addComponent("ethane", 0.0); |
| 29 | + testSystem.addComponent("n-pentane", 9E-1); |
| 30 | + testSystem.addComponent("nC16", 1E-1); |
| 31 | + testSystem.setMixingRule("classic"); |
| 32 | + testOps = new ThermodynamicOperations(testSystem); |
| 33 | + testOps.TPflash(); |
| 34 | + testSystem.initProperties(); |
| 35 | + testSystem.setTotalFlowRate(1.0, "kg/sec"); |
| 36 | + testOps.TPflash(); |
| 37 | + testSystem.initProperties(); |
| 38 | + |
| 39 | + testSystem2 = new neqsim.thermo.system.SystemUMRPRUMCEos(293.15, 0.1); |
| 40 | + testSystem2.addComponent("methane", 8.5E-1); |
| 41 | + testSystem2.addComponent("ethane", 1.5E-1); |
| 42 | + testSystem2.addComponent("n-pentane", 0); |
| 43 | + testSystem2.addComponent("nC16", 0); |
| 44 | + testSystem2.setMixingRule("classic"); |
| 45 | + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem2); |
| 46 | + testOps.TPflash(); |
| 47 | + testSystem2.initProperties(); |
| 48 | + testSystem2.setTotalFlowRate(0.3, "kg/sec"); |
| 49 | + testOps.TPflash(); |
| 50 | + testSystem2.initProperties(); |
| 51 | + } |
| 52 | + |
| 53 | + @Test |
| 54 | + void testTVflash() { |
| 55 | + double total_rig_volume = 0.998; |
| 56 | + |
| 57 | + for(int i=0;i<50;i++) { |
| 58 | + testSystem.addFluid(testSystem2); |
| 59 | + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); |
| 60 | + try { |
| 61 | + testOps.TVflash(total_rig_volume, "m3"); |
| 62 | + } |
| 63 | + catch(Exception e) { |
| 64 | + System.out.println("error iterations " + i); |
| 65 | + e.printStackTrace(); |
| 66 | + } |
| 67 | + } |
| 68 | + assertEquals(235263.80103781424, testSystem.getEnthalpy(), 1e-2); |
| 69 | + } |
| 70 | + |
| 71 | + } |
| 72 | + |
0 commit comments