In [1]:
from pypropagate import *
%matplotlib inline
We begin by creating the settings for the propagator. We set a simulation box of size $1 \mu \text{m} \times 1 \mu \text{m} \times 0.5 \text{mm}$ and $1000 \cdot 1000 \cdot 1000$ voxels and set initial and boundary conditions for a monochromatic plane wave with $12 \text{keV}$ photon energy. Note that we could also set the $x_\text{min}$, $x_\text{max}$, $N_x$, ... boundaries individually.
In [2]:
settings = presets.settings.create_paraxial_wave_equation_settings()
settings.simulation_box.set((0.25*units.um,0.25*units.um,0.25*units.mm),(1000,1000,1000))
presets.boundaries.set_plane_wave_initial_conditions(settings)
settings.wave_equation.set_energy(12*units.keV)
Our waveguide will consist of a vacuum core with a Titanium cladding. We can automatically lookup the refraction index for a compund material by providing chemical formula.
In [3]:
nVa = 1
nGe = presets.medium.create_material('Ge',settings)
For a slab waveguide we will use a one dimensional and for a circular waveguide a two dimensional propagator. Since the one dimensional propagator assumes the values for $y = 0$ are valid everywhere we can define both waveguides with one formula. As the waveguide radius we choose $24\text{nm}$.
In [4]:
s = settings.symbols
waveguide_radius = 25*units.nm
settings.wave_equation.n = pc.piecewise((nVa,pc.sqrt(s.x**2+s.y**2) <= waveguide_radius),(nGe,True))
settings.get_numeric(s.n)
Out[4]:
In [5]:
propagator = propagators.FiniteDifferences2D(settings)
In [6]:
field = propagator.run_slice()[-2*waveguide_radius:2*waveguide_radius]
plot(field,figsize = (13,5));
In [7]:
propagator = propagators.FiniteDifferencesCS(settings)
In [8]:
field = propagator.run_slice()[-2*waveguide_radius:2*waveguide_radius]
plot(field,figsize = (13,5));