Skip to content

Commit

Permalink
Bugfix for TDEM magnetic dipole sources (simpeg#1572)
Browse files Browse the repository at this point in the history
#### Summary
Bugfix so that the initial fields produced for `db/dt`, `dh/dt`, from
the B field or H field simulations are zero. There was previously a bug
where we set the electric source term to `Zero()` when infact it should
have been evaluated. This would only effect `db/dt` (or `dh/dt`) that
were measured before the first time-step, but it also impacted
visualizations of the fields.

To catch this issue, I have extended our cross-check tests for tdem
simulation to also include an evaluation of the data at t=0. Running
this test on the current main version of SimPEG will fail.
  • Loading branch information
lheagy authored Nov 4, 2024
1 parent 8c04621 commit 60e0c3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions simpeg/electromagnetics/time_domain/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,11 +1428,7 @@ def s_e(self, simulation, time):
self.waveform.has_initial_fields is True
and time < simulation.time_steps[1]
):
if simulation._fieldType == "b":
return Zero()
elif simulation._fieldType == "e":
# Compute s_e from vector potential
return C.T * (MfMui * b)
return C.T * (MfMui * b)
else:
return C.T * (MfMui * b) * self.waveform.eval(time)

Expand All @@ -1443,11 +1439,7 @@ def s_e(self, simulation, time):
self.waveform.has_initial_fields is True
and time < simulation.time_steps[1]
):
if simulation._fieldType == "h":
return Zero()
elif simulation._fieldType == "j":
# Compute s_e from vector potential
return C * h
return C * h
else:
return C * h * self.waveform.eval(time)

Expand Down
2 changes: 1 addition & 1 deletion tests/em/tdem/test_TDEM_crosscheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def setUp_TDEM(
)
mapping = maps.ExpMap(mesh) * maps.SurjectVertical1D(mesh) * activeMap

rxtimes = np.logspace(-4, -3, 20)
rxtimes = np.hstack([np.r_[0], np.logspace(-4, -3, 20)])

if waveform.upper() == "RAW":
t0 = 0.006
Expand Down

0 comments on commit 60e0c3a

Please sign in to comment.