Skip to main content

Idealized Korteweg-de Vries soliton solver with pseudo-spectral methods

Project description

sangkuriang: Idealized KdV solver

DOI Python PyPI License: WTFPL Numba

Idealized Korteweg-de Vries (KdV) soliton solver with pseudo-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 Pseudo-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.3.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.3-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sangkuriang_ideal_solver-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 27870a69d804fe1dbb32862c4b2f822b908b85e20df42b1d287195c96cea162b
MD5 6e0bb3e0d8e5b5f124e5ec060b7e611f
BLAKE2b-256 49d525afbe602ba912574f8f67950f39ac286e647c93fbee374e40bd7d088cb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sangkuriang_ideal_solver-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 01640952b42cb4f0eaa22f0af053944ee75f0319382992d6e3a3d018f6124634
MD5 1c8cce55850b27d83c2b3951372a252d
BLAKE2b-256 695f16bcf26d81bd1074ba8370adecb44485750e2edf56eb8fb8aac0d0848409

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