Skip to main content

🐦‍⬛ CORVID

Fast, lean iterative solves for time-harmonic Maxwell

Coarse Operators by Recursive Volume Interpolation of De Rham complexes

License: AGPL v3+ Python 3.9+ Rust Platforms


CORVID solves the linear systems of frequency-domain electromagnetics: second-order Nédélec elements on unstructured tetrahedral meshes, including absorbing boundaries, ports, PMLs and lossy materials. It preconditions the true, indefinite operator K (no shifted operator) and solves it with COCG or GMRES. The core is multithreaded Rust, behind a small Python API.

In multigrid terms CORVID is a two-level p-multigrid: smoothing on the second-order space, and an exact sparse direct solve on the first-order (Whitney) edge space beneath it. That direct solve makes it cheaper than a full factorization, but not an O(n) solver: its memory grows as O(n^4/3) (see Scaling).

It is built for the regime where a direct solver works but costs too much memory, and where frequency sweeps make you solve the same mesh many times. CORVID is the iterative solver of EMerge.

Status: research code under active development. The API may still change.

Why CORVID

🧠 Less memory No full factorization of K. On the Weng filter benchmark the whole EMerge process peaked at 14.8 GB, against 22.4 GB with the direct solver.
⚡ Sweep-aware One solver lives across a frequency sweep. It refactors in place, keeps factors between nearby frequencies, and starts each solve from the best combination of earlier solutions. Iterations drop from ~13 to 3–5 across most of a band.
🧵 Uses its cores Every kernel is threaded. All ports are solved in lockstep, so the matrix and the block factors are read once per iteration for all of them. Thread count per solver: threads=8.
🎯 Exact where it matters An exact solve on the lowest-order (Whitney) edge unknowns, by SPARTA's sparse LDLᵀ. Optionally also on PML rows and on unknowns next to coarsely meshed metal walls.
🔪 Thin conductors Works with EMerge's ThinConductor DoF splitting. The split is described as a cut through the mesh, and the S-parameters match the direct solver to 6·10⁻⁸.

Benchmark

A microstrip coupled-line filter (Wei-Chung Weng): 573k unknowns, 22.9M nonzeros, 2 ports, a 71-point sweep from 0.5 to 4.5 GHz. Run through EMerge on 8 threads of an Apple M3 Ultra:

Solver time, whole sweep Per frequency Peak RAM (whole process)
Direct (SPARTA LDLᵀ) 138.8 s 1.92 s 22.4 GB
CORVID 94.9 s 3.2 s (bottom of band) → 0.6 s (top) 14.8 GB

The peak-RAM figures are from an 11-point sweep. bench/weng/ holds the model and the scripts to reproduce this.

Install

Prebuilt wheels (macOS, Linux and Windows; Python 3.9 or later) are on PyPI and attached to each GitHub release:

pip install corvid-solver

The package installs as corvid-solver and imports as corvid. (PyPI's corvid is an unrelated project.)

The coarse factorization uses the dense kernels compiled into SPARTA (SpartaBLAS, or Apple's Accelerate on Macs without SME), so no BLAS has to be installed. corvid.blas_library() reports which one is in use.

To build from source you need a Rust toolchain and network access (SPARTA is fetched from GitHub):

pip install .                       # or, for development: maturin develop --release

Use

import corvid

top = corvid.Topology.nedelec2(edges, tris, solve_ids, nodes=nodes)  # once per mesh
sol = corvid.Solver(top, method="cocg", threads=8)                   # COCG: K is complex symmetric

for K, b, k0 in sweep:            # K: the solved system (CSR or CSC), b: (n,) or (n, ports)
    sol.factorize(K, k0=k0)       # refactors in place, or keeps the factors of a nearby frequency
    x = sol.solve(b)              # all ports in lockstep, starting from earlier solutions
    print(sol.info)               # iterations and true relative residual per port
  • Layout. Topology.nedelec2 takes EMerge's layout: edge_dofs edge blocks, then face_dofs face blocks (default 2 and 2, the second-order mixed spaces), the first edge block being Whitney. That covers every EMerge ElementSpace. For any other layout, corvid.Topology(dof_entity, dof_kind, edges, tris) takes the mesh entity and kind of each unknown.
  • Threads. threads=n sets the count per solver. corvid.set_num_threads(n) sets the default for solvers that don't set one.
  • Docs. The user manual is coming. Until then, the docstrings of corvid.Solver describe every option, and docs/INTERFACE.md describes the EMerge wiring.

How it works

CORVID is a p-multigrid preconditioner with two levels: the second-order Nédélec space n, and its first-order (Whitney) edge subspace, about a fifth of the unknowns. The Whitney level is not coarsened further but factored exactly. On the fine level the smoother is Chebyshev scaled by vertex-patch Schwarz. The design follows the p-multigrid of Palace.

flowchart LR
    r([residual r]) --> pre["Chebyshev smoothing<br/>scaled by vertex-patch Schwarz"]
    pre --> res["r − K y"]
    res --> coarse["exact Whitney solve<br/>SPARTA LDLᵀ"]
    coarse --> post["Chebyshev smoothing<br/>(symmetric)"]
    post --> z([z = M r])
    z -. "one per iteration,<br/>all ports at once" .-> krylov{{"COCG / GMRES"}}
  1. Vertex-patch Schwarz. For every mesh vertex, all unknowns on its edges and faces form one block. Each block is factored exactly, as a sparse LDLᵀ with a minimum-degree ordering. Arnold, Falk and Winther showed that these patches capture the curl-free (gradient) fields that defeat pointwise smoothers.
  2. Chebyshev smoothing. Fourth-kind Chebyshev polynomials (Phillips & Fischer) of the Schwarz-scaled operator, order 3 by default. The spectral bound comes from a short power iteration.
  3. Exact coarse level. The residual on the lowest-order edge unknowns is solved exactly with SPARTA. PML rows can be added, and so can unknowns next to metal walls that are coarse relative to the wavelength.
  4. Krylov. COCG for complex symmetric K (no basis to store), or GMRES. Each iteration does one operator product and one preconditioner application for all ports.
  5. Across a sweep.
    • Same sparsity pattern: refactor in place, reusing SPARTA's analysis, the block orderings and the spectral estimate.
    • Within 20% in k0²: keep the factors and swap in only the new K. If convergence slows, it refactors and continues.
    • Each solve starts from the minimum-residual combination of the last solutions.

Scaling

Everything except the coarse solve is linear in the number of unknowns n: the operator, the Schwarz blocks (one per vertex, of bounded size), the Chebyshev smoothing and the Krylov vectors cost O(n) memory and O(n) work per iteration. The coarse solve does not. It is a sparse direct factorization on the Whitney unknowns of a 3D mesh, m ≈ n/5 of them, and with a nested-dissection ordering a 3D factorization grows as:

Coarse level Whole solver
Memory O(m^4/3) O(n^4/3)
Factorization time O(m²) O(n²)
Solve time per iteration O(m^4/3) O(n^4/3)

The exponents are those of a direct solve of the full problem. The gain is in the constant: a factor of m ≈ n/5 needs about (1/5)^4/3 ≈ 1/9 of the memory and (1/5)² = 1/25 of the work. At today's problem sizes the O(n) terms still dominate, which is why the Weng filter saves about a third of peak RAM rather than nine tenths. For much larger meshes the coarse factorization will dominate, and it then sets the limit.

The iteration count is not guaranteed to be independent of the mesh or the frequency either. Problems with more wavelengths across the domain, or with weak losses near resonance, take more iterations.

For meshes whose Whitney level is too large to factor, corvid.amge contains a prototype of the agglomerated hierarchy that gives CORVID its name, and the way towards O(n) memory. Tetrahedra are grouped into polyhedral volumes, recursively. On every level the coarse spaces commute exactly with gradient and curl, so each level is again an exact de Rham complex (Pasciak & Vassilevski).

Repository

corvid/              Python package: Topology, Solver, PML detection; amge/ prototype
src/                 Rust core (PyO3): sparse kernels, Schwarz blocks, Chebyshev, coarse solve, Krylov
tests/               test_api.py, test_sweep.py, test_wheel.py (+ one EMerge problem in tests/data/)
bench/weng/          the Weng filter benchmark: EMerge model, solver dumps, timing, copper vs direct
research/            experiments, probes and dataset generators behind the design (see docs/)
docs/                EMerge interface notes, research notes and the research notebook (Typst)
tools/               release helpers (third-party notices)
.github/workflows/   wheels for macOS, Linux and Windows, published to PyPI and GitHub releases

Tests: python tests/test_api.py and python tests/test_sweep.py. The full EMerge datasets (data/aegis/) and the research datasets are not in the repository, so the tests use what is available.

Credits and licence

CORVID is Copyright (C) 2026 Robert Fennis, and is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The licence is in LICENSE. CORVID is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.

The AGPL lets you use CORVID in open-source software under the same licence. Software that includes CORVID and is distributed, or offered to users over a network, must make its own source available under the AGPL too. To include CORVID in closed-source software, you need a commercial licence: email robertfennis@emerge-numerics.com.

Built on.

Methods (algorithms followed, no code taken):

  • Arnold, Falk & Winther: vertex-patch Schwarz for H(curl).
  • Phillips & Fischer: fourth-kind Chebyshev smoothers.
  • Hiptmair: distributive smoothing.
  • Pasciak & Vassilevski, and LLNL's parELAG: exact de Rham sequences on agglomerates.
  • AWS Labs' Palace: the design of its p-multigrid preconditioner.
  • van der Vorst & Melissen: COCG.
  • Saad & Schultz: GMRES.

Full references are in LICENSE-THIRD-PARTY, and the notices that ship with every binary are in THIRD-PARTY-NOTICES.

Much of the code was written with Claude (Anthropic), an AI model, under the direction of Robert Fennis.

Metadata

Release files for corvid-solver 0.5.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 corvid-solver 0.5.3
File Size Uploaded Provenance Actions
corvid_solver-0.5.3.tar.gz 120.8 kB With provenance Details for corvid_solver-0.5.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for corvid-solver 0.5.3
File Actions
corvid_solver-0.5.3-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for corvid_solver-0.5.3-cp39-abi3-win_amd64.whl
corvid_solver-0.5.3-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for corvid_solver-0.5.3-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
corvid_solver-0.5.3-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for corvid_solver-0.5.3-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
corvid_solver-0.5.3-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for corvid_solver-0.5.3-cp39-abi3-macosx_11_0_arm64.whl
corvid_solver-0.5.3-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for corvid_solver-0.5.3-cp39-abi3-macosx_10_12_x86_64.whl
corvid_solver-0.5.3-cp39-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 10.12+ x86-64, macOS 11.0+ ARM64, macOS 10.12+ universal2 (ARM64, x86-64) Details for corvid_solver-0.5.3-cp39-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Total release size: 10.8 MB

Release files / corvid_solver-0.5.3.tar.gz

Download URL corvid_solver-0.5.3.tar.gz
Size 120.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fb232db26f981c7db6cae6ba46858a4293b7617b2f0043e5bd82db05680d1c96
BLAKE2b-256 checksum
How to use checksums
51c6b1fd100dcbfd708e8361f2ad8d68dccfc7e7affad960f0f961ecb6012ce6
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 19, 2026.

Transparency log

Release files / corvid_solver-0.5.3-cp39-abi3-win_amd64.whl

Download URL corvid_solver-0.5.3-cp39-abi3-win_amd64.whl
Size 1.6 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
4cc83a0b71c5578796be45690b5abb27e9097a36b8f6b31296cd13a1a59e14f4
BLAKE2b-256 checksum
How to use checksums
917ea12ff566e3d8625497069f2e1f4e08457f4fd1af7849eb79e83c4949e4db
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 19, 2026.

Transparency log

Release files / corvid_solver-0.5.3-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL corvid_solver-0.5.3-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.6 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
ae46b095fa93b68d96aa45e8696e46a37922c664b8aa5dc11553fab62f23b00e
BLAKE2b-256 checksum
How to use checksums
61a5af867edcab6e98c6a9e28d13ef62316517914093c5b77a1a96b939a8ca86
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 19, 2026.

Transparency log

Release files / corvid_solver-0.5.3-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL corvid_solver-0.5.3-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.5 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
11d0a8c85deec4ef2765e4157823e4b87cddf45c4b5f65f8bf1ada1146bbc95d
BLAKE2b-256 checksum
How to use checksums
b97f4983fb317bca0ae384950174ac193f1c24f51ae849ca6d93f3c7a3e471ef
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 19, 2026.

Transparency log

Release files / corvid_solver-0.5.3-cp39-abi3-macosx_11_0_arm64.whl

Download URL corvid_solver-0.5.3-cp39-abi3-macosx_11_0_arm64.whl
Size 1.4 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
24a64f28361a00938e6328fc018ec101ad0d59b4a02606e277f891a83e43db74
BLAKE2b-256 checksum
How to use checksums
25fd156ce01c479815f6fe66ef12a674fb68b57efb9a1cd8d03afcead40e01f2
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 19, 2026.

Transparency log

Release files / corvid_solver-0.5.3-cp39-abi3-macosx_10_12_x86_64.whl

Download URL corvid_solver-0.5.3-cp39-abi3-macosx_10_12_x86_64.whl
Size 1.6 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d2d2aa785f4afcb4f52cf8a0ed6a103f69e860ce6bdc5e731aa2f3dce539c7e7
BLAKE2b-256 checksum
How to use checksums
4f71eff093e77c68b937643b84edbc05e8f4825bd70c5ee1e398d82262067c0b
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 19, 2026.

Transparency log

Release files / corvid_solver-0.5.3-cp39-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Download URL corvid_solver-0.5.3-cp39-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
Size 2.9 MB
Tags CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
61f4f22f56f7cd8d8a751f36e556963a324cdd97cf0a0f9747b21203ede9631b
BLAKE2b-256 checksum
How to use checksums
1e2e063bb90edc42c1acf8c3b2aa32721d4140b12c9fec6f1c3db09682cd14d4
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 19, 2026.

Transparency log

Security for corvid-solver 0.5.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

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for corvid_solver-0.5.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 19, 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.

Release history Release notifications | RSS feed

This release

0.5.3 This release

7 release files Full provenance

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