Commit 1e247b3c authored by Nikolai G. Lehtinen's avatar Nikolai G. Lehtinen
Browse files

new demo

parent 0d29205b
......@@ -63,14 +63,13 @@ xe = φ.pcolor_x(0); ye = φ.pcolor_x(1)
# xe, ye are just for 'pcolor', these are a not the points where the function is
# defined. To get the grid points, use φ.x(0) and φ.x(1)
# print('Please close the figure window to continue') # if not using IPython
fig = plt.figure(1)
fig.clf()
ax = fig.gca()
ax.pcolor(xe,ye,φ[:,:].T)
ax.set_aspect('equal')
ax.set_xlabel('x'); ax.set_ylabel('y');
ax.set_title(r'$\phi$ for $\rho=1$ and $\phi=0$ at the boundary')
plt.show()
plt.figure(1,figsize=(6,5))
plt.clf()
plt.pcolor(xe,ye,φ[:,:].T)
plt.gca().set_aspect('equal')
plt.xlabel('x'); plt.ylabel('y');
plt.title(r'$\phi$ for $\rho=1$ and $\phi=0$ at the boundary')
plt.colorbar()
plt.savefig('trump_fig_1.pdf')
#%% Plot #2
print('Updating the BC to φ=1 on the left edge')
......@@ -80,13 +79,12 @@ print('Updating the BC to φ=1 on the left edge')
print('Solving Δφ=-ρ with φ=1 on the left edge ..')
φ_solver.solve_full(φ,ρ) # the solver already knows about the new BC
print('Error =',np.max(np.abs(Δ(φ)+ρ).arr)) # Out: 4.15134593368e-12
fig = plt.figure(2)
fig.clf()
ax = fig.gca()
ax.pcolor(xe,ye,φ[:,:].T)
ax.set_aspect('equal')
ax.set_xlabel('x'); ax.set_ylabel('y');
ax.set_title(r'$\phi$ for $\rho=1$, $\phi=1$ at left edge')
plt.show()
plt.figure(2,figsize=(6,5))
plt.clf()
plt.pcolor(xe,ye,φ[:,:].T)
plt.gca().set_aspect('equal')
plt.xlabel('x'); plt.ylabel('y');
plt.title(r'$\phi$ for $\rho=1$, $\phi=1$ at left edge')
plt.colorbar()
plt.savefig('trump_fig_2.pdf')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment