# Functional Expansion Tools

A MOOSE module for continuous, mesh-agnostic, high-fidelity, reduced-data MultiApp coupling

## Description

Functional expansions (FXs) are a methodology that represent information as moments of a functional series (Flusser et al., 2016). This is is related to a Fourier series representation of cyclic data. Moments are generated via numerical integration for each term in the functional series to represent the field of interest. These moments can then be used to reconstruct the field in a separate app (Wendt et al., 2018; Wendt and Kerby, 2017; Kerby et al., 2017).

Currently there are two main flavors of FX coupling available: interface and volumetric.

note:Nomenclature

In other contexts FXs have been identified using the initialism 'FE'. However, since MOOSE is a finite-element (FE) code, the initialism 'FX' is used throughout this module to prevent confusion.

warning:Displaced meshes

This module should only be used with non-displaced meshes.

### Interface Coupling

Interface-based coupling provides for the coupling between physically distinct solutions that share a common interface. FXs can be used to extract value and/or flux conditions at a boundary in one app, then be transferred as boundary conditions to the coupled app. These coupled boundaries represent the common interface between the two solutions.

### Volumetric Coupling

Volumetric-based coupling provides for coupling between solutions that share the same space with coupled yet separate physics. The field in one app can be collapsed into an FX, then the moment values are transferred to the other app to be used in its solution.

## Using this module

Set either FUNCTIONAL_EXPANSION_TOOLS := yes (or ALL_MODULES := yes) in the application makefile. The following objects will then be available for use:

### AuxKernels

NameDescription
FunctionSeriesToAuxExpands an FX into the named AuxVariable before the initial nonlinear solve.

### BCs

NameDescription
FXFluxBCProvides a strongly encouraged FX-based Neumann boundary condition.
FXValueBCProvides a fixed FX-based Dirichlet boundary condition.
FXValuePenaltyBCProvides a strongly encouraged FX-based Dirichlet boundary condition.

### Functions

NameDescription
FunctionSeriesThe workhorse of the FX tools module. This evaluates the terms of a function series, used both for capturing moments and expanding an FX. All other FX-based objects will depend on a FunctionSeries instance.

### Kernels

Although there are no kernels directly provided by this module (yet), these three from the framework itself have varying degrees of usefulness:

NameDescription
BodyForceMay be used to couple a FunctionSeries object directly to a solution, instead of using FunctionSeriesToAux and CoupledForce. If the BodyForce approach is used it is highly recommended to set enable_cache = true for the associated FunctionSeries object.
CoupledForceCouples an AuxVariable or Variable to the solution of another Variable. Useful in conjunction with FunctionSeriesToAux.
NullKernelMay be required for use in situation where no Variables or Kernels are needed. This may occur, for example, in an app that uses only the recommended FunctionSeriesToAux+CoupledForce approach.

### Transfers

NameDescription
MultiAppFXTransferThis transfers the FX coefficients, or moments, between named FX objects in the multi and sub apps. Supported objects that contain coefficients for transferring are instances of FunctionSeries and any FX...UserObject.

### UserObjects

NameDescription
FXBoundaryFluxUserObjectCaptures the moments of an FX representing the flux at a boundary.
FXBoundaryValueUserObjectCaptures the moments of an FX representing the value at a boundary.
FXVolumeUserObjectCaptures the moments of an FX representing the field value over a volume.

## Examples

Please refer to the examples included with the module for how these objects can be used.

## Supported Functional Series

This module currently supports FXs based on the 1D Legendre and 2D Zernike polynomial series. From these can be constructed 1D, 2D, or 3D Cartesian basis sets (Legendre only), or 3D cylindrical (Legendre + Zernike) basis sets. Nonseparable series, i.e. with fully-convolved cross terms, are used in this implementation. Examples for selecting FXs are shown in FunctionSeries.

Additional functional series, polynomial or otherwise, can be added by inheriting from the SingleSeriesBasisInterface class (found in the utils/ folder). The composite series (currently the Cartesian and CylindricalDuo classes) will then need updated to support the newly-available series.

Additional composite series, such as may be suitable for spherical or shell data, can be implemented by inheriting from the CompositeSeriesBasisInterface. The FunctionSeries class will need updated to support the newly-available series.

## Caveats

1. FXs are not recommended for spanning spaces with discontinuities (Ellis, 2017). - One example would be a space containing two distinct materials with significantly different properties - Instead, using multiple FXs, each over its own region of continuity, is the recommended approach

2. Increasing the order of an FX does not always result in an improved representation. Numerical integration of the FX moment can yield large errors if not enough quadrature points are included (Griesheimer, 2005).

## References

1. Matthew Shawn Ellis. Methods for Including Multiphysics Feedback in Monte Carlo Reactor Physics Calculations. PhD thesis, Massachusetts Institute of Technology, 2017.[BibTeX]
2. Jan Flusser, Tomáš Suk, and Barbara Zitová. 2D & 3D image analysis by moments. John Wiley & Sons, Inc., 2016. ISBN 1119039355.[BibTeX]
3. David Patrick Griesheimer. Functional Expansion Tallies for Monte Carlo Simulations. PhD thesis, University of Michigan, 2005.[BibTeX]
4. Leslie Kerby, Aaron G Tumulak, Jaakko Leppänen, and Ville Valtavirta. Preliminary Serpent—MOOSE Coupling and Implementation of Functional Expansion Tallies in Serpent. In International Conference on Mathematics & Computational Methods Applied to Nuclear Science and Engineering (M&C 2017). 2017.[BibTeX]
5. Brycen Wendt and Leslie Kerby. Multiapp transfers in the moose framework based on functional expansions. Transactions of the American Nuclear Society, 117(1):735–738, October 2017.[BibTeX]
6. Brycen Wendt, April Novak, Leslie Kerby, and Paul Romano. Integration of functional expansion methodologies as a moose module. In PHYSOR 2018: Reactor Physics paving the way towards more efficient systems. April 2018.[BibTeX]

## TODO

• Investigate the implementation of using NearestPointBase approach to easily equip multiple FXs

• Implement a Materials-derived FX-based class that can provide continuous material properties

• Implement a Kernel-derived class, a la BodyForce, that automatically sets enable_cache = true for the associated FunctionSeries object

• Add an error check in MultiAppFXTransfer for multiple objects of the same name but different type, i.e. if there are both a Function and UserObject with the same name (or other object types as they are added)

• Implement support in MutableCoefficientsInterface for multiple sets of FX coefficients

• Implement support for various types of FX derivations - Separable series - Various orthonormalizations

• Add more functional series - Fourier - Annular Zernike (0 < r <= 1) - Shell (r = 1) for 3D cylindrical boundary conditions (Zernike-based?) - Spherical harmonics + spherical composite series

• Add check to ensure we are working in an undisplaced mesh context

## Objects, Actions, and Syntax

AuxKernels
• Functional Expansion Tools App
• FunctionSeriesToAuxAuxKernel to convert a functional expansion (Functions object, type = FunctionSeries) to an AuxVariable
BCs
• Functional Expansion Tools App
• FXFluxBCSets a flux boundary condition, evaluated using a FunctionSeries instance. This does not fix the flux, but rather 'strongly encourages' flux agreement by penalizing the differences through contributions to the residual.
• FXValueBCImposes a fixed value boundary condition, evaluated using a FunctionSeries instance.
• FXValuePenaltyBCSets a value boundary condition, evaluated using a FunctionSeries instance. This does not fix the value, but rather 'strongly encourages' value agreement by penalizing the differences through contributions to the residual.
Functions
• Functional Expansion Tools App
• FunctionSeriesThis function uses a convolution of functional series (functional expansion or FX) to create a 1D, 2D, or 3D function
Transfers
• Functional Expansion Tools App
• MultiAppFXTransferTransfers coefficient arrays between objects that are derived from MutableCoefficientsInterface; currently includes the following types: FunctionSeries, FXBoundaryUserObject, and FXVolumeUserObject
UserObjects
• Functional Expansion Tools App
• FXBoundaryFluxUserObjectGenerates an Functional Expansion representation for a boundary flux condition using a 'FunctionSeries'-type Function
• FXBoundaryValueUserObjectGenerates an Functional Expansion representation for a boundary value condition using a 'FunctionSeries'-type Function
• FXVolumeUserObjectGenerates an Functional Expansion representation of a variable value over a volume using a 'FunctionSeries'-type Function