KolSol
KolSol is a pseudospectral Kolmogorov flow solver, using a Fourier-Galerkin approach as described by Canuto [1].
This library contains both NumPy and PyTorch implementations to allow for autograd-compatible workflows. Please note
that the implementation of the FFT within NumPy is much more efficient so for general usage this version is preferable.
The solver provides numerical solutions to the divergence-free Navier-Stokes equations:
$$ \begin{aligned} \nabla \cdot u &= 0 \ \partial_t u + u \cdot \nabla u &= - \nabla p + \nu \Delta u + f \end{aligned} $$
As a spectral method is employed, using a larger quantity of wavenumbers will reduce the numerical error.
Note: Highly accurate simulations can be attained even with relatively few wavenumbers.
- License: MIT
- Python Versions: 3.8.10+
Flowfield:
Installation:
You can install KolSol from PyPI as follows
$ pip install kolsol
Solver Example:
import numpy as np
from kolsol.numpy.solver import KolSol
# instantiate solver
ks = KolSol(nk=8, nf=4, re=30.0, ndim=2)
dt = 0.01
# define initial conditions
u_hat = ks.random_field(magnitude=10.0, sigma=2.0, k_offset=[0, 3])
# simulate :: run over transients
for _ in np.arange(0.0, 180.0, dt):
u_hat += dt * ks.dynamics(u_hat)
# simulate :: generate results
for _ in np.arange(0.0, 300.0, dt):
u_hat += dt * ks.dynamics(u_hat)
# generate physical field
u_field = ks.fourier_to_phys(u_hat, nref=256)
Data Generation:
The given generate.py script can be used to generate simulation data for a Kolmogorov flow field, for example:
$ python generate.py --data-path .data/RE30/results.h5 --resolution 256 --re 30.0 --time-simulation 60.0
Running the above command results in the following file structure:
data
├── RE30
│ └── results.h5
├── README.md
└── generate.py
Note: Additional command-line arguments are available for customising simulations.
References:
[1] Canuto, C. (1988) Spectral methods in fluid dynamics. New York: Springer-Verlag.
Metadata
Release files for kolsol 1.0.1
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 |
|---|---|---|---|---|
| kolsol-1.0.1.tar.gz | 384.6 kB | Without provenance | Details for kolsol-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kolsol-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for kolsol-1.0.1-py3-none-any.whl |
Total release size: 396.1 kB
Release files / kolsol-1.0.1.tar.gz
| Download URL | kolsol-1.0.1.tar.gz |
|---|---|
| Size | 384.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ace8022b96deaee44ac0732829e1aff00186a931f441f87ea6293e9c86ca8d1
|
|
BLAKE2b-256 checksum How to use checksums |
669b6437ce1d1822dc27b370af80fd803e0ecd0e00a307419ef73991e2073a04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Release files / kolsol-1.0.1-py3-none-any.whl
| Download URL | kolsol-1.0.1-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e8101eb65e74808fad421a483518a5258be57ae7a7ee0c28d24d009630cabfb5
|
|
BLAKE2b-256 checksum How to use checksums |
3251a2a96d4c007f7b0d55a6bc7d74fe10d97134fe4aa83e01bc37c8debfeb28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Security for kolsol 1.0.1
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.