pycsamt.forward.em2d#
2-D magnetotelluric finite-difference forward solver.
MT2DForward solves the 2-D MT boundary-value problem for both
the TE and TM polarisation modes on a non-uniform staggered grid using
the finite-difference (FD) method.
Physics#
For a 2-D earth with conductivity σ(x, z) and a plane electromagnetic wave incident from above, the governing scalar PDEs (time convention e^{+iωt}) are:
TE mode (electric field parallel to strike, E_y):
∂²E_y/∂x² + ∂²E_y/∂z² − iωμ₀σ(x,z) E_y = 0
TM mode (magnetic field parallel to strike, H_y):
∂/∂x[σ⁻¹ ∂H_y/∂x] + ∂/∂z[σ⁻¹ ∂H_y/∂z] − iωμ₀ H_y = 0
Grid and node numbering#
The FD grid has (nx+1) × (nz+1) nodes. Node at column j, row i
(depth) has global index k = i*(nx+1) + j. The surface is row i = 0,
the bottom is row i = nz.
Boundary conditions#
Dirichlet conditions are applied at all four boundaries using the analytic
1-D MT response of the edge column profiles (left/right) or the halfspace
(top/bottom). For the TE mode the normalised plane-wave source
E_y = 1 at the surface is the natural starting point; the BC values
at depth follow from the 1-D recursion. For the TM mode the analogous
1-D H_y field is used.
Each frequency requires two independent sparse solves (one per mode).
With scipy.sparse.linalg.spsolve and grids of order 50 × 40 nodes
(~2000 unknowns) each solve takes < 0.1 s on a single CPU core.
References
Wannamaker, P.E., Stodt, J.A., Rijo, L. (1987). A stable finite element solution for two-dimensional magnetotelluric modelling. Geophys. J. Int. 88, 277-296.
de Groot-Hedlin, C., Constable, S. (1990). Occam’s inversion to generate smooth, two-dimensional models from magnetotelluric data. Geophysics 55, 1613-1624.
Wait, J.R. (1954). On the relation between telluric currents and the Earth’s magnetic field. Geophysics 19, 281-289.
Classes
|
Output of the 2-D MT forward solver. |
|
2-D magnetotelluric finite-difference forward solver. |
- class pycsamt.forward.em2d.MT2DForward(freqs, grid, *, verbose=True)[source]#
Bases:
object2-D magnetotelluric finite-difference forward solver.
Solves both TE and TM modes for a list of frequencies on the provided
Grid2Dand returns aForwardResponse2Dwith apparent resistivity and phase at all station positions.- Parameters:
Examples
Uniform halfspace — should recover the 1-D MT response:
>>> import numpy as np >>> from pycsamt.forward.grid2d import Grid2D >>> from pycsamt.forward.em2d import MT2DForward >>> freqs = np.logspace(-2, 3, 10) >>> g = Grid2D.halfspace(rho=100.0, nx=30, nz=20, ... x_max=5_000.0, z_max=3_000.0, ... n_stations=5) >>> fwd = MT2DForward(freqs, g) >>> resp = fwd.run() >>> resp.rho_a_te.shape (10, 5)
2-D model with conductive anomaly:
>>> g2 = Grid2D.with_anomaly(bg_rho=100.0, anomaly_rho=2.0, ... anomaly_bounds=(1500.0, 3500.0, 300.0, 900.0), ... nx=40, nz=25, x_max=6000.0, z_max=3000.0, n_stations=10) >>> resp2 = MT2DForward(freqs, g2).run()
- class pycsamt.forward.em2d.ForwardResponse2D(freqs, stations_x, zxy, zyx, rho_a_te, phase_te, rho_a_tm, phase_tm, grid)[source]#
Bases:
objectOutput of the 2-D MT forward solver.
All impedance and apparent-resistivity arrays have shape
(n_freqs, n_stations).- Parameters:
freqs (ndarray, shape (n_freqs,)) – Evaluation frequencies [Hz].
stations_x (ndarray, shape (n_stations,)) – Station x-positions [m].
zxy (ndarray, shape (n_freqs, n_stations), complex) – TE-mode surface impedance Z_xy = E_y / H_x [V/A].
zyx (ndarray, shape (n_freqs, n_stations), complex) – TM-mode surface impedance Z_yx = E_x / H_y [V/A] (negative by convention: Z_yx = −Z_xy for a 1-D earth).
rho_a_te (ndarray, shape (n_freqs, n_stations)) – TE apparent resistivity [Ω·m].
phase_te (ndarray, shape (n_freqs, n_stations)) – TE impedance phase [degrees, 0–90° for a normal model].
rho_a_tm (ndarray, shape (n_freqs, n_stations)) – TM apparent resistivity [Ω·m].
phase_tm (ndarray, shape (n_freqs, n_stations)) – TM impedance phase [degrees].
grid (Grid2D) – The model grid used for the forward run.
- to_feature_array(*, mode='both', log_rho=True, include_phase=True)[source]#
Flatten to a 2-D feature matrix for ML training.
- Parameters:
- Return type:
ndarray, shape (n_stations, n_features)