pub struct PeriodicPlaneWave { /* private fields */ }Expand description
Plane-wave source for a periodic unit cell at fixed transverse wavevector; see the module docs.
use ems::engine::{Engine, FaceCondition, FaceConditions, Grid};
use ems::engine::bloch_wave::{PeriodicPlaneWave, PeriodicPlaneWaveSpec, WavePart};
use ems::{Axis, Face};
let g = Grid::uniform([4, 4, 40], [1e-3; 3])?;
let faces = FaceConditions::default()
.with(Face::XMin, FaceCondition::Periodic)
.with(Face::XMax, FaceCondition::Periodic)
.with(Face::YMin, FaceCondition::Periodic)
.with(Face::YMax, FaceCondition::Periodic);
let mut e = Engine::builder(g).faces(faces).threads(1).build()?;
// Normal incidence along +z, E along x, total field from plane 10 on.
let spec = PeriodicPlaneWaveSpec::new(Axis::Z, 10, 39, true, [0.0; 3], [1.0, 0.0, 0.0]);
let pw = PeriodicPlaneWave::new(&e, &spec, WavePart::Real, |t| (-((t - 5e-11) / 1.5e-11).powi(2)).exp())?;
let h = e.add_operator(pw);
e.run(20);
assert_eq!(e.operator(&h).incident().len(), 20);Implementations§
Source§impl PeriodicPlaneWave
impl PeriodicPlaneWave
Sourcepub fn new(
engine: &Engine,
spec: &PeriodicPlaneWaveSpec,
part: WavePart,
amplitude: impl Fn(f64) -> f64 + Send + 'static,
) -> Result<Self>
pub fn new( engine: &Engine, spec: &PeriodicPlaneWaveSpec, part: WavePart, amplitude: impl Fn(f64) -> f64 + Send + 'static, ) -> Result<Self>
Sets up the source for engine’s grid, time step and coefficients
(take them as final: build after any operator that changes
coefficients on the injection planes), injecting part of the
complex incident field. amplitude(t) drives the auxiliary grid’s
hard source.
§Errors
Error::Invalid for planes outside the mesh or start ≥ stop,
an entry plane on the domain boundary (no room for the source), a
non-finite or normal k_t, a polarisation that is zero, non-finite
or has a normal component, or an invalid background.
Sourcepub fn spec(&self) -> &PeriodicPlaneWaveSpec
pub fn spec(&self) -> &PeriodicPlaneWaveSpec
The settings.
Sourcepub fn corrections(&self) -> (usize, usize)
pub fn corrections(&self) -> (usize, usize)
Number of E and H edge corrections applied per step.
Sourcepub fn discrete_wavevector(&self) -> [f64; 3]
pub fn discrete_wavevector(&self) -> [f64; 3]
The discrete transverse wavenumbers k̃ used by the auxiliary grid
[rad/m].
Sourcepub fn incident(&self) -> &[[Complex64; 3]]
pub fn incident(&self) -> &[[Complex64; 3]]
The complex incident E [V/m] on the entry plane at the phase
reference (the first mesh line of every transverse axis), one value
per step at the E times (n + 1)·dt: the tangential components as
computed, the normal component averaged from the two half cells
around the plane.
Trait Implementations§
Source§impl Debug for PeriodicPlaneWave
impl Debug for PeriodicPlaneWave
Source§impl Operator for PeriodicPlaneWave
impl Operator for PeriodicPlaneWave
Source§fn hooks(&self) -> Hooks
fn hooks(&self) -> Hooks
Hooks::ALL). Queried once, at registration; undeclared hooks
are never called. Declaring fewer hooks only saves time: an
operator whose hooks are all empty may return Hooks::NONE.Source§fn post_h(&mut self, fields: &mut Fields<'_>, _ctx: &StepContext<'_>)
fn post_h(&mut self, fields: &mut Fields<'_>, _ctx: &StepContext<'_>)
i is at ctx.h_time()).Source§fn post_e(&mut self, fields: &mut Fields<'_>, ctx: &StepContext<'_>)
fn post_e(&mut self, fields: &mut Fields<'_>, ctx: &StepContext<'_>)
u is at ctx.e_time()).Source§fn pre_h(&mut self, _fields: &mut Fields<'_>, _ctx: &StepContext<'_>)
fn pre_h(&mut self, _fields: &mut Fields<'_>, _ctx: &StepContext<'_>)
ctx.step.Source§fn pre_e(&mut self, _fields: &mut Fields<'_>, _ctx: &StepContext<'_>)
fn pre_e(&mut self, _fields: &mut Fields<'_>, _ctx: &StepContext<'_>)
Source§fn slab_hooks(
&mut self,
_partition: &SlabPartition<'_>,
) -> Option<Arc<dyn SlabHooks>>
fn slab_hooks( &mut self, _partition: &SlabPartition<'_>, ) -> Option<Arc<dyn SlabHooks>>
partition (default
none). Called once, at registration; the returned object is run by
the worker threads (see SlabHooks). The operator may keep a
clone of the Arc to read results back.