Finite Difference Neural Network solver for 3D Maxwell FDFD
Project description
nnfd — Neural-Network Preconditioned FDFD Solver
nnfd solves 3-D Maxwell's equations (FDFD) using a neural network as a
preconditioner for GMRES iteration.
Install
pip install nnfd
Quick start
import nnfd
# Download pre-trained model (once; cached in ~/.cache/nnfd/)
model_path = nnfd.hub.download(
"your-org/nnfd-maxwell-3d-v1",
token="hf_...", # omit if the repo is public
)
solver = nnfd.NN_solver(model_path=model_path)
solver.config({"device": "cuda:0", "tol": 1e-4, "max_iter": 50})
# eps: (N, sx, sy, sz) float32 — relative permittivity
# src: (N, sx, sy, sz, 6) float32 — source (real repr of 3 complex E components)
E, residuals = solver.solve(
eps, src,
wavelength=1.55, # free-space wavelength (same units as dL)
dL=0.05, # grid spacing
pml_layers=(10,10,10,10,10,10),
)
# E: (N, sx, sy, sz, 3) complex64
# residuals: list[float], one per mini-batch chunk
Requirements
- Python ≥ 3.9
- PyTorch ≥ 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nnfd-0.1.1.tar.gz
(30.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
nnfd-0.1.1-py3-none-any.whl
(30.2 kB
view details)
File details
Details for the file nnfd-0.1.1.tar.gz.
File metadata
- Download URL: nnfd-0.1.1.tar.gz
- Upload date:
- Size: 30.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
622f4d38ddf6df2960fe8b2102cde11e516e36f301acda730b45d337b09fd7e8
|
|
| MD5 |
2456d22d62e38664621558712873bdd1
|
|
| BLAKE2b-256 |
f05467cc945bf417bfa00b473e55f48819c38794a185f4a7012d060eaadfe057
|
File details
Details for the file nnfd-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nnfd-0.1.1-py3-none-any.whl
- Upload date:
- Size: 30.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4465384a6aec7e7e76d4d7c36a9cdb971e77dffed89f716044c7635ec126af2
|
|
| MD5 |
db42edda6dc87d3cedef03be5aa6eb34
|
|
| BLAKE2b-256 |
ab12eb2d7ea70701ae1c7622c238a1d7a9dc0041a29f07ecf53c2d8b31a22812
|