Metadata-Version: 2.5
Name: simpok
Version: 1.0.0
Summary: High-level Python API for phase-ordering kinetics, with the computation in Mojo
Project-URL: Homepage, https://github.com/ivijayyadav/simpok
Project-URL: Repository, https://github.com/ivijayyadav/simpok
Project-URL: Issues, https://github.com/ivijayyadav/simpok/issues
Author-email: vijay <vijpiml@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: cahn-hilliard,ginzburg-landau,gpu,mojo,phase-field,phase-ordering,spinodal-decomposition
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Requires-Dist: max<26.6,>=26.5
Requires-Dist: mojo<1.1,>=1.0
Requires-Dist: numpy>=1.24
Provides-Extra: examples
Requires-Dist: matplotlib>=3.8; extra == 'examples'
Requires-Dist: pillow>=10; extra == 'examples'
Description-Content-Type: text/markdown

# simpok

High level Python API for phase field simulation of phase-ordering kinetics, with all computationally intensive operations, including GPU-accelerated kernels, implemented in Mojo programming langauge.

Implemented Systems: Dimensionless CHC, TDGL, and SDSD solvers

## Install

```bash
pip install simpok
```

## The models

**`TDGL`** — nonconserved scalar order parameter (Model A).

```
∂ψ/∂t = ψ − ψ³ + h + ∇²ψ + θ
```

**`CHC`** — conserved scalar order parameter (Model B).

```
∂ψ/∂t = −∇²(ψ − ψ³ + ∇²ψ) + ∇·θ
```

**`SDSD`** — surface-directed spinodal decomposition. The same conserved dynamics in contact with
a wall at `z = 0` that prefers one component: the bulk phase separates while the wall is wetted.

```
∂ψ/∂t = −∇²(ψ − ψ³ + ½∇²ψ − V(z)) + ∇·θ                    z > 0

h₁ + gψ + γ ∂ψ/∂z = 0                                      at z = 0
∂/∂z(−ψ + ψ³ − ½∇²ψ + V) = 0                               at z = 0
```

with the long-ranged wall potential `V(z) = −V₀/zⁿ` (cut off at `−V₀` for `z ≤ 1`).

## API

```python
TDGL(ny=256, nx=256, dx=1.0, dt=0.1, h=0.0, eps=0.0, dtype=np.float64, device="auto")
CHC (ny=256, nx=256, dx=1.0, dt=0.01, eps=0.0, dtype=np.float64, device="auto")
SDSD(nz=256, nx=256, dx=1.0, dt=0.03, h1=0.8, g=-0.4, gamma=0.4, v0=None, n=4,
     potential=None, eps=0.0, dtype=np.float64, device="auto")
```

The wall potential of `SDSD` defaults to the power law above, shaped by `v0` and `n`. Any other
shape can be passed to `potential` as a callable of `z` or as one value per row:

```python
SDSD(potential=lambda z: -0.8 * np.exp(-z / 3.0))        # short-ranged well
SDSD(potential=lambda z: np.where(z <= 5.0, -0.8, 0.0))  # square well
SDSD(potential=np.zeros(256))                            # no potential at all
```

## Examples

Runnable scripts for all three solvers are in [`examples/`](examples).

## Hardware notes

- **Supported Device** — GPU (AMD, NVIDIA, APPLE) and CPU

## License

MIT — see [LICENSE](LICENSE).
