Skip to content

Commit

Permalink
Merge pull request #289 from equinor/further-prepare-for-version-30
Browse files Browse the repository at this point in the history
update to reflect correct package names
  • Loading branch information
EvenSol authored Oct 6, 2024
2 parents 8abe30f + 3f7358b commit 211024a
Show file tree
Hide file tree
Showing 29 changed files with 240 additions and 218 deletions.
8 changes: 4 additions & 4 deletions examples/TEP08design.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
fluid1.setTotalFlowRate(10.0, "MSm3/day")

clearProcess()
stream1 = stream(fluid1)
separator1 = separator(stream1, "inlet separator")
stream1 = stream("steam1", fluid1)
separator1 = separator("inlet separator", stream1)

cooler1 = heater(separator1.getGasOutStream())
cooler1 = heater("heat1", separator1.getGasOutStream())
cooler1.setOutTemperature(273.15 + 30.0)

scrubber1 = separator(cooler1.getOutStream(), "inlet separator")
scrubber1 = separator("inlet separator2", cooler1.getOutStream())

runProcess()

Expand Down
22 changes: 11 additions & 11 deletions examples/asterix.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@
clearProcess()

# INLET SEPARATOR (S1)
cond_in = stream(cond)
MEG_in = stream(MEG)
gas_in = stream(gas)
mix1 = mixer()
cond_in = stream("stream1", cond)
MEG_in = stream("meg stream", MEG)
gas_in = stream("stram gas", gas)
mix1 = mixer("mixer 1")
mix1.addStream(cond_in)
mix1.addStream(MEG_in)
mix1.addStream(gas_in)
TPflash(mix1.getOutStream().getThermoSystem())
S1 = separator3phase(mix1.getOutStream())
S1 = separator3phase("separator", mix1.getOutStream())
S1.setName("S1")

gas1 = S1.getGasOutStream()
Expand All @@ -205,10 +205,10 @@
mix2 = mixer()
mix2.addStream(cond1)
mix2.addStream(MEG1)
heat2 = heater(mix2.getOutStream())
heat2 = heater("heater", mix2.getOutStream())
heat2.setOutTemperature(T[1] + 273.15)
heat2.setOutPressure(P[1])
S2 = separator3phase(heat2.getOutStream())
S2 = separator3phase("sep2", heat2.getOutStream())
S2.setName("S2")
gas2 = S2.getGasOutStream()
MEG2 = S2.getWaterOutStream()
Expand All @@ -217,19 +217,19 @@

# THIRD SEPARATOR (S3)
# make split
split = splitter(cond2, [carryunderfrac, 1.0 - carryunderfrac])
split = splitter("splitter 1", cond2, [carryunderfrac, 1.0 - carryunderfrac])
carryunder = split.getSplitStream(0)


# mix, set new condition, separate
mix3 = mixer()
mix3 = mixer("mixer 2")
mix3.addStream(carryunder)
mix3.addStream(MEG2)
MEG2_plus_carryunder = mix3.getOutStream()
heat3 = heater(MEG2_plus_carryunder)
heat3 = heater("heater 22", MEG2_plus_carryunder)
heat3.setOutTemperature(T[2] + 273.15)
heat3.setOutPressure(P[2])
S3 = separator3phase(heat3.getOutStream())
S3 = separator3phase("sep22", heat3.getOutStream())
S3.setInletStream(heat3.getOutStream())
S3.setName("S3")
gas3 = S3.getGasOutStream()
Expand Down
4 changes: 2 additions & 2 deletions examples/compressorCalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

# Setting up a process with an inpu stream and a compressor
clearProcess()
stream1 = stream(naturalgasFluid)
compressor2 = compressor(stream1)
stream1 = stream("stream 1", naturalgasFluid)
compressor2 = compressor("compressor 1", stream1)


# setting up the compressor performance
Expand Down
4 changes: 2 additions & 2 deletions examples/compressorCurves.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
# demonstration of setting up a simple process calculation

clearProcess()
stream1 = stream(fluid1)
compressor2 = compressor(stream1, 51.0)
stream1 = stream("stream 1", fluid1)
compressor2 = compressor("compressor 1", stream1, 51.0)


MW = 28.01
Expand Down
10 changes: 6 additions & 4 deletions examples/compressorTrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
# demonstration of setting up a simple process calculation

clearProcess()
stream1 = stream(fluid1)
compressor1 = compressor(stream1, 60.0) # add compressor and set out pressure
stream1 = stream("stream 1", fluid1)
compressor1 = compressor(
"compressor 1", stream1, 60.0
) # add compressor and set out pressure
compressor1.setIsentropicEfficiency(0.8)
cooler1 = heater(compressor1.getOutStream())
cooler1 = heater("coller 1", compressor1.getOutStream())
cooler1.setOutTemperature(303.0)
compressor2 = compressor(cooler1.getOutStream(), 120.0)
compressor2 = compressor("compressor 2", cooler1.getOutStream(), 120.0)
compressor2.setIsentropicEfficiency(0.77)

runProcess()
Expand Down
26 changes: 13 additions & 13 deletions examples/glycolprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,29 @@

# demonstration of setting up a simple process calculation
clearProcess()
stream1 = stream(fluid1)
glycolstream = stream(fluid2)
separator1 = separator(stream1, "inlet separator")
compressor1 = compressor(separator1.getGasOutStream(), 75.0)
stream1 = stream("stream 1", fluid1)
glycolstream = stream("stream 2", fluid2)
separator1 = separator("sep 1", stream1)
compressor1 = compressor("comp 1", separator1.getGasOutStream(), 75.0)

heater1 = heater(compressor1.getOutStream())
heater1 = heater("heater 1", compressor1.getOutStream())
heater1.setOutTemperature(313.0)

mixer1 = mixer()
mixer1 = mixer("mixer 1")
mixer1.addStream(heater1.getOutStream())
mixer1.addStream(glycolstream)

scrubberLP = separator(mixer1.getOutStream())
valve1 = valve(scrubberLP.getLiquidOutStream(), 10.0, "Glycol valve")
flashDrum = separator(valve1.getOutStream())
heater1 = heater(flashDrum.getLiquidOutStream())
scrubberLP = separator("sep1", mixer1.getOutStream())
valve1 = valve("valve1", scrubberLP.getLiquidOutStream(), 10.0)
flashDrum = separator("sep2", valve1.getOutStream())
heater1 = heater("heat2", flashDrum.getLiquidOutStream())
heater1.setOutTemperature(273.15 + 195.0)
stripper = separator(heater1.getOutStream())
stripper = separator("sep4", heater1.getOutStream())

cooler1 = heater(stripper.getLiquidOutStream())
cooler1 = heater("cooler5", stripper.getLiquidOutStream())
cooler1.setOutTemperature(313.0)

pump1 = pump(cooler1.getOutStream(), 75.0)
pump1 = pump("pump5", cooler1.getOutStream(), 75.0)


runProcess()
Expand Down
6 changes: 3 additions & 3 deletions examples/heatExchanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@

# demonstration of setting up a simple process calculation
clearProcess()
stream1 = stream(fluid1)
stream2 = stream(fluid2)
stream1 = stream("stream1", fluid1)
stream2 = stream("stream2", fluid2)

heatExchanger1 = heatExchanger(stream1, stream2, "exchanger1")
heatExchanger1 = heatExchanger("exchanger1", stream1, stream2)
runProcess()

# heatExchanger1.displayResult()
Expand Down
12 changes: 6 additions & 6 deletions examples/heatpump.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@
fluid_1.setTotalFlowRate(1000.0, "kg/hr")

clearProcess()
stream_1 = stream(fluid_1)
stream_1 = stream("stream1", fluid_1)
stream_1.setSpecification("bubT")

JTvalve = valve(stream_1, 1.0)
JTvalve = valve("valve 1", stream_1, 1.0)

cooler_1 = cooler(JTvalve.getOutStream())
cooler_1 = cooler("cooler 1", JTvalve.getOutStream())
cooler_1.setSpecification("out stream")

stream_2 = stream(cooler_1.getOutStream())
stream_2 = stream("stream2", cooler_1.getOutStream())
stream_2.setSpecification("dewP")

cooler_1.setOutStream(stream_2)
JTvalve.setOutletPressure(stream_2.getPressure())

compressor_1 = compressor(stream_2, 10.0)
compressor_1 = compressor("comp2", stream_2, 10.0)
compressor_1.setSpecification("out stream")
compressor_1.setOutletPressure(stream_1.getPressure())

heater = heater(compressor_1.getOutStream())
heater = heater("heat22", compressor_1.getOutStream())
heater.setSpecification("out stream")
heater.setOutStream(stream_1)

Expand Down
58 changes: 35 additions & 23 deletions examples/jupyter/examplesInPython.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,21 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'neqsim'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[2], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mneqsim\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mnp\u001b[39;00m\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'neqsim'"
]
}
],
"source": [
"import neqsim\n",
"import matplotlib\n",
Expand Down Expand Up @@ -49,7 +61,7 @@
"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 @@ -97,7 +109,7 @@
"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 @@ -136,7 +148,7 @@
"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 @@ -191,7 +203,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 +215,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,7 +249,7 @@
}
],
"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.addComponent(\"methane\", 900.00);\n",
Expand All @@ -248,41 +260,41 @@
"testSystem.addComponent(\"nC13\", 10.0);\n",
"testSystem.setMixingRule(2);\n",
"\n",
"stream_1 = processEquipment.stream.Stream(\"Stream1\", testSystem);\n",
"stream_1 = processequipment.stream.Stream(\"Stream1\", testSystem);\n",
" \n",
"mixerHP = processEquipment.mixer.StaticMixer(\"Mixer HP\");\n",
"mixerHP = processequipment.mixer.StaticMixer(\"Mixer HP\");\n",
"mixerHP.addStream(stream_1);\n",
" \n",
"separator = processEquipment.separator.Separator(\"Separator 1\", mixerHP.getOutStream());\n",
"separator = processequipment.separator.Separator(\"Separator 1\", mixerHP.getOutStream());\n",
" \n",
"LP_valve = processEquipment.valve.ThrottlingValve(\"LPventil\", separator.getLiquidOutStream());\n",
"LP_valve = processequipment.valve.ThrottlingValve(\"LPventil\", separator.getLiquidOutStream());\n",
"LP_valve.setOutletPressure(5.0);\n",
" \n",
"LPseparator = processEquipment.separator.Separator(\"Separator 1\", LP_valve.getOutStream());\n",
"LPseparator = processequipment.separator.Separator(\"Separator 1\", LP_valve.getOutStream());\n",
" \n",
"LPcompressor = processEquipment.compressor.Compressor(LPseparator.getGasOutStream());\n",
"LPcompressor = processequipment.compressor.Compressor(LPseparator.getGasOutStream());\n",
"LPcompressor.setOutletPressure(50.0);\n",
" \n",
"heaterLP = processEquipment.heatExchanger.Heater(LPcompressor.getOutStream());\n",
"heaterLP = processequipment.heatExchanger.Heater(LPcompressor.getOutStream());\n",
"heaterLP.setOutTemperature(270.25);\n",
" \n",
"stream_2 = processEquipment.stream.Stream(\"cooled gas\",heaterLP.getOutStream());\n",
"stream_2 = processequipment.stream.Stream(\"cooled gas\",heaterLP.getOutStream());\n",
" \n",
"gasScrubber = processEquipment.separator.GasScrubberSimple(\"Scrubber\", stream_2);\n",
"gasScrubber = processequipment.separator.GasScrubberSimple(\"Scrubber\", stream_2);\n",
"gasScrubber.setInletStream(stream_2)\n",
" \n",
"stream_3 = processEquipment.stream.Stream(\"liq from scrubber gas\",gasScrubber.getLiquidOutStream());\n",
"stream_3 = processequipment.stream.Stream(\"liq from scrubber gas\",gasScrubber.getLiquidOutStream());\n",
" \n",
"mixerHP.addStream(stream_3);\n",
" \n",
"mixer = processEquipment.mixer.StaticMixer(\"Mixer export\");\n",
"mixer = processequipment.mixer.StaticMixer(\"Mixer export\");\n",
"mixer.addStream(separator.getGasOutStream());\n",
"mixer.addStream(gasScrubber.getGasOutStream());\n",
" \n",
"HPcompressor = processEquipment.compressor.Compressor(mixer.getOutStream());\n",
"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 @@ -343,7 +355,7 @@
"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 Expand Up @@ -471,7 +483,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.9"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/multiPhaseMeterPVT.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
fluidDefinedComponents, charNames, charFlowrate, molarMass, density
)
# printFrame(characterizedFluid)
characterizedFluid.setTemperature(273.15 + 20.6)
characterizedFluid.setPressure(86.8)
characterizedFluid.setTemperature(273.15 + 20.6, "K")
characterizedFluid.setPressure(86.8, "bara")
TPflash(characterizedFluid)
GORcalc = (
characterizedFluid.getPhase("gas").getNumberOfMolesInPhase()
Expand Down
6 changes: 3 additions & 3 deletions examples/oilPumpProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

fluid1.setTemperature(28.15, "C")
fluid1.setPressure(1.0, "bara")
fluid1.setTotalFlowRate(135.0, "m3/hr")
fluid1.setTotalFlowRate(135.0, "kg/hr")
# demonstration of setting up a simple process calculation

clearProcess()
stream1 = stream(fluid1)
pump1 = pump(stream1, 11.0)
stream1 = stream("stream 1", fluid1)
pump1 = pump("pump 1", stream1, 11.0)
runProcess()

print("temperature out of pump ", pump1.getOutStream().getTemperature() - 273.15, " °C")
Expand Down
Loading

0 comments on commit 211024a

Please sign in to comment.