平行2本導線による電界,電位¶
モジュールのインポート
In [1]:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
In [2]:
import scienceplots
#Warning : As of version 2.0.0, you need to add import scienceplots before setting the style (plt.style.use('science')).
plt.style.use(['science', 'notebook'])
In [3]:
import matplotlib.pyplot as plt
plt.rcParams['font.family'] = 'Hiragino Sans' # 日本語表示
#plt.rcParams['font.family'] = 'Hiragino Mincho ProN'
#plt.rcParams['font.family'] = 'Times New Roman'
#plt.rcParams['font.family'] = 'serif' # LaTeX風のフォント
plt.rcParams['axes.unicode_minus'] = False
#plt.rcParams['mathtext.fontset'] = 'cm' # Computer Modern(TeXのデフォルト数式フォント)
平行2本導線に対する2本の直線電荷
半径$a$の円筒導体が,円筒の中心軸の間隔を$d$として平行におかれている.このような平行2本導線の静電界および電位は,一方の円筒中心軸から$b_1$,$b_2$偏位した位置に線電荷をおいて求めることができ,次のような関係を導くことがきる. \begin{gather} b_1 = \frac{a}{k}, \ \ \ \ \ b_2 = ka, \ \ \ \ \ d=b_1+b_2 \end{gather} ただし,$k$ は導体表面の電位の式に表れる定数である.これより,$b_1$を求めると, \begin{align} &b_1 b_2 = \frac{a}{k} \cdot ka = a^2 = b_1(d-b_1) \\ &b_1^2 - d b_1 + a^2 = 0 \end{align} 上式に$b_1 = d-b_2$を代入すると,次式が得られる. \begin{gather} b_2^2 - d b_2 + a^2 = 0 \end{gather} よって,$b_1$,$b_2$は次のように2次方程式の根によって得られる. \begin{gather} b_2, b_1 = \frac{d \pm \sqrt{d^2+4a^2}}{2} \end{gather}規格化した半径が次のような場合を計算しよう.
In [4]:
# Fig. 1.8(a)
a = 0.2 # 円筒導体の半径0.2, 0.5
d = 2.0 # 2つの円筒導体の中心間距離
2*a/d
Out[4]:
0.2
このとき,$b_1$,$b_2$は,
In [5]:
# Fig. 1.8(b)
a = 0.5 # 円筒導体の半径0.2, 0.5
d = 2.0 # 2つの円筒導体の中心間距離
2*a/d
Out[5]:
0.5
In [6]:
dd = np.sqrt(d**2-4*a**2)
b1 = (d - dd)/2.0
b2 = (d + dd)/2.0
b1, b2
Out[6]:
(0.1339745962155614, 1.8660254037844386)
関数
In [7]:
def uvector3(aa):
norm = np.linalg.norm(aa, axis=2, keepdims=True)
uv = aa / norm
return norm, uv
In [8]:
def p1charge2(r, rd, q):
qk = q/2.0/np.pi
rr = r-rd
norm = np.linalg.norm(rr, axis=2, keepdims=True)
v = -qk * np.log(norm)
with np.errstate(divide="ignore", invalid="ignore"):
e = qk*rr/norm**2
return e, v
計算
2次元データを描く準備として,In [9]:
# 直角座標系(x,y)で表した観測点
x_min, x_max, n_x = -2.0, 2.0, 200
y_min, y_max, n_y = -2.0, 2.0, 200
x = np.linspace(x_min, x_max, n_x)
y = np.linspace(y_min, y_max, n_y)
xx, yy = np.meshgrid(x,y, indexing='xy') # xy座標の並び (デフォルト)
r = np.stack([xx,yy], axis=-1)
2つの平行な正・負の直線電荷による電位,電界は,
In [10]:
q = np.array([1.0, -1.0])# 電荷量
nq = len(q)# 点電荷の数
rdi = np.array([-d/2+b1, 0.0])# 1つ目の点電荷の位置ベクトル(x',y')
rd = rdi.reshape(1, 1, -1)
rr = r-rd
e, vv = p1charge2(r, rd, q[0])
rdi = np.array([-d/2+b2, 0.0])# 2つ目の点電荷の位置ベクトル
rd = rdi.reshape(1, 1, -1)
ei, vi = p1charge2(r, rd, q[1])
e = e + ei
vv = vv + vi
vvv = vv.reshape(xx.shape)
eamp, vs = uvector3(e)
emax = e.max()
e_x = e[:,:,0]/emax
e_y = e[:,:,1]/emax
定数$k$は,
In [11]:
k = a/b1
v1 = np.log(k)/2/np.pi
vvvn = vvv/v1
円柱導体表面の軌跡は,
In [12]:
phi_min, phi_max, n_phi = 0.0, 2.0*np.pi, 181
phi = np.linspace(phi_min, phi_max, n_phi)
sp = a*np.sin(phi)
cp = a*np.cos(phi)
x_1, y_1 = -d/2+cp, sp
x_2, y_2 = d/2+cp, sp
プロットして,
In [13]:
fig = plt.figure(figsize=(8, 8)) # グラフ領域の作成
v = np.linspace(-1, 1, 11)
# --- 電荷位置(2本の導体) ---
pos1 = np.array([-d/2 + b1, 0.0]) # 仮想的な正の点電荷
pos2 = np.array([-d/2 + b2, 0.0]) # 仮想的な負の点電荷
# --- 電気力線の開始点(出る:正電荷、入る:負電荷) ---
num_lines = 19
radius = 1.0
theta = np.linspace(-np.pi, np.pi, num_lines)
# 正電荷から出発する点
start_points_pos = np.array([pos1 + radius * np.array([np.cos(t), np.sin(t)]) for t in theta])
# 負電荷
start_points_neg = np.array([pos2 + radius * np.array([np.cos(t), np.sin(t)]) for t in theta])
# 両方の点を結合してstreamplotに渡す
start_points = np.vstack((start_points_pos, start_points_neg))
# --- 電気力線描画 ---
plt.streamplot(xx, yy, e_x, e_y,
color='darkorange',
linewidth=1.0,
density=6.0,
arrowsize=1.5,
start_points=start_points)
# --- 等高線(電位) ---
ax = plt.contour(x, y, vvvn, levels=v, linewidths=0.8)
ax.clabel(fmt='%1.1f', inline=1, fontsize=7)
plt.contourf(x, y, vvvn, levels=v, cmap="Blues")
# 軸ラベル・等
plt.xlabel('$x$')
plt.ylabel('$y$')
plt.axis('scaled')
plt.colorbar(pad=0.1, shrink=0.77, orientation="vertical")
# --- 導体マスク(streamplotの上に描画し電気力線を隠す) ---
# zorder は Matplotlib における「描画の前後の重なり順(Z軸方向の順序)」を指定するための引数
circle1 = Circle([-d/2, 0.0], a, color='white', zorder=10)
circle2 = Circle([d/2, 0.0], a, color='white', zorder=10)
plt.gca().add_patch(circle1)
plt.gca().add_patch(circle2)
# 導体や電荷の描画
plt.plot(-d/2+b1, 0.0, 'o', color='green', zorder=11) # 正
plt.plot(-d/2+b2, 0.0, 'o', color='red', zorder=11) # 負
plt.plot(x_1, y_1, color='gray', zorder=11)
plt.plot(x_2, y_2, color='gray', zorder=11)
plt.plot(-d/2, 0.0, '.', color='gray', zorder=11)
plt.plot(d/2, 0.0, '.', color='gray', zorder=11)
plt.title("平行2本導線による電界,電位")
fig.savefig("Fig_1_8_b_streamplot.svg") # ファイル出力(SVG)
plt.show()
同様にして,
In [14]:
# Fig. 1.8(b)
a = 0.5 # 円筒導体の半径0.2, 0.5
d = 2.0 # 2つの円筒導体の中心間距離
2*a/d
Out[14]:
0.5
これより,最初から計算しなおしてプロットしてみよう.
In [ ]: