solprop.backends.numpy_ref.source#
The stage derivative: the nonlinear source of a lab-frame field, on every route.
StageSource is what NumpyWorkspace.nonlinear asks. Its
evaluate() runs the passes of docs/dev/architecture.md section 8
(solprop.backends.numpy_ref.passes) on the route the problem takes: the modal
quadrature in node chunks, with the embedded coarse rule projected beside it and the
held plasma current assembled in frequency; the radial route’s plasma, projected once in
frequency; the free and planar geometries, through transverse transforms or the slab
synthesis; the general modal guide (general_modal);
and the bound TDSE response (solprop.backends.tdse_source). It adds ADR-025’s
in-stage absorbers and returns the derivative in the frame its caller names.
score_quadrature() turns the last accepted stage’s two projections
into the quadrature alarm. SourceTables gathers the arrays the passes read.
Classes
|
The problem's tables a source evaluation multiplies by. |
|
The reference's evaluation of the stage derivative, and what it keeps. |
- class solprop.backends.numpy_ref.source.SourceTables(synthesis, projection, t_window, t_window_derivative, omega_window, temporal_rate)[source]#
Bases:
objectThe problem’s tables a source evaluation multiplies by.
The arrays the passes read, gathered once from the problem.
- Attributes:
- synthesisnumpy.ndarray
transform.synthesis.- projectionnumpy.ndarray
transform.projection.- t_windownumpy.ndarray
grids.t_window_fine.- t_window_derivativenumpy.ndarray
grids.t_window_fine_derivative.- omega_windownumpy.ndarray
grids.omega_window.- temporal_ratenumpy.ndarray or None
responses.temporal_absorber_fine.
- classmethod of(problem)[source]#
Return the problem’s own tables.
- Parameters:
- problemsolprop.translate.problem.PropagationProblem
The problem.
- Returns:
- SourceTables
References to its arrays, uncopied.
- omega_window: Float[ndarray, 'n_omega']#
- projection: Float[ndarray, 'n_modes n_columns']#
- synthesis: Float[ndarray, 'n_rows n_modes_s']#
- t_window: Float[ndarray, 'n_to']#
- t_window_derivative: Float[ndarray, 'n_to']#
- class solprop.backends.numpy_ref.source.StageSource(problem, *, chunk_plan, prefactor, tdse_binding)[source]#
Bases:
objectThe reference’s evaluation of the stage derivative, and what it keeps.
Built once by the workspace from the validated problem. It reads no state of the run: the lab-frame field and the stage’s scalars are its arguments. It keeps the problem’s tables, the last stage’s projections (for the quadrature alarm), the damped Raman kernel of the last decay rates, and, with a bound TDSE response, the accounting of the last evaluation.
- Parameters:
- problemsolprop.translate.problem.PropagationProblem
The validated problem.
- chunk_plansolprop.backends.node_chunk.NodeChunkPlan
The node chunk the response passes hold at once.
- prefactorcallable
bundle -> prefactor: the workspace’s evaluation of the response prefactor from a stage’s scalars (prefactor()).- tdse_bindingsolprop.translate.tdse.TDSEBinding or None
The host response binding a TDSE problem declares;
Noneotherwise.
- Attributes:
- collar_quietbool
Whether the modal stage leaves a quiet in-stage temporal collar out (SEP 21): set by the session through the workspace, read by every stage.
- property alarm: float[source]#
The quadrature alarm
score_quadrature()last scored, or NaN.
- property embedded: bool[source]#
Whether the quadrature has an embedded coarse rule to score the alarm on.
- evaluate(lab, bundle, inverse_propagator, *, purpose='predictor')[source]#
Evaluate one stage derivative through the transform passes.
The pipeline of
architecture.mdsection 8 for any node count: one batched inverse transform of every modal column, then, per chunk of the node chunk’s nodes, the synthesis GEMM, the fused response pass and the projection GEMM accumulated over the chunks, then one batched forward transform, the crop and the prefactor. Mode-averaged propagation is the one-node, one-column case of exactly this code.- Parameters:
- labnumpy.ndarray
The stage’s lab-frame field, in the state’s layout.
- bundlesolprop.translate.stage.StageScalars
The stage’s scalars.
- inverse_propagatornumpy.ndarray
The factor that carries the derivative back to the step’s anchor.
- purpose{‘startup’, ‘predictor’, ‘corrected’, ‘diagnostic’}, optional
The host source’s accounting label; ignored when none is bound.
- Returns:
- numpy.ndarray
The stage derivative in the anchor’s frame.
- property general: GeneralMaps | None[source]#
The general modal route’s maps, or
Noneon another route.
- score_quadrature()[source]#
Score the quadrature from the last stage of an accepted step.
The relative difference between the projections of the same node polarisation with the Kronrod rule and with its embedded Gauss subset, at the cost of one extra forward transform per accepted step rather than a whole second evaluation of the transform. It is a statistic and a warning, never a controller input: a quadrature too coarse for the integrand is a modelling error the step size cannot fix, and feeding it to the controller would only shrink the step until the run stopped.
The value is
nanwhen the rule has no embedded pair, because the difference is then identically zero and reading that as convergence would be wrong; andnanwhere the polarisation itself vanishes, at a true vacuum end, because a relative measure of nothing says nothing. The session reports a value aboveQUADRATURE_ALARMonce per plane, and thequadrature_errorstatistic reads it.- Returns:
- float
The alarm, dimensionless, or NaN.
- float
Where the last stage was evaluated, m, or NaN without one.