12 #include "libmesh/utility.h" 16 #include "libmesh/parallel.h" 38 virtual void execute()
override;
48 const std::shared_ptr<DenseVector<Real>> & snapshot);
53 std::vector<DenseVector<Real>> & residual);
72 const DenseVector<Real> &
getBasisVector(
unsigned int var_i,
unsigned int base_i)
const;
75 const DenseVector<Real> &
getBasisVector(
unsigned int glob_i)
const;
120 std::vector<std::vector<DenseVector<Real>>> &
_base;
143 ReplicatedMesh & mesh,
144 std::unordered_map<
unsigned int, std::vector<std::shared_ptr<DenseVector<Real>>>> &
146 std::unordered_map<
unsigned int, std::vector<std::shared_ptr<DenseVector<Real>>>> &
150 std::tuple<
unsigned int,
unsigned int, std::shared_ptr<DenseVector<Real>>>> & vectors);
virtual void execute() override
void addToReducedOperator(unsigned int base_i, unsigned int tag_i, std::vector< DenseVector< Real >> &residual)
Adding the contribution of a residual to the reduced operators.
std::vector< std::vector< DenseVector< Real > > > & _base
The reduced basis for the variables.
virtual void initialSetup() override
PODReducedBasisTrainer(const InputParameters ¶meters)
std::vector< DenseMatrix< Real > > _eigenvectors
The eigenvectors of the correalation matrix for each variable.
void printEigenvalues()
Prints the eigenvalues of the correlation matrix for each variable.
void initReducedOperators()
Initializing the reduced operators.
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
void receiveObjects(ReplicatedMesh &mesh, std::unordered_map< unsigned int, std::vector< std::shared_ptr< DenseVector< Real >>>> &received_vectors, std::unordered_map< unsigned int, std::vector< std::shared_ptr< DenseVector< Real >>>> &local_vectors, processor_id_type, const std::vector< std::tuple< unsigned int, unsigned int, std::shared_ptr< DenseVector< Real >>>> &vectors)
Function that manipulates the received objects and computes the correlation matrices on the fly...
static InputParameters validParams()
void addSnapshot(unsigned int var_i, unsigned int glob_i, const std::shared_ptr< DenseVector< Real >> &snapshot)
Adding a snapshot for a variable.
virtual void finalize() override
std::vector< DistributedSnapshots > _snapshots
Distributed container for snapshots per variable.
uint8_t processor_id_type
bool _empty_operators
Flag describing if the reduced operators are empty or not.
virtual void initialize() override
std::vector< std::string > & _tag_types
list of bools describing which tag is indepedent of the solution.
const std::vector< std::string > & getTagNames() const
std::vector< DenseVector< Real > > _eigenvalues
The eigenvalues of the correalation matrix for each variable.
unsigned int getVariableIndex(unsigned int glob_i) const
Getting appropriate variable index for a global base index.
std::vector< DenseMatrix< Real > > _corr_mx
The correlation matrices for the variables.
std::vector< DenseMatrix< Real > > & _red_operators
The reduced operators that should be transferred to the surrogate.
unsigned int getSnapsSize(unsigned int var_i) const
Getting the snapshot size across all of the processors for a given variable with index var_i...
unsigned int determineNumberOfModes(Real error, const std::vector< Real > &inp_vec) const
Computes the number of bases necessary for a given error indicator.
bool _base_completed
Switch that tells if the object has already computed the necessary basis vectors. ...
StochasticTools::DistributedData< std::shared_ptr< DenseVector< Real > > > DistributedSnapshots
const std::vector< std::string > & getTagTypes() const
void computeEigenDecomposition()
Computes the eigen-decomposition of the stored correlation matrices.
const InputParameters & parameters() const
std::vector< std::string > & _tag_names
Names of the tags that should be used to fetch residuals from the MultiApp.
std::vector< std::string > & _var_names
Vector containing the names of the variables we want to use for constructing the surrogates.
unsigned int getBaseSize(unsigned int var_i) const
Getting the base size for variable with index v_ind.
std::vector< Real > _error_res
Energy limits that define how many basis functions will be kept for each variable.
This is the base trainer class whose main functionality is the API for declaring model data...
const std::vector< std::string > & getVarNames() const
unsigned int getSumBaseSize() const
Getting the overall base size, which is the sum of the individual bases.
void computeCorrelationMatrix()
Computes the correlation matrices using the snapshots.
const DenseVector< Real > & getBasisVector(unsigned int var_i, unsigned int base_i) const
Getting a basis vector for a given variable.
void computeBasisVectors()
Generates the basis vectors using the snapshots together with the eigen-decomposition of the correlat...