ndiffusion.nearby_k_eigenvalue

ndiffusion.nearby_k_eigenvalue(keig_solver, fixed_solver, mats, *, medium_map=None, edges_x=None, edges_y=None, geometry=None, mesh=None, bc=None, fit=None, adjoint_solver=None, nearby=True, method='iterative', tol=1e-08, max_iter=200)[source]

Run the method of nearby problems for a k-eigenvalue diffusion solve.

The nearby problem M phi = (1/k) F phi + r is solved by a power iteration. With method="iterative" each outer step is a fixed_solver solve (it inverts the same loss+scatter operator M as the k-eigenvalue solver). With method="direct" (unstructured mesh and bc= only) M is assembled by unstructured_operator() and factorized once, which is much faster, and fixed_solver may be None.

Parameters:
  • keig_solver (KEigenSolver / KEigenSolver2D / KEigenSolverUnstructured2D) – Solver whose .solve() returns a DiffusionResult (flux + keff).

  • fixed_solver (matching FixedSource* solver, or None with method="direct") – Built with the same materials, mesh, and boundary conditions.

  • mats (Materials)

  • medium_map – Geometry descriptor, as in nearby_fixed_source().

  • edges_x – Geometry descriptor, as in nearby_fixed_source().

  • edges_y – Geometry descriptor, as in nearby_fixed_source().

  • geometry – Geometry descriptor, as in nearby_fixed_source().

  • mesh – Geometry descriptor, as in nearby_fixed_source().

  • bc – The unstructured curve fit, as in nearby_fixed_source().

  • fit – The unstructured curve fit, as in nearby_fixed_source().

  • adjoint_solver (matching KEigen* solver, optional) – Built on make_adjoint_materials() of mats (same mesh and boundary conditions). Its flux gives the one-shot eigenvalue error estimate k_error_adjoint and its per-cell contributions k_error_cells. With method="direct" the adjoint is instead the exact discrete one, from the assembled operator, and this is ignored.

  • nearby (bool, default True) – Run the nearby power iteration. With nearby=False only the fit and the one-shot estimate are formed; nearby_flux and k_nearby are then None.

  • method ({"iterative", "direct"}) – How the nearby problem and the adjoint are solved (see above).

  • tol (float) – Convergence tolerance on the flux change and |dk|.

  • max_iter (int) – Maximum nearby power-iteration steps.

Returns:

numerical (raw k result), curve_fit, k_curve_fit, nearby_flux, k_nearby, residual, and nearby_rate (the curve-fit fission production integral). The arrays are shaped (n_cells, G), like the solver flux. k_nearby - k_curve_fit estimates the eigenvalue discretization error, and so does k_error_adjoint when an adjoint is available (k_error_cells sums to it). On layouts whose error contributions cancel - material corners, small inclusions - k_error_cells and the local error are more reliable than the net eigenvalue estimate; the sum of abs(k_error_cells) is a (loose) bound. fit is the constrained spline fit (SplineFit) when one was used and operator the assembled operator with method="direct"; both feed nearby_qoi().

Return type:

NearbyKResult