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.0.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.0-py3-none-any.whl
(30.2 kB
view details)
File details
Details for the file nnfd-0.1.0.tar.gz.
File metadata
- Download URL: nnfd-0.1.0.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 |
8187825db8279824138e9c96fee5b8fcdeedcda5b235dc2f7433af695578d14a
|
|
| MD5 |
1e5a52746488ee2d9a1c96ad14e30260
|
|
| BLAKE2b-256 |
571aad00aaef8aecb5850f416df73005a22c270a5cba876752ca31ae889c9b5f
|
File details
Details for the file nnfd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nnfd-0.1.0-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 |
5ca6d2377f7956d724dec725422c08871397fcad64843e92a4f6a2d48dfec463
|
|
| MD5 |
16563011ccad3586e45f502764a8c79b
|
|
| BLAKE2b-256 |
7b8385a9beb939e43fbf56f3d286b50548e2655b704d97c558a3c24a7f5f4142
|