From 2f43e3f8dfb8122278d439f4d407d72a2ec0cf37 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Thu, 9 May 2024 22:38:43 +0200 Subject: [PATCH] update units (#1008) --- src/main/java/neqsim/util/unit/Units.java | 14 ++++++++------ .../neqsim/thermo/system/SystemThermoTest.java | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/main/java/neqsim/util/unit/Units.java b/src/main/java/neqsim/util/unit/Units.java index d3db0eef1..a221d9ce3 100644 --- a/src/main/java/neqsim/util/unit/Units.java +++ b/src/main/java/neqsim/util/unit/Units.java @@ -30,9 +30,10 @@ public UnitDescription(String symbol, String symbolName) { private static HashMap siUnits = new HashMap<>(); private static HashMap fieldUnits = new HashMap<>(); - private static String[] pressureUnits = new String[] { "Pa", "bara", "barg", "psi", "psig", "psia" }; - private static String[] temperatureUnits = new String[] { "K", "C", "F", "R" }; - private static String[] molarVolumeUnits = new String[] { "mol/m3", "litre/m3", "ft3/lbmole" }; + private static String[] pressureUnits = + new String[] {"Pa", "bara", "barg", "psi", "psig", "psia"}; + private static String[] temperatureUnits = new String[] {"K", "C", "F", "R"}; + private static String[] molarVolumeUnits = new String[] {"mol/m3", "litre/m3", "ft3/lbmole"}; public Units() { if (activeUnits.size() == 0) { @@ -48,15 +49,16 @@ public Units() { activeUnits.put("JT coefficient", new UnitDescription("C/bar", "Celsius per bar")); activeUnits.put("speed of sound", new UnitDescription("m/sec", "meter per second")); activeUnits.put("Heat Capacity (Cv)", - new UnitDescription("kJ/kg*K", "kilo joule per kg and Kelvin")); + new UnitDescription("kJ/kgK", "kilo joule per kg and Kelvin")); activeUnits.put("Heat Capacity (Cp)", - new UnitDescription("kJ/kg*K", "kilo joule per kg and Kelvin")); + new UnitDescription("kJ/kgK", "kilo joule per kg and Kelvin")); activeUnits.put("Molar Mass", new UnitDescription("kg/mol", "kilo gram per kilo mole")); activeUnits.put("molar volume", new UnitDescription("m3/mol", "cubic metre per mole")); activeUnits.put("mass flow", new UnitDescription("kg/hr", "kg per hour")); activeUnits.put("molar flow", new UnitDescription("mole/hr", "mole per hour")); activeUnits.put("volume flow", new UnitDescription("m3/hr", "cubic metre per hour")); - activeUnits.put("standard volume flow", new UnitDescription("Sm3/hr", "standard cubic metre per hour")); + activeUnits.put("standard volume flow", + new UnitDescription("Sm3/hr", "standard cubic metre per hour")); siUnits.putAll(activeUnits); // Makes a copy of activeUnits siUnits.put("temperature", new UnitDescription("K", "Kelvin")); diff --git a/src/test/java/neqsim/thermo/system/SystemThermoTest.java b/src/test/java/neqsim/thermo/system/SystemThermoTest.java index 4f710bcfe..be86f1de2 100644 --- a/src/test/java/neqsim/thermo/system/SystemThermoTest.java +++ b/src/test/java/neqsim/thermo/system/SystemThermoTest.java @@ -28,6 +28,23 @@ public static void setUp() { testSystem.initProperties(); } + /** + *

+ * setUp. + *

+ */ + @Test + public void testCp() { + testSystem = new neqsim.thermo.system.SystemPrEos(273.15 + 40.0, 1.0); + testSystem.addComponent("methane", 10.01); + testSystem.addComponent("nC20", 10.68); + testSystem.setMixingRule("classic"); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + testOps.TPflash(); + testSystem.initProperties(); + assertEquals(2.274301427480528, testSystem.getPhase(0).getCp("kJ/kgK"), 1e-6); + } + /** *

* test setPressure