Skip to content

Commit

Permalink
add ref process test (#1093)
Browse files Browse the repository at this point in the history
* add ref process test

* added test

* update

* modified multiphase separator flash

* update

* update test

* update test

* remove output characterization test
  • Loading branch information
EvenSol authored Sep 8, 2024
1 parent ff49e52 commit 723337b
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass;
import neqsim.processSimulation.processEquipment.stream.Stream;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
Expand Down Expand Up @@ -196,10 +195,7 @@ public double calcMixStreamEnthalpy() {
for (int k = 0; k < streams.size(); k++) {
streams.get(k).getThermoSystem().init(3);
enthalpy += streams.get(k).getThermoSystem().getEnthalpy();
// System.out.println("total enthalpy k : " + ( ((Stream)
// streams.get(k)).getThermoSystem()).getEnthalpy());
}
// System.out.println("total enthalpy of streams: " + enthalpy);
return enthalpy;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class ThreePhaseSeparator extends Separator {
double aqueousInOil = 0.00;
String aqueousInOilSpec = "mole";

boolean useTempMultiPhaseCheck = false;

/**
* <p>
* Constructor for ThreePhaseSeparator.
Expand Down Expand Up @@ -162,9 +164,15 @@ public void run(UUID id) {
inletStreamMixer.run(id);
thermoSystem = inletStreamMixer.getOutletStream().getThermoSystem().clone();

thermoSystem.setMultiPhaseCheck(true);
if (!thermoSystem.doMultiPhaseCheck()) {
useTempMultiPhaseCheck = true;
thermoSystem.setMultiPhaseCheck(true);
}
ThermodynamicOperations thermoOps = new ThermodynamicOperations(thermoSystem);
thermoOps.TPflash();
if (useTempMultiPhaseCheck) {
thermoSystem.setMultiPhaseCheck(false);
}
// thermoSystem.display();
thermoSystem.addPhaseFractionToPhase(gasInAqueous, gasInAqueousSpec, specifiedStream, "gas",
"aqueous");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
package neqsim.processSimulation.processSystem;

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

public class ReferenceProcessTest extends neqsim.NeqSimTest {

@Test
public void testProcess() {
SystemInterface thermoSystem = new SystemSrkEos(298.0, 10.0);
thermoSystem.addComponent("nitrogen", 51.0);
thermoSystem.addComponent("CO2", 51.0);
thermoSystem.addComponent("methane", 51.0);
thermoSystem.addComponent("ethane", 51.0);
thermoSystem.addComponent("propane", 51.0);
thermoSystem.addComponent("i-butane", 51.0);
thermoSystem.addComponent("n-butane", 51.0);
thermoSystem.addComponent("iC5", 51.0);
thermoSystem.addComponent("nC5", 1.0);

thermoSystem.addTBPfraction("C6", 1.0, 86.0 / 1000.0, 0.66);
thermoSystem.addTBPfraction("C7", 1.0, 91.0 / 1000.0, 0.74);
thermoSystem.addTBPfraction("C8", 1.0, 103.0 / 1000.0, 0.77);
thermoSystem.addTBPfraction("C9", 1.0, 117.0 / 1000.0, 0.79);
thermoSystem.addPlusFraction("C10_C12", 1.0, 145.0 / 1000.0, 0.80);
thermoSystem.addPlusFraction("C13_C14", 1.0, 181.0 / 1000.0, 0.8279);
thermoSystem.addPlusFraction("C15_C16", 1.0, 212.0 / 1000.0, 0.837);
thermoSystem.addPlusFraction("C17_C19", 1.0, 248.0 / 1000.0, 0.849);
thermoSystem.addPlusFraction("C20_C22", 1.0, 289.0 / 1000.0, 0.863);
thermoSystem.addPlusFraction("C23_C25", 1.0, 330.0 / 1000.0, 0.875);
thermoSystem.addPlusFraction("C26_C30", 1.0, 387.0 / 1000.0, 0.88);
thermoSystem.addPlusFraction("C31_C38", 1.0, 471.0 / 1000.0, 0.90);
thermoSystem.addPlusFraction("C38_C80", 1.0, 662.0 / 1000.0, 0.92);
thermoSystem.setMixingRule("classic");
// thermoSystem.setMultiPhaseCheck(true);

thermoSystem.setMolarComposition(new double[] {0.005269, 0.039189, 0.700553, 0.091154, 0.050908,
0.007751, 0.014665, 0.004249, 0.004878, 0.004541, 0.007189, 0.006904, 0.004355, 0.007658,
0.003861, 0.003301, 0.002624, 0.001857, 0.001320, 0.001426, 0.001164, 0.000916});

neqsim.processSimulation.processEquipment.stream.Stream wellStream =
new neqsim.processSimulation.processEquipment.stream.Stream(thermoSystem);
wellStream.setName("well stream");
wellStream.setTemperature(70.0, "C");
wellStream.setPressure(90.0, "bara");

neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator firstStageSeparator =
new neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator(wellStream);
firstStageSeparator.setName("1st stage separator");

neqsim.processSimulation.processEquipment.heatExchanger.Heater oilHeaterSecondStage =
new neqsim.processSimulation.processEquipment.heatExchanger.Heater(
firstStageSeparator.getOilOutStream());
oilHeaterSecondStage.setName("oil heater second stage");
oilHeaterSecondStage.setOutPressure(30.0);
oilHeaterSecondStage.setOutTemperature(68.0, "C");

neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator secondStageSeparator =
new neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator(
oilHeaterSecondStage.getOutStream());
secondStageSeparator.setName("2nd stage separator");

neqsim.processSimulation.processEquipment.heatExchanger.Heater oilHeaterThirdStage =
new neqsim.processSimulation.processEquipment.heatExchanger.Heater(
secondStageSeparator.getOilOutStream());
oilHeaterThirdStage.setName("oil heater third stage");
oilHeaterThirdStage.setOutPressure(2.8);
oilHeaterThirdStage.setOutTemperature(70.0, "C");

neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator thirdStageSeparator =
new neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator(
oilHeaterThirdStage.getOutStream());
thirdStageSeparator.setName("3rd stage separator");

neqsim.processSimulation.processEquipment.heatExchanger.Heater oilHeaterStandardStage =
new neqsim.processSimulation.processEquipment.heatExchanger.Heater(
thirdStageSeparator.getOilOutStream());
oilHeaterStandardStage.setName("oil heater standard stage");
oilHeaterStandardStage.setOutPressure(1.01325);
oilHeaterStandardStage.setOutTemperature(15.0, "C");

neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator standardStageSeparator =
new neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator(
oilHeaterStandardStage.getOutStream());
standardStageSeparator.setName("standard stage separator");

neqsim.processSimulation.processEquipment.mixer.Mixer gasMixer =
new neqsim.processSimulation.processEquipment.mixer.Mixer("gas mixer");
gasMixer.addStream(firstStageSeparator.getGasOutStream());
gasMixer.addStream(secondStageSeparator.getGasOutStream());
gasMixer.addStream(thirdStageSeparator.getGasOutStream());
gasMixer.addStream(standardStageSeparator.getGasOutStream());

neqsim.processSimulation.processEquipment.stream.Stream exportoil =
new neqsim.processSimulation.processEquipment.stream.Stream("export oil",
standardStageSeparator.getOilOutStream());
neqsim.processSimulation.processEquipment.stream.Stream exportgas =
new neqsim.processSimulation.processEquipment.stream.Stream("export gas",
gasMixer.getOutStream());

neqsim.processSimulation.processSystem.ProcessSystem oilprocess =
new neqsim.processSimulation.processSystem.ProcessSystem();
oilprocess.add(wellStream);
oilprocess.add(firstStageSeparator);
oilprocess.add(oilHeaterSecondStage);
oilprocess.add(secondStageSeparator);
oilprocess.add(oilHeaterThirdStage);
oilprocess.add(thirdStageSeparator);
oilprocess.add(oilHeaterStandardStage);
oilprocess.add(standardStageSeparator);
oilprocess.add(gasMixer);
oilprocess.add(exportoil);
oilprocess.add(exportgas);

oilprocess.run();

assertEquals(28.74349, gasMixer.getOutStream().getTemperature("C"), 0.01);
assertEquals(2278.2594247, exportgas.getFlowRate("Sm3/hr") / exportoil.getFlowRate("idSm3/hr"),
0.01);

}

}
22 changes: 11 additions & 11 deletions src/test/java/neqsim/thermo/characterization/CharacteriseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ void testCharacterisePlusFraction() {
thermoSystem.addTBPfraction("C8", 1.0, 120.0 / 1000.0, 0.76);
thermoSystem.addTBPfraction("C9", 1.0, 140.0 / 1000.0, 0.79);
thermoSystem.addPlusFraction("C10", 11.0, 290.0 / 1000.0, 0.82);
//thermoSystem.getCharacterization().getLumpingModel().setNumberOfLumpedComponents(6);
//thermoSystem.getCharacterization().setLumpingModel("PVTlumpingModel");
// thermoSystem.getCharacterization().getLumpingModel().setNumberOfLumpedComponents(6);
// thermoSystem.getCharacterization().setLumpingModel("PVTlumpingModel");
thermoSystem.getCharacterization().setLumpingModel("no lumping");
thermoSystem.getCharacterization().characterisePlusFraction();
// assertEquals(15, thermoSystem.getNumberOfComponents());
thermoSystem.prettyPrint();
// assertEquals(15, thermoSystem.getNumberOfComponents());
// thermoSystem.prettyPrint();
}


@Test
void testCharacterisePlusFractionGAMMA() {
thermoSystem = new SystemSrkEos(298.0, 10.0);
Expand All @@ -53,18 +53,18 @@ void testCharacterisePlusFractionGAMMA() {
thermoSystem.getCharacterization().getLumpingModel().setNumberOfLumpedComponents(15);
thermoSystem.getCharacterization().characterisePlusFraction();
// logger.info("number of components " + thermoSystem.getNumberOfComponents());
//assertEquals(86, thermoSystem.getNumberOfComponents());
//System.out.println(thermoSystem.getComponent("C1-2_PC").getz());
thermoSystem.prettyPrint();
// assertEquals(86, thermoSystem.getNumberOfComponents());
// System.out.println(thermoSystem.getComponent("C1-2_PC").getz());
// thermoSystem.prettyPrint();

thermoSystem.setPressure(1, "bara");


ThermodynamicOperations thermoOps = new ThermodynamicOperations(thermoSystem);
ThermodynamicOperations thermoOps = new ThermodynamicOperations(thermoSystem);
thermoOps.TPflash();

thermoSystem.initProperties();
thermoSystem.prettyPrint();
// thermoSystem.prettyPrint();
}

}

0 comments on commit 723337b

Please sign in to comment.