.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/fdomain/full_vs_diffusive.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_fdomain_full_vs_diffusive.py: Full wavefield vs diffusive approximation for a fullspace ========================================================= Example comparison of the electric field using the complete Maxwell's equations, and the electric field using the diffusive or quasi-static approximation. You can play around with the parameters to see that the difference is getting bigger for - higher frequencies, and - higher electric permittivity / magnetic permeability. .. GENERATED FROM PYTHON SOURCE LINES 16-21 .. code-block:: Python import empymod import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') .. GENERATED FROM PYTHON SOURCE LINES 22-24 Define model ------------ .. GENERATED FROM PYTHON SOURCE LINES 24-41 .. code-block:: Python x = np.arange(526)*20. - 500 x[x == 0] += 1e-3 # Avoid warning message regarding 0 offset. rx = np.tile(x[:, None], x.size) ry = rx.transpose() inp = { 'src': [0, 0, 0], # Source [x, y, z] 'rec': [rx.ravel(), ry.ravel(), 50], # Receiver [x, y, z] 'res': 1/3, # Resistivity 'freqtime': 0.5, # Frequency 'aniso': np.sqrt(10), # Anisotropy 'ab': 11, # Configuration; 11=Exx 'epermH': 1.0, # Electric permittivity 'mpermH': 1.0, # Magnetic permeability 'verb': 1, # Verbosity } .. GENERATED FROM PYTHON SOURCE LINES 42-44 Computation ----------- .. GENERATED FROM PYTHON SOURCE LINES 44-56 .. code-block:: Python # Halfspace hs = empymod.analytical(solution='dfs', **inp).reshape(rx.shape) # Fullspace fs = empymod.analytical(**inp).reshape(rx.shape) # Relative error (%) amperr = np.abs((fs.amp() - hs.amp())/fs.amp())*100 phaerr = np.abs((fs.pha(unwrap=False) - hs.pha(unwrap=False)) / fs.pha(unwrap=False))*100 .. GENERATED FROM PYTHON SOURCE LINES 57-59 Plot ---- .. GENERATED FROM PYTHON SOURCE LINES 59-93 .. code-block:: Python fig, (ax1, ax2) = plt.subplots( 1, 2, figsize=(9, 5), sharey=True, constrained_layout=True) fig.suptitle('Analytical fullspace solution\nDifference between full ' + 'wavefield and diffusive approximation.') # Min and max, properties vmin = 1e-10 vmax = 1e0 props = { 'levels': np.logspace(np.log10(vmin), np.log10(vmax), 50), 'locator': plt.matplotlib.ticker.LogLocator(), 'cmap': 'Greys', } # Plot amplitude error ax1.set_title('Amplitude') cf1 = ax1.contourf(rx/1000, ry/1000, amperr.clip(vmin, vmax), **props) ax1.set_ylabel('Crossline offset (km)') # Plot phase error ax2.set_title('Phase') cf2 = ax2.contourf(rx/1000, ry/1000, phaerr.clip(vmin, vmax), **props) for ax in [ax1, ax2]: ax.set_xlabel('Inline offset (km)') ax.set_xlim(min(x)/1000, max(x)/1000) ax.set_ylim(min(x)/1000, max(x)/1000) ax.axis('equal') # Plot colorbar cb = plt.colorbar(cf2, ax=[ax1, ax2], ticks=10**np.arange(-10, 1.)) cb.set_label('Relative Error (%)') .. image-sg:: /gallery/fdomain/images/sphx_glr_full_vs_diffusive_001.png :alt: Analytical fullspace solution Difference between full wavefield and diffusive approximation., Amplitude, Phase :srcset: /gallery/fdomain/images/sphx_glr_full_vs_diffusive_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 94-95 .. code-block:: Python empymod.Report() .. raw:: html
Sat Jan 17 19:14:45 2026 UTC
OS Linux (Ubuntu 22.04) CPU(s) 2 Machine x86_64
Architecture 64bit RAM 7.6 GiB Environment Python
File system ext4
Python 3.11.12 (main, May 6 2025, 10:45:53) [GCC 11.4.0]
numpy 2.3.5 scipy 1.17.0 numba 0.63.1
empymod 2.5.4.dev4+g4866dc83a libdlf 0.3.0 IPython 9.9.0
matplotlib 3.10.8


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.833 seconds) **Estimated memory usage:** 359 MB .. _sphx_glr_download_gallery_fdomain_full_vs_diffusive.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: full_vs_diffusive.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: full_vs_diffusive.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: full_vs_diffusive.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_