Repository navigation
Open
Description
Describe the issue:
For the 1D and 2D finite volume NSEM simulation classes, the getJ method does not work. All of these simulation classes currently inherit getJ from BaseFDEMSimulation. Functionality must be fixed or attempting to call getJ should throw a NotImplementedError.
Reproducible code example:
import numpy as np
from scipy.constants import mu_0
from simpeg.electromagnetics import natural_source as nsem
from simpeg import maps
from discretize import TensorMesh, TreeMesh, CylindricalMesh
from pymatsolver import Pardiso
def create_simulation_1d(sim_type, deriv_type):
cs = 100
ncz = 200
npad = 20
pf = 1.2
hz = [(cs, npad, -pf), (cs, ncz), (cs, npad)]
mesh = TensorMesh(
[
hz,
]
)
mesh.x0 = np.r_[-mesh.h[0][:-npad].sum()]
frequencies = np.logspace(-2, 1, 30)
rx_list = [
nsem.receivers.PointNaturalSource([[0]], orientation="xy", component="real"),
nsem.receivers.PointNaturalSource([[0]], orientation="xy", component="imag"),
nsem.receivers.PointNaturalSource(
[[0]], orientation="xy", component="apparent_resistivity"
),
nsem.receivers.PointNaturalSource([[0]], orientation="xy", component="phase"),
nsem.receivers.PointNaturalSource([[0]], orientation="yx", component="real"),
nsem.receivers.PointNaturalSource([[0]], orientation="yx", component="imag"),
nsem.receivers.PointNaturalSource(
[[0]], orientation="yx", component="apparent_resistivity"
),
nsem.receivers.PointNaturalSource([[0]], orientation="yx", component="phase"),
]
src_list = [nsem.sources.Planewave(rx_list, frequency=f) for f in frequencies]
survey = nsem.Survey(src_list)
sigma_back = 1e-1
sigma_right = 1e-3
sigma_air = 1e-8
sigma_1d = np.ones(mesh.n_cells) * sigma_back
sigma_1d[-npad:] = sigma_air
sigma_1d[50:-npad] = sigma_right
if deriv_type == "sigma":
sim_kwargs = {"sigmaMap": maps.ExpMap()}
test_mod = np.log(sigma_1d)
else:
sim_kwargs = {"muMap": maps.ExpMap(), "sigma": sigma_1d}
test_mod = np.log(mu_0) * np.ones(mesh.n_cells)
if sim_type.lower() == "e":
sim = nsem.simulation.Simulation1DElectricField(
mesh,
survey=survey,
**sim_kwargs,
solver=Pardiso,
)
else:
sim = nsem.simulation.Simulation1DMagneticField(
mesh,
survey=survey,
**sim_kwargs,
solver=Pardiso,
)
return sim, test_mod
sim, test_mod = create_simulation_1d("e", "sigma")
J = sim.getJ(test_mod)
sim, test_mod = create_simulation_1d("h", "sigma")
J = sim.getJ(test_mod)Error message:
No response
Runtime information:
Almost instant for this.
Context for the issue:
No response
Activity
Raise NotImplementedError on getJ for NSEM 1D simulations (#1653)
santisoler commentedon Apr 24, 2025
I merged #1653 to make the
getJmethods to raise aNotImplementedErrorfor now. I'll leave this issue open as reminder that we should implement them.Raise NotImplementedError on getJ for NSEM 1D simulations (simpeg#1653)