compflow
The compflow library contains functions to convert back and forth between Mach number and other non-dimensional groups in compressible flows. By using a NumPy--Fortran interface, the code is vectorised and lightning-fast, yielding a speed-up of up to two orders of magnitude.
Full documentation is available online.
Features
- Evaluation of ten non-dimensional flow quantities as explicit functions of Mach number;
- Iteration with Newton's method to invert explicit relations and solve for Mach number;
- Creation and caching of lookup tables to speed up inversions;
- Fortran-accelerated, fully-vectorised in both directions.
Basic usage
compflow is available on the Python Package Index, so installation is as simple as,
python3 -m pip install compflow
Note: as the library uses Fortran subroutines behind the scenes, you will need a working Fortran compiler for the installation to complete successfully.
We can now start doing some calculations. First, an explicit evaluation of stagnation pressure ratio given a Mach number,
>>> import compflow
>>> ga = 1.4
>>> compflow.Po_P_from_Ma(0.3, ga)
1.0644302861529382
Second, an inversion of flow function where iterative solution for Mach number is required,
>>> compflow.Ma_from_mcpTo_APo(0.8, ga)
0.39659360325173604
The names and symbols of non-dimensional quantities are fairly self-explanatory, but a full list is given in the Nomenclature. All functions and the equations used for the calculations are documented in the API.
Numpy arrays are also accepted as inputs,
>>> import numpy
>>> Ma1 = numpy.array([0., 0.5, 1., 2.])
>>> compflow.To_T_from_Ma(Ma1, ga)
array([1. , 1.05, 1.2 , 1.8 ])
>>> Ma2 = numpy.array([[0.1, 0.2], [0.3, 0.4], [0.5, 0.6]])
>>> compflow.To_T_from_Ma(Ma2, ga)
array([[1.002, 1.008],
[1.018, 1.032],
[1.05 , 1.072]])
When solving for Mach number at a given normalised mass flow, it is assumed
that we are on the subsonic branch of the curve unless a flag is specified.
Where no solution is possible, i.e. if the flow would choke, NaN is
returned,
>>> capacity = [0.6, 2.]
>>> compflow.Ma_from_mcpTo_APo(capacity, ga)
array([0.28442265, nan])
>>> compflow.Ma_from_mcpTo_APo(capacity, ga, sup=True)
array([2.27028708, nan])
TODO
- Sort out packaging so that NumPy gets installed automatically (distutils due to be deprecated?).
James Brind Mar 2022
Metadata
Release files for compflow 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| compflow-0.5.0.tar.gz | 15.7 kB | Without provenance | Details for compflow-0.5.0.tar.gz |
Release files / compflow-0.5.0.tar.gz
| Download URL | compflow-0.5.0.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a6f3cd16fc744e23f83cbf3ffc9fca9a83ca783aeff964ba51ae3cd344dc7481
|
|
BLAKE2b-256 checksum How to use checksums |
3569c53098d80fbba36483651759466a5edb06aa2fc46d22f01dbd8bcedb6d0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
|
Security for compflow 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.