import k3d
import matplotlib.pyplot as plt
import discretisedfield as df
p1 = (-10e-9, -10e-9, -20e-9)
p2 = (10e-9, 10e-9, 20e-9)
cell = (2e-9, 2e-9, 2e-9)
region = df.Region(p1=p1, p2=p2)
mesh = df.Mesh(region, cell=cell)
def norm_fun(point):
x, y, z = point
if x**2 + y**2 < (10e-9**2):
return 1e6
else:
return 0
def value_fun(point):
x, y, z = point
c = 1e9
return (c * x, c * y, c * z)
field = df.Field(mesh, dim=3, value=value_fun, norm=norm_fun)
# field.norm.plane('z').k3d_nonzero()
# plot = k3d.plot()
# @df.interact(z=mesh.slider('z'))
# def myplot(z):
# field.norm.plane(z=z).k3d_nonzero(plot=plot, interactive_field=field)
# plot.display()
field.x.plane("y").k3d_scalar()
Output()
# field.x.plane('z').mpl()
# plot = k3d.plot()
# @df.interact(z=mesh.slider('z'))
# def myplot(z):
# field.x.plane(z=z).k3d_scalar(plot=plot, filter_field=field.norm, interactive_field=field)
# plot.display()
# field.plane('z').k3d_vector()
# plot = k3d.plot()
# @df.interact(z=mesh.slider('z'))
# def myplot(z):
# field.plane(z=z).k3d_vector(plot=plot, color_field=field.x, cmap='hsv', interactive_field=field)
# plot.display()