Skip to main content

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

Project description

sangkuriang: Idealized KdV solver

DOI Python PyPI License: WTFPL Numba

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 F*ck 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.2.tar.gz (16.3 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.2-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sangkuriang_ideal_solver-0.0.2.tar.gz
  • Upload date:
  • Size: 16.3 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.2.tar.gz
Algorithm Hash digest
SHA256 fe8b14ccc60fc6dfc6c46f03b18ff8d7ea3407cb8fe2ec1d653328105f73db24
MD5 65e97afd182ad42c11aabf24e9e0044d
BLAKE2b-256 10211758fdd536bf1123c9f30e871b2448c261664f8900e0bd8db9b62a70583d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sangkuriang_ideal_solver-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 acb4beb0ab6041a6d9210c624558afb6ab53f5112719c19690d137f93316930c
MD5 53e40a28304ec49f8f13456e3338a363
BLAKE2b-256 5f5ffdffe691baf57b3a1e233939fd3b4e3271414d0d162285c06722a497254d

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