Skip to content

Commit

Permalink
added pHFlash Test for CPA (#982)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Apr 17, 2024
1 parent 1676774 commit 3e034e0
Showing 1 changed file with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package neqsim.thermodynamicOperations.flashOps;

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

/**
* @author ESOL
*/
class PHFlashCPATest {
static neqsim.thermo.system.SystemInterface testSystem = null;
static ThermodynamicOperations testOps = null;

@Test
void testRun() {
testSystem = new neqsim.thermo.system.SystemSrkCPAstatoil(323.15, 100.0);
testSystem.addComponent("CO2", 9.0);
testSystem.addComponent("methane", 90.0);
testSystem.addComponent("ethane", 12.0);
testSystem.addComponent("propane", 1.0);
testSystem.addComponent("i-butane", 1.0);
testSystem.addComponent("n-butane", 1.0);
testSystem.addComponent("i-pentane", 1.0);
testSystem.addComponent("n-pentane", 1.0);
testSystem.addComponent("n-hexane", 0.001);
testSystem.addComponent("water", 10.0);
testSystem.addComponent("MEG", 10.0);
testSystem.setMixingRule(10);
testSystem.setMultiPhaseCheck(true);

testOps = new ThermodynamicOperations(testSystem);
testOps.TPflash();
testSystem.initProperties();
double enthalpy = testSystem.getEnthalpy();
double entropy = testSystem.getEntropy();
testSystem.setPressure(50.0);
testOps.PHflash(enthalpy);
assertEquals(enthalpy, testSystem.getEnthalpy(), 1e-2);
assertEquals(307.5036701214, testSystem.getTemperature(), 1e-2);
testOps.PSflash(entropy);
assertEquals(287.0197047, testSystem.getTemperature(), 1e-2);
}


}

0 comments on commit 3e034e0

Please sign in to comment.