pararealml.operators package

Submodules

pararealml.operators.symbol_mapper module

class pararealml.operators.symbol_mapper.SymbolMapper(diff_eq: pararealml.differential_equation.DifferentialEquation)[source]

Bases: abc.ABC, typing.Generic

A class for mapping symbolic differential equation to numerical values.

create_rhs_map_function(indices: Sequence[int]) → Callable[[SymbolMapArg], Sequence[SymbolMapValue]][source]

Creates a function for evaluating the right-hand sides of the equations denoted by the provided indices.

Parameters:indices – the indices of the equations within the differential equation system whose evaluation function is to be created
Returns:a function that returns the numerical value of the right-hand sides given a substitution argument
create_symbol_map() → Dict[sympy.core.symbol.Symbol, Callable[[SymbolMapArg], SymbolMapValue]][source]

Creates a dictionary linking the symbols present in the differential equation instance associated with the symbol mapper to a set of functions used to map the symbols to numerical values.

map(arg: SymbolMapArg, lhs_type: Optional[pararealml.differential_equation.Lhs] = None) → Sequence[SymbolMapValue][source]

Evaluates the right-hand side of the differential equation system given the map argument.

Parameters:
  • arg – the map argument that the numerical values of the right-hand sides depend on
  • lhs_type – the left-hand type of the equations whose right-hand sides are to be evaluated; if None, the whole differential equation system’s right-hand side is evaluated
Returns:

the numerical value of the right-hand side of the differential equation as a sequence of map values where each element corresponds to an equation within the system

t_map_function() → Callable[[SymbolMapArg], SymbolMapValue][source]

Returns a function for mapping t to a numerical value.

x_map_function(x_axis: int) → Callable[[SymbolMapArg], SymbolMapValue][source]

Returns a function for mapping a component of x to a numerical value.

Parameters:x_axis – the component of x to return a map for
Returns:the mapper function for x
y_curl_map_function(y_indices: Sequence[int], indices_contiguous: Union[bool, numpy.bool_], curl_ind: int) → Callable[[SymbolMapArg], SymbolMapValue][source]

Returns a function for mapping the curl of a set of components of y to a numerical value.

Parameters:
  • y_indices – the components of y whose curl to return a map for
  • indices_contiguous – whether the indices are contiguous
  • curl_ind – the index of the component of the curl to map
Returns:

the mapper function for the curl of y

y_divergence_map_function(y_indices: Sequence[int], indices_contiguous: Union[bool, numpy.bool_]) → Callable[[SymbolMapArg], SymbolMapValue][source]

Returns a function for mapping the divergence of a set of components of y to a numerical value.

Parameters:
  • y_indices – the components of y whose divergence to return a map for
  • indices_contiguous – whether the indices are contiguous
Returns:

the mapper function for the divergence of y

y_gradient_map_function(y_ind: int, x_axis: int) → Callable[[SymbolMapArg], SymbolMapValue][source]

Returns a function for mapping a component of the gradient of y to a numerical value.

Parameters:
  • y_ind – the component of y whose gradient to return a map for
  • x_axis – the x-axis denoting the element of the gradient to return a map for
Returns:

the mapper function for the gradient of y

y_hessian_map_function(y_ind: int, x_axis1: int, x_axis2: int) → Callable[[SymbolMapArg], SymbolMapValue][source]

Returns a function for mapping a component of the Hessian of y to a numerical value.

Parameters:
  • y_ind – the component of y whose Hessian to return a map for
  • x_axis1 – the first x-axis denoting the element of the gradient to return a map for
  • x_axis2 – the second x-axis denoting the element of the gradient to return a map for
Returns:

the mapper function for the Hessian of y

y_laplacian_map_function(y_ind: int) → Callable[[SymbolMapArg], SymbolMapValue][source]

Returns a function for mapping a component of the element-wise scalar Laplacian of y to a numerical value.

Parameters:y_ind – the component of y whose Laplacian to return a mp for
Returns:the mapper function for the Laplacian of y
y_map_function(y_ind: int) → Callable[[SymbolMapArg], SymbolMapValue][source]

Returns a function for mapping a component of y to a numerical value.

Parameters:y_ind – the component of y to return a map for
Returns:the mapper function for y
y_vector_laplacian_map_function(y_indices: Sequence[int], indices_contiguous: Union[bool, numpy.bool_], vector_laplacian_ind: int) → Callable[[SymbolMapArg], SymbolMapValue][source]

Returns a function for mapping the vector Laplacian of a set of components of y to a numerical value.

Parameters:
  • y_indices – the components of y whose vector Laplacian to return a map for
  • indices_contiguous – whether the indices are contiguous
  • vector_laplacian_ind – the index of the component of the vector Laplacian to map
Returns:

the mapper function for the vector Laplacian of y

Module contents