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

Problem with volume flow rates #767

Merged
merged 3 commits into from
Jul 11, 2023
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
12 changes: 8 additions & 4 deletions src/main/java/neqsim/thermo/phase/Phase.java
Original file line number Diff line number Diff line change
Expand Up @@ -2120,13 +2120,17 @@ public double getFlowRate(String flowunit) {
} else if (flowunit.equals("kg/hr")) {
return numberOfMolesInPhase * getMolarMass() * 3600.0;
} else if (flowunit.equals("m3/hr")) {
return getVolume() / 1.0e5 * 3600.0;
initPhysicalProperties("density");
return numberOfMolesInPhase * getMolarMass() / getDensity("kg/m3") * 3600.0;
} else if (flowunit.equals("m3/min")) {
return getVolume() / 1.0e5 * 60.0;
initPhysicalProperties("density");
return numberOfMolesInPhase * getMolarMass() / getDensity("kg/m3") * 60.0;
} else if (flowunit.equals("m3/sec")) {
return getVolume() / 1.0e5;
initPhysicalProperties("density");
return numberOfMolesInPhase * getMolarMass() / getDensity("kg/m3");
} else if (flowunit.equals("ft3/sec")) {
return getVolume() * Math.pow(3.2808399, 3) / 1.0e5;
initPhysicalProperties("density");
return numberOfMolesInPhase * getMolarMass() / getDensity("kg/m3") * Math.pow(3.2808399, 3);
} else if (flowunit.equals("mole/sec")) {
return numberOfMolesInPhase;
} else if (flowunit.equals("mole/min")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package neqsim.processSimulation.processEquipment.pipeline;

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

public class BeggsAndBrillsPipeTest {
@Test
public void testFlowNoVolumeCorrection() {
neqsim.thermo.system.SystemInterface testSystem =
new neqsim.thermo.system.SystemSrkEos((273.15 + 15), 1.01325);

testSystem.addComponent("nC10", 50, "MSm^3/day");
testSystem.setMixingRule(2);
testSystem.init(0);
testSystem.useVolumeCorrection(false);

ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
testOps.TPflash();
testSystem.initPhysicalProperties();

Assertions.assertEquals(testSystem.getPhase("oil").getFlowRate("m3/hr"),
testSystem.getFlowRate("m3/hr"), 1e-4);
}

@Test
public void testFlowVolumeCorrection() {
neqsim.thermo.system.SystemInterface testSystem =
new neqsim.thermo.system.SystemSrkEos((273.15 + 15), 1.01325);

testSystem.addComponent("nC10", 50, "MSm^3/day");
testSystem.setMixingRule(2);
testSystem.init(0);
testSystem.useVolumeCorrection(true);

ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
testOps.TPflash();
testSystem.initPhysicalProperties();

Assertions.assertEquals(testSystem.getPhase("oil").getFlowRate("m3/hr"),
testSystem.getFlowRate("m3/hr"), 1e-4);
}

}