Python API
Math
Spherical harmonics
Compute the tesseral spherical harmonics. |
Point
General 3-element vector structure. |
Function wrappers
Vector spatial function. |
Angular quadrature
Quadrature points
Angular quadrature point. |
Base class
Angular quadrature. |
Product quadratures
Product quadrature. |
|
Curvilinear product quadrature. |
Gauss-Legendre quadrature for 1D, slab geometry. |
|
Gauss-Legendre-Chebyshev quadrature for 2D, XY geometry. |
|
Gauss-Legendre-Chebyshev quadrature for 3D, XYZ geometry. |
Gauss-Legendre-Chebyshev product quadrature for 2D, RZ geometry. |
Triangular quadrature
Triangular quadrature base class. |
Triangular Gauss-Legendre-Chebyshev quadrature for 2D, XY geometry. |
|
Triangular Gauss-Legendre-Chebyshev quadrature for 3D, XYZ geometry. |
Lebedev quadrature
Lebedev quadrature for 2D, XY geometry. |
|
Lebedev quadrature for 3D, XYZ geometry. |
Simplified LDFES quadrature
Piecewise-linear finite element quadrature using quadrilaterals. |
|
Two-dimensional variant of the piecewise-linear finite element quadrature. |
Field functions
Base class
Field function. |
Grid-based
Field function grid based. |
Interpolation
Base class for field-function interpolation objects. |
|
Interpolate the field function at a point. |
|
Line based interpolation function. |
|
A line based interpolation function. |
Mesh
Mesh
Mesh continuum. |
Surface mesh
Surface mesh. |
Mesh generator
Generic mesh generator. |
Extruded mesh generator. |
|
Orthogonal mesh generator. |
|
From file mesh generator. |
|
Split file mesh generator. |
|
Distributed mesh generator. |
Graph partitioner
Generic graph partitioner. |
Koch, Baker and Alcouffe based partitioning. |
|
Basic linear partitioning. |
|
PETSc based partitioning. |
Logical volume
Base class
Generic logical volume. |
Logical volume types
Boolean logical volume. |
|
Right circular cylinder logical volume. |
|
Rectangular parallel piped logical volume. |
|
Spherical logical volume. |
|
Surface mesh logical volume. |
Response evaluator
Response evaluator by folding sources against adjoint solutions. |
Source
Point sources, defined by its location and a group-wise strength vector. |
|
Multi-group isotropic volumetric sources. |
Cross section
Multi-group cross section. |
Problem
Note
Forward/adjoint mode transitions are destructive by design. In Python there are three valid ways to set mode:
Set
options={'adjoint': ...}in the problem constructor.Call
problem.SetOptions(adjoint=...).Call
problem.SetAdjoint(...)(low-level equivalent).
A mode transition triggers:
reinitializes material mode (forward vs adjoint),
clears point and volumetric sources,
clears boundary conditions,
zeros scalar and angular flux state.
The block-id to cross-section map is preserved. After switching mode, reapply the desired driving terms (sources and boundaries) before solving.
SetOptions is additive: only explicitly supplied options are updated.
If adjoint is omitted in a SetOptions call, the current mode is unchanged.
Adjoint mode is applied to the mapped MultiGroupXS objects themselves.
If the same cross-section object is shared across multiple problems, toggling
adjoint mode in one problem affects all problems using that object.
Base class
Base class for all problems. |
|
Base class for all linear Boltzmann problems. |
Discrete ordinates problem
Note
Steady-state <-> transient mode transitions are non-destructive for problem setup.
Calling SetTimeDependentMode() or SetSteadyStateMode() preserves:
mesh and discretization,
block-id to cross-section mapping,
boundary conditions and source definitions,
scalar flux moments (
phi_new/phi_oldstate).
For SetTimeDependentMode(), OpenSn needs angular fluxes
(psi) for the transient RHS time term. Mode transition behavior is as follows:
If
save_angular_fluxis already enabled: - the mode switch performs internal transient mode configuration only.If
save_angular_fluxis disabled: - OpenSn enables angular flux storage, - caches the scalar flux and performs a sweep to reconstructpsi, - restores the cached scalar flux, - completes internal transient mode configuration.
For SetSteadyStateMode(), transient-only internals are reset. If angular
flux saving had been temporarily forced for transient use, the original
save_angular_flux user setting is restored.
Practical implication:
- save_angular_flux=False is valid for steady-state solves that later
transition to transient; OpenSn will reconstruct
psineeded by the transient solver by performing a fixed-point iteration on the lagged angular fluxes with phi/q held at the converged steady-state value.
Warning
Reconstructed angular flux (psi) is consistent with the converged scalar
scalar flux moments, but it is not guaranteed to be identical to the angular
flux that would have been available if save_angular_flux=True had been
used during the steady-state solve. Small first-step transient differences
can therefore appear, especially for problems with reflecting boundaries or
lagged angular fluxes.
Base class for discrete ordinates problems in Cartesian geometry. |
Discrete ordinates curvilinear problem
Base class for discrete ordinates problems in curvilinear geometry. |
Solvers
Solver base class
Base class for all solvers. |
Steady state source solver
Steady state solver. |
Transient solver
Transient solver. |
Non-linear k-eigen
Non-linear k-eigenvalue solver. |
Power iteration solver
Power iteration k-eigenvalue solver. |
Acceleration methods
Discrete ordinates k-eigen acceleration base class
Base class for discrete ordinates k-eigenvalue acceleration methods. |
Discrete ordinates k-eigen acceleration
Construct an SCDSA accelerator for the power iteration k-eigenvalue solver. |
|
Construct an SMM accelerator for the power iteration k-eigenvalue solver. |
Settings
Important
Functions in this section are only available to the module mode. For the
console mode, refer to opensn --help for more information.
Logs
Set verbosity level (0 to 3). |
|
Enable/disable color output. |
|
Allow PETSc error handler. |
Caliper configuration
Set configuration to the Caliper manager. |
|
Start the Caliper manager and mark the program begin. |
Argument vector
Overwrite OpenSn settings using |
|
Finalize OpenSn context. |