Diffusion#

class scarabee.DiffusionGeometryTile#

A DiffusionGeometryTile represents an element of a cartesian diffusion mesh. It can have either an albedo entry (float) or a xs entry (DiffusionData), but not both.

__init__(*args, **kwargs)#
property albedo#

The albedo if the tile is a boundary condition.

property xs#

The DiffusionData if the tile represents a material.

class scarabee.Neighbor#

Members:

XN : Neighbor on the x < 0 side.

XP : Neighbor on the x > 0 side.

YN : Neighbor on the y < 0 side.

YP : Neighbor on the y > 0 side.

ZN : Neighbor on the z < 0 side.

ZP : Neighbor on the z > 0 side.

__init__(self: scarabee._scarabee.Neighbor, value: SupportsInt) None#
property name#
class scarabee.DiffusionGeometry#

A DiffusionGeometry represents a cartesian mesh used to solve diffusion problems.

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: scarabee._scarabee.DiffusionGeometry, tiles: collections.abc.Sequence[typing.SupportsFloat | scarabee._scarabee.DiffusionData | scarabee._scarabee.DiffusionCrossSection], dx: collections.abc.Sequence[typing.SupportsFloat], xdivs: collections.abc.Sequence[typing.SupportsInt], albedo_xn: typing.SupportsFloat, albedo_xp: typing.SupportsFloat) -> None

Creates a 1D DiffusionGeometry.

Parameters:
  • tiles (list of float or DiffusionData or DiffusionCrossSection) – All tiles in the geometry.dx : list of float Width of each tile.

  • xdivs (list of int) – Number of meshes in each tile.

  • albedo_xn (float) – Albedo at the negative x boundary.

  • albedo_xp (float) – Albedo at the positive x boundary.

  1. __init__(self: scarabee._scarabee.DiffusionGeometry, tiles: collections.abc.Sequence[typing.SupportsFloat | scarabee._scarabee.DiffusionData | scarabee._scarabee.DiffusionCrossSection], dx: collections.abc.Sequence[typing.SupportsFloat], xdivs: collections.abc.Sequence[typing.SupportsInt], dy: collections.abc.Sequence[typing.SupportsFloat], ydivs: collections.abc.Sequence[typing.SupportsInt], albedo_xn: typing.SupportsFloat, albedo_xp: typing.SupportsFloat, albedo_yn: typing.SupportsFloat, albedo_yp: typing.SupportsFloat) -> None

Creates a 2D DiffusionGeometry.

Parameters:
  • tiles (list of float or DiffusionData or DiffusionCrossSection) – All tiles in the geometry.dx : list of float Width of each tile along x.

  • xdivs (list of int) – Number of x meshes in each tile.

  • dy (list of float) – Width of each tile along y.

  • ydivs (list of int) – Number of y meshes in each tile.

  • albedo_xn (float) – Albedo at the negative x boundary.

  • albedo_xp (float) – Albedo at the positive x boundary.

  • albedo_yn (float) – Albedo at the negative y boundary.

  • albedo_yp (float) – Albedo at the positive y boundary.

  1. __init__(self: scarabee._scarabee.DiffusionGeometry, tiles: collections.abc.Sequence[typing.SupportsFloat | scarabee._scarabee.DiffusionData | scarabee._scarabee.DiffusionCrossSection], dx: collections.abc.Sequence[typing.SupportsFloat], xdivs: collections.abc.Sequence[typing.SupportsInt], dy: collections.abc.Sequence[typing.SupportsFloat], ydivs: collections.abc.Sequence[typing.SupportsInt], dz: collections.abc.Sequence[typing.SupportsFloat], zdivs: collections.abc.Sequence[typing.SupportsInt], albedo_xn: typing.SupportsFloat, albedo_xp: typing.SupportsFloat, albedo_yn: typing.SupportsFloat, albedo_yp: typing.SupportsFloat, albedo_zn: typing.SupportsFloat, albedo_zp: typing.SupportsFloat) -> None

Creates a 3D DiffusionGeometry.

Parameters:
  • tiles (list of float or DiffusionData or DiffusionCrossSection) – All tiles in the geometry.dx : list of float Width of each tile along x.

  • xdivs (list of int) – Number of x meshes in each tile.

  • dy (list of float) – Width of each tile along y.

  • ydivs (list of int) – Number of y meshes in each tile.

  • dz (list of float) – Width of each tile along z.

  • zdivs (list of int) – Number of z meshes in each tile.

  • albedo_xn (float) – Albedo at the negative x boundary.

  • albedo_xp (float) – Albedo at the positive x boundary.

  • albedo_yn (float) – Albedo at the negative y boundary.

  • albedo_yp (float) – Albedo at the positive y boundary.

  • albedo_zn (float) – Albedo at the negative z boundary.

  • albedo_zp (float) – Albedo at the positive z boundary.

dx(self: scarabee._scarabee.DiffusionGeometry, i: SupportsInt) float#

Width in the x direction of the i mesh along the x axis.

Parameters:
  • i (int) – Mesh index along x-axis.

  • Returns

  • float – Width of mesh along x-axis.

dy(self: scarabee._scarabee.DiffusionGeometry, j: SupportsInt) float#

Width in the y direction of the j mesh along the y axis.

Parameters:
  • j (int) – Mesh index along y-axis.

  • Returns

  • float – Width of mesh along y-axis.

dz(self: scarabee._scarabee.DiffusionGeometry, k: SupportsInt) float#

Width in the z direction of the k mesh along the z axis.

Parameters:
  • k (int) – Mesh index along z-axis.

  • Returns

  • float – Width of mesh along z-axis.

geom_indx(self: scarabee._scarabee.DiffusionGeometry, m: SupportsInt) list[int]#

The geometry indices for material index m.

Parameters:

m (int) – Material index.

Returns:

Geometry indices of material index m.

Return type:

list of int

mat(self: scarabee._scarabee.DiffusionGeometry, m: SupportsInt) scarabee._scarabee.DiffusionData#

Obtains the DiffusionData for material m.

Parameters:

m (int) – Material index.

Returns:

Cross section data, form factors, and ADFs for material m.

Return type:

DiffusionData

property ndims#

Number of dimensions (1, 2, or 3).

neighbor(self: scarabee._scarabee.DiffusionGeometry, m: SupportsInt, n: scarabee._scarabee.Neighbor) tuple[scarabee._scarabee.DiffusionGeometryTile, int | None]#

Obtains the desired neighboring DiffusionGeometryTile and index for material m. If the neighbor does not exist, an albedo tile is returned and the neighbor index is None.

Parameters:
  • m (int) – Material index.

  • n (Neighbor) – Desired neighbor of tile m.

Returns:

  • DiffusionGeometryTile – Tile of the desired neighbor.

  • int (optional) – The material index of the neighbor (if neighbor is a material).

property ngroups#

Number of energy groups.

property nmats#

Total number of material tiles.

property nx#

Number of tiles along the x-axis.

property ny#

Number of tiles along the y-axis.

property nz#

Number of tiles along the z-axis.

volume(self: scarabee._scarabee.DiffusionGeometry, m: SupportsInt) float#

Obtains the volume for material m.

Parameters:

m (int) – Material index.

Returns:

Volume of material m.

Return type:

float

class scarabee.FDDiffusionDriver#

A FDDiffusionDriver solves a diffusion problem using the cell centered finite-difference method. It is capable of solving 1D, 2D, or 3D problems which are defined by providing a DiffusionGeometry instance.

__init__(self: scarabee._scarabee.FDDiffusionDriver, arg0: scarabee._scarabee.DiffusionGeometry) None#

Initializes a finite-difference diffusion solver.

Parameters:

geom (DiffusionGeometry) – Problem deffinition to solve.

extern_src(*args, **kwargs)#

Overloaded function.

  1. extern_src(self: scarabee._scarabee.FDDiffusionDriver, i: typing.SupportsInt, g: typing.SupportsInt) -> float

Returns the external source in group g and region i.

Parameters:
  • i (int) – Region index along x axis.

  • g (int) – Energy group index.

Returns:

Value of the external source.

Return type:

float

  1. extern_src(self: scarabee._scarabee.FDDiffusionDriver, i: typing.SupportsInt, j: typing.SupportsInt, g: typing.SupportsInt) -> float

Returns the external source in group g and region (i, j).

Parameters:
  • i (int) – Region index along x axis.

  • j (int) – Region index along y axis.

  • g (int) – Energy group index.

Returns:

Value of the external source.

Return type:

float

  1. extern_src(self: scarabee._scarabee.FDDiffusionDriver, i: typing.SupportsInt, j: typing.SupportsInt, k: typing.SupportsInt, g: typing.SupportsInt) -> float

Returns the external source in group g and region (i, j, k).

Parameters:
  • i (int) – Region index along x axis.

  • j (int) – Region index along y axis.

  • k (int) – Region index along z axis.

  • g (int) – Energy group index.

Returns:

Value of the external source.

Return type:

float

flux(*args, **kwargs)#

Overloaded function.

  1. flux(self: scarabee._scarabee.FDDiffusionDriver, i: typing.SupportsInt, g: typing.SupportsInt) -> float

Returns the scalar flux in group g and region i.

Parameters:
  • i (int) – Region index along x axis.

  • g (int) – Energy group index.

Returns:

Flux in region i and in group g.

Return type:

float

  1. flux(self: scarabee._scarabee.FDDiffusionDriver, i: typing.SupportsInt, j: typing.SupportsInt, g: typing.SupportsInt) -> float

Returns the scalar flux in group g and region (i, j).

Parameters:
  • i (int) – Region index along x axis.

  • j (int) – Region index along y axis.

  • g (int) – Energy group index.

Returns:

Flux in region (i, j) and in group g.

Return type:

float

  1. flux(self: scarabee._scarabee.FDDiffusionDriver, i: typing.SupportsInt, j: typing.SupportsInt, k: typing.SupportsInt, g: typing.SupportsInt) -> float

Returns the scalar flux in group g and region (i, j, k).

Parameters:
  • i (int) – Region index along x axis.

  • j (int) – Region index along y axis.

  • k (int) – Region index along z axis.

  • g (int) – Energy group index.

Returns:

Flux in region (i, j, k) and in group g.

Return type:

float

  1. flux(self: scarabee._scarabee.FDDiffusionDriver) -> tuple[numpy.ndarray[numpy.float64], numpy.ndarray[numpy.float64], numpy.ndarray[numpy.float64] | None, numpy.ndarray[numpy.float64] | None]

Returns the computed flux, along with the mesh bounds. The first dimension of the flux array is the energy group index. The second index is for the x coordinate. If the problem is 2 or 3 dimensional, the third and fourth indices are for the y and z coordinates respectively.

Returns:

  • flux (ndarray) – 2D, 3D, or 4D array containing the multigroup flux.

  • x_bounds (ndarray) – 1D array with the x-bounds for the flux mesh.

  • y_bounds (ndarray or None) – 1D array with the y-bounds for the flux mesh, if a 2D problem.

  • z_bounds (ndarray or None) – 1D array with the z-bounds for the flux mesh, if a 3D problem.

property flux_tolerance#

Maximum relative error in the flux for problem convergence.

property geometry#

The DiffusionGeometry geometry for the problem.

property keff#

Value of keff. This is 1 by default is solved is False.

property keff_tolerance#

Maximum relative error in keff for problem convergence.

static load(fname: str) scarabee._scarabee.FDDiffusionDriver#

Loads a previously save FDDiffusionDriver from a binary file.

Parameters:

fname (str) – Name of the file.

Return type:

FDDiffusionDriver

property ngroups#

Number of energy groups.

power(self: scarabee._scarabee.FDDiffusionDriver) tuple[numpy.ndarray[numpy.float64], numpy.ndarray[numpy.float64], numpy.ndarray[numpy.float64] | None, numpy.ndarray[numpy.float64] | None]#

Returns the computed power distribution, along with the mesh bounds. The first dimension of the power array is for the x coordinate. If the problem is 2 or 3 dimensional, the second and third indices are for the y and z coordinates respectively.

Returns:

  • power (ndarray) – 1D, 2D, or 3D array containing the power distribution.

  • x_bounds (ndarray) – 1D array with the x-bounds for the power mesh.

  • y_bounds (ndarray or None) – 1D array with the y-bounds for the power mesh, if a 2D problem.

  • z_bounds (ndarray or None) – 1D array with the z-bounds for the power mesh, if a 3D problem.

save(self: scarabee._scarabee.FDDiffusionDriver, fname: str) None#

Saves the FDDiffusionDriver to a binary file.

Parameters:

fname (str) – Name of the file.

set_extern_src(*args, **kwargs)#

Overloaded function.

  1. set_extern_src(self: scarabee._scarabee.FDDiffusionDriver, i: typing.SupportsInt, g: typing.SupportsInt, src: typing.SupportsFloat) -> None

Sets the external source in group g and region i.

Parameters:
  • i (int) – Region index along x axis.

  • g (int) – Energy group index.

  • src (float) – Value of source.

  1. set_extern_src(self: scarabee._scarabee.FDDiffusionDriver, i: typing.SupportsInt, j: typing.SupportsInt, g: typing.SupportsInt, src: typing.SupportsFloat) -> None

Sets the external source in group g and region (i, j).

Parameters:
  • i (int) – Region index along x axis.

  • j (int) – Region index along y axis.

  • g (int) – Energy group index.

  • src (float) – Value of source.

  1. set_extern_src(self: scarabee._scarabee.FDDiffusionDriver, i: typing.SupportsInt, j: typing.SupportsInt, k: typing.SupportsInt, g: typing.SupportsInt, src: typing.SupportsFloat) -> None

Sets the external source in group g and region (i, j, k).

Parameters:
  • i (int) – Region index along x axis.

  • j (int) – Region index along y axis.

  • k (int) – Region index along z axis.

  • g (int) – Energy group index.

  • src (float) – Value of source.

property sim_mode#

SimulationMode describing type of simulation (fixed-source or keff).

solve(self: scarabee._scarabee.FDDiffusionDriver) None#

Solves the diffusion problem.

property solved#

True if the problem has been solved, False otherwise.

class scarabee.NEMDiffusionDriver#

A NEMDiffusionDriver solves a diffusion problem using the nodal expansion method. It is capable of solving 3D problems which are defined by providing a DiffusionGeometry instance.

__init__(self: scarabee._scarabee.NEMDiffusionDriver, arg0: scarabee._scarabee.DiffusionGeometry) None#

Initializes a nodal diffusion solver.

Parameters:

geom (DiffusionGeometry) – Problem deffinition to solve.

avg_flux(self: scarabee._scarabee.NEMDiffusionDriver) numpy.ndarray[numpy.float64]#

Constructs an array storing the value of the average flux in each node. The resulting array is indexed as (g, x, y, z).

Returns:

Value of the average flux in each node.

Return type:

array of float

avg_power(self: scarabee._scarabee.NEMDiffusionDriver) numpy.ndarray[numpy.float64]#

Constructs an array storing the value of the average power density in each node. The resulting array is indexed as (x, y, z).

Returns:

Value of the average power density in each node.

Return type:

array of float

flux(*args, **kwargs)#

Overloaded function.

  1. flux(self: scarabee._scarabee.NEMDiffusionDriver, x: typing.SupportsFloat, y: typing.SupportsFloat, z: typing.SupportsFloat, g: typing.SupportsInt) -> float

Calculates the flux at the desired position and group. The lowest value for any coordinate is 0.

Parameters:
  • x (float) – Position along the x axis.

  • y (float) – Position along the y axis.

  • z (float) – Position along the z axis.

  • g (ing) – Energy group index.

Returns:

Value of the flux.

Return type:

float

  1. flux(self: scarabee._scarabee.NEMDiffusionDriver, x: numpy.ndarray[numpy.float64], y: numpy.ndarray[numpy.float64], z: numpy.ndarray[numpy.float64]) -> numpy.ndarray[numpy.float64]

Constructs an array storing the flux at all desired (x,y,z) points and at all energy groups. The first index is the group, the second is x, the third is y, and the fourth is z.

Parameters:
  • x (array of float) – Positions along the x axis.

  • y (array of float) – Positions along the y axis.

  • z (array of float) – Positions along the z axis.

Returns:

Value of the flux at all (g,x,y,z).

Return type:

array of float

property flux_tolerance#

Maximum relative error in the flux for problem convergence.

property geometry#

The DiffusionGeometry geometry for the problem.

property keff#

Value of keff. This is 1 by default is solved is False.

property keff_tolerance#

Maximum relative error in keff for problem convergence.

static load(fname: str) scarabee._scarabee.NEMDiffusionDriver#

Loads a previously save NEMDiffusionDriver from a binary file.

Parameters:

fname (str) – Name of the file.

Return type:

NEMDiffusionDriver

property ngroups#

Number of energy groups.

pin_power(self: scarabee._scarabee.NEMDiffusionDriver, z: numpy.ndarray[numpy.float64]) tuple[numpy.ndarray[numpy.float64], numpy.ndarray[numpy.float64], numpy.ndarray[numpy.float64]]#

Constructs an array storing the pin powers reconstructed on a provided axial mesh.

Parameters:

z (array of float) – Positions along the z axis.

Returns:

Value of pin powers at all provided z positions.

Return type:

array of float

power(*args, **kwargs)#

Overloaded function.

  1. power(self: scarabee._scarabee.NEMDiffusionDriver, x: typing.SupportsFloat, y: typing.SupportsFloat, z: typing.SupportsFloat) -> float

Calculates the power density at the desired position. The lowest value for any coordinate is 0.

Parameters:
  • x (float) – Position along the x axis.

  • y (float) – Position along the y axis.

  • z (float) – Position along the z axis.

Returns:

Value of the power density.

Return type:

float

  1. power(self: scarabee._scarabee.NEMDiffusionDriver, x: numpy.ndarray[numpy.float64], y: numpy.ndarray[numpy.float64], z: numpy.ndarray[numpy.float64]) -> numpy.ndarray[numpy.float64]

Constructs an array storing the power density at all desired (x,y,z) points. The first index is x, the second is y, and the third is z.

Parameters:
  • x (array of float) – Positions along the x axis.

  • y (array of float) – Positions along the y axis.

  • z (array of float) – Positions along the z axis.

Returns:

Value of the power density at all (x,y,z).

Return type:

array of float

save(self: scarabee._scarabee.NEMDiffusionDriver, fname: str) None#

Saves the NEMDiffusionDriver to a binary file.

Parameters:

fname (str) – Name of the file.

solve(self: scarabee._scarabee.NEMDiffusionDriver) None#

Solves the diffusion problem.

property solved#

True if the problem has been solved, False otherwise.