Skip to main content

Idealized 1D Korteweg-de Vries soliton solver with spectral methods

Project description

sangkuriang: Idealized KdV solver

Python PyPI License: WTFPL Numba

High-performance idealized Korteweg-de Vries (KdV) soliton solver with spectral methods and Numba acceleration.

Physics

Solves the Korteweg-de Vries equation:

$$\frac{\partial u}{\partial t} + \varepsilon \cdot u \cdot \frac{\partial u}{\partial x} + \mu \cdot \frac{\partial^3 u}{\partial x^3} = 0$$

Conservation Laws: Mass, Momentum, Energy

Features

  • Spectral (Fourier) spatial derivatives
  • DOP853 adaptive 8th-order Runge-Kutta
  • Numba JIT compilation (10-100× speedup)
  • Multi-core parallel processing
  • 3D animated visualizations
  • NetCDF4 output

Installation

From PyPI:

pip install sangkuriang-ideal-solver

From source:

git clone https://github.com/sandyherho/sangkuriang-ideal-solver.git
cd sangkuriang-ideal-solver
pip install -e .

Quick Start

Command line:

sangkuriang case1           # Single soliton
sangkuriang case3 --cores 8 # Collision with 8 cores
sangkuriang --all           # Run all cases

Python API:

from sangkuriang_ideal import KdVSolver, SechProfile

solver = KdVSolver(nx=512, x_min=-30.0, x_max=30.0, n_cores=8)
u0 = SechProfile(amplitude=4.0, width=2.0, position=-10.0)(solver.x)
result = solver.solve(u0=u0, mu=0.1, eps=0.2, t_final=50.0)

print(f"Energy error: {result['energy_error']:.2e}")

Test Cases

Case Description Physics
1 Single soliton Baseline
2 Two equal solitons Phase shift
3 Collision (different heights) Overtaking
4 Three-soliton system Complex multi-body

Citation

If you use this software in your research, please cite:

@article{herho202x_sangkuriang,
  title   = {Sangkuriang: An Idealized {K}orteweg-de {V}ries Soliton Solver with Spectral Methods},
  author  = {Herho, Sandy H. S. and Irawan, Dasapta E. and Suwarman, Rusmawan and Kaban, Siti N.},
  journal = {xxx},
  volume  = {xxx},
  pages   = {xxx--xxx},
  year    = {202x},
  doi     = {10.xxxx/xxxxx}
}

Authors

  • Sandy H.S. Herho
  • Dasapta E. Irawan
  • Rusmawan Suwarman
  • Siti N. Kaban

License

WTFPL - Do What The Fuck You Want To Public License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sangkuriang_ideal_solver-0.0.1.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sangkuriang_ideal_solver-0.0.1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file sangkuriang_ideal_solver-0.0.1.tar.gz.

File metadata

  • Download URL: sangkuriang_ideal_solver-0.0.1.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.2 Linux/6.11.9-100.fc39.x86_64

File hashes

Hashes for sangkuriang_ideal_solver-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f23a08a9aadc4986933dd9b88adae70cf07a435e47b60b986dcffb945b100889
MD5 fea5b82555b53b0cfc374fa1fd1119cc
BLAKE2b-256 5131d9f2f5ee157ee11ff15f340642b5a0d7b0f5c6cc287542a84f7d4ab8b983

See more details on using hashes here.

File details

Details for the file sangkuriang_ideal_solver-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sangkuriang_ideal_solver-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4aaba5bb942fbe0adfbb36a3fcfcbb417fb1cd0de2abb0880d78f04d5a767717
MD5 e3b15ae6aa95d7cffb6bb1d77bb42ce7
BLAKE2b-256 62c7517183a2963b78547cff4ecdb5758d9929231c4ce427622986d07488df97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page