pyopensn.solver.NonLinearKEigenSolver
- class pyopensn.solver.NonLinearKEigenSolver
Non-linear k-eigenvalue solver.
Wrapper of
opensn::NonLinearKEigenSolver.Supports one or more groupsets when the groupsets run without WGDSA/TGDSA. If WGDSA or TGDSA is enabled on any groupset, the nonlinear k-eigen solve must use a single groupset; otherwise
Initialize()raises aValueError.The eigenvector is returned with an arbitrary scale that depends on the solver, the acceleration method, and the starting flux. Normalize absolute quantities (power, reaction rates, leakage, balance rates) explicitly, e.g. with
power_normalization_target.- Advance(self: pyopensn.solver.Solver) None
Advance the solver by one step.
Changes made to the problem since the last step are checked as in
Execute.Initializemust be called first. Solver classes that do not implement stepping leave the state unchanged and log thatAdvanceis unsupported.For MPI transport solvers, this is a collective operation and must be called on all ranks.
- ComputeBalanceTable(self: pyopensn.solver.NonLinearKEigenSolver) dict
Compute and return the global balance table using the solver’s normalization. This is a collective operation and must be called on all ranks.
- Returns:
Dictionary with the following entries:
absorption_rate: Global absorption rate, approximatelyintegral sigma_a * phi dVsummed over groups and the full domain.production_rate: Global volumetric production/source rate used by the solver, approximatelyintegral Q dVsummed over groups and the full domain.inflow_rate: Global incoming boundary contribution integrated over incoming angular flux on boundaries. On reflecting boundaries the outgoing partial current is counted as the incoming one, so reflecting faces add equal amounts toinflow_rateandoutflow_rateand cancel inbalance.outflow_rate: Global outgoing boundary contribution accumulated from face outflow tallies, including reflecting boundaries (seeinflow_rate).balance: Rate balance,production_rate + inflow_rate - absorption_rate - outflow_rate.
- Return type:
dict
Notes
For k-eigenvalue balance reporting, this solver scales the production term by
1 / k_effbefore forming bothproduction_rateandbalance.
- Execute(self: pyopensn.solver.Solver) None
Execute the solver.
The problem’s current state and the solver’s requirements are checked first, so changes made to the problem after
Initialize(for example a mode switch orSetXSMap) are validated before they are used.Initializemust be called beforeExecute.For MPI transport solvers, this is a collective operation and must be called on all ranks.
- GetEigenvalue(self: pyopensn.solver.NonLinearKEigenSolver) float
Return the current k-eigenvalue.
- GetNumSweeps(self: pyopensn.solver.NonLinearKEigenSolver) int
Return the cumulative number of transport sweeps performed by all groupsets, including those of the initial power iterations.
- Returns:
Total number of transport sweeps.
- Return type:
int
- Initialize(self: pyopensn.solver.Solver) None
Initialize the solver.
Solvers check that the problem is in a supported state (for example, steady-state mode without external sources for the k-eigenvalue solvers) and raise
ValueErrorotherwise. Setup and post-setup validation must both succeed. CallingInitializeagain clears the previous initialized state first.For MPI transport solvers, this is a collective operation and must be called on all ranks.
- IsConverged(self: pyopensn.solver.NonLinearKEigenSolver) bool
Return True if the nonlinear solve of the last
Execute()converged.Returns False if the nonlinear solver stopped on its iteration limit or another divergence reason, and before the first
Execute().
- __init__(self: pyopensn.solver.NonLinearKEigenSolver, **kwargs) None
Construct a non-linear k-eigenvalue solver.
- Parameters:
problem (pyopensn.solver.DiscreteOrdinatesProblem) – Existing discrete ordinates problem instance. Multiple groupsets are supported when groupset WGDSA/TGDSA is disabled. If WGDSA or TGDSA is enabled on any groupset, the nonlinear k-eigen solve must use a single groupset.
nl_abs_tol (float, default=1.0e-8) – Non-linear absolute tolerance.
nl_rel_tol (float, default=1.0e-8) – Non-linear relative tolerance.
nl_sol_tol (float, default=1.0e-50) – Non-linear solution tolerance.
nl_max_its (int, default=50) – Non-linear algorithm maximum iterations.
l_abs_tol (float, default=1.0e-8) – Linear absolute tolerance. The value used is
min(l_abs_tol, nl_abs_tol), so that the linear solves can reduce the nonlinear residual belownl_abs_tol.l_rel_tol (float, default=1.0e-8) – Linear relative tolerance.
l_div_tol (float, default=1.0e6) – Linear divergence tolerance.
l_max_its (int, default=50) – Linear algorithm maximum iterations.
l_gmres_restart_intvl (int, default=30) – GMRES restart interval.
l_gmres_breakdown_tol (float, default=0.1) – GMRES breakdown tolerance.
reset_phi0 (bool, default=True) – If true, reinitializes scalar fluxes to 1.0.
num_initial_power_iterations (int, default=0) – Number of initial power iterations before the non-linear solve.
compute_balance (bool, default=False) – If true, print the balance table, with production scaled by
1/k_eff, afterExecute()completes.
Notes
PETSc convergence failures and iteration limits are reported through the solver status and log output, consistent with the other transport solvers. Invalid residual states are reported to PETSc as function-domain errors so SNES can backtrack or terminate with the appropriate reason.