https://mooseframework.inl.gov
PODReducedBasisSurrogate.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "SurrogateModel.h"
13 
15 {
16 public:
18 
20 
22  void evaluateSolution(const std::vector<Real> & params);
23 
26  void evaluateSolution(const std::vector<Real> & params,
27  DenseVector<Real> & inp_vector,
28  std::string var_name);
29 
31  const std::vector<DenseVector<Real>> & getApproximateSolution() const { return _approx_solution; }
32 
34  Real getNodalQoI(std::string var_name, unsigned int qoi_type) const;
35 
36 protected:
39 
42 
44  void solveReducedSystem(const std::vector<Real> & params);
45 
49 
51  void reconstructApproximateSolution(DenseVector<Real> & inp_vector, std::string var_name);
52 
55  std::vector<std::string> _change_rank;
56 
58  std::vector<unsigned int> _new_ranks;
59 
61  std::vector<unsigned int> _final_ranks;
62 
64  std::vector<unsigned int> _comulative_ranks;
65 
67  const std::vector<std::string> & _var_names;
68 
71  const std::vector<std::string> & _tag_types;
72 
74  const std::vector<std::vector<DenseVector<Real>>> & _base;
75 
77  const std::vector<DenseMatrix<Real>> & _red_operators;
78 
80  DenseVector<Real> _coeffs;
81 
84 
86  DenseVector<Real> _rhs;
87 
89  std::vector<DenseVector<Real>> _approx_solution;
90 
92  const Real _penalty;
93 
96 };
PODReducedBasisSurrogate(const InputParameters &parameters)
std::vector< DenseVector< Real > > _approx_solution
Reconstructed solution for each variable.
void reconstructApproximateSolution()
Reconstruct the approximate solution vector using the stored coefficients.
Real getNodalQoI(std::string var_name, unsigned int qoi_type) const
Get the nodal QoI of the reconstructed solution for a given variable.
DenseVector< Real > _rhs
The reduced right hand side.
const Real _penalty
Penalty parameter for Dirichlet BCs.
const std::vector< DenseVector< Real > > & getApproximateSolution() const
Get a reference to the approximate solutions.
std::vector< unsigned int > _final_ranks
The final rank that should be used for every variable.
const std::vector< std::string > & _tag_types
Strings describing which operator is indepedent of the solution and which corresponds to a reduced Di...
const std::vector< std::vector< DenseVector< Real > > > & _base
The basis vectors for all the variables.
const std::vector< DenseMatrix< Real > > & _red_operators
The reduced operators in the same order as given in tag_types.
DenseMatrix< Real > _sys_mx
The reduced system matrix.
void evaluateSolution(const std::vector< Real > &params)
Get the reduced solution for a given parameter sample.
const std::vector< std::string > & _var_names
Vector containing the names of the variables we want to reconstruct.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void initializeApproximateSolution()
Initialize approximate solution vector.
DenseVector< Real > _coeffs
Coefficients of the reduced order model.
bool _initialized
Switch that is set to see if the ROM matrices and vectors are initialized.
const InputParameters & parameters() const
void initializeReducedSystem()
Initialize reduced matrices, vectors and additional containers.
void solveReducedSystem(const std::vector< Real > &params)
Assemble and solve the reduced equation system.
std::vector< std::string > _change_rank
A vector containing the number of basis functions each variable should use.
std::vector< unsigned int > _new_ranks
The new rank the variable should have.
static InputParameters validParams()
std::vector< unsigned int > _comulative_ranks
Comulative ranks of the system. Used for indexing only.