pycsamt.forward.maxwell.mt2d#
Validated adapter for the in-repo 2-D MT finite-difference solver.
MT2DAdapter bridges the solver-neutral
MaxwellProblem /
ForwardResult contract to the
existing, tested finite-difference implementation in
pycsamt.forward.em2d
(MT2DForward) over a
Grid2D model. No new physics is
introduced here: this module only translates problem/result shapes and
enforces the assumptions the wrapped solver actually makes.
Known solver-specific limits, declared through
BackendCapabilities or checked
in MT2DAdapter.assess():
only the
zxy(TE) andzyx(TM) impedance components are produced, matching the physical 2-D TE/TM decomposition;every receiver must sit exactly at the surface (
z = 0); the wrapped solver has no borehole or buried-receiver formulation;the earth model has no inactive (air) cells: the solver always treats the full mesh as earth, so a problem must use
mark_air_inactive=Falsewhen built fromto_problem();magnetic permeability is fixed at the vacuum value
4*pi*1e-7H/m, matchingpycsamt.forward.em2d.MU0;only the
exp(+iwt)phasor convention is supported, matching the sign convention hardcoded inpycsamt.forward.em2d.
A numerically degenerate solve (near-zero surface magnetic field at a
station) makes pycsamt.forward.em2d fall back to 0 + 0j
rather than raise or return NaN; such an entry is currently
reported as valid because
valid defaults
to finiteness. This is a known, narrow limitation inherited from the
wrapped solver, not something this adapter can detect from its output
alone.
Scipy (a required pycsamt dependency, not optional) is imported only
through pycsamt.forward.em2d; this module performs no lazy or
optional-dependency handling of its own.
Functions
|
Register |
Classes
|
Validated 2-D MT adapter over the in-repo finite-difference solver. |
- class pycsamt.forward.maxwell.mt2d.MT2DAdapter(*, version='1.0', policy=None, verbose=False)[source]
Bases:
BaseMaxwellAdapterValidated 2-D MT adapter over the in-repo finite-difference solver.
- Parameters:
version (str, default="1.0") – Adapter version reported in every
ForwardResult. Bump this when the translation logic in this module changes in a way that could alter numerical output.policy (AdapterPolicy or None, optional) – Solver-independent result acceptance policy. Defaults to
AdapterPolicy.verbose (bool, default=False) – Forwarded to
MT2DForward; prints per-frequency progress when true.
Examples
>>> import numpy as np >>> from pycsamt.forward.maxwell import ( ... MaxwellMesh, ... MaxwellProblem, ... ReceiverSet, ... ) >>> mesh = MaxwellMesh( ... np.linspace(0, 10_000, 41), np.linspace(0, 5_000, 31) ... ) >>> problem = MaxwellProblem( ... mesh, ... np.full(mesh.shape, 1.0 / 100.0), ... [10.0, 1.0], ... ReceiverSet([[5_000.0, 0.0]], ["S00"]), ... ("zxy", "zyx"), ... ) >>> adapter = MT2DAdapter(verbose=False) >>> result = adapter.solve(problem) >>> result.shape (1, 2, 2)
- assess(problem)[source]
Assess a problem, adding this solver’s surface-only checks.
- Parameters:
problem (MaxwellProblem) – Candidate simulation problem.
- Returns:
The generic capability report from
assess(), extended with two solver-specific checks: every receiver must be at the surface, and the permeability must be the vacuum value the wrapped solver hardcodes.- Return type:
Examples
See
MT2DAdapterfor a complete solve example; a problem with a buried receiver is rejected before the solver runs.
- pycsamt.forward.maxwell.mt2d.register_mt2d_backend(*, replace=False)[source]
Register
MT2DAdapterin the process-wide backend registry.- Parameters:
replace (bool, default=False) – Explicitly replace an existing
"mt2d"registration.- Return type:
None
Examples
>>> from pycsamt.forward.maxwell import create_backend, list_backends >>> register_mt2d_backend(replace=True) >>> "mt2d" in list_backends() True >>> create_backend("mt2d").capabilities.name 'mt2d'