Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Dec 9, 2024
1 parent 7f887a6 commit a056515
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/main/java/neqsim/thermodynamicoperations/flashops/Flash.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public int findLowestGibbsEnergyPhase() {
if (!findLowestGibbsPhaseIsChecked) {
minimumGibbsEnergySystem = system.clone();
minimumGibbsEnergySystem.init(0);
minimumGibbsEnergySystem.setTotalNumberOfMoles(1.0);
if (minimumGibbsEnergySystem.getTotalNumberOfMoles() < 1e-20) {
minimumGibbsEnergySystem.setTotalNumberOfMoles(1.0);
}
minimumGibbsEnergySystem.init(1);
if ((minimumGibbsEnergySystem.getPhase(0).getGibbsEnergy()
* (1.0 - Math.signum(minimumGibbsEnergySystem.getPhase(0).getGibbsEnergy())
Expand Down Expand Up @@ -120,10 +122,8 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException,
sumw[1] = 0.0;
sumw[0] = 0.0;
for (int i = 0; i < clonedSystem.getPhase(0).getNumberOfComponents(); i++) {
if (clonedSystem.getPhase(0).getComponent(i).getK() > 0) {
sumw[1] += clonedSystem.getPhase(0).getComponent(i).getz()
/ clonedSystem.getPhase(0).getComponent(i).getK();
}
sumw[1] += clonedSystem.getPhase(0).getComponent(i).getz()
/ clonedSystem.getPhase(0).getComponent(i).getK();
if (clonedSystem.getPhase(0).getComponent(i).getz() > 0) {
sumw[0] += clonedSystem.getPhase(0).getComponent(i).getK()
* clonedSystem.getPhase(0).getComponent(i).getz();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import neqsim.process.equipment.pipeline.AdiabaticTwoPhasePipe;
import neqsim.process.equipment.stream.Stream;

public class AdiabaticTwoPhasePipeTest {
Expand Down Expand Up @@ -42,10 +41,11 @@ public void testMain() {
// System.out.println("out pressure " + pipe2.getOutletStream().getPressure("bara"));
// System.out.println("velocity " + pipe2.getSuperficialVelocity());

Assertions.assertEquals(75.0000001, pipe2.getOutletStream().getFluid().getFlowRate("MSm3/day"));
Assertions.assertEquals(153.58741116226855, pipe.getOutletStream().getPressure("bara"));
Assertions.assertEquals(4.207400548548574, pipe.getSuperficialVelocity());
Assertions.assertEquals(146.28492500260614, pipe2.getOutletStream().getPressure("bara"));
Assertions.assertEquals(60.751298047046646, pipe2.getSuperficialVelocity());
Assertions.assertEquals(75.0000001, pipe2.getOutletStream().getFluid().getFlowRate("MSm3/day"),
1e-5);
Assertions.assertEquals(153.58741116226855, pipe.getOutletStream().getPressure("bara"), 1e-6);
Assertions.assertEquals(4.207400548548574, pipe.getSuperficialVelocity(), 1e-6);
Assertions.assertEquals(146.28492500260614, pipe2.getOutletStream().getPressure("bara"), 0.001);
Assertions.assertEquals(60.751298047046646, pipe2.getSuperficialVelocity(), 0.01);
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package neqsim.process.processmodel;

import static org.junit.jupiter.api.Assertions.assertAll;
import java.io.File;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import neqsim.process.equipment.compressor.Compressor;
import neqsim.process.equipment.expander.Expander;
import neqsim.process.equipment.heatexchanger.Cooler;
import neqsim.process.equipment.heatexchanger.Heater;
import neqsim.process.equipment.mixer.Mixer;
import neqsim.process.equipment.pump.Pump;
import neqsim.process.equipment.separator.Separator;
import neqsim.process.equipment.separator.ThreePhaseSeparator;
import neqsim.process.equipment.stream.Stream;
import neqsim.process.equipment.util.Recycle;
import neqsim.process.equipment.valve.ThrottlingValve;
import neqsim.thermo.system.SystemInterface;

Expand Down Expand Up @@ -235,10 +236,10 @@ public void testProcess2() {

Cooler dewPointControlCooler2 = new neqsim.process.equipment.heatexchanger.Cooler(
"dew point cooler 2", dewPointScrubber.getGasOutStream());
dewPointControlCooler2.setOutTemperature(-5.0, "C");
dewPointControlCooler2.setOutTemperature(-15.0, "C");
dewPointControlCooler2.setOutPressure(59.5, "bara");
dewPointControlCooler2.run();
Assertions.assertEquals(0.9808118997528,
Assertions.assertEquals(0.967383748675644,
dewPointControlCooler2.getOutStream().getFluid().getBeta(), 1e-6);
Separator dewPointScrubber2 = new neqsim.process.equipment.separator.Separator(
"dew point scrubber 2", dewPointControlCooler2.getOutStream());
Expand All @@ -259,6 +260,36 @@ public void testProcess2() {
lpLiqmixer.addStream(firstStageScrubber2.getLiquidOutStream());
lpLiqmixer.run();

Recycle hpResycle = new neqsim.process.equipment.util.Recycle("HP liq resycle");
hpResycle.addStream(hpLiqmixer.getOutStream());
hpResycle.setOutletStream(oilFirstStage);
hpResycle.setTolerance(1e-2);
hpResycle.run();

Recycle mpResycle = new neqsim.process.equipment.util.Recycle("MP liq resycle");
mpResycle.addStream(mpLiqmixer.getOutStream());
mpResycle.setOutletStream(oilSeccondStage);
mpResycle.setTolerance(1e-2);
mpResycle.run();

Recycle lpResycle = new neqsim.process.equipment.util.Recycle("LP liq resycle");
lpResycle.addStream(lpLiqmixer.getOutStream());
lpResycle.setOutletStream(oilThirdStage);
lpResycle.setTolerance(1e-2);
lpResycle.run();

Expander turboexpander =
new neqsim.process.equipment.expander.Expander("TEX", dewPointScrubber2.getGasOutStream());
turboexpander.setIsentropicEfficiency(0.80);
turboexpander.setOutletPressure(50.0);
turboexpander.run();
turboexpander.getFluid().prettyPrint();

Separator DPCUScrubber = new neqsim.process.equipment.separator.Separator("TEX LT scrubber",
turboexpander.getOutStream());
DPCUScrubber.run();

DPCUScrubber.getFluid().prettyPrint();
// richGasMixer.getOutStream().getFluid().prettyPrint();


Expand Down

0 comments on commit a056515

Please sign in to comment.