PODMapping

Class which provides a Proper Orthogonal Decomposition-based mapping between full-order and reduced-order spaces.

Overview

A mapping which uses a Proper Orthogonal Decomposition (POD) to establish mapping between (high-dimensional) solution vectors coming from numerical simulations and corresponding coefficients in lower-dimensional spaces (latent spaces). For the use cases in MOOSE, this method is equivalent to linear Principal Component Analysis (PCA) or Singular Value Decomposition (SVD).

The process for building the mapping is the following:

  1. Collection of snapshots of the solution fields. This can be done by running the full-order models with different model parameters and saving the solution fields along the simulations. This process is established in SolutionContainer, SerializedSolutionTransfer and ParallelSolutionStorage.

  2. Once the snapshots are at our disposal, we organize them into a snapshot matrix (S\boldsymbol{S}) as follows:

    Sv=[sv,μ1,t1 sv,μ1,t2 sv,μ1,t3 ... sv,μ1,tNTμ1 sv,μ2,t1 sv,μ2,t2 ... sv,μNμ,tN1 sv,μNμ,tNTμNμ] ,\boldsymbol{S}_{v} = \left[\boldsymbol{s}_{v,\mu_1,t_1}~\boldsymbol{s}_{v,\mu_1,t_2}~\boldsymbol{s}_{v,\mu_1,t_3}~ ... ~\boldsymbol{s}_{v,\mu_1,t_{N_{T_{\mu_1}}}}~ \boldsymbol{s}_{v,\mu_2,t_1}~ \boldsymbol{s}_{v,\mu_2,t_2}~ ...~ \boldsymbol{s}_{v,\mu_{N_\mu},t_{N-1}}~ \boldsymbol{s}_{v,\mu_{N_\mu},t_{N_{T_{\mu_{N_\mu}}}}} \right]~,(1)

    where NμN_\mu is the number of different model parameter samples, NTμiN_{T_{\mu_i}} is the number of snapshots per transient simulation with parameter sample μi\mu_i, while sv,μi,tj\boldsymbol{s}_{v,\mu_i,t_j} denotes the solution vector for variable vv with parameter sample μi\mu_i at time step tjt_j. Note that the number of time steps might depend on the model parameters. The current implementation supports variable-based POD only.

  3. As the next step, we extract the common features in the snapshots. In other words, we compute the POD or SVD of the snapshot matrix:

    Sv=UvΣvVvT ,\boldsymbol{S}_v = \boldsymbol{U}_v \boldsymbol{\Sigma}_v \boldsymbol{V}_v^T~,(2)

    where U\boldsymbol{U} and V\boldsymbol{V} are the unitary left and right singular vector matrices, respectively. Matrix Σ\boldsymbol{\Sigma} contains the singular values on its diagonal. Given that the size of the snapshot matrix is high, we use the parallel SVD solver available in SLEPc with a Lánczos method to solve the underlying eigenvalue problem and get only the requested number of singular values. Additional parameters for SLEPc to fine tune the solution algorithm can be supplied using input parameter "extra_slepc_options".

    The number of needed singular triplets (uv,i,σv,i,vv,i\boldsymbol{u}_{v,i}, \sigma_{v,i}, \boldsymbol{v}_{v,i}) for each variable can be prescribed using the "num_modes_to_compute" parameter. The algorithm will select the minimum of these numbers and the number of converged singular triplets. Let's denote these numbers by rvr_v.

    For this mapping object the transition from high-dimensional to low-dimensional and back is determined by the left singular vector computed in the decomposition. We assume that the solution vector (sv\boldsymbol{s}_v) of the system for variable vv can be approximated as

    svUvcv ,\boldsymbol{s}_v \approx \boldsymbol{U}_v \boldsymbol{c}_v~,(3)

    where vector cv\boldsymbol{c}_v contains the reduced-order coefficients (or coordinates in the latent) space in the low-dimensional space. Considering that the left singular vector vector matrix is unitary, we can express the mapping from high to low dimensional spaces as:

    cv=UvTsv .\boldsymbol{c}_v = \boldsymbol{U}^T_v \boldsymbol{s}_v~.(4)

  4. The last step in this process consists of filtering out singular triplets which do not contribute to the description of variation in the variable fields. For this, we utilize the singular values as follows:

    keep basis vector I,if(1i=1Iσv,i2i=1rvσv,i2)<τvdiscard,otherwise.\begin{array}{lr} \text{keep basis vector $I$}, & \text{if\quad} \left(1 - \frac{\sum\limits_{i=1}^{I} \sigma^2_{v,i}}{\sum\limits_{i=1}^{r_v} \sigma_{v,i}^2}\right) < \tau_v\\ & \\ \text{discard}, & \text{otherwise.} \end{array}(5)

    The filtering parameter τv\tau_v van be specified for every variable using input parameter "energy_threshold".

Once a mapping is trained, one can save it into a binary file using MappingOutput and load it by specifying the "filename" parameter in the object.

warningwarning

This object is only compatible with PETSc versions above 3.14 with SLEPc support.

Example Input File Syntax

Creating a mapping object:

[VariableMappings]
  [pod_mapping]
    type = PODMapping
    solution_storage = parallel_storage
    variables = "v"
    num_modes_to_compute = '2'
    extra_slepc_options = "-svd_monitor_all"
  []
[]
(contrib/moose/modules/stochastic_tools/test/tests/variablemappings/pod_mapping/pod_mapping_main.i)

Loading a mapping object:

[VariableMappings]
  [pod]
    type = PODMapping
    filename = "create_mapping_main_mapping_pod_mapping.rd"
    num_modes_to_compute = 2
  []
[]
(contrib/moose/modules/stochastic_tools/test/tests/userobjects/inverse_mapping/inverse_map.i)

Syntax

Input Parameters

  • energy_thresholdThe energy threshold for the automatic truncation of the number of modes. In general, the lower this number is the more information is retained about the system by keeping more POD modes.

    C++ Type:std::vector<double>

    Unit:(no unit assumed)

    Controllable:No

    Description:The energy threshold for the automatic truncation of the number of modes. In general, the lower this number is the more information is retained about the system by keeping more POD modes.

  • extra_slepc_optionsAdditional options for the singular/eigenvalue solvers in SLEPc.

    C++ Type:std::string

    Unit:(no unit assumed)

    Controllable:No

    Description:Additional options for the singular/eigenvalue solvers in SLEPc.

  • filenameThe name of the file which will be associated with the saved/loaded data.

    C++ Type:FileName

    Unit:(no unit assumed)

    Controllable:No

    Description:The name of the file which will be associated with the saved/loaded data.

  • num_modes_to_computeThe number of modes that this object should compute. Modes with 0 eigenvalues are filtered out, so the real number of modes might be lower than this. This is also used for setting the subspace sizes for distributed singular value solves. By default, the subspace used for the SVD is twice as big as the number of requested vectors. For more information see the SLEPc manual. If not specified, only one mode is computed per variable.

    C++ Type:std::vector<unsigned long>

    Unit:(no unit assumed)

    Controllable:No

    Description:The number of modes that this object should compute. Modes with 0 eigenvalues are filtered out, so the real number of modes might be lower than this. This is also used for setting the subspace sizes for distributed singular value solves. By default, the subspace used for the SVD is twice as big as the number of requested vectors. For more information see the SLEPc manual. If not specified, only one mode is computed per variable.

  • solution_storageThe name of the storage reporter where the snapshots are located.

    C++ Type:UserObjectName

    Unit:(no unit assumed)

    Controllable:No

    Description:The name of the storage reporter where the snapshots are located.

  • variablesThe names of the variables which need a mapping.

    C++ Type:std::vector<VariableName>

    Unit:(no unit assumed)

    Controllable:No

    Description:The names of the variables which need a mapping.

Optional Parameters

  • control_tagsAdds user-defined labels for accessing object parameters via control logic.

    C++ Type:std::vector<std::string>

    Unit:(no unit assumed)

    Controllable:No

    Description:Adds user-defined labels for accessing object parameters via control logic.

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Unit:(no unit assumed)

    Controllable:No

    Description:Set the enabled status of the MooseObject.

Advanced Parameters