0% found this document useful (0 votes)
8 views6 pages

A. Exact Solution

The document discusses three solutions for the potential distribution near a flat surface: the exact solution, an approximate solution, and the Debye-Huckle approximation. It provides the equations for each solution and plots the potential values calculated from the equations against kx for different values of φs. It then plots the exact solution alongside the approximate and Debye-Huckle solutions to determine where they start to deviate from the exact solution for φs values of 0.5, 1, and 2.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

A. Exact Solution

The document discusses three solutions for the potential distribution near a flat surface: the exact solution, an approximate solution, and the Debye-Huckle approximation. It provides the equations for each solution and plots the potential values calculated from the equations against kx for different values of φs. It then plots the exact solution alongside the approximate and Debye-Huckle solutions to determine where they start to deviate from the exact solution for φs values of 0.5, 1, and 2.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Potential distribution near a flat surface: Plot the

following solution for the potential distribution phi

a. Exact solution
ϕs
⎡ 1 + exp (−kx) tanh ( ) ⎤
4

ϕ = 2ln ⎢



ϕs
⎣ 1 − exp (−kx) tanh ( ) ⎦
4

b. Approximate solution
1 + 0.25ϕs exp (−kx)
ϕ = 2ln [ ]
1 − 0.25ϕs exp (−kx)

c. Debye-Huckle approximation
ϕ = ϕs exp (−kx)

c. Find where the solutions in 'b' and 'c'


start to deviate from the exact solution.

vary kx between 0 to 2 and compare the


solutions for ϕ = 0.5, 1, 2.
s

In [3]: import numpy as np


import matplotlib.pyplot as plt

# Arrange the 'kx' from 0 to 2 and write the all input data
kx = np.linspace(0, 2, 20)
l = len(kx)
phi_s1 = 0.5
phi_s2 = 1
phi_s3 = 2

Exact solution
In [5]: # Define the 'phi_e'
phi_e1 = np.zeros(kx.shape)
phi_e2 = np.zeros(kx.shape)
phi_e3 = np.zeros(kx.shape)

for i in range(0, l, 1):


# Write the equation of 'phi' for exact solution.
phi_e1[i] = 2*np.log((1+np.exp(-kx[i])*np.tanh(phi_s1/4))/(1-np.exp(-kx[i])*np.
phi_e2[i] = 2*np.log((1+np.exp(-kx[i])*np.tanh(phi_s2/4))/(1-np.exp(-kx[i])*np.
phi_e3[i] = 2*np.log((1+np.exp(-kx[i])*np.tanh(phi_s3/4))/(1-np.exp(-kx[i])*np.

plt.plot(kx, phi_e1, label ='phi_s=0.5')


plt.plot(kx, phi_e2, label ='phi_s=1')
plt.plot(kx, phi_e3, label ='phi_s=2')
plt.xlabel('kx')
plt.ylabel('phi_e')
plt.title('Exact solution Potential distribution')
plt.legend()
plt.grid()
plt.show()

Approximate solution
In [6]: # Define the 'phi_a'
phi_a1 = np.zeros(kx.shape)
phi_a2 = np.zeros(kx.shape)
phi_a3 = np.zeros(kx.shape)

for i in range(0, l, 1):


# Write the equation of 'phi' for approximate solution.
phi_a1[i] = 2*np.log((1+0.25*phi_s1*np.exp(-kx[i]))/(1-0.25*phi_s1*np.exp(-kx[i
phi_a2[i] = 2*np.log((1+0.25*phi_s2*np.exp(-kx[i]))/(1-0.25*phi_s1*np.exp(-kx[i
phi_a3[i] = 2*np.log((1+0.25*phi_s3*np.exp(-kx[i]))/(1-0.25*phi_s1*np.exp(-kx[i

plt.plot(kx, phi_a1, label ='phi_s=0.5')


plt.plot(kx, phi_a2, label ='phi_s=1')
plt.plot(kx, phi_a3, label ='phi_s=2')
plt.xlabel('kx')
plt.ylabel('phi_a')
plt.title('Approximate solution Potential distribution')
plt.legend()
plt.grid()
plt.show()

Debye-Huckle approximation
In [7]: # Define the 'phi_D'
phi_D1 = np.zeros(kx.shape)
phi_D2 = np.zeros(kx.shape)
phi_D3 = np.zeros(kx.shape)
for i in range(0, l, 1):
# Write the equation of 'phi' for Debye-Huckle approximation.
phi_D1[i] = phi_s1*np.exp(-kx[i])
phi_D2[i] = phi_s2*np.exp(-kx[i])
phi_D3[i] = phi_s3*np.exp(-kx[i])

plt.plot(kx, phi_D1, label ='phi_s=0.5')


plt.plot(kx, phi_D2, label ='phi_s=1')
plt.plot(kx, phi_D3, label ='phi_s=2')
plt.xlabel('kx')
plt.ylabel('phi_D')
plt.title('Debye-Huckle approximation Potential distribution')
plt.legend()
plt.grid()
plt.show()

c. Find where the solutions in 'b' and 'c'


start to deviate from the exact solution.
In [10]: # Initialise the subplot function using number of rows and columns
figure, axis = plt.subplots(3, 2, figsize=(15,15))
# fig.tight_layout(pad=5.0)

# phi_s=0.5
axis[0, 0].plot(kx, phi_e1, label ='Exact solution', linestyle='--');
axis[0, 0].plot(kx, phi_a1, label ='Approximate solution', alpha=0.6)
axis[0, 0].set_title("phi_s=0.5")
axis[0, 0].grid()
axis[0, 0].legend()

# phi_s=1
axis[1, 0].plot(kx, phi_e2, label ='Exact solution', linestyle='--');
axis[1, 0].plot(kx, phi_a2, label ='Approximate solution', alpha=0.6)
axis[1, 0].set_title("phi_s=1")
axis[1, 0].grid()
axis[1, 0].legend()

# phi_s=2
axis[2, 0].plot(kx, phi_e3, label ='Exact solution', linestyle='--');
axis[2, 0].plot(kx, phi_a3, label ='Approximate solution', alpha=0.6)
axis[2, 0].set_title("phi_s=2")
axis[2, 0].grid()
axis[2, 0].legend()

# phi_s=0.5
axis[0, 1].plot(kx, phi_e1, label ='Exact solution', linestyle='--');
axis[0, 1].plot(kx, phi_D1, label ='Debye-Huckle approximation', alpha=0.6)
axis[0, 1].set_title("phi_s=0.5")
axis[0, 1].grid()
axis[0, 1].legend()

# phi_s=1
axis[1, 1].plot(kx, phi_e2, label ='Exact solution', linestyle='--');
axis[1, 1].plot(kx, phi_D2, label ='Debye-Huckle approximation', alpha=0.6)
axis[1, 1].set_title("phi_s=1")
axis[1, 1].grid()
axis[1, 1].legend()

# phi_s=2
axis[2, 1].plot(kx, phi_e3, label ='Exact solution', linestyle='--');
axis[2, 1].plot(kx, phi_D3, label ='Debye-Huckle approximation', alpha=0.6)
axis[2, 1].set_title("phi_s=2")
axis[2, 1].grid()
axis[2, 1].legend()

# Combine all the operations and display


plt.show()
In [ ]:

You might also like