mirror of
https://github.com/wassname/simpeg.git
synced 2026-06-28 13:54:53 +08:00
Multiple recs on one tx for the same field had a bug. These should add in the projection adjoint.
This commit is contained in:
@@ -16,15 +16,14 @@ class BaseTDEMProblem(BaseTimeProblem, BaseEMProblem):
|
||||
|
||||
surveyPair = SurveyTDEM
|
||||
|
||||
def calcFields(self, sol, solType, tInd):
|
||||
def calcFields(self, sol, tInd):
|
||||
|
||||
if solType == 'b':
|
||||
if self.solType == 'b':
|
||||
b = sol
|
||||
e = self.MeSigmaI*self.mesh.edgeCurl.T*self.MfMui*b
|
||||
# Todo: implement non-zero js
|
||||
else:
|
||||
errStr = 'solType: ' + solType
|
||||
raise NotImplementedError(errStr)
|
||||
raise NotImplementedError('solType "%s" is not implemented in CalcFields.' % self.solType)
|
||||
|
||||
return {'b':b, 'e':e}
|
||||
|
||||
@@ -53,7 +52,7 @@ class BaseTDEMProblem(BaseTimeProblem, BaseEMProblem):
|
||||
sol = Asolve.solve(rhs)
|
||||
if sol.ndim == 1:
|
||||
sol.shape = (sol.size,1)
|
||||
F[:,:,tInd+1] = CalcFields(sol, self.solType, tInd)
|
||||
F[:,:,tInd+1] = CalcFields(sol, tInd)
|
||||
return F
|
||||
|
||||
def adjoint(self, m, RHS, CalcFields, F=None):
|
||||
@@ -71,6 +70,6 @@ class BaseTDEMProblem(BaseTimeProblem, BaseEMProblem):
|
||||
sol = Asolve.solve(rhs)
|
||||
if sol.ndim == 1:
|
||||
sol.shape = (sol.size,1)
|
||||
F[:,:,tInd+1] = CalcFields(sol, self.solType, tInd)
|
||||
F[:,:,tInd+1] = CalcFields(sol, tInd)
|
||||
return F
|
||||
|
||||
|
||||
@@ -124,8 +124,14 @@ class SurveyTDEM(Survey.BaseSurvey):
|
||||
for tx in self.txList:
|
||||
for rx in tx.rxList:
|
||||
Ptv = rx.projectFieldsDeriv(tx, self.mesh, self.prob.timeMesh, u, v, adjoint=True)
|
||||
Ptv = Ptv.reshape((-1, 1, self.prob.timeMesh.nN), order='F')
|
||||
f[tx, rx.projField, :] = Ptv
|
||||
if rx.projField not in f: # first time we are projecting
|
||||
Ptv = Ptv.reshape((-1, 1, self.prob.timeMesh.nN), order='F')
|
||||
f[tx, rx.projField, :] = Ptv
|
||||
else:
|
||||
Ptv = Ptv.reshape((-1, self.prob.timeMesh.nN), order='F')
|
||||
addedPtv = f[tx, rx.projField, :] + Ptv
|
||||
addedPtv = addedPtv.reshape((-1, 1, self.prob.timeMesh.nN), order='F')
|
||||
f[tx, rx.projField, :] = addedPtv
|
||||
return f
|
||||
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ class ProblemTDEM_b(BaseTDEMProblem):
|
||||
dt = self.timeSteps[tInd]
|
||||
return rhs + 1.0/dt*self.MfMui*y[:,'b',tInd]
|
||||
|
||||
def AhCalcFields(sol, solType, tInd):
|
||||
def AhCalcFields(sol, tInd):
|
||||
y_b = sol
|
||||
if self.survey.nTx == 1:
|
||||
y_b = mkvc(y_b)
|
||||
@@ -168,7 +168,7 @@ class ProblemTDEM_b(BaseTDEMProblem):
|
||||
dt = self.timeSteps[tInd+1]
|
||||
return rhs + 1.0/dt*self.MfMui*y[:,'b',tInd+2]
|
||||
|
||||
def AhtCalcFields(sol, solType, tInd):
|
||||
def AhtCalcFields(sol, tInd):
|
||||
y_b = sol
|
||||
if self.survey.nTx == 1:
|
||||
y_b = mkvc(y_b)
|
||||
|
||||
@@ -22,8 +22,9 @@ class TDEM_bDerivTests(unittest.TestCase):
|
||||
[Maps.ExpMap, Maps.Vertical1DMap, activeMap])
|
||||
|
||||
rxOffset = 40.
|
||||
rx = EM.TDEM.RxTDEM(np.array([[rxOffset, 0., 0.]]), np.logspace(-4,-3, 20), 'bz')
|
||||
tx = EM.TDEM.TxTDEM(np.array([0., 0., 0.]), 'VMD_MVP', [rx])
|
||||
rxTypes = 'bx,bz'
|
||||
rxs = [EM.TDEM.RxTDEM(np.array([[rxOffset, 0., 0.]]), np.logspace(-4,-3, 20), rxType) for rxType in rxTypes.split(',')]
|
||||
tx = EM.TDEM.TxTDEM(np.array([0., 0., 0.]), 'VMD_MVP', rxs)
|
||||
|
||||
survey = EM.TDEM.SurveyTDEM([tx])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user