Change rxList --> [rx,rx]

Projections are not shared at the moment, but this can be changed later.
This commit is contained in:
rowanc1
2014-03-22 12:24:54 -07:00
parent a8f09ee869
commit aacbc03cf6
4 changed files with 77 additions and 69 deletions
+17 -4
View File
@@ -110,10 +110,10 @@ class BaseProblemFDEM(Problem.BaseProblem):
u_tx = u[tx, self.solType]
w = self.getADeriv(freq, u_tx, v)
Ainvw = solver.solve(w)
fAinvw = self.calcFieldsList(Ainvw, freq, tx.rxList.fieldTypes)
fAinvw = self._calcFieldsList(Ainvw, freq, tx.rxList.fieldTypes)
P = lambda v: tx.projectFieldsDeriv(self.mesh, u, v)
df_dm = self.calcFieldsDerivList(u_tx, freq, tx.rxList.fieldTypes, v)
df_dm = self._calcFieldsDerivList(u_tx, freq, tx.rxList.fieldTypes, v)
#TODO: this is now a list?
if df_dm is None:
Jv[tx] = - P(fAinvw)
@@ -142,12 +142,12 @@ class BaseProblemFDEM(Problem.BaseProblem):
u_tx = u[tx, self.solType]
PTv = tx.projectFieldsDeriv(self.mesh, u, v[tx], adjoint=True)
fPTv = self.calcFields(PTv, freq, tx.rxList.fieldTypes, adjoint=True)
fPTv = self._calcFieldsList(PTv, freq, tx.rxList.fieldTypes, adjoint=True)
w = solver.solve( fPTv )
Jtv_tx = self.getADeriv(freq, u_tx, w, adjoint=True)
df_dm = self.calcFieldsDeriv(u_tx, freq, tx.rxList.fieldTypes, PTv, adjoint=True)
df_dm = self._calcFieldsDerivList(u_tx, freq, tx.rxList.fieldTypes, PTv, adjoint=True)
if df_dm is None:
Jtv += - Jtv_tx
@@ -156,6 +156,19 @@ class BaseProblemFDEM(Problem.BaseProblem):
return Jtv
def _calcFieldsList(self, sol, freq, fieldTypes, adjoint=False):
fVecs = range(len(fieldTypes))
for ii, fieldType in enumerate(fieldTypes):
fVecs[ii] = self.calcFields(sol, freq, fieldType, adjoint=adjoint)
return np.concatenate(fVecs)
def _calcFieldsDerivList(self, sol, freq, fieldTypes, v, adjoint=False):
fVecs = range(len(fieldTypes))
V = v.reshape((-1, len(fieldTypes)), order='F')
for ii, fieldType in enumerate(fieldTypes):
fVecs[ii] = self.calcFieldsDeriv(sol, freq, fieldType, V[:,ii], adjoint=adjoint)
return np.concatenate(fVecs)
class ProblemFDEM_e(BaseProblemFDEM):
"""
Solving for e!