Skip to content

Commit

Permalink
Implementation for Inverting Secondary B field
Browse files Browse the repository at this point in the history
  • Loading branch information
seogi_macbook committed Jun 17, 2016
1 parent 382b31b commit 2fb0f3f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
31 changes: 31 additions & 0 deletions SimPEG/EM/FDEM/FieldsFDEM.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ def _b(self, solution, srcList):

return self._bPrimary(solution, srcList) + self._bSecondary(solution, srcList)

def _bSecondary(self, solution, srcList):
"""
Total magnetic flux density is sum of primary and secondary
:param numpy.ndarray solution: field we solved for
:param list srcList: list of sources
:rtype: numpy.ndarray
:return: total magnetic flux density
"""
if getattr(self, '_bSecondary', None) is None:
raise NotImplementedError ('Getting b from %s is not implemented' %self.knownFields.keys()[0])

return self._bSecondary(solution, srcList)

def _h(self, solution, srcList):
"""
Total magnetic field is sum of primary and secondary
Expand Down Expand Up @@ -124,6 +138,21 @@ def _bDeriv(self, src, du_dm_v, v, adjoint = False):
return self._bDeriv_u(src, v, adjoint), self._bDeriv_m(src, v, adjoint)
return np.array(self._bDeriv_u(src, du_dm_v, adjoint) + self._bDeriv_m(src, v, adjoint), dtype = complex)

def _bSecondaryDeriv(self, src, du_dm_v, v, adjoint = False):
"""
Total derivative of b with respect to the inversion model. Returns :math:`d\mathbf{b}/d\mathbf{m}` for forward and (:math:`d\mathbf{b}/d\mathbf{u}`, :math:`d\mathb{u}/d\mathbf{m}`) for the adjoint
:param Src src: sorce
:param numpy.ndarray du_dm_v: derivative of the solution vector with respect to the model times a vector (is None for adjoint)
:param numpy.ndarray v: vector to take sensitivity product with
:param bool adjoint: adjoint?
:rtype: numpy.ndarray
:return: derivative times a vector (or tuple for adjoint)
"""
# TODO: modify when primary field is dependent on m

return self._bDeriv(src, du_dm_v, v, adjoint = adjoint)

def _hDeriv(self, src, du_dm_v, v, adjoint = False):
"""
Total derivative of h with respect to the inversion model. Returns :math:`d\mathbf{h}/d\mathbf{m}` for forward and (:math:`d\mathbf{h}/d\mathbf{u}`, :math:`d\mathb{u}/d\mathbf{m}`) for the adjoint
Expand Down Expand Up @@ -471,6 +500,8 @@ def _GLoc(self,fieldType):
return 'E'
elif fieldType == 'b':
return 'F'
elif fieldType == 'bSecondary':
return 'F'
elif (fieldType == 'h') or (fieldType == 'j'):
return'CCV'
else:
Expand Down
13 changes: 13 additions & 0 deletions SimPEG/EM/FDEM/RxFDEM.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ def __init__(self, locs, orientation=None, component=None):
self.projField = 'b'
super(Point_b, self).__init__(locs, orientation, component)

class Point_bSecondary(BaseRx):
"""
Magnetic flux FDEM receiver
:param numpy.ndarray locs: receiver locations (ie. :code:`np.r_[x,y,z]`)
:param string orientation: receiver orientation 'x', 'y' or 'z'
:param string component: real or imaginary component 'real' or 'imag'
"""

def __init__(self, locs, orientation=None, component=None):
self.projField = 'bSecondary'
super(Point_bSecondary, self).__init__(locs, orientation, component)


class Point_h(BaseRx):
"""
Expand Down

0 comments on commit 2fb0f3f

Please sign in to comment.