kicad2ems.core.solvers

The solvers: each one a Solver subclass, listed in SOLVERS by its module and
class. The line model solved as a circuit by qucs (qucsator) or scikit
(scikit-rf); the full-wave solvers openems and gfdtd (3D FDTD, the one FDTD
model on openEMS's engine or gfdtd's: kicad2ems.fdtd), mom25d (2.5D Method
of Moments: kicad2ems.mom25d), palace (3D FEM: kicad2ems.fem) and pcbqs
(quasi-static: kicad2ems.pcbqs). Each appears in --solvers, --check, the config
tables and the GUI with no change here.

    from kicad2ems.core.solvers import registry, get
    get('mom').name  # 'mom25d' (aliases: fdtd, mom, qucsator, skrf)
    [sv.label for sv in registry().values()]

A solver declares (class attributes)
  name, aliases, label  'mom25d', ('mom',), 'mom25d (MoM)'; name is also its
                        table [solver.mom25d]
  consumes              'board' (the geometry) or 'network' (the line model,
                        tlines.LineModel)
  previewed             True: --preview prepares it without solving (openEMS:
                        the mesh preview)
  rank                  rough cost: 0 circuit, 1 planar, 2 3D; the cheap solvers
                        run first
  order                 its place in the registry (lists, the GUI, the order of
                        results): lowest first, then by name
  capabilities          {feature: 'yes' | 'no' | 'ignored' | 'approximated:
                        how'}, features in FEATURES
  options               [Option]: its settings. The command-line options, the
                        config keys (top level, or under [solver.<name>] by
                        their short names), the GUI fields and the Settings
                        fields are all made from these lists (and config.CORE
                        for the settings of every run)
and implements
  check(s=None)           (usable, one line: version and origin, or what is
                          missing and how to get it); s: the settings of the
                          run, where one says where the solver is (--qucsator)
  validate(s)             a message when its settings cannot be used together
                          (checked with the settings)
  assess(run)             why it cannot model this board in this run ([]: it
                          can); after the board and the line model are built,
                          before any solver prepares
  prepare(run)            its own form of the board (openEMS: boundaries, mesh),
                          handed to solve()
  solve(run, prep)        Result: S-parameters over the board's ports, as
                          reported
  outputs(run, prep, res) its own extra outputs (plots, files, summary entries);
                          optional
  reusable(run)           whether an earlier run's result may stand for its
                          solve (no outputs() then): by default only where it
                          has no outputs() (kicad2ems.core.reuse)
  deviations(run, prep)   [Deviation]: what it models differently from the
                          board, by its own rules (vias moved onto a mesh, parts
                          split, walls as via rows), for the report and the
                          parity checks
  readback(run, prep)     what its native model holds, read back (parity.py:
                          vias, copper area per layer, parts, ports), or None
  estimate(run)           dict(seconds, gb, what): its rough cost on this board
                          (--solvers auto), or None
  resources()             dict(gpus=[dict(device, backend, api, free, total):
                          GB], why): the GPUs it would run on here and why there
                          are none (sysinfo, the GUI's System panel), or None:
                          the CPU only

`run` is the pipeline's Job. A solver may use run.m (the board), run.s
(Settings: its options are fields), run.freq (Hz), run.lm (the line model),
run.name, run.log(), run.status(run_name, dict) (progress events),
run.path(suffix), run.wrote(label, path), run.figure(fig, suffix, key, label)
and run.summary.
class kicad2ems.core.solvers.Deviation(item: str, feature: str, what: str, amount: float = None, to: object = None, dropped: bool = False, added: list = None, layer: str = None, area: float = None)[source]
Something a solver models differently from the board, and says so
(parity.py, the report's "What each solver saw" table). item names what it
is about: 'via:<index>', 'wall:<index>', 'part:<ref>', 'copper:<layer>',
'outline'.
class kicad2ems.core.solvers.Result(S: ~numpy.ndarray, names: list, zref: list, seconds: float, info: dict = <factory>, comment: str = '')[source]
A solver's answer, over the board's ports as reported: differential pairs
as mixed-mode ports (P1d, P1c), the others single-ended, in board order. NaN
where a term was not computed.
class kicad2ems.core.solvers.Solver[source]
A solver. A subclass sets the declarations (class attributes: the
module docstring lists them) and overrides the steps it does differently;
the pipeline calls them in the order check, validate, assess, estimate (for
auto), prepare, solve, deviations and readback (the parity checks),
outputs.
assess(run)[source]
Why it cannot model this board in this run, a list of reasons ([]: it
can). Called after the board and the line model are built, before any
solver prepares.
check(s=None)[source]
(usable, one line): its version and origin, or what is missing and
how to get it. s: the run's settings, where one says where the solver is
(--qucsator); None for --check.
details()[source]
(usable, report lines) of a longer check (--check, and when a named
solver cannot run).
deviations(run, prep)[source]
[Deviation]: what it models differently from the board, by its own
rules (vias moved onto a mesh, parts split, walls as via rows), for the
report and the parity checks.
estimate(run)[source]
dict(seconds, gb, what): its rough cost on this board, for --solvers
auto, or None.
outputs(run, prep, res)[source]
Its own outputs after the solve (plots, files, summary entries);
optional.
prepare(run)[source]
Its own form of the board (openEMS: the boundaries and the mesh),
handed to solve() and the later steps; None when it needs none. A
preview stops here.
readback(run, prep)[source]
What its native model holds, read back in the board's terms
(parity.py: vias, copper area per layer, parts, ports), or None.
resources()[source]
dict(gpus=[dict(device, backend, api, free, total)], why): the GPUs
it would run on here (memory in GB) and why there are none (sysinfo, the
GUI's System panel), or None: the CPU only.
reusable(run)[source]
Whether an earlier run's result may stand for its solve in this run
(kicad2ems.core.reuse): its outputs() is not called for one, so a solver
whose outputs need what its solve keeps says no where this run asks for
them. By default: only a solver with no outputs() of its own.
solve(run, prep)[source]
The Result: S-parameters over the board's ports as reported
(differential pairs as mixed-mode ports).
validate(s)[source]
A message when its settings in s cannot be used together (None:
fine); checked for every run.
kicad2ems.core.solvers.aliases()[source]
{name or alias: name} of every solver.
kicad2ems.core.solvers.capability_table()[source]
The capabilities as text lines: one row per feature, one column per
solver (--check).
kicad2ems.core.solvers.get(name)[source]
The solver of a name or alias (any case).
kicad2ems.core.solvers.ordered(names)[source]
Solver names in registry order; LINES (the line model, not resolved yet)
where the line solvers are.
kicad2ems.core.solvers.registry()[source]
{name: Solver}: every solver of SOLVERS, by its `order` (then its name).
Solvers may share a setting by listing the same Option object (the FDTD
solvers' mesh and run settings).
kicad2ems.core.solvers.resolve_lines(s=None)[source]
The solver LINES stands for: qucs when qucsator is installed (its
coupled-line and discontinuity models), else scikit.

Modules