This commit is contained in:
m 2020-02-22 00:25:36 +01:00
parent f5e3b2b4f3
commit 39436ea6d9

14
fdtd.py
View File

@ -1,15 +1,15 @@
#!/usr/bin/env python3 #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# From the Meep tutorial: plotting permittivity and fields of a bent waveguide # From the Meep tutorial: plotting permittivity and fields of a bent waveguide
from __future__ import division from __future__ import division
import meep as mp import meep as mp
import matplotlib.pyplot as plt #import matplotlib.pyplot as plt
import os import os
import sys import sys
import numpy as np import numpy as np
from matplotlib import cm #from matplotlib import cm
import pygame import pygame
mp.quiet(True) mp.quiet(True)
@ -67,11 +67,11 @@ def get_slice(sim):
def plot_dielectric(sim): def plot_dielectric(sim):
val = sim.get_array(center=mp.Vector3(), size=cell, component=mp.Dielectric, arr=buffer) val = sim.get_array(center=mp.Vector3(), size=cell, component=mp.Dielectric, arr=buffer)
plt.figure() #plt.figure()
plt.imshow(val, interpolation='none', cmap='RdBu') #plt.imshow(val, interpolation='none', cmap='RdBu')
#plt.axis('off') #plt.axis('off')
plt.show() #plt.show()
print() #print()
#sim.run(mp.at_beginning(plot_dielectric), mp.at_every(0.6, get_slice), until=200) #sim.run(mp.at_beginning(plot_dielectric), mp.at_every(0.6, get_slice), until=200)