Reliable compressible-flow calculator for isentropic flow, normal shocks, and oblique shocks — with batch CSV input, automated HTML reporting, optional PDF export, and test-backed engineering validation.
- Current capabilities
- Quickstart
- Example input format
- Outputs
- Example workflow
- Engineering assumptions
- Known limitations / failure modes
- Reliability features
- Verification philosophy
- Repository structure
- Development roadmap
Compressible-flow formulas are easy to find, but reliable engineering tools are harder to build well.
This project focuses on turning standard gas-dynamics relations into a more professional workflow:
- batch case execution from CSV
- validation-aware computation
- graceful handling of bad cases
- automated report generation
- reproducible tests and CI
Instead of being just a collection of formulas, CFS is designed as a small engineering toolchain.
- Isentropic flow
T/T0P/P0rho/rho0A/A*- inverse
A/A* -> Mfor subsonic and supersonic branches
- Normal shock
M2p2/p1rho2/rho1T2/T1p02/p01
- Oblique shock
- weak / strong branch
- shock angle
beta Mn1,Mn2,M2p2/p1,rho2/rho1,T2/T1,p02/p01- attached-shock validity check through
theta_max
- Batch runner from CSV
- HTML report generation
- Optional PDF generation with graceful fallback
- Error summary for failed cases
- pytest test suite
- GitHub Actions CI
Windows PowerShell:
py -m venv .venv
.\.venv\Scripts\Activate.ps1Linux/macOS:
python3 -m venv .venv
source .venv/bin/activatepip install -e ".[dev]"python -m cfs demo --out build/demopython -m cfs run examples/inputs_demo.csv --out build/run1python -m cfs demo --out build/demo --pdfOpen:
build/demo/report.htmlpytest -qexamples/inputs_demo.csv
case_id,model,gamma,M,M1,theta_deg,branch
iso_1,isentropic,1.4,2.0,,,
ns_1,normal_shock,1.4,,2.0,,
os_1,oblique_shock,1.4,,3.0,15,weakA typical run generates:
results.csvwith model-by-model computed quantitiesreport.htmlwith assumptions, limitations, tables, plots, and conclusionsassets/isentropic_area_ratio.png- optional
report.pdfwhen PDF dependencies are available
The report also includes:
- successful case counts
- error case counts
- per-case error summaries for invalid inputs
python -m cfs run examples/inputs_demo.csv --out build/run1Then open:
build/run1/report.html
CFS currently assumes:
- ideal gas behavior
- calorically perfect gas (
gammais constant) - steady, inviscid, adiabatic flow
- quasi-1D relations for isentropic flow
- 1D normal-shock relations
- 2D attached oblique-shock modeling for wedge-type deflection cases
These assumptions are appropriate for many textbook and introductory engineering compressible-flow calculations, but they are not universal.
CFS does not currently model:
- real-gas effects
- variable-
gammathermodynamics - high-temperature chemistry, dissociation, or ionization
- shock-boundary-layer interaction
- detached bow shocks beyond attached oblique-shock limits
- viscous duct effects such as Fanno flow
- heat-addition effects such as Rayleigh flow
Important numerical or physical rejection cases include:
M <= 0for isentropic relationsM1 <= 1for normal-shock calculations- oblique-shock cases with
theta > theta_max(M1, gamma) - missing required CSV fields
- invalid numeric inputs
- unsupported model names
In batch runs, these cases are not allowed to crash the whole job. They are recorded as ERROR rows in the output instead.
What makes this project more than a formula script:
- validation-aware functions
- branch-aware inverse area-ratio solver
- error isolation at the row level for batch jobs
- explicit reporting of failed cases
- unit tests for core relations and edge cases
- CI automation
The project is verified through:
- closed-form compressible-flow relations
- regression-style numerical checks
- branch consistency checks
- batch workflow smoke tests
- report-generation smoke tests
compressible-flow-studio/
.github/workflows/ci.yml
examples/
inputs_demo.csv
src/
cfs/
cli.py
errors.py
io/
models/
report/
tests/
Planned next steps:
- better plots for oblique-shock behavior
- Fanno flow support
- Rayleigh flow support
- unit-aware user inputs with pint
- more formal golden-data validation tables
- richer report conclusions and comparison views

