pyopensn.math.AngularFluxFunction

class pyopensn.math.AngularFluxFunction

Angular flux function.

Functions that accept a group index and a direction index and return the incoming angular flux value for that (group, direction) pair.

Wrapper of opensn::AngularFluxFunction.

Examples

>>> # Create from a Python function
>>> def incident_flux(group, direction):
...     return 1.0 if group == 0 else 0.0
>>> f = AngularFluxFunction(incident_flux)
>>>
>>> # Create from lambda
>>> g = AngularFluxFunction(lambda g, n: 0.5 * (g + n))
>>>
>>> # Evaluate
>>> f(0, 3)
1.0
>>> g(1, 2)
1.5
__call__(self: pyopensn.math.AngularFluxFunction, group: int, direction: int) float

Evaluate the associated angular flux function.

Parameters:
  • group (int) – Energy group index.

  • direction (int) – Direction index in the angular quadrature.

__init__(self: pyopensn.math.AngularFluxFunction, func: Callable[[int, int], float]) None

Construct an angular flux function from a Python function or lambda.

Parameters:

func (Callable[[int, int], float]) – Referenced angular flux function. The first argument is the energy group index. The second argument is the direction index in the angular quadrature for the groupset.