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:
apply_linear()– the exact linear propagatorexp(L z);nonlinear_rhs()– the Kerr term of the UPPE in the spectral domain;first_born_signal()– the first-order (undepleted-pump) four-wave-mixing signal by Gauss-Legendre quadrature of the linearly propagated source;linear_diagnostics(),operator_admittance()andtime_edge_fraction()– the per-save diagnostics and the measure, against which the fused host reduction is checked.
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
The permeability in the UPPE prefactor |
Functions
|
Return the weight of |
|
Apply the exact linear propagator |
|
Tabulate the operator that a set of solprop objects defines. |
|
First-Born (undepleted-pump) signal-region spectrum at |
|
Return the per-save energy and absorption diagnostics. |
|
Build the operator from this package's own materials and grids. |
|
Evaluate the nonlinear term of the UPPE in the spectral domain. |
|
Return the axial admittance of the operator's medium at every element. |
|
Return the fraction of total energy in the outer edges of the time window. |
Classes
|
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 as1 / (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:
objectSeparable 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^2indexed[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.Nonefor 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;Nonefor 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_Rsampled at lagsk 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']#
- pnps.reference.admittance_weight(tables)[source]#
Return the weight of
|E|^2in 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, andpnps.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 isE_1(Z) = integral_0^Z exp(L (Z - z)) P[E_p(z)] dzwith
Pthe full nonlinear term of the UPPE projected onto the signal region (the TG quadrantkx < 0, ky < 0unless 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’si_omega_fullat 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_lapandabsorb_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|^2is weighted by the admittanceeta(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 framebeta1_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). WhereRe 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/dzfrom 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.