Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions examples/CO2deprezzurizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@

from neqsim.thermo import (
PHflash,
PHsolidflash,
TPflash,
TPsolidflash,
bubt,
dewt,
fluid,
printFrame,
)
Expand Down
8 changes: 0 additions & 8 deletions examples/H2Sdistribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,9 @@
@author: ESOL
"""

import pandas as pd
from neqsim.thermo import (
TPflash,
addOilFractions,
createfluid,
createfluid2,
dataFrame,
fluid,
fluid_df,
fluidcreator,
phaseenvelope,
printFrame,
)

Expand Down
7 changes: 0 additions & 7 deletions examples/PVTsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
from neqsim.thermo import (
CVD,
TPflash,
addOilFractions,
createfluid,
createfluid2,
dataFrame,
fluid,
fluidcreator,
phaseenvelope,
printFrame,
separatortest,
)

Expand Down
2 changes: 1 addition & 1 deletion examples/TPflash.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@author: esol
"""

from neqsim.thermo import TPflash, fluid, fluidComposition, phaseenvelope
from neqsim.thermo import TPflash, fluid, fluidComposition

# Start by creating a fluid in neqsim
fluid1 = fluid("srk") # create a fluid using the SRK-EoS
Expand Down
2 changes: 1 addition & 1 deletion examples/TPflashBenchmark.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import time

from neqsim.thermo import TPflash, createfluid, fluid, fluidcreator, printFrame
from neqsim.thermo import TPflash, fluid

fluid1 = fluid("srk", 303.15, 35.01325)

Expand Down
2 changes: 0 additions & 2 deletions examples/TPflashReactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
from neqsim.thermo import (
TPflash,
fluid,
fluidComposition,
ionComposition,
phaseenvelope,
scaleCheck,
)

Expand Down
10 changes: 5 additions & 5 deletions examples/beggsBrillPipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@
print("=" * 65)

print("\nPipeline Geometry:")
print(f" Length: 10,000 m (10 km)")
print(f" Diameter: 0.30 m (12 inch)")
print(f" Wall roughness: 50 um")
print(f" Elevation gain: 200 m (uphill)")
print(" Length: 10,000 m (10 km)")
print(" Diameter: 0.30 m (12 inch)")
print(" Wall roughness: 50 um")
print(" Elevation gain: 200 m (uphill)")

print("\nInlet Conditions:")
print(f" Pressure: {inlet_stream.getPressure('bara'):.1f} bara")
Expand All @@ -95,7 +95,7 @@
if outlet_fluid.hasPhaseType("gas") and outlet_fluid.hasPhaseType("oil"):
gas_fraction = outlet_fluid.getPhase("gas").getBeta()
liquid_fraction = 1.0 - gas_fraction
print(f"\nPhase Distribution at Outlet:")
print("\nPhase Distribution at Outlet:")
print(f" Gas fraction: {gas_fraction * 100:.1f}%")
print(f" Liquid fraction: {liquid_fraction * 100:.1f}%")

Expand Down
2 changes: 1 addition & 1 deletion examples/compressorCalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import pandas as pd
from neqsim.process import clearProcess, compressor, compressorChart, runProcess, stream
from neqsim.thermo import fluid, fluid_df
from neqsim.thermo import fluid_df

# Create a gas-condensate fluid
naturalgas = {
Expand Down
3 changes: 0 additions & 3 deletions examples/compressorTrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
compressor,
heater,
runProcess,
separator,
stream,
valve,
viewProcess,
)
from neqsim.thermo import fluid

Expand Down
2 changes: 0 additions & 2 deletions examples/createFluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
addOilFractions,
createfluid,
createfluid2,
dataFrame,
fluid,
fluid_df,
fluidcreator,
phaseenvelope,
Expand Down
6 changes: 3 additions & 3 deletions examples/ejectorProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@
print("=" * 60)
print("EJECTOR SIMULATION RESULTS")
print("=" * 60)
print(f"\nMotive Stream:")
print("\nMotive Stream:")
print(f" Pressure: {motive_stream.getPressure('bara'):.1f} bara")
print(f" Temperature: {motive_stream.getTemperature('C'):.1f} °C")
print(f" Flow rate: {motive_stream.getFlowRate('kg/hr'):.0f} kg/hr")

print(f"\nSuction Stream:")
print("\nSuction Stream:")
print(f" Pressure: {suction_stream.getPressure('bara'):.1f} bara")
print(f" Temperature: {suction_stream.getTemperature('C'):.1f} °C")
print(f" Flow rate: {suction_stream.getFlowRate('kg/hr'):.0f} kg/hr")

print(f"\nMixed Outlet Stream:")
print("\nMixed Outlet Stream:")
print(f" Pressure: {outlet_pressure:.2f} bara")
print(f" Temperature: {outlet_temperature:.1f} °C")
print(f" Flow rate: {outlet_flow:.0f} kg/hr")
Expand Down
18 changes: 7 additions & 11 deletions examples/equationOfState.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def create_wet_gas(eos_name):
return gas


print(f"\nConditions: T = 25°C, P = 50 bara")
print("\nConditions: T = 25°C, P = 50 bara")
print("Wet natural gas with 5 mol% water")
print("\nEoS | # Phases | Gas Density | Water in Gas Phase")
print(" | | [kg/m³] | [mol fraction]")
Expand Down Expand Up @@ -186,7 +186,7 @@ def create_wet_gas(eos_name):
print("CO2 near critical point (Tc=31°C, Pc=73.8 bar)")
print("Span-Wagner is the reference EoS for CO2")

print(f"\nConditions: T = 35°C, P = 80 bara (supercritical)")
print("\nConditions: T = 35°C, P = 80 bara (supercritical)")
print("\nEoS | Density [kg/m³] | Z-factor")
print("-" * 45)

Expand All @@ -212,8 +212,7 @@ def create_wet_gas(eos_name):
# =============================================================================
print("\n6. EOS-CG FOR CO2 AND COMBUSTION GASES")
print("-" * 40)
print(
"""
print("""
EOS-CG (Equation of State for Combustion Gases) is based on GERG-2008
but optimized for CO2-rich mixtures and combustion product gases.

Expand All @@ -225,13 +224,12 @@ def create_wet_gas(eos_name):
- Blue/green hydrogen with CO2

Components: CO2, N2, O2, Ar, H2O, CO, H2, H2S, SO2, CH4
"""
)
""")

# Create a typical flue gas / CCS mixture
print("Example: CO2-rich CCS mixture")
print("Composition: 95% CO2, 3% N2, 1% O2, 1% Ar")
print(f"\nConditions: T = 25°C, P = 100 bara (dense phase CO2)")
print("\nConditions: T = 25°C, P = 100 bara (dense phase CO2)")
print("\nEoS | Density [kg/m³] | Z-factor")
print("-" * 45)

Expand Down Expand Up @@ -263,8 +261,7 @@ def create_wet_gas(eos_name):
# =============================================================================
print("\n7. GUIDELINES FOR EoS SELECTION")
print("-" * 40)
print(
"""
print("""
Application | Recommended EoS
-------------------------------------|----------------------
Natural gas properties | GERG-2008 (most accurate)
Expand All @@ -289,6 +286,5 @@ def create_wet_gas(eos_name):
Gas hydrates | CPA with hydrate model
|
Electrolyte solutions (brine) | Electrolyte-CPA
"""
)
""")
print("=" * 70)
6 changes: 3 additions & 3 deletions examples/flareSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@
print("FLARE SYSTEM SIMULATION RESULTS")
print("=" * 60)

print(f"\nFlare Configuration:")
print("\nFlare Configuration:")
print(f" Flame height: {60.0} m")
print(f" Radiant fraction: {0.20:.0%}")
print(f" Tip diameter: {0.8} m")

print(f"\nOperating Conditions:")
print("\nOperating Conditions:")
print(f" Inlet pressure: {flare_inlet.getPressure('bara'):.1f} bara")
print(f" Inlet temperature: {flare_inlet.getTemperature('C'):.1f} °C")
print(f" Mass flow rate: {flare_inlet.getFlowRate('kg/hr'):.0f} kg/hr")

print(f"\nFlare Performance:")
print("\nFlare Performance:")
print(f" Heat duty: {heat_duty_mw:.2f} MW")
print(f" CO2 emissions: {co2_emission:.0f} kg/hr")
print(f" CO2 emissions: {co2_emission * 24 / 1000:.1f} tonnes/day")
Expand Down
23 changes: 9 additions & 14 deletions examples/flashCalculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
PHflash,
PSflash,
TVflash,
VHflash,
VUflash,
printFrame,
)

print("=" * 70)
Expand Down Expand Up @@ -72,13 +69,13 @@
natural_gas.initThermoProperties()
natural_gas.initPhysicalProperties()

print(f"\nResults:")
print("\nResults:")
print(f" Number of phases: {natural_gas.getNumberOfPhases()}")
print(f" Total density: {natural_gas.getDensity('kg/m3'):.2f} kg/m³")

if natural_gas.hasPhaseType("gas"):
gas_phase = natural_gas.getPhase("gas")
print(f" Gas phase:")
print(" Gas phase:")
print(
f" - Mole fraction: {natural_gas.getMoleFraction(natural_gas.getPhaseNumberOfPhase('gas')):.4f}"
)
Expand All @@ -87,7 +84,7 @@

if natural_gas.hasPhaseType("oil"):
oil_phase = natural_gas.getPhase("oil")
print(f" Liquid phase:")
print(" Liquid phase:")
print(
f" - Mole fraction: {natural_gas.getMoleFraction(natural_gas.getPhaseNumberOfPhase('oil')):.4f}"
)
Expand Down Expand Up @@ -120,7 +117,7 @@
natural_gas.initThermoProperties()

final_temp = natural_gas.getTemperature("C")
print(f"\nAfter throttling to 20 bara:")
print("\nAfter throttling to 20 bara:")
print(f" Final temperature: {final_temp:.1f}°C")
print(f" Temperature drop (JT effect): {initial_temp - final_temp:.1f}°C")

Expand Down Expand Up @@ -150,7 +147,7 @@
natural_gas.initThermoProperties()

discharge_temp = natural_gas.getTemperature("C")
print(f"\nIsentropic discharge at 50 bara:")
print("\nIsentropic discharge at 50 bara:")
print(f" Discharge temperature: {discharge_temp:.1f}°C")
print(f" Temperature rise: {discharge_temp - initial_temp:.1f}°C")

Expand All @@ -170,7 +167,7 @@

# Get current volume
system_volume = natural_gas.getVolume("m3")
print(f"\nInitial state: T = 25°C, P = 50 bara")
print("\nInitial state: T = 25°C, P = 50 bara")
print(f"System volume: {system_volume:.6f} m³")

# Change temperature while keeping volume constant
Expand All @@ -180,7 +177,7 @@
natural_gas.initThermoProperties()

new_pressure = natural_gas.getPressure("bara")
print(f"\nAfter heating to 50°C at constant volume:")
print("\nAfter heating to 50°C at constant volume:")
print(f" New pressure: {new_pressure:.2f} bara")

# =============================================================================
Expand All @@ -189,8 +186,7 @@
print("\n" + "=" * 70)
print("FLASH CALCULATION SUMMARY")
print("=" * 70)
print(
"""
print("""
Flash Type | Given | Find | Application
-----------|----------------|----------------|---------------------------
TPflash | T, P | Phases, comp. | General equilibrium
Expand All @@ -199,6 +195,5 @@
TVflash | T, V | P, phases | Closed vessels
VHflash | V, H | T, P, phases | Adiabatic closed systems
VUflash | V, U | T, P, phases | Isolated systems
"""
)
""")
print("=" * 70)
2 changes: 1 addition & 1 deletion examples/fluidCharacterization.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@author: esol
"""

from neqsim.thermo import TPflash, fluid, fluidComposition, phaseenvelope
from neqsim.thermo import TPflash, fluid, fluidComposition

# Start by creating a fluid in neqsim
fluid1 = fluid("srk") # create a fluid using the SRK-EoS
Expand Down
8 changes: 3 additions & 5 deletions examples/fluidCreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
gas_df.setPressure(50.0, "bara")
TPflash(gas_df)

print(f"\nCreated fluid from DataFrame")
print("\nCreated fluid from DataFrame")
print(f" Total molar flow: {gas_df.getTotalNumberOfMoles():.4f} mol")

# =============================================================================
Expand Down Expand Up @@ -272,8 +272,7 @@
# =============================================================================
print("\n9. COMMONLY USED COMPONENTS")
print("-" * 40)
print(
"""
print("""
Category | Component Names
-------------------|------------------------------------------------
Light gases | nitrogen, oxygen, argon, helium, hydrogen, H2S
Expand All @@ -288,8 +287,7 @@

Note: For components not in database, use addTBPfraction() or
addPlusFraction() with MW and density.
"""
)
""")

# =============================================================================
# 10. ELECTROLYTE FLUIDS
Expand Down
10 changes: 0 additions & 10 deletions examples/glycolprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,14 @@
heater,
mixer,
pump,
recycle,
runProcess,
separator,
stream,
valve,
viewProcess,
)
from neqsim.thermo import (
TPflash,
addOilFractions,
createfluid,
createfluid2,
dataFrame,
fluid,
fluidComposition,
fluidcreator,
phaseenvelope,
printFrame,
)

# Start by creating a fluid in neqsim uing a predifined fluid (dry gas, rich gas, light oil, black oil)
Expand Down
1 change: 0 additions & 1 deletion examples/heatExchanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@author: esol
"""

from neqsim import methods
from neqsim.process import clearProcess, heatExchanger, runProcess, stream
from neqsim.thermo import fluid

Expand Down
2 changes: 1 addition & 1 deletion examples/heatOfCombustion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""

from neqsim.standards import ISO6976
from neqsim.thermo import TPflash, fluid, fluidComposition, phaseenvelope
from neqsim.thermo import TPflash, fluid

# Start by creating a fluid in neqsim
fluid1 = fluid("srk") # create a fluid using the SRK-EoS
Expand Down
Loading
Loading