Skip to content

EMsimulation face and edge conductivities - #1296

Merged
dccowan merged 164 commits into
mainfrom
EMsimulationFaceProperties
Oct 20, 2026
Merged

dccowan merged 164 commits into
mainfrom
EMsimulationFaceProperties

Conversation

@dccowan

@dccowan dccowan commented Oct 25, 2023 •

Copy link
Copy Markdown
Member

Summary

This pull request covers the addition of face and edge conductivities to FDEM and TDEM simulations. Because most of the properties are part of a base EMsimulation class, work can be done to add this functionality to static problems in the future. Due to the amount of invertible and non-invertible properties, we will make new simulation classes to handle this type of problem, and leave the original EM simulation classes as is.

PR Checklist

  • If this is a work in progress PR, set as a Draft PR
  • Linted my code according to the style guides.
  • Added tests to verify changes to the code.
  • Added necessary documentation to any new functions/classes following the
    expect style.
  • Marked as ready for review (if this is was a draft PR), and converted
    to a Pull Request
  • Tagged @simpeg/simpeg-developers when ready for review.

What does this implement/fix?

  • Add the ability to define face and edge conductivities on for 2D and 3D FDEM and TDEM simulations.
  • Add the Jvec and Jtvec methods to allow differentiation with respect to these properties
  • Add utilities to project surfaces to tensor and tree meshes

@dccowan dccowan self-assigned this Oct 25, 2023
@dccowan
dccowan marked this pull request as draft October 25, 2023 18:00
@codecov

codecov Bot commented Nov 2, 2023 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.34605% with 83 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.71%. Comparing base (89ce061) to head (d47c71e).

Files with missing lines Patch % Lines
simpeg/base/pde_simulation.py 88.18% 10 Missing and 16 partials ⚠️
simpeg/electromagnetics/utils/testing_utils.py 68.57% 13 Missing and 9 partials ⚠️
simpeg/electromagnetics/time_domain/simulation.py 44.44% 6 Missing and 14 partials ⚠️
simpeg/maps/_injection.py 85.00% 6 Missing and 6 partials ⚠️
...ard/test_FDEM_analytic_edge_face_conductivities.py 99.16% 0 Missing and 1 partial ⚠️
tests/em/fdem/inverse/test_FDEM_adjoint.py 97.29% 0 Missing and 1 partial ⚠️
...dem/test_TDEM_analytic_edge_face_conductivities.py 99.15% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1296      +/-   ##
==========================================
+ Coverage   86.52%   86.71%   +0.18%     
==========================================
  Files         423      429       +6     
  Lines       56338    57506    +1168     
  Branches     5354     5438      +84     
==========================================
+ Hits        48749    49865    +1116     
- Misses       6171     6197      +26     
- Partials     1418     1444      +26     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dccowan
dccowan requested a review from a team November 2, 2023 03:03
@dccowan
dccowan marked this pull request as ready for review November 2, 2023 03:04
@dccowan

dccowan commented Nov 2, 2023

Copy link
Copy Markdown
Member Author

With regards to docstrings, this will be done when general docstrings for EM modules are created for the API.

@jcapriot jcapriot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for turning these around so quickly @dccowan. The cache, the map names and the DC test all look good now (I checked the cache by changing each property and doing a model update, and compared against freshly built sims). I left suggestions for what's left that you can batch-commit: the hierarchical q in the electric field docstring, the np.random.default_rng(...) lines (those don't seed the global state), survey as a positional argument again, the full-tensor case in MeSigmaI, and a handful of docstring typos. I ran the base, maps, DC, FDEM and TDEM hierarchical tests with all of them applied and they pass.

One other thing: the direct eDeriv_m / eDeriv_u adjoint tests from TDEM_Fields_B_Pieces aren't in test_TDEM_DerivAdjoint.py anymore. The new parametrized tests reach those functions as integration tests (I perturbed the adjoint branches and several of the B formulation cases fail), but unit tests for them are still worth having. They isolate the fields functions so a failure points straight at the function, and they caught a 0.1% error that only some of the new cases do. I'd strongly suggest bringing them back as plain pytest functions (no unittest class needed).

I'll reply on the getA(resistivity) thread separately.

Comment thread tests/base/test_base_pde_sim.py Resolved

@jcapriot jcapriot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work Devin, I'm happy with it now!

@santisoler

Copy link
Copy Markdown
Member

Thanks @dccowan and @jcapriot for the work. Let me know if you think we should merge it or if there's anything else you want to push here.

@dccowan
dccowan merged commit cf41688 into main Oct 20, 2026
21 checks passed
@lheagy

lheagy commented Oct 20, 2026

Copy link
Copy Markdown
Member

🚀

@dccowan
dccowan deleted the EMsimulationFaceProperties branch October 20, 2026 16:38
@dccowan
dccowan restored the EMsimulationFaceProperties branch October 20, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants