Skip to content

Commit 51615d0

Browse files
committed
Fix scattering for FEM simulations
1 parent abec17f commit 51615d0

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

simpeg/dask/electromagnetics/frequency_domain/simulation.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def compute_J(self, m, f=None):
282282
for block_derivs_chunks, addresses_chunks in zip(
283283
blocks_receiver_derivs, blocks, strict=True
284284
):
285-
Jmatrix = parallel_block_compute(
285+
parallel_block_compute(
286286
simulation,
287287
m,
288288
Jmatrix,
@@ -301,7 +301,10 @@ def compute_J(self, m, f=None):
301301
gc.collect()
302302
if self.store_sensitivities == "disk":
303303
del Jmatrix
304-
Jmatrix = array.from_zarr(self.sensitivity_path)
304+
return array.from_zarr(self.sensitivity_path)
305+
306+
if client:
307+
return client.gather(Jmatrix)
305308

306309
return Jmatrix
307310

@@ -367,11 +370,9 @@ def parallel_block_compute(
367370
count += n_cols
368371

369372
if client:
370-
client.gather(block_delayed)
373+
return client.gather(block_delayed)
371374
else:
372-
compute(block_delayed)
373-
374-
return Jmatrix
375+
return compute(block_delayed)
375376

376377

377378
Sim.compute_J = compute_J

0 commit comments

Comments
 (0)