Test diagonal of inductance matrixΒΆ

Use different number of quadrature points and two different implementations

import numpy as np
import matplotlib.pyplot as plt

from bfieldtools.utils import load_example_mesh

coilmesh = load_example_mesh("10x10_plane")

from bfieldtools.mesh_impedance import self_inductance_matrix, mutual_inductance_matrix


M5 = mutual_inductance_matrix(coilmesh, coilmesh, quad_degree=5)
M6 = mutual_inductance_matrix(coilmesh, coilmesh, quad_degree=6)
M7 = mutual_inductance_matrix(coilmesh, coilmesh, quad_degree=7)

plt.figure()
for m in (M5, M6, M7):
    plt.plot(np.diag(m))

MM5 = self_inductance_matrix(coilmesh, quad_degree=5, analytic_self_coupling=True)
MM6 = self_inductance_matrix(coilmesh, quad_degree=6, analytic_self_coupling=True)
MM7 = self_inductance_matrix(coilmesh, quad_degree=7, analytic_self_coupling=True)
../../_images/sphx_glr_inductance_comparison_001.png

Out:

Estimating 2432 MiB required for 676 by 676 vertices...
Computing inductance matrix in 20 chunks (10492 MiB memory free),              when approx_far=True using more chunks is faster...
Computing triangle-coupling matrix
Estimating 2432 MiB required for 676 by 676 vertices...
Computing inductance matrix in 20 chunks (10495 MiB memory free),              when approx_far=True using more chunks is faster...
Computing triangle-coupling matrix
Estimating 2432 MiB required for 676 by 676 vertices...
Computing inductance matrix in 20 chunks (10499 MiB memory free),              when approx_far=True using more chunks is faster...
Computing triangle-coupling matrix
Estimating 2432 MiB required for 676 by 676 vertices...
Computing inductance matrix in 20 chunks (10500 MiB memory free),              when approx_far=True using more chunks is faster...
Computing triangle-coupling matrix
Estimating 2432 MiB required for 676 by 676 vertices...
Computing inductance matrix in 20 chunks (10508 MiB memory free),              when approx_far=True using more chunks is faster...
Computing triangle-coupling matrix
Estimating 2432 MiB required for 676 by 676 vertices...
Computing inductance matrix in 20 chunks (10508 MiB memory free),              when approx_far=True using more chunks is faster...
Computing triangle-coupling matrix
plt.gca().set_prop_cycle(None)
for m in (MM5, MM6, MM7):
    plt.plot(np.diag(m), "--")
../../_images/sphx_glr_inductance_comparison_002.png

Total running time of the script: ( 0 minutes 15.484 seconds)

Gallery generated by Sphinx-Gallery