https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
16public:
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 bool isReady() const;
35
37 Real getNodalQoI(std::string var_name, unsigned int qoi_type) const;
38
39protected:
42
45
47 void solveReducedSystem(const std::vector<Real> & params);
48
52
54 void reconstructApproximateSolution(DenseVector<Real> & inp_vector, std::string var_name);
55
58 std::vector<std::string> _change_rank;
59
61 std::vector<unsigned int> _new_ranks;
62
64 std::vector<unsigned int> _final_ranks;
65
67 std::vector<unsigned int> _comulative_ranks;
68
70 const std::vector<std::string> & _var_names;
71
74 const std::vector<std::string> & _tag_types;
75
77 const std::vector<std::vector<DenseVector<Real>>> & _base;
78
80 const std::vector<DenseMatrix<Real>> & _red_operators;
81
83 DenseVector<Real> _coeffs;
84
86 DenseMatrix<Real> _sys_mx;
87
89 DenseVector<Real> _rhs;
90
92 std::vector<DenseVector<Real>> _approx_solution;
93
95 const Real _penalty;
96
99};
const InputParameters & parameters() const
Real getNodalQoI(std::string var_name, unsigned int qoi_type) const
Get the nodal QoI of the reconstructed solution for a given variable.
void reconstructApproximateSolution()
Reconstruct the approximate solution vector using the stored coefficients.
void solveReducedSystem(const std::vector< Real > &params)
Assemble and solve the reduced equation system.
void initializeReducedSystem()
Initialize reduced matrices, vectors and additional containers.
const Real _penalty
Penalty parameter for Dirichlet BCs.
std::vector< unsigned int > _comulative_ranks
Comulative ranks of the system. Used for indexing only.
const std::vector< DenseVector< Real > > & getApproximateSolution() const
Get a reference to the approximate solutions.
static InputParameters validParams()
std::vector< unsigned int > _new_ranks
The new rank the variable should have.
std::vector< DenseVector< Real > > _approx_solution
Reconstructed solution for each variable.
void initializeApproximateSolution()
Initialize approximate solution vector.
bool isReady() const
Whether the basis vectors and reduced operators are ready for evaluation.
const std::vector< std::vector< DenseVector< Real > > > & _base
The basis vectors for all the variables.
std::vector< std::string > _change_rank
A vector containing the number of basis functions each variable should use.
bool _initialized
Switch that is set to see if the ROM matrices and vectors are initialized.
void evaluateSolution(const std::vector< Real > &params)
Get the reduced solution for a given parameter sample.
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< DenseMatrix< Real > > & _red_operators
The reduced operators in the same order as given in tag_types.
DenseVector< Real > _rhs
The reduced right hand side.
DenseMatrix< Real > _sys_mx
The reduced system matrix.
std::vector< unsigned int > _final_ranks
The final rank that should be used for every variable.
DenseVector< Real > _coeffs
Coefficients of the reduced order model.
const std::vector< std::string > & _var_names
Vector containing the names of the variables we want to reconstruct.