ndiffusion.nearby_qoi

ndiffusion.nearby_qoi(result, mats, mesh, bc, numerator, denominator)[source]

Discretization error of normalized quantities of interest.

A quantity of interest here is a ratio of two reaction-rate integrals,

J(phi) = int a . phi dV / int b . phi dV,

with per-unit-volume weights a (numerator) and b (denominator) per cell and group, e.g. the absorption cross section in one region over the production cross section everywhere (a normalized region power or absorption rate). The ratio makes J independent of the eigenvector’s arbitrary normalization.

The one-shot estimate solves the generalized adjoint problem (M - F/k)^T Gamma = dJ/dphi with <Gamma, F phi> = 0 on the exact discrete operator (unstructured_operator()) and returns <Gamma, V r> + J(phi_h) - J(fit), the linearization of the nearby estimate J(phi_nearby) - J(fit). It needs the exact transpose: a solver run on adjoint cross sections does not transpose the non-orthogonal correction and leaves a bias of 1-2% on triangles and hexagons.

Parameters:
  • result (NearbyKResult) – From nearby_k_eigenvalue() with the constrained spline fit (bc= given). Its operator is reused when present (method="direct").

  • mats – As passed to nearby_k_eigenvalue().

  • mesh – As passed to nearby_k_eigenvalue().

  • bc – As passed to nearby_k_eigenvalue().

  • numerator (array-like) – Weights a and b, shaped (n_cells, G), or (n_q, n_cells, G) to evaluate several quantities with one factorization.

  • denominator (array-like) – Weights a and b, shaped (n_cells, G), or (n_q, n_cells, G) to evaluate several quantities with one factorization.

Returns:

value J(phi_h), fit_value J(fit) (by degree-4 quadrature of the fit over each cell), error_adjoint the one-shot estimate of J(phi_h) - J(phi_exact), error_nearby the nearby-solve estimate J(phi_nearby) - J(fit) (None without a nearby solve), and cells, the per-cell contributions Gamma . V r (n_q, n_cells), a goal-oriented error map for adaptation. Arrays have a leading n_q axis only when the weights do.

Return type:

NearbyQoIResult