Skip to content

2D forward modelling ​

In 2D the resistivity changes along a profile and with depth, but not along the geological strike. The MT fields then split into two independent modes: TE (electric field along strike) and TM (magnetic field along strike). MTGeophysics.jl solves both with finite differences on a rectangular mesh, including topography and lakes.

In this section we compute the 2D response of a model. A forward run needs three files: a model, a data file giving the stations and frequencies, and a forward control file. It writes data.pred.

Run the example ​

bash
julia --project=. helpers/benchmarks_2D.jl    # writes examples/data/2D-IV
julia --project=. examples/run_fwd2D.jl       # model.true -> data.pred

To use your own files:

bash
julia --project=. examples/run_fwd2D.jl model.rho data.dat FwdCtrl

The forward control file ​

fwd.ctrl sets the mode, the strike and the air above the model. The example (examples/ctrl/2D/FwdCtrl) looks like this:

text
Mode                     : TETM
Strike (deg)             : auto
Air layers               : 10
Air thickness (m)        : 50000
Air growth factor        : 2
Air resistivity (ohm m)  : 1e+09
Write Frechet derivative : no
Dipole length (m)        : 100

Most of the time you only change the first two lines. Mode is TE, TM or TETM. Strike is auto or an angle in degrees; the data are rotated to it before the run (see Rotation and strike).

From Julia ​

julia
using MTGeophysics

pred = ForwardSolve2D("model.rho", "data.dat", "FwdCtrl")    # writes data.pred next to data.dat
PlotData2D("data.dat"; predicted_path = pred, output_path = "DataFit.png")

The second line plots the observed and predicted apparent resistivity and phase, so you can compare them (see 2D plots).

Working in memory ​

If you want to change the model in a script, for example inside your own inversion, work with the mesh and resistivity directly:

julia
mesh, ρ = Mesh2DFromInputs(ReadModel2D("model.rho"), load_data2d("data.dat"), ReadFwdCtrl2D("FwdCtrl"))
response = run_mt2d_forward(mesh, ρ; mode = :TETM)

response holds the TE and TM impedances, apparent resistivities and phases, per frequency and station.

Benchmarks ​

helpers/benchmarks_2D.jl writes four test cases into examples/data/. The stations run east–west near Jyväskylä, Finland, one every kilometre.

CaseDescription
2D-Ia thin conductive dyke in a two-layer earth
2D-IItwo resistive blocks in a two-layer earth
2D-IIIconductors and resistors in a three-layer earth
2D-IV2D-III under 100–200 m of hills and a 3 km lake, with topo.dat (the default)
bash
julia --project=. helpers/benchmarks_2D.jl 2D-I 2D-II 2D-III 2D-IV

The data of each case are computed on a finer mesh than the one the inversion uses, so an inversion cannot fit them by simply reproducing the forward mesh.