Skip to main content

jNO logo

Dev Docs License Citation Docker image available arXiv Paper

Install · Examples · Features · Docs · Citation

jNO (jax Numerical Operators) is a JAX library for differentiable numerical methods. Finite elements, finite differences and RCWA sit next to PINNs, neural operators and Bayesian inference on one substrate: you write the math (a weak form, a stencil, a residual, a loss) and it becomes one jit-compiled, GPU-ready graph that is differentiable end to end. An inverse problem, a design optimisation or a neural coefficient is therefore one composition away from a forward solve.

Install

pip install jax-numerical-operators              # CPU; FEM, FDM, solvers and SciML included
pip install "jax-numerical-operators[cuda,fem]"  # + NVIDIA GPU, remeshing, PARDISO/cuDSS, METIS

Other extras: [rcwa], [amg] (GPU multigrid), [iree]. For the newest features install from main: pip install git+https://github.com/FhG-IISB/jNO. Pixi, Docker and CUDA pinning are in the installation guide.

Examples

Each example is complete and runs as shown on a CPU.

Topology optimisation: a SIMP cantilever, with gradients through the FEM solve
import jax
jax.config.update("jax_enable_x64", True)
import jax.numpy as jnp
import numpy as np
import jno

L, H, VF, LAM, MU = 60.0, 30.0, 0.4, 0.33, 0.38          # plane-stress Lamé constants, E = 1
d = jno.shape.rect(0, 0, L, H, size=1.0).domain()
x, y, _ = d.variable("interior", split=True)
xl, yl, _ = d.variable("left", split=True)               # clamped root
xt, yt, _ = d.variable("tip", where=lambda x, y: (x > L - 1e-6) & (y < 2 + 1e-6), split=True)

u = d.unknown.vector(2); v = u.test()
rho = jno.np.parameter(d.unknown.scalar(space="P0", name="r").test(), name="rho")  # one density per element
rho.initialize(jax.nn.initializers.constant(VF))
rho.optimizer(jno.optimizers.mma(move=0.15, lower=1e-3, upper=1.0))
rho.constrain(d.patch_filter())                          # no checkerboards, no one-node hinges

eps = lambda w: jno.np.symgrad(w, [x, y])
a = lambda e1, e2: LAM * jno.np.trace(e1) * jno.np.trace(e2) + 2 * MU * jno.np.inner(e1, e2, n_contract=2)
E = 1e-9 + rho**3                                        # SIMP interpolation

fem = jno.fem([E * a(eps(u), eps(v)),                    # ∫ E(ρ) σ(u):ε(v)
               u(xl, yl) - (0.0, 0.0),
               jno.np.inner(jnp.array([0.0, 0.5]), v.bind(x=xt, y=yt))])   # downward tip load

compliance = (E * a(eps(u), eps(u))).integrate(fem)      # the objective, through the solve
volume = (rho.reshape(-1) * d.cell_volume()).sum / (VF * L * H)
crux = jno.core([compliance, jno.le(volume, 1.0)],       # minimise C subject to V ≤ 40 %
                domain=jno.domain.from_array({"_": np.zeros((1, 1))}))
crux.solve(150)                                          # → a crisp truss, volume exactly at the bound

No sensitivity is derived by hand: fem.solve() is a node of the graph, so MMA gets dC/dρ from autodiff. The deformable-mesh tutorial also moves the mesh nodes as design variables.

Inverse problem: recover a whole conductivity field from one measurement
import jax
import jax.numpy as jnp
import optax
import jno

d = jno.shape.rect(0, 0, 1, 1, size=0.1).domain()
x, y, _ = d.variable("interior", split=True)
xb, yb, _ = d.variable("boundary", split=True)
u = d.unknown(); v = u.test()
grad = lambda w: jno.np.jacobian(w, [x, y])
f = 30 * (x * (1 - x) + y * (1 - y))

def forward(k):                                          # −∇·(k∇u) = f,  u = 0 on ∂Ω
    return jno.fem([k * jno.np.inner(grad(u), grad(v)) - f * v, u(xb, yb) - 0.0], quad_degree=3).solve()

# Synthetic data from a hidden inclusion ...
k_true = lambda x, y: 1 + 0.8 * jnp.exp(-((x - 0.5) ** 2 + (y - 0.5) ** 2) / 0.03)
u_obs = jnp.asarray(forward(jno.np.parameter(v).initialize(k_true).freeze()))

# ... and the whole nodal field k(x) recovered from it, through the solve.
k = jno.np.parameter(v, name="k").initialize(jax.nn.initializers.constant(1.0))
k.optimizer(optax.adam(2e-2))
crux = jno.core([(forward(k) - u_obs).mse,                 # data misfit
                 1e-3 * k.regularize("h1seminorm").mean])  # smoothness prior
crux.solve(500)                                            # k(x) to 6 % relative L2

Swap k for a scalar, the mesh coordinates, or a network jno.nn(net); the structure stays the same.

Coupled multiphysics: Rayleigh–Bénard convection, transient and nonlinear
import jax
jax.config.update("jax_enable_x64", True)
import numpy as np
import jno

Pr, Ra = 1.0, 1.0e4                                      # Ra ≫ Ra_c ≈ 1708: the layer must convect
d = jno.shape.rect(0, 0, 2, 1, size=0.11).domain(time=(0, 0.234, 27))
x, y, t = d.variable("interior", split=True)
xb, yb, _ = d.variable("boundary", split=True)
x0, y0, _ = d.variable("initial", split=True)

u = d.unknown.vector(2, order=2)                         # P2 velocity ┐ Taylor–Hood
p = d.unknown.scalar(name="p")                           # P1 pressure ┘
T = d.unknown.scalar(name="T")                           # P1 temperature
v, q, s = u.test(), p.test(), T.test()

grad = lambda w: jno.np.jacobian(w, [x, y])
div = lambda w: jno.np.trace(grad(w))
dot, ddot = jno.np.inner, lambda a, b: jno.np.inner(a, b, n_contract=2)
dt = lambda w: w.bind(x=x, y=y, t=t).t

fem = jno.fem([
    dot(dt(u), v) + dot(dot(grad(u), u), v) + Pr * ddot(grad(u), grad(v))   # ∂ₜu + (u·∇)u − Pr Δu
      - p * div(v) - Pr * Ra * T * v[1],                 #   + ∇p = Pr Ra T ê_y
    -q * div(u),                                         # ∇·u = 0
    dt(T) * s + dot(u, grad(T)) * s + dot(grad(T), grad(s)),   # ∂ₜT + u·∇T = ΔT
    u(xb, yb) - 0.0, T(xb, yb) - (1 - yb), p.pin(),      # no slip, hot floor, cold lid
    u(x0, y0) - 0.0,                                     # start at rest, slightly perturbed
    T(x0, y0) - (1 - y0 + 0.05 * jno.np.sin(np.pi * x0) * jno.np.sin(np.pi * y0)),
])
sol = fem.solve(linear=jno.solve.lu())                   # backward Euler + Newton per step
traj = np.asarray(jno.core([sol.mse]).eval([sol]))       # (27, 2398): one row per time step
# peak |u| 27.7: started at rest, ends in two counter-rotating rolls

Nothing selects a mode: fem.solve() reads the time derivative and the nonlinearity off the terms.

Domain decomposition: GenEO finds the coarse space that a stiffness contrast needs
import jax
jax.config.update("jax_enable_x64", True)
import jno

R, NU = jno.shape.rect, 0.3
d = (R(0, 0.00, 4, 0.25).name("stiff0").attach(E=1e4)    # four layers, stiffness contrast 10⁴
     + R(0, 0.25, 4, 0.50).name("soft0").attach(E=1.0)
     + R(0, 0.50, 4, 0.75).name("stiff1").attach(E=1e4)
     + R(0, 0.75, 4, 1.00).name("soft1").attach(E=1.0)).sized(0.05).domain()
x, y, _ = d.variable("interior", split=True)
xl, yl, _ = d.variable("left", split=True)               # clamped on the left
u = d.unknown.vector(2); v = u.test()

eps = lambda w: jno.np.symgrad(w, [x, y])
ddot, tr = lambda a, b: jno.np.inner(a, b, n_contract=2), jno.np.trace
lam, mu = d.E * NU / ((1 + NU) * (1 - 2 * NU)), d.E / (2 * (1 + NU))
fem = jno.fem([2 * mu * ddot(eps(u), eps(v)) + lam * tr(eps(u)) * tr(eps(v)) + 0.1 * v[1],   # under its own weight
               u(xl, yl) - (0.0, 0.0)])

S = jno.precond.schwarz(parts=64, coarse=False)          # local solves on 64 METIS subdomains
rigid = jno.precond.coarse([(1, 0), (0, 1), (-y, x)], parts=S)   # the modes you can write down
geneo = jno.precond.coarse(jno.space.geneo(), parts=S)   # the ones you can't, from local eigenproblems
for M in (S, rigid >> S >> rigid, geneo >> S >> geneo):
    fem.solve(linear=jno.solve.cg(tol=1e-8, maxiter=5000), precond=M)
    print(fem.stats["linear_iterations"]["total"])       # 291, 110, 40 CG iterations

A preconditioner is a value you compose: Q >> S >> Q applies the coarse correction around the local solves. GenEO keeps the count close to that of a homogeneous block; it needs a symmetric positive definite problem (and [fem], for METIS). The coarse-space tutorial follows the count over the number of subdomains.

Electromagnetics: resonant modes of a 3-D cavity with Nédélec edge elements
import jax
jax.config.update("jax_enable_x64", True)
import numpy as np
import jno

d = jno.shape.box(0, 0, 0, 1, 1, 1, size=0.35).domain()
x, y, z, _ = d.variable("interior", split=True)
E = d.unknown.vector(3, space="N1E", order=2); F = E.test()   # 2nd-order H(curl) elements
curl = lambda w: w.vector.curl(x, y, z)

K = jno.fem([jno.np.inner(curl(E), curl(F)),                   # ∇×∇×E = k² E
             E.vector.cross(d.variable("boundary", normals=True))])   # PEC wall: n×E = 0
k2, modes = K.eigs(mass=[jno.np.inner(E.bind(x=x, y=y, z=z), F.bind(x=x, y=y, z=z))],
                   k=6, sigma=25.0)                            # shift-invert near k² = 25
print(np.sort(np.asarray(k2)) / np.pi**2)                      # [2.00 2.00 2.00 3.00 3.00 4.93]

The analytic spectrum is k² = π²(l² + m² + n²). Edge elements send the gradient fields to k² = 0, so no spurious modes appear between the physical ones.

Diffraction grating: RCWA from the same Helmholtz term list
import jax
jax.config.update("jax_enable_x64", True)
import jax.numpy as jnp
import jno

K0, P = 2 * jnp.pi, 1.5                                  # λ = 1, period Λ = 1.5 λ
d = jno.shape.box(0, 0, 0, P, 0.3, 1.0, size=0.25).domain()
for tag, f in {"bottom": lambda x, y, z: z < 1e-6, "top": lambda x, y, z: z > 1 - 1e-6,
               "left": lambda x, y, z: x < 1e-6, "right": lambda x, y, z: x > P - 1e-6,
               "front": lambda x, y, z: y < 1e-6, "back": lambda x, y, z: y > 0.3 - 1e-6}.items():
    d.tag(tag, f)
x, y, z, _ = d.variable("interior", split=True)
u = d.unknown(); v = u.test()

def on(tag):                                             # u and v on a named face
    s = d.variable(tag, split=True)
    return u.bind(x=s[0], y=s[1], z=s[2]), v.bind(x=s[0], y=s[1], z=s[2])
(ut, vt), (ub, vb) = on("top"), on("bottom")

ridge = jno.fn(lambda x, y, z: jnp.where((0.4 < z) & (z < 0.6) & (x < P / 2), 1.0, 0.0), [x, y, z])
eps = 1.0 + 10.0 * ridge                                 # a silicon-like ridge in half of each period

sol = jno.rcwa([
    jno.np.inner(jno.np.jacobian(u, [x, y, z]), jno.np.jacobian(v, [x, y, z])) - K0**2 * eps * u * v,
    -(1j * K0 * ut) * vt,                                # outgoing radiation (top)
    -(1j * K0 * ub - 2j * K0) * vb,                      # incident plane wave + radiation (bottom)
    on("left")[0] - on("right")[0], on("front")[0] - on("back")[0],   # Floquet periodicity
], orders=160).solve()

sol.efficiency("R"), sol.efficiency("T")                 # 0.840, 0.160: R + T = 1
sol.order(-1, 0), sol.order(+1, 0)                       # 0.073 each: the ±1 orders now propagate

jno.rcwa reads the period, layer stack, permittivity and incidence off the terms (needs [rcwa]).

PINN: natural convection in a heated cavity, every boundary condition hard-constrained
import jax
jax.config.update("jax_enable_x64", True)                 # the quasi-Newton phase needs float64
import numpy as np
import optax
import foundax
import jno

Pr, Ra = 0.71, 1.0e3                                      # de Vahl Davis (1983) benchmark
d = jno.shape.rect(0, 0, 1, 1).structured(n=32).domain()
x, y, _ = d.variable("interior", split=True)

mlp = lambda key: jno.nn(foundax.mlp(2, hidden_dims=32, num_layers=3, activation=jax.nn.tanh,
                                     key=jax.random.PRNGKey(key)))
nets = net_psi, net_p, net_T = mlp(0), mlp(1), mlp(2)
for net in nets:
    net.optimizer(jno.optimizers.soap(optax.exponential_decay(3e-3, 2000, 0.5, end_value=1e-5)))

# u = ∇×ψ with ψ = 0 and ∂ψ/∂n = 0 on the walls: no slip and ∇·u = 0 hold exactly.
psi = (256 * (x * (1 - x) * y * (1 - y)) ** 2 * net_psi(x, y)).scalar.bind(x=x, y=y)
p = (Ra * Pr * net_p(x, y)).scalar.bind(x=x, y=y)
# T = 1 on the hot wall, 0 on the cold one; T sees y only through cos(πy), so ∂T/∂y = 0 on floor and lid.
T = ((1 - x) + x * (1 - x) * net_T(x, jno.np.cos(np.pi * y))).scalar.bind(x=x, y=y)

u, v = psi.d(y), -psi.d(x)
dx, dy, lap = (lambda f: f.d(x)), (lambda f: f.d(y)), (lambda f: f.d2(x) + f.d2(y))
crux = jno.core([                                         # strong form, scaled to O(1)
    ((u * dx(u) + v * dy(u) + dx(p) - Pr * lap(u)) / (Ra * Pr)).mse,       # x-momentum
    ((u * dx(v) + v * dy(v) + dy(p) - Pr * lap(v)) / (Ra * Pr) - T).mse,   # y-momentum: buoyancy T → u
    (u * dx(T) + v * dy(T) - lap(T)).mse,                                  # energy: advection u → T
], domain=d)

crux.solve(15_000)                                        # SOAP
for net in nets:
    net.optimizer(jno.optimizers.ssbroyden())            # then self-scaled Broyden (quasi-Newton)
crux.solve(1_000)
# u_max 3.650, v_max 3.692, Nu 1.117   (benchmark: 3.649, 3.697, 1.118)

No boundary loss is needed: the ansatz satisfies every condition, so the loss is the physics alone. SOAP and SSBroyden are part of jno.optimizers; together they bring the residual to ~1e-7.

Operator learning: an FNO trained on the PDE residual alone, with no solution data
import foundax
import optax
import jno

jno.setup("./runs/pino", diff_type="spectral")            # differentiate the FNO output on its grid
N = 64
dom = 256 * jno.shape.rect(0, 0, 1, 1, size=1 / N).structured().domain()   # 256 samples
x, y, _ = dom.variable("interior", split=True)
f = jno.noise.grf(x, y, length_scale=0.2)                # a fresh random forcing every batch

net = jno.nn(foundax.fno2d(in_features=1, hidden_channels=32, n_modes=16, d_model=(N + 1, N + 1)))
net.optimizer(optax.adam(1e-3))
u = net(f).bind(x=x, y=y)

crux = jno.core([(u.xx + u.yy + f).mse], domain=dom)     # learn f ↦ u for −Δu = f
crux.solve(epochs=20_000, batchsize=8)

The operator is trained on the physics alone. Data losses, DeepONet, transformers and LoRA fine-tuning plug into the same jno.core.

Features

What is in jNO, with maturity and a docs page per area (click to expand)
Area What is there Maturity
FEM Lagrange P1–Pk on triangles and tets (quads and hexes in beta); scalar, vector, matrix and constant unknowns; complex fields; steady, transient, 2nd order in time stable
Elements Nédélec (N1E, N2E) and Raviart–Thomas of any degree; Hermite, Argyris, Morley (C¹ plates); P0 experimental
Coupling & constraints periodic and Bloch ties, mortar ties between non-matching meshes, contact, moving meshes (ALE) beta
Adaptivity h (anisotropic remeshing), r and p adaptivity beta
FDM strong form on structured and unstructured grids, 2-D and 3-D, geometric multigrid stable
RCWA vector Maxwell, anisotropic media, diffraction orders, Jones readout stable
PEEC partial-element equivalent circuits: inductance and resistance of conductor layouts, DC to MHz beta
Solvers sparse LU (SuperLU, PARDISO, cuDSS), Krylov, AMG, AMS, Schwarz with coarse spaces (GenEO); Newton; eigenproblems (LOBPCG, shift-invert, Arnoldi) stable
Time integration θ-method, BDF2, SDIRK, Rosenbrock, exponential, adaptive steps stable
Inverse & design gradients through any solve: coefficients, fields, geometry, topology optimisation (MMA) stable
Geometry CSG via gmsh-OCC, multi-material regions, signed distance, mesh import stable
Domain decomposition FEM, FDM and PINN subdomains in one problem beta
PINNs forward, variational (VPINN, Deep Ritz), stochastic PDEs, adaptive resampling stable
Operator learning FNO, DeepONet, U-Net, transformers via foundax; physics or data losses stable
Bayesian NUTS, HMC, MALA, SGLD, VI per parameter stable
Training tools LoRA and PEFT, explainability, data and model parallelism, W&B, checkpointing, IREE export stable

More than 40 worked tutorials cover flow (up to vortex shedding and LES), fracture, elastodynamics, melt pools, droplets, Maxwell, inverse and Bayesian problems and operator learning.

Citation

If you use jNO in academic work, please cite:

@article{armbruster2026jno,
  title   = {jNO: A JAX Library for Neural Operator and Foundation Model Training},
  author  = {Armbruster, Leon and Ramesh, Rathan and Kruse, Georg and Straub, Christopher},
  journal = {arXiv preprint arXiv:2605.10159},
  year    = {2026},
  doi     = {10.48550/arXiv.2605.10159},
  url     = {https://arxiv.org/abs/2605.10159}
}

AI Disclosure

Parts of this codebase — including model ports, tests, and documentation — were developed with the assistance of AI coding tools. All contributions are reviewed and tested to the best of our ability, but mistakes may remain; please open an issue if you spot one.

Metadata

Release files for jax-numerical-operators 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jax-numerical-operators 0.4.3
File Size Uploaded Provenance Actions
jax_numerical_operators-0.4.3.tar.gz 4.4 MB With provenance Details for jax_numerical_operators-0.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jax-numerical-operators 0.4.3
File Interpreter ABI Platform Actions
jax_numerical_operators-0.4.3-py3-none-any.whl Python 3 none any Details for jax_numerical_operators-0.4.3-py3-none-any.whl

Total release size: 6.9 MB

Release files / jax_numerical_operators-0.4.3.tar.gz

Download URL jax_numerical_operators-0.4.3.tar.gz
Size 4.4 MB
Tags Source
SHA-256 checksum
How to use checksums
4a2eab6892a6f6368ff9c754e6f62ebe1bc7361f1a18cbb6243fdc42942605ab
BLAKE2b-256 checksum
How to use checksums
10615b90545663c5494885b107f6edfc1c44e9195c705df25a88fb1e815b3720
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / jax_numerical_operators-0.4.3-py3-none-any.whl

Download URL jax_numerical_operators-0.4.3-py3-none-any.whl
Size 2.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c23927a6a4064b2a922d59966258c47c19e9194231115b6f4b05256062e2a0f3
BLAKE2b-256 checksum
How to use checksums
f85109b93d0676c2f33d4647e7373fa1b833ce7552e5af015973f34d1648ffc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for jax-numerical-operators 0.4.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for jax_numerical_operators-0.4.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page