From 752ac78e5ae7597f8f42f2339f6c8235e84176a5 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Fri, 7 Jul 2023 11:12:22 +0000 Subject: [PATCH] added composition init --- src/main/java/neqsim/thermo/system/SystemThermo.java | 6 +++++- .../twoPhaseStirredCellNode/StirredCellNodeTest.java | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 37de15986..0496b2a07 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -1788,6 +1788,9 @@ public void reset() { /** {@inheritDoc} */ @Override public void init(int type) { + if (!isInitialized) { + calc_x_y(); + } if (this.numericDerivatives) { initNumeric(type); } else { @@ -1814,6 +1817,7 @@ public void init(int type, int phase) { * calculate all derivatives and 4 to calculate all derivatives numerically */ public void initAnalytic(int type) { + if (type == 0) { reInitPhaseInformation(); @@ -3387,7 +3391,7 @@ public void normalizeBeta() { /** {@inheritDoc} */ @Override public String[][] createTable(String name) { - + if (!isInitialized) { init_x_y(); } diff --git a/src/test/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNodeTest.java b/src/test/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNodeTest.java index 442eb0c56..1a94925f1 100644 --- a/src/test/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNodeTest.java +++ b/src/test/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNodeTest.java @@ -12,14 +12,14 @@ void testUpdate() { SystemInterface testSystem = new SystemSrkEos(313.3, 10.01325); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); StirredCell pipe1 = new StirredCell(2.0, 0.05); - //testSystem.addComponent("CO2", 1, "kg/hr", 0); + // testSystem.addComponent("CO2", 1, "kg/hr", 0); testSystem.addComponent("methane", 10, "kg/hr", 0); - //testSystem.addComponent("ethane", 1, "kg/hr", 0); - //testSystem.addComponent("n-hexane", 1.206862204876, "kg/min", 0); + // testSystem.addComponent("ethane", 1, "kg/hr", 0); + // testSystem.addComponent("n-hexane", 1.206862204876, "kg/min", 0); testSystem.addComponent("nC10", 3, "kg/hr", 1); testSystem.setMixingRule(2); - - //testSystem.prettyPrint(); + testSystem.initProperties(); + StirredCellNode test = new StirredCellNode(testSystem, pipe1); test.setInterphaseModelType(1); test.getFluidBoundary().useFiniteFluxCorrection(true); @@ -35,6 +35,6 @@ void testUpdate() { test.update(); // test.getBulkSystem().prettyPrint(); } - //test.getBulkSystem().prettyPrint(); + // test.getBulkSystem().prettyPrint(); } }