<jupyter_start><jupyter_text>Examples visualizing different geometries<jupyter_code>import infinite_conformal as infinite_conformal
import infinite_fourier as infinite_fourier
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import tqdm<jupyter_output><empty_output><jupyter_text>Basic example of potential with simple geometry<jupyter_code># declare geometry
epss=[1,5,2] # dielectric constant of layer 1, 2 and 3
t=[0.2] #thickness of layer 2
etas=[0.3,0] # cover fraction of electrodes, between layer 1 and 2 and between layer 2 and 3
# declare model parameters
LAcomp=2 # number of linear algebra componens
max_n=180 # number of fourier components
# make case
simple_geometry_case = infinite_fourier.multiple_recursive_images(etas,t,epss,epss,LAcomp,max_n,accuracy_limit=10**-15,hybrid=True)
print(simple_geometry_case.get_C(), 'F/m')
y=np.arange(-0.5,0.5001,0.01)
x=np.arange(-0.5,0.5001,0.01)
V_simple_geometry_case=np.zeros((len(y),len(x)))
for j in tqdm.tqdm(range(len(y))):
    v = simple_geometry_case.get_V(x,y[j])
    V_simple_geometry_case[j,:] += v
xx, yy = np.meshgrid(x, y)
fig, ax = plt.subplots(1,1)
# plot potential
levels=np.arange(-0.5,0.51,0.05)
CS=ax.contourf(xx,yy, V_simple_geometry_case,levels,cmap='RdBu',alpha=0.7)
cbar=fig.colorbar(CS, ax=ax)
ax.set_aspect('equal', 'box')
# set_labels 
ax.set_xlabel(r"$x'$ [-]")
ax.set_ylabel(r"$y'$ [-]")
cbar.set_label(r'Potential [V]')
# draw electrodes 
ax.plot([[-0.5,0.5],[-0.5+etas[0]/2,0.5-etas[0]/2]],[[0,0],[0,0]],'k',solid_capstyle='butt')
# shade the film 
ax.add_patch(matplotlib.patches.Rectangle(
            (-0.5,0),   # (x,y)
            1,          # width
            t[0],          # height
            facecolor=[0,0,0,0.1]))
# add dielectric constant
ax.text(0,-0.3,r'$\varepsilon$ = '+str(epss[0]), ha='center',va='center')
ax.text(0,t[0]/2,r'$\varepsilon$ = '+str(epss[1]), ha='center',va='center')
ax.text(0,0.4,r'$\varepsilon$ = '+str(epss[2]), ha='center',va='center')
# flip y axis
ax.invert_yaxis()<jupyter_output><empty_output><jupyter_text>Anisotropic film<jupyter_code># declare geometry
eps_x=[1,20,2] # in-plane dielectric constant of layer 1, 2 and 3
eps_y=[1,5,2] # out-of-plane dielectric constant of layer 1, 2 and 3
t=[0.2] #thickness of layer 2
etas=[0.3,0] # cover fraction of electrodes, between layer 1 and 2 and between layer 2 and 3
# declare model parameters
LAcomp=2 # number of linear algebra componens
max_n=180 # number of fourier components
# make case
anisotropy_case = infinite_fourier.multiple_recursive_images(etas,t,eps_x,eps_y,LAcomp,max_n,accuracy_limit=10**-15,hybrid=True)
print(anisotropy_case.get_C(), 'F/m')
y=np.arange(-0.5,0.5001,0.01)
x=np.arange(-0.5,0.5001,0.01)
V_anisotropy_case=np.zeros((len(y),len(x)))
for j in tqdm.tqdm(range(len(y))):
    v = anisotropy_case.get_V(x,y[j])
    V_anisotropy_case[j,:] += v
xx, yy = np.meshgrid(x, y)
fig, ax = plt.subplots(1,1)
# plot potential
levels=np.arange(-0.5,0.51,0.05)
CS=ax.contourf(xx,yy, V_anisotropy_case,levels,cmap='RdBu',alpha=0.7)
cbar=fig.colorbar(CS, ax=ax)
ax.set_aspect('equal', 'box')
# set_labels 
ax.set_xlabel(r"$x'$ [-]")
ax.set_ylabel(r"$y'$ [-]")
cbar.set_label(r'Potential [V]')
# draw electrodes 
ax.plot([[-0.5,0.5],[-0.5+etas[0]/2,0.5-etas[0]/2]],[[0,0],[0,0]],'k',solid_capstyle='butt')
# shade the film 
ax.add_patch(matplotlib.patches.Rectangle(
            (-0.5,0),   # (x,y)
            1,          # width
            t[0],          # height
            facecolor=[0,0,0,0.1]))
# add dielectric constant
ax.text(0,-0.3,r'$\varepsilon$ = '+str(eps_x[0]), ha='center',va='center')
ax.text(0,t[0]/2,r'$\varepsilon_x,\varepsilon_y$ = '+str(eps_x[1])+', '+str(eps_y[1]), ha='center',va='center')
ax.text(0,0.4,r'$\varepsilon$ = '+str(eps_x[2]), ha='center',va='center')
# flip y axis
ax.invert_yaxis()<jupyter_output><empty_output><jupyter_text>Multiple layers, bottom electrode<jupyter_code># declare geometry
epss=[1,5,2,1] # dielectric constant of layer 1, 2, 3 and 4 (below the continious electrode)
t=[0.1,0.2] #thickness of layer 2 and 3
etas=[0.3,0,1] # cover fraction of electrodes, between layer 1 and 2, between layer 2 and 3 and between layer 3 and 4
    # by setting the cover fractio to 1, the potential at the associated electrodes is automatically set to 0
# declare model parameters
LAcomp=[2,0,4] # number of linear algebra componens for the different interfaces
max_n=180 # number of fourier components
# make case
mlbe_case = infinite_fourier.multiple_recursive_images(etas,t,epss,epss,LAcomp,max_n,accuracy_limit=10**-15,hybrid=True)
print(mlbe_case.get_C(), 'F/m')
y=np.arange(-0.5,0.5001,0.01)
x=np.arange(-0.5,0.5001,0.01)
V_mlbe_case=np.zeros((len(y),len(x)))
for j in tqdm.tqdm(range(len(y))):
    v = mlbe_case.get_V(x,y[j])
    V_mlbe_case[j,:] += v
xx, yy = np.meshgrid(x, y)
fig, ax = plt.subplots(1,1)
# plot potential
levels=np.arange(-0.5,0.51,0.05)
CS=ax.contourf(xx,yy, V_mlbe_case,levels,cmap='RdBu',alpha=0.7)
cbar=fig.colorbar(CS, ax=ax)
ax.set_aspect('equal', 'box')
# set_labels 
ax.set_xlabel(r"$x'$ [-]")
ax.set_ylabel(r"$y'$ [-]")
cbar.set_label(r'Potential [V]')
# draw electrodes 
ax.plot([[-0.5,0.5],[-0.5+etas[0]/2,0.5-etas[0]/2]],[[0,0],[0,0]],'k',solid_capstyle='butt')
ax.plot([-0.5,0.5],[t[1]+t[0],t[1]+t[0]],'k',solid_capstyle='butt')
# shade the films
ax.add_patch(matplotlib.patches.Rectangle(
            (-0.5,0),   # (x,y)
            1,          # width
            t[0],          # height
            facecolor=[0,0,0,0.2]))
ax.add_patch(matplotlib.patches.Rectangle(
            (-0.5,t[0]),   # (x,y)
            1,          # width
            t[1],          # height
            facecolor=[0,0,0,0.1]))
# add dielectric constant
ax.text(0,-0.3,r'$\varepsilon$ = '+str(epss[0]), ha='center',va='center')
ax.text(0,t[0]/2,r'$\varepsilon$ = '+str(epss[1]), ha='center',va='center')
ax.text(0,t[1]/2+t[0],r'$\varepsilon$ = '+str(epss[2]), ha='center',va='center')
# flip y axis
ax.invert_yaxis()<jupyter_output><empty_output><jupyter_text>Electrodes both sides of film, symmetrical<jupyter_code># declare geometry
epss=[1,5,1] # dielectric constant of layer 1, 2, 3 and 4 (below the continious electrode)
t=[0.2] #thickness of layer 2 and 3
etas=[0.3,0.3] # cover fraction of electrodes, between layer 1 and 2, between layer 2 and 3 and between layer 3 and 4
# declare model parameters
LAcomp=[2,2] # number of linear algebra componens for the different interfaces
max_n=180 # number of fourier components
# make case
both_sides_case = infinite_fourier.multiple_recursive_images(etas,t,epss,epss,LAcomp,max_n,accuracy_limit=10**-15,hybrid=True)
print(both_sides_case.get_C(), 'F/m')
y=np.arange(-0.4,0.6001,0.01)
x=np.arange(-0.5,0.5001,0.01)
V_both_sides_case=np.zeros((len(y),len(x)))
for j in tqdm.tqdm(range(len(y))):
    v = both_sides_case.get_V(x,y[j])
    V_both_sides_case[j,:] += v
xx, yy = np.meshgrid(x, y)
fig, ax = plt.subplots(1,1)
# plot potential
levels=np.arange(-0.5,0.51,0.05)
CS=ax.contourf(xx,yy, V_both_sides_case,levels,cmap='RdBu',alpha=0.7)
cbar=fig.colorbar(CS, ax=ax)
ax.set_aspect('equal', 'box')
# set_labels 
ax.set_xlabel(r"$x'$ [-]")
ax.set_ylabel(r"$y'$ [-]")
cbar.set_label(r'Potential [V]')
# draw electrodes 
ax.plot([[-0.5,0.5],[-0.5+etas[0]/2,0.5-etas[0]/2]],[[0,0],[0,0]],'k',solid_capstyle='butt')
ax.plot([[-0.5,0.5],[-0.5+etas[0]/2,0.5-etas[0]/2]],[[t[0],t[0]],[t[0],t[0]]],'k',solid_capstyle='butt')
# shade the film 
ax.add_patch(matplotlib.patches.Rectangle(
            (-0.5,0),   # (x,y)
            1,          # width
            t[0],          # height
            facecolor=[0,0,0,0.1]))
# add dielectric constant
ax.text(0,-0.3,r'$\varepsilon$ = '+str(epss[0]), ha='center',va='center')
ax.text(0,t[0]/2,r'$\varepsilon$ = '+str(epss[1]), ha='center',va='center')
ax.text(0,0.4,r'$\varepsilon$ = '+str(epss[2]), ha='center',va='center')
# flip y axis
ax.invert_yaxis()<jupyter_output><empty_output><jupyter_text>Thick electrodes<jupyter_code># declare geometry
epss=[1,1,1,5,2] # dielectric constant of layer 1, 2, 3 and 4 (below the continious electrode)
t=[0.05,0.05,0.2] # multiple layers
etas=[0.3,0.3,0.3,0] # cover fraction of electrodes between layers
# declare model parameters
LAcomp=4 # number of linear algebra componens for the different interfaces
max_n=180 # number of fourier components
# make case
thicke_electrodes_case = infinite_fourier.multiple_recursive_images(etas,t,epss,epss,LAcomp,max_n,accuracy_limit=10**-15,hybrid=True)
print(thicke_electrodes_case.get_C(), 'F/m')
y=np.arange(-0.4,0.6001,0.01)
x=np.arange(-0.5,0.5001,0.01)
V_thicke_electrodes_case=np.zeros((len(y),len(x)))
for j in tqdm.tqdm(range(len(y))):
    v = thicke_electrodes_case.get_V(x,y[j])
    V_thicke_electrodes_case[j,:] += v
xx, yy = np.meshgrid(x, y)
fig, ax = plt.subplots(1,1)
# plot potential
levels=np.arange(-0.5,0.51,0.05)
CS=ax.contourf(xx,yy, V_thicke_electrodes_case,levels,cmap='RdBu',alpha=0.7)
cbar=fig.colorbar(CS, ax=ax)
ax.set_aspect('equal', 'box')
# set_labels 
ax.set_xlabel(r"$x'$ [-]")
ax.set_ylabel(r"$y'$ [-]")
cbar.set_label(r'Potential [V]')
# draw electrodes 
ax.plot([[-0.5,0.5],[-0.5+etas[0]/2,0.5-etas[0]/2]],[[0]*2]*2,'k',solid_capstyle='butt')
ax.plot([[-0.5,0.5],[-0.5+etas[0]/2,0.5-etas[1]/2]],[[t[0]]*2]*2,'k',solid_capstyle='butt')
ax.plot([[-0.5,0.5],[-0.5+etas[0]/2,0.5-etas[2]/2]],[[t[0]+t[1]]*2]*2,'k',solid_capstyle='butt')
# shade the film 
ax.add_patch(matplotlib.patches.Rectangle(
            (-0.5,0),   # (x,y)
            1,          # width
            t[0],          # height
            facecolor=[0,0,0,0.05]))
ax.add_patch(matplotlib.patches.Rectangle(
            (-0.5,t[0]),   # (x,y)
            1,          # width
            t[1],          # height
            facecolor=[0,0,0,0.03]))
ax.add_patch(matplotlib.patches.Rectangle(
            (-0.5,t[0]+t[1]),   # (x,y)
            1,          # width
            t[2],          # height
            facecolor=[0,0,0,0.1]))
# add dielectric constant
ax.text(0,-0.2,r'$\varepsilon$ = '+str(epss[0]), ha='center',va='center')
ax.text(0,t[0]/2,r'$\varepsilon$ = '+str(epss[1]), ha='center',va='center')
ax.text(0,t[0]+t[1]/2,r'$\varepsilon$ = '+str(epss[2]), ha='center',va='center')
ax.text(0,t[0]+t[1]+t[2]/2,r'$\varepsilon$ = '+str(epss[3]), ha='center',va='center')
ax.text(0,0.4,r'$\varepsilon$ = '+str(epss[4]), ha='center',va='center')
# flip y axis
ax.invert_yaxis()<jupyter_output><empty_output><jupyter_text>Electrodes both sides of film, asymmetrical = Quadrupole<jupyter_code># declare geometry
epss=[1,5,1] # dielectric constant of layer 1, 2, 3 and 4 (below the continious electrode)
t=[0.2] #thickness of layer 2 and 3
etas=[0.3,0.3] # cover fraction of electrodes, between layer 1 and 2, between layer 2 and 3 and between layer 3 and 4
# declare model parameters
LAcomp=[2,2] # number of linear algebra componens for the different interfaces
max_n=180 # number of fourier components
# make case
both_sides_case_asym = infinite_fourier.multiple_recursive_images(etas,t,epss,epss,LAcomp,max_n,accuracy_limit=10**-15,voltages=[0.5,-0.5],hybrid=True)
print('Capacitance between all left vs all right electrodes')
print(both_sides_case_asym.get_C(), '= ~0 F/m')
print('The capacitance of the quadrupole may be calculated by integrating the electric field')
y=np.arange(-0.4,0.6001,0.01)
x=np.arange(-0.5,0.5001,0.01)
V_both_sides_case_asym=np.zeros((len(y),len(x)))
for j in tqdm.tqdm(range(len(y))):
    v = both_sides_case_asym.get_V(x,y[j])
    V_both_sides_case_asym[j,:] += v
xx, yy = np.meshgrid(x, y)
fig, ax = plt.subplots(1,1)
# plot potential
levels=np.arange(-0.5,0.51,0.05)
CS=ax.contourf(xx,yy, V_both_sides_case_asym,levels,cmap='RdBu',alpha=0.7)
cbar=fig.colorbar(CS, ax=ax)
ax.set_aspect('equal', 'box')
# set_labels 
ax.set_xlabel(r"$x'$ [-]")
ax.set_ylabel(r"$y'$ [-]")
cbar.set_label(r'Potential [V]')
# draw electrodes 
ax.plot([[-0.5,0.5],[-0.5+etas[0]/2,0.5-etas[0]/2]],[[0,0],[0,0]],'k',solid_capstyle='butt')
ax.plot([[-0.5,0.5],[-0.5+etas[0]/2,0.5-etas[0]/2]],[[t[0],t[0]],[t[0],t[0]]],'k',solid_capstyle='butt')
# shade the film 
ax.add_patch(matplotlib.patches.Rectangle(
            (-0.5,0),   # (x,y)
            1,          # width
            t[0],          # height
            facecolor=[0,0,0,0.1]))
# add dielectric constant
ax.text(0,-0.3,r'$\varepsilon$ = '+str(epss[0]), ha='center',va='center')
ax.text(0,t[0]/2,r'$\varepsilon$ = '+str(epss[1]), ha='center',va='center')
ax.text(0,0.4,r'$\varepsilon$ = '+str(epss[2]), ha='center',va='center')
# flip y axis
ax.invert_yaxis()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20474753890123848, 'fraction_numerical': 0.05747856462369006, 'mean_word_length': 4.8211645101663585, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '106283', 'license': 'MIT', 'n_tokens_mistral': 5671, 'n_tokens_neox': 5379, 'n_words': 862, 'path': 'Examples_different_geometries.ipynb', 'repo_name': 'trygvrad/Interdigitated-Electrodes', 'size': '12596'}