8. Iterative Methods
8.1. Overview
OpenSn’s linear Boltzmann solver uses several levels of iteration. The most important distinction for users is that not all iteration controls live in the same place.
There are three levels to keep in mind:
inner groupset solves
across-groupset iterations
solver-specific outer iterations, such as k-eigenvalue iterations
In an OpenSn input, the inner groupset solver is selected in each groupset block,
while across-groupset controls are set in the problem options block.
Example:
phys = DiscreteOrdinatesProblem(
mesh=grid,
num_groups=20,
groupsets=[
{
"groups_from_to": (0, 9),
"angular_quadrature": quad,
"inner_linear_method": "petsc_gmres",
"l_abs_tol": 1.0e-6,
"l_max_its": 200,
"gmres_restart_interval": 30,
},
{
"groups_from_to": (10, 19),
"angular_quadrature": quad,
"inner_linear_method": "petsc_gmres",
"l_abs_tol": 1.0e-6,
"l_max_its": 200,
"gmres_restart_interval": 30,
},
],
xs_map=[{"block_ids": [0], "xs": xs}],
options={
"max_ags_iterations": 100,
"ags_tolerance": 1.0e-6,
"ags_convergence_check": "pointwise",
},
)
For most users, the practical questions are:
which inner solver should be used in each groupset?
should DSA be enabled?
does the problem need multiple groupsets and AGS control?
is the top-level solver a steady-state solve, a transient solve, a power iteration k-eigen solve, or a nonlinear k-eigen solve?
8.2. Where the Iteration Controls Live
8.2.1. Groupset controls
These are specified inside each entry of groupsets=[...]:
inner_linear_methodl_abs_toll_max_itsgmres_restart_intervalallow_cyclesapply_wgdsawgdsa_l_abs_tolwgdsa_l_max_itswgdsa_verbosewgdsa_petsc_optionswgdsa_solver_policywgdsa_direct_solve_thresholdwgdsa_boundary_closurewgdsa_h_perp_conventionapply_tgdsatgdsa_l_abs_toltgdsa_l_max_itstgdsa_verbosetgdsa_petsc_optionstgdsa_solver_policytgdsa_direct_solve_thresholdtgdsa_boundary_closuretgdsa_h_perp_convention
These settings control the solve performed within a single groupset.
8.2.2. Problem-level controls
These are specified in the problem options block:
max_ags_iterationsags_toleranceags_convergence_checkverbose_inner_iterationscontrols inner solver details, including WGS and AGS iterations.verbose_outer_iterationscontrols outer solver progress, including PI/NLKE iterations and transient step summaries.
These settings control how the solver coordinates multiple groupsets and how much iteration information is printed.
A within-groupset solve that stops at its own iteration limit is treated as an
inexact inner solve: the across-groupset iteration continues until
ags_tolerance is met or max_ags_iterations is reached. If
max_ags_iterations is not set, each solver uses its own default: 100
for the steady-state and transient solvers, and 1 in each power iteration
of the power iteration k-eigen solver. A value set in the problem options is
used by every solver. The steady-state
and transient solvers print a warning when their transport solve ends without
converging (the across-groupset iteration with several groupsets, otherwise the
within-groupset solve).
8.2.3. Solver-level controls
Some solvers add their own iteration settings.
For pyopensn.solver.PowerIterationKEigenSolver:
max_itersk_tolfission_source_tolreset_phi0
For pyopensn.solver.NonLinearKEigenSolver:
nl_abs_tolnl_rel_tolnl_sol_tolnl_max_itsl_abs_toll_rel_toll_div_toll_max_itsl_gmres_restart_intvll_gmres_breakdown_tolreset_phi0num_initial_power_iterations
8.3. Inner Groupset Methods
The available groupset inner methods are:
"classic_richardson""petsc_richardson""petsc_gmres""petsc_fgmres""petsc_bicgstab"
These are selected with inner_linear_method in each groupset.
Example:
groupset = {
"groups_from_to": (0, 9),
"angular_quadrature": quad,
"inner_linear_method": "petsc_gmres",
"l_abs_tol": 1.0e-6,
"l_max_its": 300,
"gmres_restart_interval": 50,
}
8.3.1. What these methods are solving
For a discrete ordinates groupset, the inner iteration repeatedly applies the inverse transport sweep operator and updates the groupset flux moments until the chosen convergence criterion is met.
The main difference between the available methods is how that fixed-point or linear solve is managed:
classic_richardsonperforms an explicit source iteration loop in OpenSn codethe
petsc_*methods use PETSc Krylov solvers wrapped around the sweep operator
As a practical rule, PETSc methods are usually the better starting point for
difficult problems. classic_richardson is simple and useful, but it is
generally the least robust option on strongly scattering or otherwise difficult
systems unless acceleration is also enabled.
8.3.2. classic_richardson
This is OpenSn’s explicit source-iteration style method. On each iteration it:
rebuilds the groupset source from the current iterate
applies the inverse transport sweep
optionally applies WGDSA and TGDSA corrections
checks convergence using pointwise changes in
phiand delayed angular flux
Why use it:
simple algorithmic behavior
useful for debugging and method studies
pairs naturally with DSA for source-iteration style solves
by far the least memory-intensive of the groupset inner solver methods
Why not use it by default:
usually slower and less robust than Krylov methods on harder problems
convergence can deteriorate badly for optically thick or highly scattering cases without acceleration
in fixed-source and time-dependent solves, fission within the groupset is lagged by one iteration like scattering. WGDSA and TGDSA do not correct it, so a problem with a multiplication factor close to one converges at about that factor per iteration. The Krylov methods converge fission with the rest of the groupset operator.
Example:
{
"groups_from_to": (0, 0),
"angular_quadrature": quad,
"inner_linear_method": "classic_richardson",
"l_abs_tol": 1.0e-8,
"l_max_its": 200,
}
8.3.3. petsc_richardson
This uses PETSc’s Richardson iteration around the transport operator.
Why use it:
useful when a simple stationary iteration is desired but with PETSc-managed setup and convergence handling
A special case worth knowing:
if ``inner_linear_method=”petsc_richardson”`` and ``l_max_its=1``, the code effectively performs a single sweep-style update
For most problems, this is not the first PETSc method to try. GMRES is usually the stronger default.
8.3.4. petsc_gmres
This uses PETSc GMRES around the transport operator.
For most steady-state transport problems, this is the best general-purpose starting choice.
Why use it:
usually the most robust of the groupset solver methods
often the best choice for difficult scattering-dominated problems
works with DSA preconditioning
Relevant control:
gmres_restart_intervalcontrols how many Krylov vectors GMRES keeps before it restarts
Warning
GMRES can incur substantial memory usage because it stores restart vectors.
Increasing gmres_restart_interval increases the Krylov storage footprint,
so use larger values only when the convergence benefit justifies the extra
memory.
Example:
{
"groups_from_to": (0, 19),
"angular_quadrature": quad,
"inner_linear_method": "petsc_gmres",
"l_abs_tol": 1.0e-6,
"l_max_its": 300,
"gmres_restart_interval": 30,
}
8.3.5. petsc_fgmres
This uses PETSc flexible GMRES (FGMRES) around the transport operator, with the preconditioner applied on the right.
Why use it:
with
apply_wgdsaorapply_tgdsawhen the DSA diffusion system is solved iteratively. The iterative solve stops at the relative tolerancewgdsa_l_abs_tol/tgdsa_l_abs_tol, so the DSA preconditioner differs slightly between applications. Standard GMRES assumes a fixed preconditioner and can then report convergence while the transport solution is still in error. Flexible GMRES remains exact. With standard GMRES, the transport error follows the DSA tolerance once that tolerance is looser thanl_abs_tol. A groupset that usespetsc_gmresorpetsc_bicgstabwith such a DSA tolerance prints a warning suggestingpetsc_fgmres. The warning compares only the tolerances. A direct diffusion solve, which the default"auto"policy chooses for small systems on one MPI process, is the same in every application, and standard GMRES is then exact. Settingwgdsa_l_abs_tolandtgdsa_l_abs_tolno larger thanl_abs_tolalso avoids the error, at the cost of tighter diffusion solves.
It uses gmres_restart_interval like GMRES and stores about twice as many
restart vectors. Its residual test uses the unpreconditioned residual scaled by
the right-hand-side norm. Without a DSA preconditioner it behaves like
petsc_gmres.
8.3.6. petsc_bicgstab
This uses PETSc BiCGStab around the transport operator.
Why use it:
as an alternative to GMRES when memory or restart behavior is undesirable
as a solver-choice experiment for problems where GMRES is not ideal
In most common workflows, GMRES is still the more typical choice.
8.4. Convergence Controls
8.4.1. Groupset tolerance and iteration count
Each groupset has:
l_abs_tol: default1.0e-6l_max_its: default200
These control the inner solve stopping behavior.
For PETSc-based groupset methods, the residual printed in the log is the scaled residual used by OpenSn’s custom convergence test for WGS solves.
For classic_richardson, the convergence test is based on pointwise changes
in the solution, together with a spectral-radius estimate. The change of each
flux moment is measured relative to the scalar flux at the same node and group,
or to the moment itself when it is larger. The angular fluxes lagged at opposing
reflecting boundaries and broken sweep cycles must also change by less than
l_abs_tol, each measured relative to the scalar flux where the sweep reads
it, or to the lagged value itself when it is larger.
The test is relative at every node, so it also covers values close to zero, such as the small negative fluxes that the spatial discretization produces in optically thick cells. Such a value can change sign between iterations while the downscatter source is still reaching the lower groups of the groupset. The printed change is then close to 2 and the rate estimate close to 1, although the rest of the flux has nearly converged. The change falls once the source has reached every group. These values must meet the same relative tolerance as the rest of the flux, so they can add a few iterations.
8.4.1.1. l_abs_tol
This is the main convergence tolerance for the groupset inner solve.
What it tests:
for PETSc-based groupset methods, it tests the scaled WGS residual used by the OpenSn convergence check
for
classic_richardson, it is the stopping tolerance for the pointwise flux-change test used by the Richardson iteration machinery
Reasonable values:
1.0e-6is a good default for most production runs1.0e-4to1.0e-5is often acceptable for setup, debugging, or quick parameter studies1.0e-7to1.0e-8is reasonable when eigenvalues, localized responses, or balance quantities need tighter transport convergence
If the solve repeatedly reaches the outer iterations while the inner residual is still large, the inner tolerance is probably too loose for that problem.
8.4.1.2. l_max_its
This is the hard cap on the number of groupset inner iterations.
What it tests:
nothing by itself; it is a safeguard that stops the inner solve if the chosen convergence test is not met in time
Reasonable values:
200is a good default100to300is a normal range for most problemshigher values can be justified for very difficult scattering-dominated problems, but routinely hitting the cap usually means the method, groupset structure, or acceleration setup needs attention
8.4.2. What tolerance to choose
As a practical rule:
use looser tolerances while setting up and debugging a model
tighten tolerances when k-eigenvalues, localized responses, or balance quantities need to be resolved accurately
if outer iterations are still moving substantially, over-solving the inner iterations may not be the best use of work
This is especially important in multi-groupset and eigenvalue problems, where the inner solve is only one part of the total iteration process.
8.4.3. GMRES restart interval
gmres_restart_interval only matters for petsc_gmres.
Smaller restart values use less Krylov storage but may slow or degrade convergence. Larger restart values can improve robustness but cost more memory and work per restart cycle.
What it tests:
it does not change the convergence test directly
it controls how many GMRES Krylov vectors are retained before restart
Reasonable values:
30is a good default20to50is a reasonable first rangelarger values such as
60to100can help difficult problems if the extra memory is acceptable
Note
On large production cases, the memory cost of GMRES restart vectors can be a
practical limiter. If memory grows too much, reduce
gmres_restart_interval first before assuming the only fix is more
hardware.
8.4.4. allow_cycles
allow_cycles controls whether sweep cycles are allowed in the groupset.
For most users, this is not the first iterative-method parameter to tune, but it is part of the groupset solve setup and can matter on meshes whose sweep dependencies contain cycles.
8.5. Across-Groupset Iteration
When a problem has multiple groupsets, OpenSn may perform across-groupset iterations, usually abbreviated AGS.
The relevant problem options are:
max_ags_iterationsags_toleranceags_convergence_checkags_groupset_order
8.5.1. What AGS does
AGS coordinates repeated solves of the groupsets until the full multigroup solution is consistent across groupset boundaries.
In OpenSn, AGS:
executes each WGS solver in sequence, in the order set by
ags_groupset_ordercompares the new and previous full
phiiterateuses either an
l2orpointwiseconvergence checkstops when the AGS tolerance is satisfied or the iteration limit is reached
stops after the first pass when the cross sections make that pass exact (see When one pass is exact), and otherwise logs why it iterates (see Why the AGS iterates)
Why this matters:
if the problem has only one groupset, AGS is irrelevant
if the problem has multiple groupsets, AGS is part of the main solve algorithm, not just a logging detail
in fixed-source and time-dependent solves with fission, fission that emits from one groupset into another is iterated by AGS at about the multiplication factor of the problem per pass, which can take hundreds of passes (see Groupsets)
8.5.2. When one pass is exact
Each groupset solve uses the latest flux of every other groupset. The groupsets solved before it in the same pass give their new flux. The groupsets solved after it give the flux of the previous pass, and only these sources are out of date at the end of a pass. One pass over the groupsets therefore solves the coupling between them exactly when no groupset receives a source from a groupset solved after it.
Groupsets are coupled through:
scattering, the transfer matrices of every Legendre moment, including reactions that produce secondary particles. In an adjoint problem the transfer matrices are transposed, so the coupling runs in the opposite direction in energy.
fission, in fixed-source and time-dependent solves with fissionable materials, when fission emits from one groupset into another. A power iteration holds the fission source fixed during each transport solve, so there only scattering counts.
continuous slowing down. A CSDA problem always iterates (see Why the AGS iterates).
OpenSn checks the cross sections of every block before each transport solve. Only transfers between the groups the problem simulates count, so a library with more groups than the problem is checked on the simulated groups alone. Every rank holds the same cross sections and reaches the same decision.
When one pass is exact, the AGS iteration stops after the first pass in which
every groupset solve converges. It does not test the change between passes,
since that would take a second pass that only continues the converged groupset
solves. The accuracy of the result is then that of the groupset solves, so set
l_abs_tol for the accuracy you need. l_abs_tol bounds the residual
relative to the whole groupset, so where the flux or the importance is many
decades below its peak, the local error can be far larger than l_abs_tol.
In an adjoint of a thick shield whose importance falls by ten decades,
l_abs_tol = 1.0e-6 left the importance in some cells far from the detector
wrong by more than a factor of 100, while 1.0e-10 agreed with a much
tighter solve to within a factor of 2 everywhere. Tighten l_abs_tol for deep-penetration
problems and compare with a tighter solve.
Common cases:
Problem and cross sections |
Groupset order |
AGS passes |
|---|---|---|
Forward, downscatter only |
|
one |
Forward, upscatter confined to one groupset |
|
one |
Forward, upscatter and downscatter across the same groupset boundary |
any |
iterates to |
Adjoint, downscatter only in the forward cross sections |
|
one |
Adjoint, upscatter confined to one groupset |
|
one |
Adjoint, scattering between groupsets |
|
iterates, at least one pass per groupset |
Fixed-source or time-dependent, fission across groupsets |
any |
iterates, slowly near criticality (see Groupsets) |
CSDA |
any |
iterates |
A groupset with upscatter among its own groups converges that upscatter in its own solve, so upscatter confined to one groupset does not prevent one pass. The power iteration k-eigen solver makes one AGS pass per power iteration by default whether or not the pass is exact (see Power iteration k-eigen solve).
8.5.3. ags_groupset_order
Allowed values are:
"ascending"(the default): groupset 0 first, from high to low energy"descending": the last groupset first, from low to high energy"auto": ascending in forward mode and descending in adjoint mode
The order decides which coupling one pass resolves. Scattering that lowers the
energy makes a forward groupset depend on the groupsets above it in energy, so
ascending order solves every source before it is needed. In adjoint mode the
transfer matrices are transposed. The importance of a groupset depends on the
groupsets below it in energy, the coupling runs the other way, and descending
order solves every source before it is needed. Ascending order in an adjoint
problem carries the importance up by one groupset per pass, so it needs at
least as many passes as there are groupsets, and the AGS iteration then runs
until ags_tolerance is met.
Use "auto" for adjoint problems with several groupsets, and for problems
that switch between forward and adjoint mode with SetAdjoint: it follows
the mode. The default is "ascending" so that existing inputs solve in the
same order as before. "descending" is rarely useful in forward mode.
problem = DiscreteOrdinatesProblem(
mesh=grid,
num_groups=44,
groupsets=[
{"groups_from_to": (0, 11), "angular_quadrature": quad},
{"groups_from_to": (12, 23), "angular_quadrature": quad},
{"groups_from_to": (24, 35), "angular_quadrature": quad},
{"groups_from_to": (36, 43), "angular_quadrature": quad},
],
xs_map=xs_map,
volumetric_sources=[response],
options={"adjoint": True, "ags_groupset_order": "auto"},
)
Here every group that receives upscatter is in the last groupset, so the adjoint is solved in one pass, from groups 36-43 up to groups 0-11.
8.5.4. Why the AGS iterates
When one pass is not exact, the AGS log says why on rank 0 before the first
pass. The message is part of the verbose AGS output, which
verbose_inner_iterations controls and which is on by default, and it
appears only in problems with more than one groupset. The AGS solver belongs to
the problem, so the message is printed again only when the reason changes. A
power iteration, a sequence of time steps, or repeated Execute calls print
it once, and a problem switched between forward and adjoint mode prints the
reason for the new mode.
The messages are:
AGS will iterate because group 100 scatters into group 93 in an earlier groupset. Put groups 69-166 in one groupset for a single pass.
AGS will iterate because group 63 scatters into group 0 in an earlier groupset (adjoint). Set ags_groupset_order = "auto" for a single pass.
AGS will iterate because fission couples the groupsets.
AGS will iterate because CSDA is enabled.
The first part names one transfer that prevents a single pass. Group numbers are problem group indices, with group 0 at the highest energy. “Group 100 scatters into group 93 in an earlier groupset” means that the scattering source of group 93 comes from group 100, which is solved after it, so group 93 sees the group 100 flux of the previous pass. In an adjoint problem the message ends with “(adjoint)” and refers to the transposed transfer matrix: “group 63 scatters into group 0” means that the importance of group 0 depends on group 63, because group 0 scatters into group 63 in the forward problem. The named transfer is the first one found and is usually one of many.
The second part gives one change that removes all of them:
When the reverse order is exact with the same groupsets, the message names the
ags_groupset_ordervalue that gives it. This is"auto"when the reverse order is the default of the problem’s mode, as for an adjoint problem solved in ascending order.Otherwise it lists the group ranges that must each lie in one groupset, in the current order. In ascending order, a transfer up in energy, from group \(g'\) into a group \(g < g'\), is solved in one pass only when groups \(g\) through \(g'\) share a groupset. Overlapping ranges are merged, so each range runs from the lowest group that receives such a transfer to the highest group that sends one. In descending order the same holds for transfers down in energy. Several ranges read “Put groups 10-12 and 36-43 each in one groupset”. When the ranges cover every group, the message reads “Use one groupset for a single pass”.
The ranges are the least that one pass requires. Any groupsets that keep each range together give one pass, and splitting any range makes the AGS iterate again. The groups outside the ranges can be divided freely.
Fission and CSDA are reported without a suggestion. Fission couples every group to every other, so no groupset split solves it in one pass. Use one groupset for fixed-source and time-dependent problems with fission (see Groupsets). A CSDA problem always iterates. Each contiguous block of charged-particle groups must stay within one groupset, which problem validation enforces, and no other grouping is suggested for it.
Iterating is not an error. The AGS iteration converges the coupling to
ags_tolerance (see ags_tolerance), and the message only
says why the solve takes more than one pass and how to avoid it.
8.5.5. Designing groupsets for a single pass
Several groupsets solved in one exact pass give the same solution as one groupset. Each groupset solve keeps its Krylov vectors only while it runs, so the memory of a Krylov inner method is set by the largest groupset instead of all groups. The groupsets without upscatter also tend to converge in fewer iterations than the groupset with it, which can make the whole solve faster. To set them up:
Find the groups that take part in upscatter: the lowest group that receives upscatter and the highest group that sends it, over all materials. Put these groups, and every group between them, in one groupset. In a thermal library this is the thermal groupset.
Divide the remaining groups into groupsets as needed for memory or for different inner settings.
Use
ags_groupset_order = "auto". It solves forward problems from high to low energy and adjoint problems from low to high energy.Run the problem. If the log says that the AGS will iterate, apply the suggestion in that message.
For example, in a 44-group library for water, concrete, and air, the
highest-energy group that receives upscatter is group 36, and the upscatter
comes from groups up to 43. Groups 36-43 must then share a groupset. The groupsets (0, 11), (12, 23), (24, 35), and
(36, 43) then give one pass in forward and adjoint mode with "auto".
Keep the other groupset rules in mind. With TGDSA, keep every group that receives upscatter in the same groupset (see Groupsets). With CSDA, each block of charged-particle groups must be in one groupset. In fixed-source and time-dependent problems with fission, use one groupset.
8.5.6. ags_convergence_check
Allowed values are:
"pointwise"(the default)"l2"
pointwise measures the largest change of any flux moment at any node and in
any group, relative to the local scalar flux of that group or to the moment
itself, whichever is larger. It is relative, so the test does not depend on how
the source is normalized, on the number of nodes, or on how much flux a group
carries: every group, including the low-flux ones, is converged to
ags_tolerance.
Values close to zero are included, so the test can read close to 2 in early
passes, as described for classic_richardson above.
l2 measures the L2 norm of the change of all flux moments over all spatial
unknowns. The norm is not normalized by the flux or weighted by volume, so
ags_tolerance is in the units of the flux, the test tightens as the mesh is
refined, and the groups with the most flux dominate it. Scaling the source down
loosens it: a low-flux group can stop far from converged while the test passes.
Use it only when the flux scale and the mesh are fixed and an absolute tolerance
is wanted.
Both checks stop when the change is below \((1-\varrho)\,\)
ags_tolerance, where \(\varrho\) is the estimated convergence rate, so
that the remaining error, about \(\varrho/(1-\varrho)\) times the last
change, stays near the tolerance even when the groupsets are strongly coupled.
8.5.7. ags_tolerance
This is the stopping tolerance for the AGS iteration.
What it tests:
the change between successive full multigroup
phiiterates across AGS passes, using either thel2orpointwisecheck selected byags_convergence_check
Reasonable values:
1.0e-6is a good default1.0e-5is often sufficient for debugging or coarse studies1.0e-7to1.0e-8may be appropriate when strong cross-groupset coupling must be converged tightly
In general, the groupset inner solves should be tighter than the AGS solve. The change between AGS iterates includes the error that the inner solves leave, so the AGS iteration cannot stop until that error is below its own test. Compare the two in the same terms:
With the PETSc inner methods,
l_abs_tolbounds the relative residual of a groupset solve, not its error. A groupset whose iteration converges at rate \(\rho\) leaves an error of up to aboutl_abs_tol\(/(1-\rho)\) relative to the flux. \(\rho\) is the convergence rate of the whole groupset iteration. Without acceleration it is set by everything the iteration lags: the within-group scattering, the scattering between the groups of the groupset and, in fixed-source and time-dependent solves, the fission within the groupset. Two groups that scatter strongly into each other converge slowly even without within-group scattering. WGDSA reduces the within-group part and TGDSA the part that scattering between the groups couples.classic_richardsonalready scales its test by \(1-\rho\).The
l2check is absolute.ags_toleranceis in the units of the flux, so compare it with that relative error times the L2 norm of the flux. Thepointwisecheck is relative.The AGS test also scales
ags_toleranceby \(1-\varrho\).
When one pass is exact, the AGS iteration stops after that pass without testing the change between passes, and the accuracy is that of the groupset solves (see When one pass is exact).
When the groupsets are coupled and the inner error is above the AGS test, the
AGS iteration does not stop at the inner tolerance. It runs slowly. A groupset
whose PETSc solve starts below l_abs_tol takes no Krylov iteration, but the
sweep that rebuilds its angular flux after the solve still applies one source
iteration to it. Each AGS pass
then advances that groupset by one source iteration, and the AGS iteration can
take tens of passes or reach max_ags_iterations. The log shows this as
groupsets that converge at iteration 0 while the AGS change decreases slowly.
Tighten
l_abs_tol, add DSA to the groupsets with strong scattering, or loosen
ags_tolerance. Loosening ags_tolerance or switching to the
pointwise check stops the iteration sooner, with the accuracy of the inner
solves.
8.5.8. max_ags_iterations
This is the hard cap on AGS passes in one transport solve.
What it tests:
nothing by itself; it simply limits the total number of across-groupset iterations
Defaults:
if the option is not set, the steady-state and transient solvers use
100and the power iteration k-eigen solver uses1in each power iterationa value set in the problem options is used by every solver, including the power iteration solver, which then makes up to that many passes in every power iteration
Reasonable values for fixed-source and time-dependent solves:
10020to50is often enough for easier multi-groupset problemsif this limit is reached regularly, the real issue is usually strong cross-groupset coupling, an overly aggressive groupset split, or the need for tighter inner solves
Example:
options = {
"max_ags_iterations": 100,
"ags_tolerance": 1.0e-6,
"ags_convergence_check": "pointwise",
}
8.6. DSA Options
The groupset-level acceleration toggles are:
apply_wgdsaapply_tgdsa
with associated controls:
wgdsa_l_abs_tolwgdsa_l_max_itswgdsa_verbosewgdsa_petsc_optionswgdsa_solver_policywgdsa_direct_solve_thresholdwgdsa_boundary_closurewgdsa_h_perp_conventiontgdsa_l_abs_toltgdsa_l_max_itstgdsa_verbosetgdsa_petsc_optionstgdsa_solver_policytgdsa_direct_solve_thresholdtgdsa_boundary_closuretgdsa_h_perp_convention
8.6.1. WGDSA
WGDSA stands for within-group diffusion synthetic acceleration. Enabling
apply_wgdsa creates one MIP diffusion solve for the groupset. After each
groupset iteration, it corrects the scalar flux of every group with the
solution of a one-group diffusion problem whose source is the change of that
group’s within-group scattering source. The groups are not coupled in the
correction unless wgdsa_energy_coupling is set. Then WGDSA solves one
diffusion problem per group in energy order, coupled by the in-groupset
scattering of the corrections (see Groupsets). In a groupset with
charged-particle groups and csda_enabled, WGDSA always uses this form, with
the CSDA slowing-down added (see CSDA Charged-Particle Transport). With
classic_richardson the correction is applied after each sweep. With the
PETSc methods it is the preconditioner.
Why use it:
to accelerate inner iterations that are slow because of within-group scattering in optically thick regions
with any inner method: it is the correction step of Richardson iteration and the preconditioner of the Krylov methods
WGDSA controls:
wgdsa_energy_coupling: couple the corrections of the groupset groups in energywgdsa_l_abs_tol: residual tolerance of the iterative diffusion solve, relative to the norm of its right-hand sidewgdsa_l_max_its: maximum iterations of the iterative diffusion solvewgdsa_solver_policy: PETSc solver setup policy for the WGDSA diffusion solve."auto"uses direct PETSc LU on one MPI process for systems at or belowwgdsa_direct_solve_thresholdglobal unknowns, and conjugate gradients preconditioned by BoomerAMG otherwise."direct"and"iterative"force those paths."petsc_options"takes the KSP/PC setup fromwgdsa_petsc_options.wgdsa_direct_solve_threshold: maximum global WGDSA diffusion unknown count for the automatic direct solve. The count is the number of spatial nodes times the number of groups in the groupset, or the number of spatial nodes for the per-group systems of an energy-coupled or CSDA groupset. The default is20000.wgdsa_petsc_options: PETSc options for the diffusion solver. They must carry the solver’s prefix (see Groupsets).
The direct solve ignores wgdsa_l_abs_tol and wgdsa_l_max_its.
Reasonable values:
start with
wgdsa_l_abs_tol=1.0e-4andwgdsa_l_max_its=30withclassic_richardsonorpetsc_fgmreswith
petsc_gmresorpetsc_bicgstaband an iterative diffusion solve, use awgdsa_l_abs_tolno larger thanl_abs_tol(seepetsc_fgmresabove)if WGDSA is clearly helping but not converging tightly enough, reduce the tolerance to
1.0e-5or raise the iteration cap modestly
8.6.2. TGDSA
TGDSA stands for two-grid diffusion synthetic acceleration. Enabling
apply_tgdsa builds, per material, the energy spectrum of the slowest error
mode of the groupset’s iteration in energy and diffusion cross sections
collapsed with it. After each groupset iteration, it solves one one-group
diffusion problem whose source is the change of the scattering between the
groups of the groupset, and adds the solution times the spectrum to the scalar
flux of each group. It acts after WGDSA when both are enabled. TGDSA requires a
groupset with at least two groups and is not supported with CSDA.
TGDSA controls:
tgdsa_l_abs_tol: residual tolerance of the iterative two-grid diffusion solve, relative to the norm of its right-hand sidetgdsa_l_max_its: maximum iterations of the iterative two-grid diffusion solvetgdsa_solver_policy: PETSc solver setup policy for the TGDSA diffusion solve, with the same choices and behavior aswgdsa_solver_policy.tgdsa_direct_solve_threshold: maximum global TGDSA diffusion unknown count for the automatic direct solve. The TGDSA system has one unknown per spatial node. The default is20000.
Reasonable values:
the same starting values as WGDSA are usually sensible:
tgdsa_l_abs_tol=1.0e-4andtgdsa_l_max_its=30, with the same caveat forpetsc_gmresandpetsc_bicgstabTGDSA is a correction solve, so very tight tolerances are usually unnecessary
Why use it:
to accelerate the error that scattering between the groups of a groupset couples across them, which within-group acceleration does not correct, for example in thermal groups with upscattering
8.6.3. Practical guidance
For many problems:
start without DSA
if convergence is too slow, enable WGDSA in groupsets whose groups scatter strongly within themselves
enable TGDSA in a groupset that contains thermal upscattering, usually together with WGDSA
keep every group that receives upscatter in the groupset that has TGDSA
See Choosing WGDSA, TGDSA, or both for when to use each correction and how to lay out groupsets for TGDSA.
DSA is most useful when there is an actual iteration problem to solve. It is not automatically beneficial for every easy case.
Example:
{
"groups_from_to": (0, 39),
"angular_quadrature": quad,
"inner_linear_method": "petsc_fgmres",
"l_abs_tol": 1.0e-6,
"l_max_its": 200,
"apply_wgdsa": True,
"wgdsa_l_abs_tol": 1.0e-4,
"wgdsa_l_max_its": 30,
"wgdsa_verbose": False,
}
8.7. Solver-Specific Outer Iteration
8.7.1. Steady-state source solves
For a standard steady-state source problem, the main iteration controls are the groupset inner method and, when multiple groupsets are present, AGS.
Example:
ss_solver = SteadyStateSourceSolver(problem=phys)
ss_solver.Initialize()
ss_solver.Execute()
8.7.2. Transient solves
For transient problems, each timestep calls into the same underlying transport iteration machinery. That means the groupset inner method and AGS settings still matter, but now they matter per timestep.
If a transient run is unexpectedly expensive, the first iterative-method settings to examine are usually:
the chosen groupset inner method
the inner tolerance
whether angular flux storage is enabled for the transient formulation
8.7.3. Power iteration k-eigen solve
pyopensn.solver.PowerIterationKEigenSolver adds its own outer
iteration on top of the transport solve.
Relevant parameters:
max_itersk_tolfission_source_tolreset_phi0
What it does:
sets the fission source from the previous iterate
performs the transport solve through AGS and the groupset inner solves, with one across-groupset pass unless the problem sets
max_ags_iterationsupdates
k_effrepeats until the relative eigenvalue change is below \((1-\rho)\,\)
k_tolin two consecutive power iterations, the fission-source change is below \((1-\rho)\,\)fission_source_tolunlessfission_source_tolis0, and the acceleration method, if any, allows convergence, or untilmax_itersis reached. A change below \(100\epsilon\), about2.2e-14, also passes its test, because round-off cannot resolve smaller changes
k_tol is the tolerance on the estimated relative error of the eigenvalue.
A power iteration converging at rate \(\rho\) changes \(k\) by only
about \(1-\rho\) times its error per iteration, so the relative change
\(|k_n - k_{n-1}| / k_n\) must be below \((1-\rho)\,\) k_tol, with
\(\rho\) estimated from the change of the production-normalized flux. For a
problem with a dominance ratio close to one this takes more iterations than a
test on the change alone, which stops with an error of about \(1/(1-\rho)\)
times k_tol. The test must hold for two consecutive iterations, because an
accelerated eigenvalue sequence can overshoot and show one small change where it
turns around. 1.0e-8 to
1.0e-10 is a reasonable production range, with 1.0e-10 being common
when a fairly tight k_eff is desired.
fission_source_tol is the tolerance on the estimated error of the
fission-source shape. The fission production of each fissionable cell is
divided by the total production, and the fission-source change is the
root-mean-square of the relative changes of these cell sources between power
iterations. A cell whose previous source is not positive adds nothing to the
sum but counts as a cell. The change must be below \((1-\rho)\,\)
fission_source_tol, with the same \(\rho\) as for k_tol. The
eigenvalue is insensitive to small errors of the flux shape, so it can settle
while the shape, and the pin powers, still change. This happens with
accelerated iterations whose eigenvalue comes from a converged low-order
problem, and in large, loosely coupled cores. The default, 1.0e-6, bounds
the estimated root-mean-square error of the cell fission sources. The test sees
only the fission production of fissionable cells, not the flux elsewhere. It is
on by default, so a run can take more power iterations than with the eigenvalue
test alone, or reach max_iters where that test would have stopped. 0
disables it, which leaves only the eigenvalue test.
With more than one groupset, each power iteration makes one across-groupset
pass unless the problem options set max_ags_iterations, in which case it
makes up to that many. The fission source of a power iteration is itself only an
estimate, so converging the scattering coupling between groupsets inside each
power iteration does not change the converged eigenpair; it only adds sweeps.
With a single pass, the power iteration converges the coupling between
groupsets together with the fission source, and its rate estimate, taken from
the change of the flux, includes both. Strong upscattering split across many
groupsets can slow the power iteration; a few passes per power iteration then
reduce the number of power iterations.
max_iters is the hard cap on power iterations. 500 to 1000 is a
reasonable starting range. If that cap is reached often, the issue is usually
not the cap itself but the overall transport convergence strategy.
Example:
keigen = PowerIterationKEigenSolver(
problem=phys,
max_iters=500,
k_tol=1.0e-10,
)
keigen.Initialize()
keigen.Execute()
8.7.4. Nonlinear k-eigen solve
pyopensn.solver.NonLinearKEigenSolver uses a separate nonlinear
solve path.
Relevant parameters:
nonlinear tolerances:
nl_abs_tol,nl_rel_tol,nl_sol_tol,nl_max_itslinear tolerances inside the nonlinear solve:
l_abs_tol,l_rel_tol,l_div_tol,l_max_itsGMRES controls for the nonlinear linearization solves:
l_gmres_restart_intvlandl_gmres_breakdown_toloptional warm start via
num_initial_power_iterations
Why use it:
when the nonlinear eigenvalue solve is preferred over plain power iteration
when convergence behavior of the nonlinear method is better suited to the problem
This is a different top-level algorithm from groupset WGS iteration. Its
internal linear solves are controlled by the l_* parameters on
NonLinearKEigenSolver, not by the groupset inner_linear_method or the
groupset l_* settings.
The nonlinear k-eigen solver supports multiple groupsets, but WGDSA/TGDSA preconditioning is currently restricted to single-groupset nonlinear k-eigen solves.
Important
This is different from the other solver paths discussed in this section.
NonLinearKEigenSolver uses its own internal linear solve. If a nonlinear
k-eigen run needs tuning, start with the solver-level nl_* and l_*
parameters on pyopensn.solver.NonLinearKEigenSolver, not with
the groupset inner-solver settings.
What the main nonlinear controls do:
nl_abs_tol: absolute nonlinear residual tolerancenl_rel_tol: relative nonlinear residual tolerancenl_sol_tol: solution-update tolerance for the nonlinear solvenl_max_its: hard cap on nonlinear iterations
Reasonable values:
1.0e-8is a sensible starting point fornl_abs_tolandnl_rel_tol25to50is a reasonable starting range fornl_max_itsnl_sol_tolis usually left at its default unless there is a specific reason to tune the solution-update criterion
What the internal linear controls do:
l_abs_tol: absolute tolerance for the linear solve inside each nonlinear stepl_rel_tol: relative tolerance for that same linear solvel_div_tol: divergence guard for the linear solvel_max_its: hard cap on linear iterations inside each nonlinear stepl_gmres_restart_intvl: restart size for the internal GMRES solvel_gmres_breakdown_tol: breakdown guard for that GMRES solve
Reasonable values:
1.0e-8is a reasonable starting value forl_abs_tolandl_rel_tol50is a reasonable first value forl_max_its30is a good default forl_gmres_restart_intvll_div_tolandl_gmres_breakdown_tolare usually left at their defaults unless the nonlinear linearization is clearly running into solver pathologies
8.8. Choosing a Method
For most users, a sensible starting progression is:
Start with
petsc_gmres.Use the default AGS settings unless there is a clear need to change them.
If convergence is slow on scattering-dominated problems, enable WGDSA.
If the groups of a groupset upscatter, enable TGDSA as well, and keep the whole upscatter range in that groupset (see Choosing WGDSA, TGDSA, or both).
Use
classic_richardsonwhen a simple source-iteration style method is specifically desired.
Keep in mind that petsc_gmres is not memory-free: the restart interval sets
how many Krylov vectors are retained between restarts, so aggressive values can
materially increase memory usage.
If the problem is easy, these choices may not matter much. If the problem is difficult, the best improvements usually come from:
a better inner method
appropriate DSA
sensible groupset decomposition
tolerances that match the real accuracy target
8.9. Examples
8.9.1. Single groupset with GMRES
groupsets = [
{
"groups_from_to": (0, 9),
"angular_quadrature": quad,
"inner_linear_method": "petsc_gmres",
"l_abs_tol": 1.0e-6,
"l_max_its": 200,
"gmres_restart_interval": 30,
}
]
8.9.2. Classic Richardson with WGDSA
groupsets = [
{
"groups_from_to": (0, 19),
"angular_quadrature": quad,
"inner_linear_method": "classic_richardson",
"l_abs_tol": 1.0e-8,
"l_max_its": 200,
"apply_wgdsa": True,
"wgdsa_l_abs_tol": 1.0e-4,
"wgdsa_l_max_its": 30,
}
]
8.9.3. Two groupsets with AGS control
phys = DiscreteOrdinatesProblem(
mesh=grid,
num_groups=40,
groupsets=[
{
"groups_from_to": (0, 19),
"angular_quadrature": quad,
"inner_linear_method": "petsc_gmres",
"l_abs_tol": 1.0e-6,
"l_max_its": 200,
},
{
"groups_from_to": (20, 39),
"angular_quadrature": quad,
"inner_linear_method": "petsc_gmres",
"l_abs_tol": 1.0e-6,
"l_max_its": 200,
},
],
xs_map=[{"block_ids": [0], "xs": xs}],
options={
"max_ags_iterations": 100,
"ags_tolerance": 1.0e-6,
"ags_convergence_check": "pointwise",
},
)
8.9.4. Power iteration k-eigen solve
keigen = PowerIterationKEigenSolver(
problem=phys,
max_iters=1000,
k_tol=1.0e-10,
reset_phi0=True,
)
8.9.5. Nonlinear k-eigen solve
keigen = NonLinearKEigenSolver(
problem=phys,
nl_abs_tol=1.0e-8,
nl_rel_tol=1.0e-8,
nl_max_its=50,
l_abs_tol=1.0e-8,
l_rel_tol=1.0e-8,
l_max_its=50,
l_gmres_restart_intvl=30,
num_initial_power_iterations=5,
)
8.10. Recommendations
Use
petsc_gmresas the default first choice unless there is a specific reason to prefer another method.Remember that GMRES stores restart vectors, so aggressive restart sizes can significantly increase memory usage.
Use
classic_richardsonwhen a simple source-iteration style solve is desired, especially for studies and debugging.Treat AGS settings as important only when the problem has multiple groupsets.
Try WGDSA before TGDSA when the main issue is slow scattering convergence.
Tighten tolerances only as far as the quantities of interest actually require.
Revisit the iterative-method settings when changing problem difficulty, groupset structure, or solver type. A choice that is good for a fixed-source problem may not be the best one for a transient or k-eigen solve.