Numerical solver for the
Key Features:
- Pseudo-spectral Fourier discretization (exponential convergence)
- Størmer-Verlet symplectic integration (structure-preserving)
- Adaptive CFL-based timestepping
- Parallel execution with Numba
- NetCDF4 data output + 3D animations
| Potential | Physics | ||
|---|---|---|---|
| Linear | Free massive scalar field | ||
| Topological kinks, domain walls | |||
| Sine-Gordon | Breathers, Josephson junctions |
Spatial: Pseudo-spectral Fourier with wavenumbers
Temporal: Størmer-Verlet (symplectic leapfrog)
Stability: CFL condition
git clone https://github.com/sandyherho/amangkurat.git
cd amangkurat
pip install -e .pip install amangkuratDependencies: numpy, scipy, matplotlib, netCDF4, tqdm, numba (optional, recommended for 10-100× speedup)
amangkurat case1 # Linear wave
amangkurat case2 # Kink soliton
amangkurat case3 # Breather
amangkurat case4 # Kink-antikink collision
# Options
amangkurat case1 --cores 8 --output-dir results/ --quiet
amangkurat --all # Run all casesfrom amangkurat import KGSolver
from amangkurat.core.initial_conditions import KinkIC
# Initialize solver
solver = KGSolver(nx=512, x_min=-30.0, x_max=30.0, adaptive_dt=True, n_cores=4)
# Create initial condition
ic = KinkIC(vacuum=1.0, position=0.0, velocity=0.0)
phi0, phi_dot0 = ic(solver.x)
# Solve
result = solver.solve(
phi0=phi0, phi_dot0=phi_dot0,
dt=0.005, t_final=50.0,
potential='phi4', lambda_=1.0, vacuum=1.0,
n_snapshots=200
)
# Access results
x = result['x'] # Spatial grid
t = result['t'] # Time snapshots
phi = result['phi'] # Field evolution (nt × nx)| Case | Potential | Initial Condition | Description |
|---|---|---|---|
| 1 | Linear | Gaussian pulse | Dispersive wave propagation |
| 2 | Static kink | Topological soliton ($\phi = v\tanh(x/\xi)$) | |
| 3 | Sine-Gordon | Breather | Time-periodic localized oscillation |
| 4 | Kink-antikink pair | Collision dynamics ( |
Simple key-value format (configs/case*.txt):
scenario_name = Kink Soliton
nx = 1024
x_min = -50.0
x_max = 50.0
t_final = 50.0
dt = 0.005
adaptive_dt = true
potential = phi4
lambda = 1.0
vacuum = 1.0
ic_type = kink
position = 0.0
velocity = 0.0
n_cores = 0
save_netcdf = true
save_animation = true
n_frames = 200
fps = 30
colormap = infernoNetCDF4 data (outputs/*.nc):
- Variables:
x(nx),t(nt),phi(nt, nx) - Metadata: grid parameters, potential type, timestep info
Animated GIFs (outputs/*.gif):
- 3D visualization of
$\phi(x,t)$ evolution - Dynamic camera rotation, color-coded amplitude
Log files (logs/*.log):
- Detailed diagnostics, parameter listings, timing
Code uses dimensionless units. Map to physical systems via scale factors:
Natural scales: Length
| Context | Length Scale | Time Scale | Application |
|---|---|---|---|
| Particle physics |
|
|
Higgs field (theoretical) |
| Condensed matter |
|
|
Ferromagnetic domain walls |
| Josephson junctions |
|
|
Superconducting phase |
Conversion:
units = result['units']
x_physical = result['x'] * length_scale_physical / units.length_scaleamangkurat/
├── configs/ # Test configurations
├── src/amangkurat/
│ ├── core/ # Solver + initial conditions
│ ├── io/ # NetCDF + config parser
│ ├── visualization/ # 3D animations
│ └── utils/ # Logger + timer
├── outputs/ # Results (*.nc, *.gif)
├── logs/ # Simulation logs
└── pyproject.toml # Build config
- 1D spatial domain only ($(1+1)$D spacetime)
- Periodic boundary conditions (not suitable for scattering)
- Uniform grid (no adaptive mesh refinement)
- CFL-limited timestep (explicit integration)
- Requires smooth solutions (spectral methods)
@software{herho2025_amangkurat,
author = {Herho, Sandy H. S.},
title = {amangkurat: Idealized Nonlinear Klein-Gordon Solver},
year = {2025},
version = {0.0.1},
url = {https://github.com/sandyherho/amangkurat}
}