ndiffusion.nearby_fixed_source

ndiffusion.nearby_fixed_source(solver, mats, source, *, medium_map=None, edges_x=None, edges_y=None, geometry=None, mesh=None, bc=None, fit=None, return_nearby=True)[source]

Run the method of nearby problems for a fixed-source diffusion solve.

Parameters:
  • solver (FixedSourceSolver / FixedSourceSolver2D / FixedSourceSolverUnstructured2D) – A constructed solver whose .solve(source) returns a FixedSourceResult.

  • mats (Materials) – The same cross sections the solver was built with.

  • source (array-like) – Flat volumetric source [n_cells * G] (public layout).

  • medium_map – Geometry descriptor (the solver does not expose its own). Use (medium_map, edges_x, geometry) for 1-D, (medium_map, edges_x, edges_y, geometry) for 2-D structured, or mesh= for the unstructured FVM mesh.

  • edges_x – Geometry descriptor (the solver does not expose its own). Use (medium_map, edges_x, geometry) for 1-D, (medium_map, edges_x, edges_y, geometry) for 2-D structured, or mesh= for the unstructured FVM mesh.

  • edges_y – Geometry descriptor (the solver does not expose its own). Use (medium_map, edges_x, geometry) for 1-D, (medium_map, edges_x, edges_y, geometry) for 2-D structured, or mesh= for the unstructured FVM mesh.

  • geometry – Geometry descriptor (the solver does not expose its own). Use (medium_map, edges_x, geometry) for 1-D, (medium_map, edges_x, edges_y, geometry) for 2-D structured, or mesh= for the unstructured FVM mesh.

  • mesh – Geometry descriptor (the solver does not expose its own). Use (medium_map, edges_x, geometry) for 1-D, (medium_map, edges_x, edges_y, geometry) for 2-D structured, or mesh= for the unstructured FVM mesh.

  • bc (list of BoundaryCondition, optional) – Unstructured mesh only: the tag-indexed boundary conditions the solver was built with. Given bc, the curve fit is the constrained spline fit; without it, the per-cell polynomial fit.

  • fit ({None, "spline", "local"}) – Force the unstructured curve fit; None picks "spline" when bc is given.

  • return_nearby (bool, default True) – If True, also solve the nearby problem and return the error estimate.

Returns:

numerical (raw solver result), curve_fit, residual, and - when return_nearby - nearby (raw solver result) and error_estimate = nearby.flux - curve_fit, which estimates phi_num - phi_exact. The arrays are shaped (n_cells, G), like the solver flux.

Return type:

NearbyFixedResult