diff --git a/SimPEG/EM/FDEM/FieldsFDEM.py b/SimPEG/EM/FDEM/FieldsFDEM.py index 253b9984..6a39e00d 100644 --- a/SimPEG/EM/FDEM/FieldsFDEM.py +++ b/SimPEG/EM/FDEM/FieldsFDEM.py @@ -60,6 +60,20 @@ class Fields(SimPEG.Problem.Fields): 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 @@ -124,6 +138,21 @@ class Fields(SimPEG.Problem.Fields): 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 @@ -471,6 +500,8 @@ class Fields3D_b(Fields): return 'E' elif fieldType == 'b': return 'F' + elif fieldType == 'bSecondary': + return 'F' elif (fieldType == 'h') or (fieldType == 'j'): return'CCV' else: diff --git a/SimPEG/EM/FDEM/RxFDEM.py b/SimPEG/EM/FDEM/RxFDEM.py index 53d6c722..318e62b7 100644 --- a/SimPEG/EM/FDEM/RxFDEM.py +++ b/SimPEG/EM/FDEM/RxFDEM.py @@ -97,6 +97,19 @@ class Point_b(BaseRx): 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): """