Skip to content

Maintained examples

Run examples from the repository root in an environment where Morana is installed. The regular user installation in the installation and quickstart guide is sufficient. Examples that generate artifacts write them under artifacts/examples/ by default; that directory is ignored by Git. Those examples accept --output-dir PATH to choose another destination. The domain-face inspection example reports to the console and does not create artifacts.

The source repository’s examples/ directory contains the examples; they are excluded from the installed runtime package. Run them from a checkout that matches the Morana version being evaluated.

Run the routine example suite

The repository run_all.sh runner executes the routine examples in this catalog, including the verification studies. The computationally expensive OpenMC comparison and long many-group performance modes are exceptions; they have separate explicit commands.

examples/run_all.sh

Start with a small solve

Quickstart

quickstart.py is the executable source rendered in the installation and quickstart guide. It solves the reflected six-cell ring and reports its uniform analytic flux.

python -m examples.quickstart

Build and inspect geometry

Mesh inspection and export

mesh_plotting.py writes full-lattice and axial-slice Matplotlib/Plotly output, planar VTU data, and material-layout VTM data.

python -m examples.mesh_plotting

Domain-face inspection

material_mesh_domain_faces.py demonstrates ring-ordered material input, slice-local active IDs, and representative internal, outer, and to_excluded face classifications.

python -m examples.material_mesh_domain_faces

Mixed boundary regions

mixed_boundary_regions.py demonstrates boundary selection by radial exterior, excluded key, excluded kind, and excluded-face direction. Reflective, vacuum, Robin, partial-current return, and incoming-current conditions all resolve on represented faces.

python -m examples.mixed_boundary_regions

Solve and inspect responses

Multigroup fixed source

multigroup_fixed_source.py demonstrates an axially heterogeneous two-layer, variable-height external-source problem with top vacuum, downscatter, thermal fission emission, nonzero axial leakage, and matched unit-multiplicity and multiplying-scatter cases. It reports group flux sums with signed scattering_coupling and net_scattering balances, then writes separate axial-slice PNG/HTML and VTM artifacts for each case.

python -m examples.multigroup_fixed_source

Multigroup criticality

multigroup_keff.py demonstrates a two-group, axially heterogeneous fuel/reflector eigenvalue solve across two variable-height layers. It includes top vacuum, explicit P0 scattering, nonzero axial leakage, recoverable-power-normalized flux, group balances, axial-slice inspection, and VTM output. It solves the same fuel data once as SeparableFission(nu_sigma_f, chi) and once as the equivalent event-oriented FissionTransfer(fission_transfer[g_from, g_to]), then verifies agreement of the fission matrices, k_eff, flux, and group balances. Its illustrative fuel data includes groupwise kappa_sigma_f; each completed result is normalized to 100 kW.

python -m examples.multigroup_keff

Result archive

result_archive.py solves the layered multigroup fixed-source case, writes a non-pickle .morana-result archive, reloads it through Result.load_from_disk, and checks every group and flux layer against the original result.

python -m examples.result_archive

Verify and compare

One-group criticality

one_group_keff.py solves a reflected-radial, one-dimensional axial core-reflector criticality problem. It compares k_eff and a source-normalized cell-average axial flux with an analytic two-region eigenfunction, and writes an axial-comparison PNG and material-aware VTM output. The one-dimensional axial core-reflector case derives the reference solution and records the maintained comparison.

python -m examples.one_group_keff

Fixed-source manufactured solution

fixed_source_mms.py is a verification-focused three-group refinement study. It exercises non-unit scattering multiplicity and uses a uniquely keyed inactive excluded shell with directional excluded-face selectors to apply independently evaluated local Dirichlet data to a refining variable-height hex-z core. The derivation, acceptance criteria, and recorded convergence evidence are in the fixed-source manufactured-solution case.

python -m examples.fixed_source_mms

k-effective manufactured solution

keff_mms.py is a verification-focused one-group eigenvalue refinement study. It manufactures cell-local fission-production cross sections and face-local homogeneous Robin coefficients for a positive three-dimensional Gaussian mode on the same refining variable-height hex-z domain as the fixed-source example above. The derivation, acceptance criteria, and recorded convergence evidence are in the k-effective manufactured-solution case.

python -m examples.keff_mms

Custom finite-volume operator solve

custom_operator_solve.py shows the advanced public-operator boundary without using private Morana names. It assembles a small ragged two-group problem, constructs a custom dense node-block Jacobi preconditioner from the documented group-fastest packing, and uses SciPy GMRES for both an external fixed-source solve and the inner solves of an external power iteration. It unpacks both candidate vectors into group-major layer arrays and verifies the original fixed-source and criticality equations.

The candidates and diagnostics remain owned by the example as NumPy values; they are not checked Morana Result objects. Use Morana’s solve functions when result construction, execution provenance, physical normalization, balance checks, and the complete admissibility and convergence contract are required. The operator-assembly guide defines the mapping, signs, prerequisites, and ownership rules used here.

python -m examples.custom_operator_solve

Import and compare external material data

OpenMC–Morana SRE-derived comparison

The repository’s examples/openmc_comparison/ directory demonstrates the complete path from a heterogeneous OpenMC continuous-energy model through locally generated runtime-MGXS data to a Morana diffusion calculation. The documented comparison explains the problem definition, figures, numerical results, and interpretation; the reproduction workflow gives the staged commands.

OpenMC, a configured evaluated-data library, and substantial particle transport are required to reproduce the documented result, so this workflow is not part of examples/run_all.sh. Its deterministic geometry plot, coordinate mapping, and comparison-reader checks can be run independently of OpenMC.

The OpenMC MGXS import guide separately defines the accepted runtime file, diffusion conventions, data conversion, and rejection boundaries.

See inspection and output for artifact conventions and the verification guide for the regression evidence behind these workflows.