N2 Blowdown — quick run instructions
This folder contains the Peng–Robinson N2 blowdown model and a small non-invasive interactive wrapper to run example simulations.
Files
gas_blowdown.py— physics and ODE definitions (do not modify the core ODE functionblowdown_copv_flowif you want consistent results).run_gas_blowdown.py— interactive wrapper that imports the model and provides a simple CLI to run one- or two-COPV analyses and display plots.
Prerequisites
- Python 3.8+ (3.10/3.11 recommended)
- Packages: numpy, scipy, matplotlib, dearpygui
Install dependencies (PowerShell):
python -m pip install --user numpy scipy matplotlib dearpyguiHow to run (interactive)
- Open PowerShell and change to this folder:
cd "c:\Users\andre\Downloads\WISP GitHub Repo\n2_blowdown"- Run the interactive wrapper:
python run_gas_blowdown.pyThe wrapper will prompt for initial COPV pressure (psi), temperature (K), simulation time (s), and which plots to display. Confirm when prompted to start the simulation.
What appears when it runs
- The script runs the numerical integration (scipy.integrate.solve_ivp) and will open matplotlib windows showing the requested plots.
- The wrapper prints summary numbers to the terminal (depletion times, minimum tank-sizing estimates when available).
Non-interactive usage
- You can also import the model programmatically if you need scripted runs. Example from Python:
import importlib.util
spec = importlib.util.spec_from_file_location('gas_model', r'C:\Users\andre\Downloads\WISP GitHub Repo\n2_blowdown\gas_blowdown.py')
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
# call helper directly (example):
mod.required_tank_volumes_for_duration(6.24) # returns (V_lox, V_ipa) in m^3