1.1.1. Anatomy of an OpenSn Calculation

Most OpenSn transport calculations follow the same sequence. This overview names each stage before the next two tutorials assemble complete one- and two-dimensional examples.

1.1.1.1. The calculation sequence

  1. Import the Python classes used by the calculation.

  2. Create or load a mesh and assign block and boundary identifiers.

  3. Create or load material cross sections.

  4. Select an angular quadrature and define energy groupsets.

  5. Define volumetric, point, or boundary sources.

  6. Construct a problem that collects the physical model.

  7. Construct a solver, initialize it, and execute it.

  8. Retrieve field functions and verify or export the result.

1.1.1.2. Problem and solver objects

The problem object contains the mesh, material map, sources, boundary conditions, energy groups, and angular discretization. The solver object controls how that problem is initialized and solved. Keeping these responsibilities separate makes it easier to reuse a model with another solution strategy later.

1.1.1.3. A compact input shape

mesh = mesh_generator.Execute()
mesh.SetUniformBlockID(0)

cross_sections = MultiGroupXS()
cross_sections.CreateSimpleOneGroup(sigma_t=1.0, c=0.0)

quadrature = GLProductQuadrature1DSlab(n_polar=8, scattering_order=0)
groupset = [
    {
        "groups_from_to": (0, 0),
        "angular_quadrature": quadrature,
        "inner_linear_method": "petsc_gmres",
        "l_abs_tol": 1.0e-10,
        "l_max_its": 100,
        "gmres_restart_interval": 30,
    }
]

problem = DiscreteOrdinatesProblem(
    mesh=mesh,
    num_groups=1,
    groupsets=groupset,
    xs_map=[{"block_ids": [0], "xs": cross_sections}],
    volumetric_sources=[source],
)

solver = SteadyStateSourceSolver(problem=problem)
solver.Initialize()
solver.Execute()

The next two tutorials fill in each object first for a one-dimensional slab and then for a two-dimensional square.