Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update model #382

Merged
merged 1 commit into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public double calcSaturationPressure() {
thermoOps.TPflash();
} while (getThermoSystem().getNumberOfPhases() > 1
&& getThermoSystem().getPressure() < 1000.0);

if(getThermoSystem().getPressure()>1000.0) {
return getThermoSystem().getPressure();
}

double minPres = getThermoSystem().getPressure() - 10.0;
double maxPres = getThermoSystem().getPressure();
int iteration = 0;
Expand Down Expand Up @@ -98,7 +103,7 @@ public static void main(String[] args) {
tempSystem.setMixingRule(9);// "HV", "UNIFAC_UMRPRU");
tempSystem.init(0);
tempSystem.init(1);
tempSystem.saveFluid(928);
//tempSystem.saveFluid(928);

SimulationInterface satPresSim = new SaturationPressure(tempSystem);
satPresSim.run();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package neqsim.PVTsimulation.simulation;

import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;

class SaturationPressureTest {

@BeforeAll
static void setUpBeforeClass() throws Exception {}


@Test
void testCalcSaturationPressure() {
SystemInterface tempSystem = new SystemSrkEos(273.15 + 20, 10.0);
tempSystem.addComponent("nitrogen", 0.34);
tempSystem.addComponent("CO2", 0.59);
tempSystem.addComponent("methane", 87.42);
tempSystem.addComponent("ethane", 3.02);
tempSystem.addComponent("propane", 4.31);
tempSystem.addComponent("i-butane", 0.93);
tempSystem.addComponent("n-butane", 1.71);
tempSystem.addComponent("i-pentane", 0.74);
tempSystem.addComponent("n-pentane", 0.85);
tempSystem.addComponent("n-hexane", 0.38);
tempSystem.addTBPfraction("C7", 0.05, 109.00 / 1000.0, 0.6912);
tempSystem.addTBPfraction("C8", 0.069, 120.20 / 1000.0, 0.7255);
tempSystem.addTBPfraction("C9", 0.014, 129.5 / 1000.0, 0.7454);
tempSystem.addTBPfraction("C10", 0.0078, 135.3 / 1000.0, 0.7864);
tempSystem.setMixingRule(2);
SimulationInterface satPresSim = new SaturationPressure(tempSystem);
satPresSim.run();
assertEquals(satPresSim.getThermoSystem().getPressure(), 122.28338813781738, 0.1);
}

}