adjoint debugging

This commit is contained in:
Lindsey Heagy
2016-02-21 11:33:15 -08:00
parent feff936c92
commit f37235973b
2 changed files with 5 additions and 3 deletions
+3 -3
View File
@@ -139,14 +139,14 @@ class BaseFDEMProblem(BaseEMProblem):
dRHS_dmT = self.getRHSDeriv(freq, src, ATinvdf_duT, adjoint=True)
du_dmT = -dA_dmT + dRHS_dmT
df_dmT += du_dmT
Df_DmT = df_dmT + du_dmT
# TODO: this should be taken care of by the reciever?
real_or_imag = rx.projComp
if real_or_imag is 'real':
Jtv += np.array(df_dmT,dtype=complex).real
Jtv += np.array(Df_DmT,dtype=complex).real
elif real_or_imag is 'imag':
Jtv += - np.array(df_dmT,dtype=complex).real
Jtv += - np.array(Df_DmT,dtype=complex).real
else:
raise Exception('Must be real or imag')
+2
View File
@@ -633,6 +633,8 @@ class Fields_b(Fields):
"""
n = int(self._aveE2CCV.shape[0] / self._nC) # number of components
VI = sdiag(np.kron(np.ones(n), 1./self.prob.mesh.vol))
if adjoint:
return self._MfMui.T * ( self._edgeCurl * ( self._aveE2CCV.T * (VI.T * du_dm_v) ) )
return VI * (self._aveE2CCV * (self._edgeCurl.T * ( self._MfMui * du_dm_v ) ) )