Skip to content

Commit

Permalink
prepare for v 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Oct 6, 2024
1 parent fc20369 commit d529710
Show file tree
Hide file tree
Showing 18 changed files with 230 additions and 274 deletions.
25 changes: 4 additions & 21 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.224.3/containers/python-3
{
"name": "Python 3",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.10",
// Options
"NODE_VERSION": "none"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.linting.enabled": true,
Expand All @@ -30,26 +22,17 @@
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
"ms-vscode.test-adapter-converter",
"ms-azuretools.vscode-docker"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
//"postCreateCommand": "pip3 install --user -r .devcontainer/requirements.txt",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
//"remoteUser": "vscode",
"forwardPorts": [],
"postCreateCommand": "pip3 install --user -r .devcontainer/requirements.txt",
"remoteUser": "vscode",
"features": {
"java": "latest"
"java": "21.0.4-tem"
}

}
2 changes: 1 addition & 1 deletion examples/heatExchanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
fluid2.setMixingRule(2)
fluid2.setTemperature(28.15, "C")
fluid2.setPressure(3.0, "bara")
fluid2.setTotalFlowRate(2700.0, "m^3/hr")
fluid2.setTotalFlowRate(2700.0, "Sm3/hr")


# demonstration of setting up a simple process calculation
Expand Down
28 changes: 14 additions & 14 deletions examples/jupyter/examplesInPython.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
}
],
"source": [
"thermoSystem = jNeqSim.thermo.system.SystemSrkEos(280.0,10.0)\n",
"thermoSystem = jneqsim.thermo.system.SystemSrkEos(280.0,10.0)\n",
"thermoSystem.addComponent(\"methane\", 10.0)\n",
"thermoSystem.addComponent(\"water\", 4.0)\n",
"\n",
"thermoOps = jNeqSim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps = jneqsim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps.TPflash()\n",
"\n",
"#thermoSystem.display()\n",
Expand Down Expand Up @@ -89,15 +89,15 @@
}
],
"source": [
"thermoSystem = jNeqSim.thermo.system.SystemSrkEos(280.0,10.0)\n",
"thermoSystem = jneqsim.thermo.system.SystemSrkEos(280.0,10.0)\n",
"thermoSystem.addComponent(\"nitrogen\", 1.0)\n",
"thermoSystem.addComponent(\"methane\", 70.0)\n",
"thermoSystem.addComponent(\"ethane\", 4.0)\n",
"thermoSystem.addComponent(\"propane\", 2.0)\n",
"thermoSystem.addComponent(\"i-butane\", 1.0)\n",
"thermoSystem.addComponent(\"n-butane\", 1.0)\n",
"\n",
"thermoOps = jNeqSim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps = jneqsim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps.calcPTphaseEnvelope()\n",
"\n",
"plt.plot(list(thermoOps.getOperation().get(\"dewT\")),list(thermoOps.getOperation().get(\"dewP\")), label=\"dew point\")\n",
Expand Down Expand Up @@ -130,13 +130,13 @@
}
],
"source": [
"thermoSystem = jNeqSim.thermo.system.SystemSrkEos(280.0,60.0)\n",
"thermoSystem = jneqsim.thermo.system.SystemSrkEos(280.0,60.0)\n",
"thermoSystem.addComponent(\"methane\", 90.0)\n",
"thermoSystem.addComponent(\"ethane\", 10.0)\n",
"thermoSystem.addComponent(\"propane\", 1.0)\n",
"thermoSystem.addComponent(\"water\", 4.0)\n",
"thermoSystem.setHydrateCheck(True);\n",
"thermoOps = jNeqSim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps = jneqsim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps.hydrateFormationTemperature()\n",
"\n",
"print(\"Hydrate equilibrium temperature \", thermoSystem.getTemperature()-273.15, \" C\")"
Expand Down Expand Up @@ -176,7 +176,7 @@
}
],
"source": [
"thermoSystem = jNeqSim.thermo.system.SystemSrkEos(280.0,60.0)\n",
"thermoSystem = jneqsim.thermo.system.SystemSrkEos(280.0,60.0)\n",
"thermoSystem.addComponent(\"nitrogen\", 2.0)\n",
"thermoSystem.addComponent(\"CO2\", 1.0)\n",
"thermoSystem.addComponent(\"methane\", 10.0)\n",
Expand All @@ -191,7 +191,7 @@
"thermoSystem.getCharacterization().characterisePlusFraction();\n",
"thermoSystem.setMixingRule(2)\n",
"\n",
"thermoOps = jNeqSim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps = jneqsim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps.TPflash()\n",
"\n",
"#thermoSystem.display()\n",
Expand All @@ -203,7 +203,7 @@
"print(\"gas density \", gasDensity)\n",
"print(\"oil density \", oilDensity)\n",
"\n",
"thermoOps = jNeqSim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps = jneqsim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps.calcPTphaseEnvelope()\n",
"\n",
"plt.plot(list(thermoOps.getOperation().get(\"dewT\")),list(thermoOps.getOperation().get(\"dewP\")), label=\"dew point\")\n",
Expand Down Expand Up @@ -237,9 +237,9 @@
}
],
"source": [
"processEquipment = jNeqSim.processSimulation.processEquipment\n",
"processEquipment = jneqsim.processSimulation.processEquipment\n",
"\n",
"testSystem = jNeqSim.thermo.system.SystemSrkEos((273.15+50.0),50.00);\n",
"testSystem = jneqsim.thermo.system.SystemSrkEos((273.15+50.0),50.00);\n",
"testSystem.addComponent(\"methane\", 900.00);\n",
"testSystem.addComponent(\"ethane\", 200.00);\n",
"testSystem.addComponent(\"n-hexane\", 200.0);\n",
Expand Down Expand Up @@ -282,7 +282,7 @@
"HPcompressor = processEquipment.compressor.Compressor(mixer.getOutStream());\n",
"HPcompressor.setOutletPressure(200.0);\n",
" \n",
"operations = jNeqSim.processSimulation.processSystem.ProcessSystem();\n",
"operations = jneqsim.processSimulation.processSystem.ProcessSystem();\n",
"operations.add(stream_1);\n",
"operations.add(mixerHP);\n",
"operations.add(separator);\n",
Expand Down Expand Up @@ -339,11 +339,11 @@
}
],
"source": [
"thermoSystem = jNeqSim.thermo.system.SystemSrkEos(280.0,10.0)\n",
"thermoSystem = jneqsim.thermo.system.SystemSrkEos(280.0,10.0)\n",
"thermoSystem.addComponent(\"methane\", 10.0)\n",
"thermoSystem.addComponent(\"ethane\", 4.0)\n",
"\n",
"thermoOps = jNeqSim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps = jneqsim.thermodynamicOperations.ThermodynamicOperations(thermoSystem)\n",
"thermoOps.TPflash()\n",
"\n",
"def enthalpy(P):\n",
Expand Down
8 changes: 4 additions & 4 deletions examples/jupyter/separatorEfficiency.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"from neqsim.process import (clearProcess, compressor, heater, runProcess,\n",
" separator, stream, valve, viewProcess, separator3phase, cooler)\n",
"from neqsim.thermo import fluid, printFrame\n",
"from neqsim import jNeqSim\n",
"from neqsim import jneqsim\n",
"\n",
"factor = 1.0\n",
"\n",
Expand All @@ -85,7 +85,7 @@
"fractions['C11'] = ['nC11']\n",
"fractions['C12'] = ['nC12']\n",
"\n",
"fluid1 = jNeqSim.thermo.system.SystemUMRPRUMCEos(280.0, 10.0)\n",
"fluid1 = jneqsim.thermo.system.SystemUMRPRUMCEos(280.0, 10.0)\n",
"fluid1.addComponent(\"CO2\", 0.00591)\n",
"fluid1.addComponent(\"nitrogen\", 0.00971)\n",
"fluid1.addComponent(\"methane\", 0.948)\n",
Expand Down Expand Up @@ -154,7 +154,7 @@
"exportGasFluid.setTemperature(0.0, \"C\")\n",
"exportGasFluid.setPressure(10.0, \"bara\")\n",
"\n",
"cvdSim = jNeqSim.PVTsimulation.simulation.SaturationPressure(exportGasFluid)\n",
"cvdSim = jneqsim.PVTsimulation.simulation.SaturationPressure(exportGasFluid)\n",
"cvdSim.run()\n",
"\n",
"\n",
Expand Down Expand Up @@ -193,7 +193,7 @@
" exportGasFluid = separator2.getGasOutStream().getFluid().clone()\n",
" exportGasFluid.setTemperature(0.0, \"C\")\n",
" exportGasFluid.setPressure(10.0, \"bara\")\n",
" cvdSim = jNeqSim.PVTsimulation.simulation.SaturationPressure(exportGasFluid)\n",
" cvdSim = jneqsim.PVTsimulation.simulation.SaturationPressure(exportGasFluid)\n",
" cvdSim.run()\n",
" c6plus.append(getC6plus(exportGasFluid)*100)\n",
" dewpointpressure.append(cvdSim.getSaturationPressure()-1.01325)\n",
Expand Down
6 changes: 3 additions & 3 deletions neqsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
It uses the Jpype module for bridging python and Java.
"""

from neqsim.neqsimpython import jNeqSim, jpype
from neqsim.neqsimpython import jneqsim, jpype


def methods(checkClass):
Expand All @@ -26,8 +26,8 @@ def has_tabulate():


def setDatabase(connectionString):
jNeqSim.util.database.NeqSimDataBase.setConnectionString(connectionString)
jNeqSim.util.database.NeqSimDataBase.setCreateTemporaryTables(True)
jneqsim.util.database.NeqSimDataBase.setConnectionString(connectionString)
jneqsim.util.database.NeqSimDataBase.setCreateTemporaryTables(True)


def save_xml(javaobject, filename):
Expand Down
2 changes: 1 addition & 1 deletion neqsim/neqsimpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
)
print("See: https://github.com/equinor/neqsimpython#prerequisites")

jNeqSim = jpype.JPackage("neqsim")
jneqsim = jpype.JPackage("neqsim")
6 changes: 3 additions & 3 deletions neqsim/process/measurement.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from neqsim import jNeqSim
from neqsim import jneqsim
import jpype
import jpype.imports
from jpype import JImplements, JOverride
Expand All @@ -10,8 +10,8 @@


@JImplements(
jNeqSim.processSimulation.measurementDevice.MeasurementDeviceInterface
) # Use the fully qualified class name directly from the jNeqSim package
jneqsim.processSimulation.measurementDevice.MeasurementDeviceInterface
) # Use the fully qualified class name directly from the jneqsim package
class measurement:
def __init__(self):
self.name = ""
Expand Down
Loading

0 comments on commit d529710

Please sign in to comment.