question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accessing Fields for DC 2.5D

See original GitHub issue

In DC 2.5D, trying to access any other field than “Phi” raises the current error (btw, those other fields appear in the documentation and the 2.5Dcode, they are just not fully implemented yet): image

Side note: Accessing the ‘Phi’ field is working. However, I have a question about its shape. See example below. The second dimension is the number of spatial frequencies but I am unsure what is the first dimension: it is neither the size of the whole mesh nor the size of the active cells… image

Extra information: here is the scripts I ended up using to compute and visualize the field. The em-apps are using a similar approach. So improving on the Fields object will likely improve the em-apps.

# Plot vector field of one quadrupole for mtrue
Mx = meshList20[0].gridCC
rx = DC.Rx.Pole_ky(Mx)
src = DC.Src.Dipole([rx],dcsurvey20[0].srcList[0].loc[0],dcsurvey20[0].srcList[0].loc[1])
dcsurvey = DC.Survey_ky([src])
dcprob = DC.Problem2D_N(meshList20[0],sigmaMap=mapping20[0],Solver=PardisoSolver)
dcprob.pair(dcsurvey)

mtrue = 1./res20[0]*1000
phipotential = dcsurvey.dpred(mtrue[actind_air20[0]])
efield = -meshList20[0].cellGrad * phipotential
efieldx = -meshList20[0].cellGradx * phipotential
efieldy = -meshList20[0].cellGrady * phipotential

jfield = dcprob.MfRhoI * efield

from scipy.interpolate import LinearNDInterpolator, NearestNDInterpolator
import matplotlib

tensormesh = Mesh.TensorMesh(meshList20[0].h)
tensormesh.x0 = meshList20[0].x0
indcore, tensormesh = Utils.ExtractCoreMesh(np.c_[[-3,-1],[3,1]],tensormesh)

InterpolateEField_x = LinearNDInterpolator(meshList20[0].gridEy,efieldx)
ExField_tensor = InterpolateEField_x(tensormesh.gridEy)
InterpolateEField_y = LinearNDInterpolator(meshList20[0].gridEx,efieldy)
EyField_tensor = InterpolateEField_y(tensormesh.gridEx)
EField_tensor = np.r_[ExField_tensor,EyField_tensor]

InterpolateJField_x = NearestNDInterpolator(meshList20[0].gridEy,jfield[meshList20[0].gridEx.shape[0]:])
JxField_tensor = InterpolateField_x(tensormesh.gridEy)
InterpolateJField_y = NearestNDInterpolator(meshList20[0].gridEx,jfield[:meshList20[0].gridEx.shape[0]])
JyField_tensor = InterpolateField_y(tensormesh.gridEx)
JField_tensor = np.r_[JxField_tensor,JyField_tensor]

tensormesh.plotImage(EField_tensor,view='vec',vType='F',pcolorOpts={'norm':matplotlib.colors.LogNorm()})

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
dccowancommented, May 4, 2020

@thast @sgkang I believe I found the problem. I match a patch. See PR #868

0reactions
jcapriotcommented, Jun 8, 2020

This has now been taken care of in 0.14.1. You can directly access the phi and other solutions from the 2.5D fields object (it will take care of the transformation object behind the scenes).

Read more comments on GitHub >

github_iconTop Results From Across the Web

2.5-D and 3-D DC resistivity modelling using an extrapolation ...
In this study, an improved extrapolation cascadic multigrid (EXCMG) method is presented to solve large sparse systems of linear equations, which are discretized ......
Read more >
DC modelling in 2.5-D anisotropic media with singularity ...
We present a 2.5-dimensional (2.5-D) finite element algorithm for direct current (DC) resistivity modelling in anisotropic media with ...
Read more >
2.5D inversion of electric field data using the open source ...
2.5D inversion of electric field data using the open source CSEM inversion code MARE2DEM. (a) Obtained 2D conductivity model. After 20 iterations, the...
Read more >
Efficient inversion of 2.5D electrical resistivity data using the ...
We evaluate two case studies to assess the validity of our algo- rithm. First, on a 2.5D synthetic example, and then on field...
Read more >
2.5D forward modeling and inversion of frequency-domain ...
Huang, H. P., and Fraser, D. C., 2002, Dielectric permittivity and resistivity mapping using high frequency helicopter-borne EM data: Geophysics ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found