Skip to content

Commit

Permalink
rebase on master (#693)
Browse files Browse the repository at this point in the history
* 684 addfluid is not adding pc if not existing (#685)

* added test for addFLuids

* updated test

* updated test with new pseudo component

* solution for bug

* refact: simplified if-else nesting

---------

Co-authored-by: Åsmund Våge Fannemel <[email protected]>

* dont do log of zeros (#688)

* AddfluidHighTemp (#689)

* added test for addFLuids

* updated test

* updated test with new pseudo component

* solution for bug

* add test TPflas high

* added gitlense extension

* update

* update

* update test

---------

Co-authored-by: Åsmund Våge Fannemel <[email protected]>
  • Loading branch information
EvenSol and asmfstatoil authored May 21, 2023
1 parent 1eaa894 commit 691a712
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"ms-vscode.test-adapter-converter",
"shengchen.vscode-checkstyle",
"mechatroner.rainbow-csv",
"redhat.vscode-xml"
"redhat.vscode-xml",
"eamodio.gitlens"
]


Expand Down
10 changes: 9 additions & 1 deletion src/main/java/neqsim/thermo/system/SystemThermo.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,15 @@ public SystemInterface addFluid(SystemInterface addSystem) {
addSystem.getPhase(0).getComponent(i).getMolarMass(),
addSystem.getPhase(0).getComponent(i).getNormalLiquidDensity());
} else {
addComponent(addSystem.getComponent(i));
if (addSystem.getPhase(0).getComponent(i).isIsTBPfraction()) {
addTBPfraction(
addSystem.getPhase(0).getComponent(i).getComponentName().replaceFirst("_PC", ""),
addSystem.getPhase(0).getComponent(i).getNumberOfmoles(),
addSystem.getPhase(0).getComponent(i).getMolarMass(),
addSystem.getPhase(0).getComponent(i).getNormalLiquidDensity());
} else {
addComponent(addSystem.getComponent(i));
}
}
}
if (addedNewComponent) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package neqsim.thermodynamicOperations.flashOps;

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

/**
* @author ESOL
*
*/
class TPFlashTestHighTemp {

static neqsim.thermo.system.SystemInterface testSystem = null;
static ThermodynamicOperations testOps = null;

/**
* @throws java.lang.Exception
*/
@BeforeEach
void setUp() throws Exception {
testSystem = new neqsim.thermo.system.SystemSrkEos(243.15, 300.0);
testSystem.addComponent("nitrogen", 1.64e-3);
testSystem.addComponent("CO2", 1.64e-3);
testSystem.addComponent("H2S", 1.64e-3);
testSystem.addComponent("methane", 90.0);
testSystem.addComponent("ethane", 2.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", 1.0);
testSystem.addComponent("n-heptane", 1.0);
testSystem.addComponent("n-octane", 1.0);
testSystem.addComponent("n-nonane", 1.0);
testSystem.addComponent("nC10", 1.0);
testSystem.addComponent("nC11", 1.0);
testSystem.addComponent("nC12", 1.0);
testSystem.addComponent("nC13", 1.0);
testSystem.addComponent("nC14", 1.0);
testSystem.addComponent("nC15", 1.0);
testSystem.addComponent("nC16", 1.0);
testSystem.addComponent("nC17", 1.0);
testSystem.addComponent("nC18", 1.0);
testSystem.addComponent("nC19", 1.0);


testSystem.setMixingRule("classic");

testSystem.setMolarComposition(new double[] {1.63e-3, 3.23e-3, 0, 3e-1, 4.6e-2, 1.4e-2, 2.2e-2,
3.9e-3, 8.8e-3, 2.6e-3, 3.2e-2, 1.2e-1, 1.5e-1, 9.8e-2, 7.6e-2, 4.1e-2, 2.5e-2, 1.6e-2,
1e-2, 5.6e-3, 2.7e-3, 1.3e-3, 8.7e-4, 3.8e-4});
// testSystem.setMultiPhaseCheck(true);
}

@Test
void testRun() {
testSystem.setPressure(88, "bara");
/*
* for (int i = 0; i < 400; i++) { testSystem.setTemperature(0.0 + i * 1, "C"); testOps = new
* ThermodynamicOperations(testSystem); testOps.TPflash(); testSystem.initProperties();
* System.out.print(testSystem.getPhaseFraction("gas", "mole") + " numerofphases " +
* testSystem.getNumberOfPhases() + " temp " + testSystem.getTemperature("C") + " hasoil " +
* testSystem.hasPhaseType("oil") + " gibbs energy " + testSystem.getGibbsEnergy() +
* " gibbs energy " + " density " + testSystem.getDensity("kg/m3") + " \n"); }
*/
testSystem.setTemperature(268.0, "C");
testOps = new ThermodynamicOperations(testSystem);
testOps.TPflash();
assertEquals(0.006832557441121211, testSystem.getPhaseFraction("gas", "mole"), 0.0001);
}
}

0 comments on commit 691a712

Please sign in to comment.