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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 5 additions & 3 deletions .github/workflows/generate-stubs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
with:
python-version: '3.13'

- name: Set up uv
uses: astral-sh/setup-uv@v5

- name: Set up Java
uses: actions/setup-java@v5
with:
Expand All @@ -31,12 +34,11 @@ jobs:

- name: Install dependencies
run: |
pip install poetry
poetry install --with dev
uv sync --group dev

- name: Generate stubs
run: |
poetry run python scripts/generate_stubs.py
uv run python scripts/generate_stubs.py

- name: Commit updated stubs
uses: stefanzweifel/git-auto-commit-action@v7
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,16 @@ jobs:
steps:
- uses: actions/checkout@v7

- name: Install poetry
run: pipx install poetry

- name: Setup python
uses: actions/setup-python@v6
with:
python-version: 3.13

- name: Install dependencies
run: poetry install --no-interaction
- name: Set up uv
uses: astral-sh/setup-uv@v5

- name: Build wheel
run: poetry build
run: uv build

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/runtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ jobs:
steps:
- uses: actions/checkout@v7

- name: Install poetry
run: pipx install poetry
- name: Install uv
run: pipx install uv

- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.version }}

- name: Install dependencies
run: poetry install --no-interaction
run: uv sync

- name: Run tests with pytest
run: poetry run pytest -p no:faulthandler
run: uv run pytest -p no:faulthandler
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.analysis.extraPaths": ["src"]
}
}
1 change: 1 addition & 0 deletions conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ python:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ requirements:
host:
- python >=3.9
- pip
- poetry-core
- uv-build >=0.11.18,<0.12.0
run:
- python >=3.9
- jpype1 >=1.7.0,<2.0.0
Expand Down
12 changes: 8 additions & 4 deletions examples/equationOfState.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ 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 @@ -224,7 +225,8 @@ 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")
Expand Down Expand Up @@ -261,7 +263,8 @@ 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 @@ -286,5 +289,6 @@ def create_wet_gas(eos_name):
Gas hydrates | CPA with hydrate model
|
Electrolyte solutions (brine) | Electrolyte-CPA
""")
"""
)
print("=" * 70)
6 changes: 4 additions & 2 deletions examples/flashCalculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@
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 @@ -195,5 +196,6 @@
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)
6 changes: 4 additions & 2 deletions examples/fluidCreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@
# =============================================================================
print("\n9. COMMONLY USED COMPONENTS")
print("-" * 40)
print("""
print(
"""
Category | Component Names
-------------------|------------------------------------------------
Light gases | nitrogen, oxygen, argon, helium, hydrogen, H2S
Expand All @@ -287,7 +288,8 @@

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

# =============================================================================
# 10. ELECTROLYTE FLUIDS
Expand Down
30 changes: 20 additions & 10 deletions examples/hydrateCalculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
# =============================================================================
print("\n1. INTRODUCTION TO GAS HYDRATES")
print("-" * 40)
print("""
print(
"""
Gas hydrates form when water and light gases (C1, C2, C3, CO2, H2S)
combine under high pressure and low temperature conditions.

Expand All @@ -43,7 +44,8 @@
- Temperature: Typically < 25°C
- Pressure: Typically > 10-20 bara
- Presence of free water
""")
"""
)

# =============================================================================
# 2. HYDRATE FORMATION TEMPERATURE
Expand Down Expand Up @@ -114,14 +116,16 @@
# =============================================================================
print("\n4. SUBCOOLING - HYDRATE RISK ASSESSMENT")
print("-" * 40)
print("""
print(
"""
Subcooling (ΔT) = Hydrate formation T - Operating T

Interpretation:
ΔT > 0: Operating BELOW hydrate T → HIGH RISK
ΔT = 0: At hydrate equilibrium → BORDERLINE
ΔT < 0: Operating ABOVE hydrate T → SAFE
""")
"""
)

# Example calculation
gas.setPressure(100.0, "bara")
Expand Down Expand Up @@ -224,7 +228,8 @@
# =============================================================================
print("\n7. INHIBITOR SELECTION GUIDELINES")
print("-" * 40)
print("""
print(
"""
┌─────────────────────────────────────────────────────────────────┐
│ Inhibitor Comparison │
├────────────┬──────────────────────────────────────────────────┐
Expand All @@ -251,14 +256,16 @@
│ │ ✗ Cannot be regenerated │
│ │ → Best for: Drilling fluids, completion ops │
└────────────┴──────────────────────────────────────────────────┘
""")
"""
)

# =============================================================================
# 8. KINETIC HYDRATE INHIBITORS (KHI)
# =============================================================================
print("\n8. KINETIC HYDRATE INHIBITORS (KHI)")
print("-" * 40)
print("""
print(
"""
Unlike thermodynamic inhibitors (MEG, MeOH) that shift equilibrium,
KHIs work by slowing hydrate formation kinetics.

Expand All @@ -273,22 +280,25 @@

Note: NeqSim primarily calculates thermodynamic equilibrium.
KHI effects require separate kinetic models.
""")
"""
)

# =============================================================================
# 9. PRACTICAL EXAMPLE: PIPELINE HYDRATE ASSESSMENT
# =============================================================================
print("\n9. PRACTICAL EXAMPLE: PIPELINE HYDRATE ASSESSMENT")
print("-" * 40)

print("""
print(
"""
Scenario: Subsea pipeline from wellhead to platform
- Wellhead: 150 bara, 80°C
- Pipeline arrival: 80 bara, 5°C
- Gas is water-saturated

Question: Will hydrates form? How much MEG is needed?
""")
"""
)

# Check hydrate risk
pipeline_gas = fluid("cpa")
Expand Down
Loading
Loading