PODReducedBasisSurrogate

Evaluates POD-RB surrogate model with reduced operators computed from PODReducedBasisTrainer.

Overview

This surrogate takes the reduced operators and bases from PODReducedBasisTrainer and assembles the reduced equation system for a new parameter sample (μ\boldsymbol{\mu^* }):

(i=1NAfiA(μ)Air)c(μ)=i=1Nbfib(μ)bir.\left(\sum \limits_{i=1}^{N_A} f^A_i(\boldsymbol{\mu^* })\textbf{A}_i^r\right)\textbf{c}(\boldsymbol{\mu^* }) = \sum \limits_{i=1}^{N_b} f^b_i(\boldsymbol{\mu^* })\textbf{b}_i^r.(1)

Following this, the reduced equation system is solved for c(μ)\textbf{c}(\boldsymbol{\mu^* }) and an approximate solution is reconstructed as

u(μ)Φc(μ).\textbf{u}(\boldsymbol{\mu}) \approx \boldsymbol{\Phi}\textbf{c}(\boldsymbol{\mu}).(2)

It must be mentioned that in case of Dirichlet boundary conditions (either nodal or in weak form) there is a contribution in ADirr\textbf{A}_{Dir}^r and bDirr\textbf{b}_{Dir}^r as well. However, in this case a penalty parameter (γ\gamma) is used to enforce the boundary condition at reduced order level. Therefore, the slightly modified equation system can be written as:

(i=1NA1fiA(μ)Air+γfDirA(μ)ADirr)c(μ)=i=1Nb1fib(μ)bir+γfDirb(μ)bDirr.\left(\sum \limits_{i=1}^{N_A-1} f^A_i(\boldsymbol{\mu^* })\textbf{A}_i^r+\gamma f^A_{Dir}(\boldsymbol{\mu^* })\textbf{A}_{Dir}^r\right)\textbf{c}(\boldsymbol{\mu^* }) = \sum \limits_{i=1}^{N_b-1} f^b_i(\boldsymbol{\mu^* })\textbf{b}_i^r+\gamma f^b_{Dir}(\boldsymbol{\mu^* })\textbf{b}_{Dir}^r.(3)

the magnitude of γ\gamma can be set using the "penalty" parameter in the input file. It is important to note that by increasing the magnitude of γ\gamma, the condition number of the reduced equation may deteriorate, therefore the overly high values are not recommended.

It is important to mention that the size of the reduced system can be modified by changing the number of bases per variable in the input file. To do this one can use "change_rank" and "new_ranks" input parameters. This feature makes it possible to test the accuracy of the surrogate with different subspace sizes without the need of rerunning the training procedure.

Details of implementation

The approximate solution given by the POD-RB surrogate can be reconstructed using two different approaches. Both approaches are implemented by overloading the evaluateSolution function:

  1. One can call evaluateSolution with a simple parameter sample as an input argument:

    /// Get the reduced solution for a given parameter sample.
    void evaluateSolution(const std::vector<Real> & params);
    (contrib/moose/modules/stochastic_tools/include/surrogates/PODReducedBasisSurrogate.h)

    In this case, the approximate solution vectors are reconstructed and stored within the surrogate object and the QoI-s for a given variable can be acquired using the getNodalQoI function. A good example for this approach is the implementation of the execute function in (contrib/moose/modules/stochastic_tools/test/src/vectorpostprocessors/PODSurrogateTester.C).

    PODSurrogateTester::execute()
    {
      unsigned int n_models = _model.size();
      unsigned int n_pp = _to_compute.size();
    
      // Loop over samples
      for (dof_id_type p = _sampler.getLocalRowBegin(); p < _sampler.getLocalRowEnd(); ++p)
      {
        std::vector<Real> data = _sampler.getNextLocalRow();
    
        for (unsigned int m = 0; m < n_models; ++m)
        {
          _model[m]->evaluateSolution(data);
          for (unsigned int ppi = 0; ppi < n_pp; ++ppi)
          {
            unsigned int idx = m * n_pp + ppi;
            (*_value_vector[idx])[p - _sampler.getLocalRowBegin()] =
                _model[m]->getNodalQoI(_variable_name, _to_compute.get(ppi));
          }
        }
    
        if (_output_samples)
          for (unsigned int d = 0; d < _sampler.getNumberOfCols(); ++d)
          {
            (*_sample_vector[d])[p - _sampler.getLocalRowBegin()] = data[d];
          }
      }
    }
    (contrib/moose/modules/stochastic_tools/test/src/vectorpostprocessors/PODSurrogateTester.C)

  2. The second option is to supply a reference to an external vector to evaluateSolution together with a variable name:

    /// Get the reduced solution for a given parameter sample and reconstruct the
    /// approximate solution into a given vector.
    void evaluateSolution(const std::vector<Real> & params,
                          DenseVector<Real> & inp_vector,
                          std::string var_name);
    (contrib/moose/modules/stochastic_tools/include/surrogates/PODReducedBasisSurrogate.h)

    In this case, the surrogate will try to reconstruct the approximate solution for the given variable into this vector. This option can be used to couple POD-RB surrogates to other, full-order objects.

Example Input File Syntax

To create a POD reduced basis surrogate model, one can use the following syntax:

[Surrogates]
  [rbpod]
    type = PODReducedBasisSurrogate
    filename = 'trainer_out_pod_rb.rd'
  []
[]
(contrib/moose/modules/stochastic_tools/test/tests/surrogates/pod_rb/internal/surr.i)

It is visible that the reduced operators and basis vectors from PODReducedBasisTrainer have been saved to trainer_out_pod_rb.rd and the surrogate model is constructed by loading the necessary information from it. For the sampling of the uncertain parameters, the same objects can be used in the Samplers block:

[Samplers]
  [sample]
    type = LatinHypercube
    distributions = 'k_dist alpha_dist S_dist'
    num_rows = 10
    execute_on = PRE_MULTIAPP_SETUP
    seed = 17
  []
[]
(contrib/moose/modules/stochastic_tools/test/tests/surrogates/pod_rb/internal/surr.i)

Finally, a vector postprocessor of type PODSurrogateTester is created to extract the approximate value of the nodal maximum of variable u in this case:

[VectorPostprocessors]
  [res]
    type = PODSurrogateTester
    model = rbpod
    sampler = sample
    variable_name = "u"
    to_compute = nodal_max
  []
[]
(contrib/moose/modules/stochastic_tools/test/tests/surrogates/pod_rb/internal/surr.i)

Input Parameters

  • change_rankNames of variables whose rank should be changed.

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

    Unit:(no unit assumed)

    Controllable:No

    Description:Names of variables whose rank should be changed.

  • 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.

  • new_ranksThe new ranks that each variable in 'change_rank' shall have.

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

    Unit:(no unit assumed)

    Controllable:No

    Description:The new ranks that each variable in 'change_rank' shall have.

  • penalty100000The penalty parameter for Dirichlet BCs.

    Default:100000

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:The penalty parameter for Dirichlet BCs.

  • trainerThe SurrogateTrainer object. If this is specified the trainer data is automatically gathered and available in this SurrogateModel object.

    C++ Type:UserObjectName

    Unit:(no unit assumed)

    Controllable:No

    Description:The SurrogateTrainer object. If this is specified the trainer data is automatically gathered and available in this SurrogateModel object.

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