Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@JKutt
Copy link
Contributor

@JKutt JKutt commented Aug 9, 2023

Summary

A PR to bring in methods inorder to calculate sensitivity and sensitivity weights for fdem and nsem simulations with the MetaSimulation class.

Added methods for the FDEM simulation class are:

  • getJ
  • getJtJdiag

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.

Reference issue

NA

What does this implement/fix?

Allows the calculation of the sensitivity matrix for fdem and nsem

Additional information

NA

@JKutt JKutt self-assigned this Aug 9, 2023
@JKutt JKutt marked this pull request as draft August 9, 2023 21:50
Copy link
Contributor

@domfournier domfournier left a comment

Choose a reason for hiding this comment

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

Glad to see this coming along. See comments

@jcapriot
Copy link
Member

My question would be do we need another way to call getting the J function? I.e. the compute_J function. We should probably just leave it as a single function using what we’ve already established.

@JKutt
Copy link
Contributor Author

JKutt commented Aug 10, 2023

My question would be do we need another way to call getting the J function? I.e. the compute_J function. We should probably just leave it as a single function using what we’ve already established.

So just lump this all into the getJ function?

@JKutt
Copy link
Contributor Author

JKutt commented Aug 10, 2023

@jcapriot , https://github.com/JKutt/simpeg/blob/c5d54c5b1c31eea9e9e3e9b281e40d9f8b030135/SimPEG/meta/simulation.py#L312C17-L313C53

these lines don't seem to execute and the model does not get passed down to the sub simulations. Is there a place I should be setting this self._repeat_sim?

@jcapriot
Copy link
Member

@jcapriot , https://github.com/JKutt/simpeg/blob/c5d54c5b1c31eea9e9e3e9b281e40d9f8b030135/SimPEG/meta/simulation.py#L312C17-L313C53

these lines don't seem to execute and the model does not get passed down to the sub simulations. Is there a place I should be setting this self._repeat_sim?

No, you shouldn't mess with that property, it is only used when there is actually a RepeatedSimulation (i.e. a single simulation is used repeatedly for multiple models). If you look further up in that function you linked, when it sets self.model = m, it should go through the MetaSimulation's model setter, which then will echo the model to all sub simulations.

Copy link
Member

@jcapriot jcapriot left a comment

Choose a reason for hiding this comment

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

I think you'll need to change indexing the J matrix

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Attention: Patch coverage is 97.10145% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 82.27%. Comparing base (7420f93) to head (3d2ad2a).

Files Patch % Lines
...EG/electromagnetics/frequency_domain/simulation.py 96.07% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1276      +/-   ##
==========================================
+ Coverage   82.24%   82.27%   +0.03%     
==========================================
  Files         165      165              
  Lines       25162    25225      +63     
==========================================
+ Hits        20694    20755      +61     
- Misses       4468     4470       +2     

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

@JKutt JKutt marked this pull request as ready for review September 8, 2023 19:29
@JKutt
Copy link
Contributor Author

JKutt commented Sep 8, 2023

@simpeg/simpeg-developers

@lheagy lheagy added this to the 0.21.0 milestone Nov 29, 2023
@JKutt
Copy link
Contributor Author

JKutt commented Jan 4, 2024

@jcapriot , @santisoler , examples are working and tests are passing! Though have a look at the pde_simulation.py modifications. specifically the function __inner_mat_mul_op. For the adjoint, I had to add a case for when the second dimension is larger than 2. When building the full J matrix I am passing v as an identity matrix. Perhaps there is a more elegent way to do this? Let me know what you think.

@jcapriot
Copy link
Member

This is now good to go on my end, had to fix a few implementation errors

@jcapriot jcapriot merged commit e8367b0 into simpeg:main Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants