pnps.reference#

NumPy reference implementation of the propagation model, for validation.

solprop integrates this package’s envelope UPPE (pnps.bridge). Everything here is the same model written as whole-array NumPy, small enough to read in one sitting and slow enough to be used only on test grids:

The operator is described by an OperatorTables record, which can be built two ways, deliberately:

  • materials_tables() from this package’s own materials and grids – the independent operator, sharing no code with solprop, so agreement with solprop’s propagation validates solprop’s integration of it;

  • pnps.bridge.bridge_tables() from the solprop objects the bridge configured – the configured operator, which isolates the integrator from the operator assembly when a discrepancy has to be located.

The state is E[ky, kx, omega], the unnormalised 3-D DFT of the field in V/m, in the FFT sign convention (every physical phase carries a minus sign). The linear operator is

L = -i (Re k_z - frame(omega)) - |Im k_z| - gamma_omega(omega)

with k_z = sqrt(k(omega)^2 - kperp^2) on the principal branch and frame the co-moving subtraction beta1 omega + beta0_ref; the transverse-wavevector ramp gamma_k(kx, ky), when the configuration has one, damps as gamma_omega does.

Module Attributes

MU

The permeability in the UPPE prefactor -i mu omega^2 / (2 Re k_z), H/m, written as 1 / (eps_0 c^2), the form solprop's prefactor takes, so that both operators carry the same rounded constant.

Functions

admittance_weight(tables)

Return the weight of |E|^2 in every measured energy, (n, n, nt).

apply_linear(e, tables, dz)

Apply the exact linear propagator exp(L dz) elementwise.

configured_tables(setup, grid, space, ...[, ...])

Tabulate the operator that a set of solprop objects defines.

first_born_signal(e_in, tables, z_end[, ...])

First-Born (undepleted-pump) signal-region spectrum at z_end.

linear_diagnostics(e, tables)

Return the per-save energy and absorption diagnostics.

materials_tables(setup)

Build the operator from this package's own materials and grids.

nonlinear_rhs(e, tables)

Evaluate the nonlinear term of the UPPE in the spectral domain.

operator_admittance(tables)

Return the axial admittance of the operator's medium at every element.

time_edge_fraction(e[, edge_fraction])

Return the fraction of total energy in the outer edges of the time window.

Classes

OperatorTables(omega, k2, kperp2, frame, ...)

Separable tables of the propagation operator (never materialised in 3-D).

pnps.reference.MU = 1.2566370612685004e-06#

The permeability in the UPPE prefactor -i mu omega^2 / (2 Re k_z), H/m, written as 1 / (eps_0 c^2), the form solprop’s prefactor takes, so that both operators carry the same rounded constant.

class pnps.reference.OperatorTables(omega, k2, kperp2, frame, gamma_omega, gamma_lap, gd_band, chi3, active, evanescent_clamp, raman_fraction=0.0, raman_shape=None, gamma_k=None)[source]#

Bases: object

Separable tables of the propagation operator (never materialised in 3-D).

Attributes:
omeganumpy.ndarray

Absolute angular frequency, FFT-ordered, (nt,), rad/s.

k2numpy.ndarray

Material wavenumber squared (n(omega) omega / c)^2, complex, (nt,), rad^2/m^2, zero off the active band. Real for a lossless index.

kperp2numpy.ndarray

kx^2 + ky^2 indexed [iy, ix], (n, n), rad^2/m^2.

framenumpy.ndarray

Co-moving phase rate subtracted from Re k_z, (nt,), rad/m.

gamma_omeganumpy.ndarray

Spectral absorber, an amplitude rate, (nt,), 1/m.

gamma_lapnumpy.ndarray

The lap budget’s share of gamma_omega, (nt,), 1/m; the rest is the band edges’.

gd_bandnumpy.ndarray

Indicator (0/1) of the bins the group-delay lap budget absorbs, (nt,).

chi3float

Third-order susceptibility multiplying (3/4) eps_0 |E|^2 E, m^2/V^2.

activenumpy.ndarray or None

solprop’s hard band limit: the field is held at zero outside this boolean (nt,) mask. None for this package’s own operator, which damps those bins instead of zeroing them.

evanescent_clampfloat or None

Ceiling on the evanescent field attenuation |Im k_z|, 1/m; None for the unclamped physical decay.

raman_fractionfloat

The share f_R of chi3 carried by the delayed Raman response, 0 for none.

raman_shapenumpy.ndarray or None

The unit-integral Raman shape h_R sampled at lags k delta_t, k = 0 .. n_t - 1, in 1/s; None without Raman.

gamma_knumpy.ndarray or None

The transverse-wavevector ramp’s amplitude rate, (n_y, n_x), 1/m; None for none.

omega: Float[ndarray, 'n_omega']#
k2: Complex[ndarray, 'n_omega']#
kperp2: Float[ndarray, 'n_y n_x']#
frame: Float[ndarray, 'n_omega']#
gamma_omega: Float[ndarray, 'n_omega']#
gamma_lap: Float[ndarray, 'n_omega']#
gd_band: Float[ndarray, 'n_omega']#
chi3: float#
active: Bool[ndarray, 'n_omega'] | None#
evanescent_clamp: float | None#
raman_fraction: float = 0.0#
raman_shape: Float[ndarray, 'n_t'] | None = None#
gamma_k: Float[ndarray, 'n_y n_x'] | None = None#
pnps.reference.admittance_weight(tables)[source]#

Return the weight of |E|^2 in every measured energy, (n, n, nt).

Parameters:
tablesOperatorTables

The operator.

Returns:
numpy.ndarray

The real part of operator_admittance().

pnps.reference.apply_linear(e, tables, dz)[source]#

Apply the exact linear propagator exp(L dz) elementwise.

Parameters:
enumpy.ndarray

Spectral state (n, n, nt).

tablesOperatorTables

The operator.

dzfloat

Propagation distance in m.

Returns:
numpy.ndarray

exp(L dz) e, band-limited when the operator has a hard band limit.

pnps.reference.configured_tables(setup, grid, space, medium, frame, absorber, chi3, transverse=None)[source]#

Tabulate the operator that a set of solprop objects defines.

pnps.bridge.bridge_tables() calls this for a built bridge, and pnps.bridge.build_bridge() calls it directly, before the bridge exists, for the reducer’s diagnostics.

Parameters:
setupSetup

The configuration (for the transverse sample count and the lap-budget band).

gridsolprop.grid.EnvelopeGrid

The solprop temporal grid.

spacesolprop.grid.FreeGrid

The solprop transverse grid.

mediumsolprop.spatial.SpatialMedium

The slab.

framesolprop.linear.Frame

The co-moving frame.

absorbersolprop.boundaries.Absorber

The absorber; its spectral rate is a power rate.

chi3float

The chi3 given to solprop’s Kerr response, m^2/V^2.

transversesolprop.spatial_absorber.SpatialAbsorberDesign or None, optional

The translated problem’s transverse boundary, whose safety ramp is the transverse-wavevector ramp, or None.

Returns:
OperatorTables

The tables of the operator those objects define.

pnps.reference.first_born_signal(e_in, tables, z_end, n_nodes=32, region=None)[source]#

First-Born (undepleted-pump) signal-region spectrum at z_end.

The pumps evolve with the exact linear propagator, E_p(z) = exp(L z) E_in; the first-order signal is

E_1(Z) = integral_0^Z exp(L (Z - z)) P[E_p(z)] dz

with P the full nonlinear term of the UPPE projected onto the signal region (the TG quadrant kx < 0, ky < 0 unless another is given). Projecting the full Kerr polarisation picks up every frequency/momentum combination that lands in the region, with all coefficient bookkeeping included for free. The integral is evaluated by Gauss-Legendre quadrature; each node costs one nonlinear-term evaluation (one FFT pair).

Parameters:
e_innumpy.ndarray

Input state (n, n, nt) at z = 0.

tablesOperatorTables

The operator.

z_endfloat

Slab position to evaluate at, in m.

n_nodesint

Gauss-Legendre nodes over [0, z_end].

regionnumpy.ndarray or None, optional

The signal region as a mask of the state (pnps.geometry.region_mask()); None for the TG quadrant.

Returns:
numpy.ndarray

The Born prediction of i_omega_full (region-summed spectrum), shape (nt,) – directly comparable with a full simulation’s i_omega_full at the same position and low pulse energy, once its linear part has been subtracted at field level.

pnps.reference.linear_diagnostics(e, tables)[source]#

Return the per-save energy and absorption diagnostics.

The reference for the fused host reduction (pnps.reduce_numba).

Parameters:
enumpy.ndarray

Spectral state (n, n, nt).

tablesOperatorTables

The operator.

Returns:
dict of float

absorb_omega, absorb_lap and absorb_k: the instantaneous measured absorption rates of the band edges’ absorber, of the lap budget and of the transverse-wavevector ramp; gd_band_power: the fraction of the energy in the bins the lap budget absorbs. |E|^2 is weighted by the admittance eta (zero off the operator’s band).

pnps.reference.materials_tables(setup)[source]#

Build the operator from this package’s own materials and grids.

The independent operator: the index through pnps.materials.silica_index() (optmat’s fit evaluated here rather than by solprop), this package’s momentum axis, the co-moving frame beta1_ref omega + beta0_ref, unclamped evanescent decay and no hard band limit – no code shared with solprop’s operator assembly. The nonlinearity is the instantaneous Kerr term with the total chi3: these tables carry no Raman response.

Parameters:
setupSetup

The configuration.

Returns:
OperatorTables

The independent operator tables.

pnps.reference.nonlinear_rhs(e, tables)[source]#

Evaluate the nonlinear term of the UPPE in the spectral domain.

Transforms to (y, x, t), evaluates the envelope polarisation (3/4) eps_0 chi3 [(1 - f_R) |A|^2 + f_R (h_R * |A|^2)] A (the instantaneous Kerr term alone without Raman), transforms back, and applies the UPPE prefactor -i omega mu / (2 Re k_z / omega). Where Re k_z^2 <= 0 (or omega <= 0) the prefactor is guarded to -i omega / 2 – those bins carry no propagating field.

Parameters:
enumpy.ndarray

Spectral state (n, n, nt).

tablesOperatorTables

The operator.

Returns:
numpy.ndarray

dE/dz from the nonlinearity, band-limited when the operator has a hard band limit.

pnps.reference.operator_admittance(tables)[source]#

Return the axial admittance of the operator’s medium at every element.

pnps.flux.axial_admittance() of the tables’ wavenumber, zero off the operator’s hard band limit when it has one.

Parameters:
tablesOperatorTables

The operator.

Returns:
numpy.ndarray

The complex admittance, (n_y, n_x, n_omega).

pnps.reference.time_edge_fraction(e, edge_fraction=0.05)[source]#

Return the fraction of total energy in the outer edges of the time window.

Only a 1-D inverse FFT along the frequency axis is needed (Parseval over the transverse axes). Time index 0 is t = -T/2, so the window edges are the first and last bins.

Parameters:
enumpy.ndarray

Spectral state (n, n, nt).

edge_fractionfloat

Fraction of the window counted as edge, split between the two ends.

Returns:
float

Energy fraction in the edges.