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 Real getNodalQoI(std::string var_name, unsigned int qoi_type) const;
35
36protected:
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
83 DenseMatrix<Real> _sys_mx;
84
86 DenseVector<Real> _rhs;
87
89 std::vector<DenseVector<Real>> _approx_solution;
90
92 const Real _penalty;
93
96};
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.
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.