Go to the documentation of this file.
   21 #include "libmesh/transient_rb_construction.h" 
   22 #include "libmesh/transient_rb_evaluation.h" 
   23 #include "libmesh/transient_rb_theta_expansion.h" 
   24 #include "libmesh/transient_rb_assembly_expansion.h" 
   27 #include "libmesh/numeric_vector.h" 
   28 #include "libmesh/sparse_matrix.h" 
   29 #include "libmesh/dof_map.h" 
   30 #include "libmesh/libmesh_logging.h" 
   31 #include "libmesh/linear_solver.h" 
   32 #include "libmesh/equation_systems.h" 
   33 #include "libmesh/exodusII_io.h" 
   34 #include "libmesh/getpot.h" 
   35 #include "libmesh/dense_matrix.h" 
   36 #include "libmesh/dense_vector.h" 
   37 #include "libmesh/xdr_cxx.h" 
   38 #include "libmesh/timestamp.h" 
   50 #if defined(LIBMESH_HAVE_SLEPC) 
   52 #include "libmesh/ignore_warnings.h" 
   54 #include <slepcblaslapack.h> 
   55 #include "libmesh/restore_warnings.h" 
   56 #endif // LIBMESH_HAVE_SLEPC 
   62                                                   const std::string & name_in,
 
   63                                                   const unsigned int number_in)
 
   64   : 
Parent(es, name_in, number_in),
 
   67     nonzero_initialization(false),
 
   68     compute_truth_projection_error(false),
 
  106                                                          bool skip_vector_assembly)
 
  127   GetPot infile(parameters_filename);
 
  136   const Real POD_tol_in         = infile(
"POD_tol", 
POD_tol);
 
  137   const int max_truth_solves_in = infile(
"max_truth_solves", 
max_truth_solves);
 
  138   const unsigned int delta_N_in = infile(
"delta_N", 
delta_N);
 
  153   libMesh::out << std::endl << 
"TransientRBConstruction parameters:" << std::endl;
 
  164       libMesh::out << 
"RBThetaExpansion member is not set yet" << std::endl;
 
  173   libMesh::out << 
"delta_N (number of basis functions to add each POD-Greedy step): " << 
get_delta_N() << std::endl;
 
  180       libMesh::out << 
"Using zero initial condition" << std::endl;
 
  191   const unsigned int Q_m       = trans_theta_expansion.
get_n_M_terms();
 
  192   const unsigned int n_outputs = trans_theta_expansion.
get_n_outputs();
 
  211     for (
unsigned int q=0; q<Q_m; q++)
 
  228         for (
unsigned int q=0; q<Q_m; q++)
 
  239   for (
unsigned int i=0; i<n_time_levels; i++)
 
  247   for (
unsigned int n=0; n<n_outputs; n++)
 
  259                                                         bool skip_vector_assembly)
 
  302     libmesh_error_msg(
"Error: We must have q < Q_m in get_M_q.");
 
  310     libmesh_error_msg(
"Error: Must have store_non_dirichlet_operators==true to access non_dirichlet_M_q.");
 
  316     libmesh_error_msg(
"Error: We must have q < Q_m in get_M_q.");
 
  325   all_matrices[
"L2_matrix"] = 
L2_matrix.get();
 
  332   const unsigned int Q_m = trans_theta_expansion.
get_n_M_terms();
 
  334   for (
unsigned int q_m=0; q_m<Q_m; q_m++)
 
  336       std::stringstream matrix_name;
 
  337       matrix_name << 
"M" << q_m;
 
  338       all_matrices[matrix_name.str()] = 
get_M_q(q_m);
 
  342           matrix_name << 
"_non_dirichlet";
 
  350   input_matrix->
zero();
 
  361   input_matrix->
zero();
 
  372   const unsigned int Q_m = trans_theta_expansion.
get_n_M_terms();
 
  374   for (
unsigned int q=0; q<Q_m; q++)
 
  382   LOG_SCOPE(
"mass_matrix_scaled_matvec()", 
"TransientRBConstruction");
 
  391   const unsigned int Q_m = trans_theta_expansion.
get_n_M_terms();
 
  396   for (
unsigned int q=0; q<Q_m; q++)
 
  399       dest.
add(scalar * trans_theta_expansion.
eval_M_theta(q,mu), *temp_vec);
 
  405   LOG_SCOPE(
"truth_assembly()", 
"TransientRBConstruction");
 
  417   const unsigned int Q_a = trans_theta_expansion.
get_n_A_terms();
 
  418   const unsigned int Q_f = trans_theta_expansion.
get_n_F_terms();
 
  434     for (
unsigned int q_a=0; q_a<Q_a; q_a++)
 
  439         temp_vec->scale( -(1.-euler_theta)*trans_theta_expansion.
eval_A_theta(q_a,mu) );
 
  443     for (
unsigned int q_f=0; q_f<Q_f; q_f++)
 
  464     libmesh_error_msg(
"Error: L2_assembly hasn't been initialized yet");
 
  478     libmesh_error_msg(
"Error: We must have q < Q_m in assemble_Mq_matrix.");
 
  480   input_matrix->
zero();
 
  496   for (
unsigned int q=0; q<trans_theta_expansion.
get_n_M_terms(); q++)
 
  501       for (
unsigned int q=0; q<trans_theta_expansion.
get_n_M_terms(); q++)
 
  513       libMesh::out << 
"Assembling non-Dirichlet L2 matrix" << std::endl;
 
  522   LOG_SCOPE(
"truth_solve()", 
"TransientRBConstruction");
 
  550   for (
unsigned int time_level=1; time_level<=n_time_steps; time_level++)
 
  586       if ((write_interval > 0) && (time_level%write_interval == 0))
 
  588           libMesh::out << std::endl << 
"Truth solve, plotting time step " << time_level << std::endl;
 
  590           std::ostringstream file_name;
 
  592           file_name << 
"truth.e.";
 
  593           file_name << std::setw(3)
 
  594                     << std::setprecision(0)
 
  599 #ifdef LIBMESH_HAVE_EXODUS_API 
  615   return final_truth_L2_norm;
 
  620                                                  Real initial_greedy_error,
 
  625       libMesh::out << 
"Maximum number of truth solves reached: max = " 
  626                    << count << std::endl;
 
  635   LOG_SCOPE(
"set_error_temporal_data()", 
"TransientRBConstruction");
 
  665       for (
unsigned int i=0; i<RB_size; i++)
 
  666         for (
unsigned int j=0; j<RB_size; j++)
 
  673       for (
unsigned int i=0; i<RB_size; i++)
 
  681       RB_inner_product_matrix_N.
lu_solve(RB_proj_rhs, RB_proj);
 
  685       for (
unsigned int i=0; i<RB_size; i++)
 
  704   LOG_SCOPE(
"get_error_temporal_data()", 
"TransientRBConstruction");
 
  731   LOG_SCOPE(
"add_IC_to_RB_space()", 
"TransientRBConstruction");
 
  734     libmesh_error_msg(
"Error: Should not call TransientRBConstruction::add_IC_to_RB_space() " \
 
  735                       << 
"on a system that already contains basis functions.");
 
  738     libmesh_error_msg(
"Error: Should not call TransientRBConstruction::add_IC_to_RB_space() " \
 
  739                       << 
"when nonzero_initialization==false.");
 
  753   current_bf.
scale(1./current_bf_norm);
 
  764 #if defined(LIBMESH_HAVE_SLEPC) 
  765   LOG_SCOPE(
"enrich_RB_space()", 
"TransientRBConstruction");
 
  770   PetscBLASInt eigen_size = cast_int<PetscBLASInt>(
temporal_data.size());
 
  771   PetscBLASInt LDA = eigen_size; 
 
  772   std::vector<Number> correlation_matrix(LDA*eigen_size);
 
  774   for (
int i=0; i<eigen_size; i++)
 
  778       for (
int j=i; j<eigen_size; j++)
 
  786           correlation_matrix[j*eigen_size+i] = inner_prod;
 
  801   Real ABSTOL = 1.e-14; 
 
  805   std::vector<Real> W(eigen_size); 
 
  807   PetscBLASInt LDZ = eigen_size; 
 
  808   std::vector<Number> Z(LDZ*eigen_size); 
 
  810   std::vector<PetscBLASInt> ISUPPZ(2*eigen_size); 
 
  813   PetscBLASInt LWORK = 26*eigen_size;
 
  814   std::vector<Number> WORK(LWORK);
 
  817   PetscBLASInt LIWORK = 10*eigen_size;
 
  818   std::vector<PetscBLASInt> IWORK(LIWORK);
 
  820   PetscBLASInt INFO = 0;
 
  822 #ifdef LIBMESH_USE_REAL_NUMBERS // Use real numbers 
  825   LAPACKsyevr_(&JOBZ, &RANGE, &UPLO, &eigen_size, correlation_matrix.data(),
 
  826                &LDA, &VL, &VU, &IL, &IU, &ABSTOL, &M, W.data(), Z.data(), &LDZ,
 
  827                ISUPPZ.data(), WORK.data(), &LWORK, IWORK.data(), &LIWORK, &INFO );
 
  828 #elif LIBMESH_USE_COMPLEX_NUMBERS // Use complex numbers 
  832   PetscBLASInt LRWORK = 24*eigen_size;
 
  833   std::vector<Real> RWORK(LRWORK);
 
  837   LAPACKsyevr_(&JOBZ, &RANGE, &UPLO, &eigen_size, correlation_matrix.data(),
 
  838                &LDA, &VL, &VU, &IL, &IU, &ABSTOL, &M, W.data(), Z.data(), &LDZ,
 
  839                ISUPPZ.data(), WORK.data(), &LWORK, RWORK.data(), &LRWORK, IWORK.data(),
 
  842 #error libMesh does not yet support quaternions! 
  846     libmesh_error_msg(
"Error in LAPACK syev eigensolver routine, INFO = " << INFO);
 
  849   libMesh::out << std::endl << 
"POD Eigenvalues:" << std::endl;
 
  850   for (
unsigned int i=0; i<=1; i++)
 
  852       libMesh::out << 
"eigenvalue " << i << 
" = " << W[eigen_size-1-i] << std::endl;
 
  855   libMesh::out << 
"last eigenvalue = " << W[0] << std::endl;
 
  859   unsigned int count = 0;
 
  870       for (
int j=0; j<eigen_size; j++)
 
  873           int Z_col = (eigen_size-1-count);
 
  874           int Z_index = Z_col*eigen_size + Z_row;
 
  882       current_bf.
scale(1./current_bf_norm);
 
  922   libmesh_not_implemented();
 
  935   libMesh::out << 
"Updating RB initial conditions" << std::endl;
 
  946   LOG_SCOPE(
"load_rb_solution()", 
"TransientRBConstruction");
 
  956     libmesh_error_msg(
"ERROR: rb_eval object contains " \
 
  958                       << 
" basis functions. RB_solution vector constains " \
 
  959                       << RB_solution_vector_k.
size() \
 
  960                       << 
" entries. RB_solution in TransientRBConstruction::load_rb_solution is too long!");
 
  962   for (
unsigned int i=0; i<RB_solution_vector_k.
size(); i++)
 
  970   LOG_SCOPE(
"update_RB_system_matrices()", 
"TransientRBConstruction");
 
  978   const unsigned int Q_m = trans_theta_expansion.
get_n_M_terms();
 
  985   for (
unsigned int i=(RB_size-
delta_N); i<RB_size; i++)
 
  987       for (
unsigned int j=0; j<RB_size; j++)
 
 1002           for (
unsigned int q_m=0; q_m<Q_m; q_m++)
 
 1028   LOG_SCOPE(
"update_residual_terms()", 
"TransientRBConstruction");
 
 1037   const unsigned int Q_m = trans_theta_expansion.
get_n_M_terms();
 
 1038   const unsigned int Q_a = trans_theta_expansion.
get_n_A_terms();
 
 1039   const unsigned int Q_f = trans_theta_expansion.
get_n_F_terms();
 
 1043   for (
unsigned int q_m=0; q_m<Q_m; q_m++)
 
 1045       for (
unsigned int i=(RB_size-
delta_N); i<RB_size; i++)
 
 1062                          << i << 
" in TransientRBConstruction::update_residual_terms() at " 
 1073                            << i << 
" in TransientRBConstruction::update_residual_terms() at " 
 1077                            << 
" iterations, final residual " 
 1086   if (compute_inner_products)
 
 1088       for (
unsigned int q_f=0; q_f<Q_f; q_f++)
 
 1092           for (
unsigned int i=(RB_size-
delta_N); i<RB_size; i++)
 
 1094               for (
unsigned int q_m=0; q_m<Q_m; q_m++)
 
 1103       for (
unsigned int q_m1=0; q_m1<Q_m; q_m1++)
 
 1105           for (
unsigned int q_m2=q_m1; q_m2<Q_m; q_m2++)
 
 1107               for (
unsigned int i=(RB_size-
delta_N); i<RB_size; i++)
 
 1109                   for (
unsigned int j=0; j<RB_size; j++)
 
 1131       for (
unsigned int i=(RB_size-
delta_N); i<RB_size; i++)
 
 1133           for (
unsigned int j=0; j<RB_size; j++)
 
 1135               for (
unsigned int q_a=0; q_a<Q_a; q_a++)
 
 1137                   for (
unsigned int q_m=0; q_m<Q_m; q_m++)
 
 1163   LOG_SCOPE(
"update_RB_initial_condition_all_N()", 
"TransientRBConstruction");
 
 1182   for (
unsigned int i=(RB_size-
delta_N); i<RB_size; i++)
 
 1191   for (
unsigned int N=(RB_size-
delta_N); N<RB_size; N++)
 
 1201       RB_L2_matrix_N.
lu_solve(RB_rhs_N, RB_ic_N);
 
 1211       for (
unsigned int i=0; i<N+1; i++)
 
 1305                                                                 const bool write_binary_residual_representors)
 
 1307   LOG_SCOPE(
"write_riesz_representors_to_files()", 
"TransientRBConstruction");
 
 1312   libMesh::out << 
"Writing out the M_q_representors..." << std::endl;
 
 1314   std::ostringstream file_name;
 
 1315   const std::string riesz_representor_suffix = (write_binary_residual_representors ? 
".xdr" : 
".dat");
 
 1323     for (
unsigned int i=istart; i<istop; ++i)
 
 1325         libMesh::out << 
"Writing out M_q_representor[" << q << 
"][" << i << 
"]..." << std::endl;
 
 1329         file_name << riesz_representors_dir << 
"/M_q_representor" << i << riesz_representor_suffix;
 
 1336           Xdr mr_data(file_name.str(),
 
 1337                       write_binary_residual_representors ? 
ENCODE : 
WRITE);
 
 1342           this->
comm().barrier();
 
 1354                                                                  const bool read_binary_residual_representors)
 
 1356   LOG_SCOPE(
"read_riesz_representors_from_files()", 
"TransientRBConstruction");
 
 1358   const std::string riesz_representor_suffix =
 
 1359     (read_binary_residual_representors ? 
".xdr" : 
".dat");
 
 1361   std::ostringstream file_name;
 
 1362   struct stat stat_info;
 
 1366   libMesh::out << 
"Reading in the M_q_representors..." << std::endl;
 
 1371   for (std::size_t i=0; i<trans_rb_eval.M_q_representor.size(); ++i)
 
 1372     for (std::size_t j=0; j<trans_rb_eval.M_q_representor[i].size(); ++j)
 
 1374         if (trans_rb_eval.M_q_representor[i][j] != 
nullptr)
 
 1375           libmesh_error_msg(
"Error, must delete existing M_q_representor before reading in from file.");
 
 1379   for (std::size_t i=0; i<trans_rb_eval.M_q_representor.size(); ++i)
 
 1380     for (std::size_t j=0; j<trans_rb_eval.get_n_basis_functions(); ++j)
 
 1383         file_name << riesz_representors_dir
 
 1384                   << 
"/M_q_representor" << i << 
"_" << j << riesz_representor_suffix;
 
 1389             int stat_result = stat(file_name.str().c_str(), &stat_info);
 
 1391             if (stat_result != 0)
 
 1392               libmesh_error_msg(
"File does not exist: " << file_name.str());
 
 1395         Xdr aqr_data(file_name.str(),
 
 1396                      read_binary_residual_representors ? 
DECODE : 
READ);
 
 1406         trans_rb_eval.M_q_representor[i][j]->swap(*
solution);
 
  
std::unique_ptr< SparseMatrix< Number > > inner_product_matrix
The inner product matrix.
 
virtual void close()=0
Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across p...
 
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
 
virtual void zero()=0
Set all entries to zero.
 
virtual Real truth_solve(int write_interval) override
Perform a truth solve at the current parameter.
 
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
 
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
 
const EquationSystems & get_equation_systems() const
 
unsigned int get_n_M_terms() const
Get Q_m, the number of terms in the affine expansion for the bilinear form.
 
virtual void add(const numeric_index_type i, const T value)=0
Adds value to each entry of the vector.
 
Real get_control(const unsigned int k) const
Get/set the RHS control.
 
This class stores the set of RBTheta functor objects that define the "parameter-dependent expansion" ...
 
SparseMatrix< Number > * get_Aq(unsigned int q)
Get a pointer to Aq.
 
NumericVector< Number > * rhs
The system matrix.
 
unsigned int Nmax
Maximum number of reduced basis functions we are willing to use.
 
std::unique_ptr< NumericVector< Number > > inner_product_storage_vector
We keep an extra temporary vector that is useful for performing inner products (avoids unnecessary me...
 
virtual void process_parameters_file(const std::string ¶meters_filename)
Read in from the file specified by parameters_filename and set the this system's member variables acc...
 
const NumericVector< Number > & get_error_temporal_data()
Get the column of temporal_data corresponding to the current time level.
 
virtual Number eval_M_theta(unsigned int q, const RBParameters &mu)
Evaluate theta at the current parameter.
 
std::vector< std::vector< std::unique_ptr< NumericVector< Number > > > > M_q_representor
Vector storing the mass matrix representors.
 
virtual bool greedy_termination_test(Real abs_greedy_error, Real initial_greedy_error, int count) override
Function that indicates when to terminate the Greedy basis training.
 
bool compute_truth_projection_error
Boolean flag that indicates whether we will compute the projection error for the truth solution into ...
 
Real get_euler_theta() const
Get/set euler_theta, parameter that determines the temporal discretization.
 
virtual void initialize_rb_construction(bool skip_matrix_assembly=false, bool skip_vector_assembly=false)
Allocate all the data structures necessary for the construction stage of the RB method.
 
void set_delta_N(const unsigned int new_delta_N)
Set delta_N, the number of basis functions we add to the RB space from each POD.
 
std::vector< DenseVector< Number > > RB_initial_condition_all_N
The RB initial conditions (i.e.
 
virtual Real rb_solve(unsigned int N)
Perform online solve with the N RB basis functions, for the set of parameters in current_params,...
 
void vector_mult(NumericVector< T > &dest, const NumericVector< T > &arg) const
Multiplies the matrix by the NumericVector arg and stores the result in NumericVector dest.
 
ElemAssembly * L2_assembly
Function pointer for assembling the L2 matrix.
 
The libMesh namespace provides an interface to certain functionality in the library.
 
virtual void zero() override
Set every element in the vector to 0.
 
This class implements a C++ interface to the XDR (eXternal Data Representation) format.
 
std::vector< std::unique_ptr< SparseMatrix< Number > > > M_q_vector
Vector storing the Q_m matrices from the mass operator.
 
virtual void get_all_matrices(std::map< std::string, SparseMatrix< Number > * > &all_matrices) override
Get a map that stores pointers to all of the matrices.
 
virtual ~TransientRBConstruction()
Destructor.
 
virtual void print_info() override
Print out info that describes the current setup of this RBConstruction.
 
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
 
virtual void update_residual_terms(bool compute_inner_products) override
Compute the terms that are combined ‘online’ to determine the dual norm of the residual.
 
virtual void init(const numeric_index_type n, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC)=0
Change the dimension of the vector to n.
 
MetaPhysicL::DualNumber< T, D > sqrt(const MetaPhysicL::DualNumber< T, D > &in)
 
virtual void clear() override
Clear all the data structures associated with the system.
 
std::vector< std::unique_ptr< NumericVector< Number > > > Fq_representor
Vector storing the residual representors associated with the right-hand side.
 
const Parallel::Communicator & comm() const
 
DenseMatrix< Number > RB_L2_matrix
Dense RB L2 matrix.
 
bool assert_convergence
A boolean flag to indicate whether to check for proper convergence after each solve.
 
This class is part of the rbOOmit framework.
 
void process_temporal_parameters_file(const std::string ¶meters_filename)
Read in and initialize parameters from parameters_filename.
 
virtual Number eval_output_theta(unsigned int output_index, unsigned int q_l, const RBParameters &mu)
Evaluate theta_q_l at the current parameter.
 
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
 
SparseMatrix< Number > * get_non_dirichlet_M_q(unsigned int q)
Get a pointer to non_dirichlet_M_q.
 
Real get_delta_t() const
Get/set delta_t, the time-step size.
 
void pull_temporal_discretization_data(RBTemporalDiscretization &other)
Pull the temporal discretization data from other.
 
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
 
const RBParameters & get_parameters() const
Get the current parameters.
 
virtual bool greedy_termination_test(Real abs_greedy_error, Real initial_greedy_error, int count)
Function that indicates when to terminate the Greedy basis training.
 
virtual void assemble_misc_matrices()
Assemble and store all the inner-product matrix, the constraint matrix (for constrained problems) and...
 
ElemAssembly & get_M_assembly(unsigned int q)
Return a reference to the specified M_assembly object.
 
Real POD_tol
If positive, this tolerance determines the number of POD modes we add to the space on a call to enric...
 
virtual void write_riesz_representors_to_files(const std::string &riesz_representors_dir, const bool write_binary_residual_representors) override
Write out all the Riesz representor data to files.
 
void set_time_step(const unsigned int k)
 
std::vector< std::vector< std::vector< Number > > > Fq_Mq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online.
 
unsigned int get_n_time_steps() const
Get/set the total number of time-steps.
 
void set_max_truth_solves(int max_truth_solves_in)
 
void set_L2_assembly(ElemAssembly &L2_assembly_in)
Set the L2 object.
 
void add_scaled_mass_matrix(Number scalar, SparseMatrix< Number > *input_matrix)
Add the scaled mass matrix (assembled for the current parameter) to input_matrix.
 
virtual void update_residual_terms(bool compute_inner_products=true)
Compute the terms that are combined ‘online’ to determine the dual norm of the residual.
 
virtual void initialize_truth()
This function imposes a truth initial condition, defaults to zero initial condition if the flag nonze...
 
std::string init_filename
The filename of the file containing the initial condition projected onto the truth mesh.
 
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
 
virtual unsigned int get_n_M_terms()
Get Q_m, the number of terms in the affine expansion for the mass operator.
 
std::unique_ptr< LinearSolver< Number > > inner_product_solver
We store an extra linear solver object which we can optionally use for solving all systems in which t...
 
virtual void allocate_data_structures()
Helper function that actually allocates all the data structures required by this class.
 
unsigned int get_time_step() const
Get/set the current time-step.
 
virtual LinearSolver< Number > * get_linear_solver() const override
 
virtual Real train_reduced_basis(const bool resize_rb_eval_data=true) override
Train the reduced basis.
 
dof_id_type n_local_dofs() const
 
virtual void update_system()
Update the system after enriching the RB space; this calls a series of functions to update the system...
 
bool is_rb_eval_initialized() const
 
const MeshBase & get_mesh() const
 
processor_id_type processor_id() const
 
NumericVector< Number > * get_output_vector(unsigned int n, unsigned int q_l)
Get a pointer to the n^th output.
 
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
 
std::vector< DenseMatrix< Number > > RB_M_q_vector
Dense matrices for the RB mass matrices.
 
virtual SparseMatrix< Number > & get_matrix_for_output_dual_solves() override
Override to return the L2 product matrix for output dual norm solves for transient state problems.
 
void read_serialized_data(Xdr &io, const bool read_additional_data=true)
Reads additional data, namely vectors, for this System.
 
void assemble_L2_matrix(SparseMatrix< Number > *input_matrix, bool apply_dirichlet_bc=true)
Assemble the L2 matrix.
 
SparseMatrix< Number > * matrix
The system matrix.
 
std::vector< std::vector< std::vector< Number > > > Mq_Mq_representor_innerprods
 
virtual void solve_for_matrix_and_rhs(LinearSolver< Number > &input_solver, SparseMatrix< Number > &input_matrix, NumericVector< Number > &input_rhs)
Assembles & solves the linear system A*x=b for the specified matrix input_matrix and right-hand side ...
 
RBEvaluation & get_rb_evaluation()
Get a reference to the RBEvaluation object.
 
CompareTypes< T, T2 >::supertype dot(const DenseVector< T2 > &vec) const
 
RBThetaExpansion & get_rb_theta_expansion()
Get a reference to the RBThetaExpansion object that that belongs to rb_eval.
 
virtual Number eval_A_theta(unsigned int q, const RBParameters &mu)
Evaluate theta_q_a at the current parameter.
 
virtual void process_parameters_file(const std::string ¶meters_filename) override
Read in the parameters from file and set up the system accordingly.
 
std::vector< DenseVector< Number > > RB_temporal_solution_data
Array storing the solution data at each time level from the most recent solve.
 
virtual void update_system() override
Update the system after enriching the RB space.
 
bool is_quiet() const
Is the system in quiet mode?
 
std::vector< std::unique_ptr< SparseMatrix< Number > > > non_dirichlet_M_q_vector
We sometimes also need a second set of M_q matrices that do not have the Dirichlet boundary condition...
 
virtual void read_riesz_representors_from_files(const std::string &riesz_representors_dir, const bool write_binary_residual_representors) override
Write out all the Riesz representor data to files.
 
unsigned int get_Nmax() const
Get/set Nmax, the maximum number of RB functions we are willing to compute.
 
void add_IC_to_RB_space()
Initialize RB space by adding the truth initial condition as the first RB basis function.
 
This class is part of the rbOOmit framework.
 
virtual unsigned int size() const override
 
virtual void initialize_rb_construction(bool skip_matrix_assembly=false, bool skip_vector_assembly=false) override
Allocate all the data structures necessary for the construction stage of the RB method.
 
std::unique_ptr< SparseMatrix< Number > > L2_matrix
The L2 matrix.
 
void check_convergence(LinearSolver< Number > &input_solver)
Check if the linear solver reports convergence.
 
virtual void add(const numeric_index_type i, const numeric_index_type j, const T value)=0
Add value to the element (i,j).
 
std::string get_timestamp()
 
virtual void allocate_data_structures() override
Helper function that actually allocates all the data structures required by this class.
 
This is the EquationSystems class.
 
unsigned int n_linear_iterations() const
 
virtual void write_equation_systems(const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
This method implements writing a mesh with data to a specified file where the data is taken from the ...
 
virtual void print_info()
Print out info that describes the current setup of this RBConstruction.
 
SparseMatrix< Number > * get_non_dirichlet_inner_product_matrix_if_avail()
Get the non-Dirichlet inner-product matrix if it's available, otherwise get the inner-product matrix ...
 
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
 
virtual void assemble_affine_expansion(bool skip_matrix_assembly, bool skip_vector_assembly)
Assemble the matrices and vectors for this system.
 
void write_serialized_data(Xdr &io, const bool write_additional_data=true) const
Writes additional data, namely vectors, for this System.
 
virtual void update_RB_system_matrices()
Compute the reduced basis matrices for the current basis.
 
std::vector< std::vector< Number > > truth_outputs_all_k
The truth outputs for all time-levels from the most recent truth_solve.
 
void resize(const unsigned int n)
Resize the vector.
 
void attach_matrix(SparseMatrix< Number > &matrix)
Additional matrices may be handled with this DofMap.
 
bool compute_RB_inner_product
Boolean flag to indicate whether we compute the RB_inner_product_matrix.
 
unsigned int delta_N
The number of basis functions that we add at each greedy step.
 
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
 
unsigned int get_delta_N() const
Get delta_N, the number of basis functions we add to the RB space per iteration of the greedy algorit...
 
DenseVector< Number > RB_ic_proj_rhs_all_N
The vector that stores the right-hand side for the initial condition projections.
 
ElemAssembly provides a per-element (interior and boundary) assembly functionality.
 
DenseMatrix< Number > RB_inner_product_matrix
The inner product matrix.
 
static std::unique_ptr< SparseMatrix< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a SparseMatrix<T> using the linear solver package specified by solver_package.
 
void add_scaled_matrix_and_vector(Number scalar, ElemAssembly *elem_assembly, SparseMatrix< Number > *input_matrix, NumericVector< Number > *input_vector, bool symmetrize=false, bool apply_dof_constraints=true)
This function loops over the mesh and applies the specified interior and/or boundary assembly routine...
 
void assemble_mass_matrix(SparseMatrix< Number > *input_matrix)
Assemble the mass matrix at the current parameter and store it in input_matrix.
 
This class handles the numbering of degrees of freedom on a mesh.
 
std::vector< std::vector< std::vector< std::vector< Number > > > > Aq_Mq_representor_innerprods
 
virtual void clear() override
Clear all the data structures associated with the system.
 
std::vector< std::vector< std::unique_ptr< NumericVector< Number > > > > Aq_representor
Vector storing the residual representors associated with the left-hand side.
 
void get_principal_submatrix(unsigned int sub_m, unsigned int sub_n, DenseMatrix< T > &dest) const
Put the sub_m x sub_n principal submatrix into dest.
 
bool exit_on_repeated_greedy_parameters
Boolean flag to indicate whether we exit the greedy if we select the same parameters twice in a row.
 
TransientRBConstruction(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
 
virtual void update_RB_system_matrices() override
Compute the reduced basis matrices for the current basis.
 
virtual void get_all_matrices(std::map< std::string, SparseMatrix< Number > * > &all_matrices)
Get a map that stores pointers to all of the matrices.
 
void update_RB_initial_condition_all_N()
Compute the L2 projection of the initial condition onto the RB space for 1 <= N <= RB_size and store ...
 
virtual void enrich_RB_space() override
Add a new basis functions to the RB space.
 
NumericVector< Number > * get_Fq(unsigned int q)
Get a pointer to Fq.
 
std::vector< Real > initial_L2_error_all_N
Vector storing initial L2 error for all 1 <= N <= RB_size.
 
int get_max_truth_solves() const
Get/set max_truth_solves, the maximum number of RB truth solves we are willing to compute in the tran...
 
virtual void scale(const T factor)=0
Scale each element of the vector by the given factor.
 
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
 
virtual Number eval_F_theta(unsigned int q, const RBParameters &mu)
Evaluate theta_q_f at the current parameter.
 
virtual void assemble_all_affine_operators() override
Assemble and store all the affine operators.
 
bool store_non_dirichlet_operators
Boolean flag to indicate whether we store a second copy of each affine operator and vector which does...
 
Real final_linear_residual() const
 
std::unique_ptr< SparseMatrix< Number > > non_dirichlet_L2_matrix
The L2 matrix without Dirichlet conditions enforced.
 
const DofMap & get_dof_map() const
 
dof_id_type n_dofs() const
 
int max_truth_solves
Maximum number of truth solves in the POD-Greedy.
 
void get_principal_subvector(unsigned int sub_n, DenseVector< T > &dest) const
Puts the principal subvector of size sub_n (i.e.
 
void lu_solve(const DenseVector< T > &b, DenseVector< T > &x)
Solve the system Ax=b given the input vector b.
 
virtual void assemble_misc_matrices() override
Override to assemble the L2 matrix as well.
 
bool nonzero_initialization
Boolean flag to indicate whether we are using a non-zero initialization.
 
void assemble_Mq_matrix(unsigned int q, SparseMatrix< Number > *input_matrix, bool apply_dirichlet_bc=true)
Assemble the q^th affine term of the mass matrix and store it in input_matrix.
 
std::vector< std::unique_ptr< NumericVector< Number > > > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
 
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
 
std::unique_ptr< NumericVector< Number > > old_local_solution
All the values I need to compute my contribution to the simulation at hand.
 
Real get_POD_tol() const
Get/set POD_tol.
 
void set_POD_tol(const Real POD_tol_in)
 
virtual void assemble_all_affine_operators()
Assemble and store all Q_a affine operators as well as the inner-product matrix.
 
virtual void assemble_affine_expansion(bool skip_matrix_assembly, bool skip_vector_assembly) override
Override assemble_affine_expansion to also initialize RB_ic_proj_rhs_all_N, if necessary.
 
This extends RBAssemblyExpansion to provide an assembly expansion for the case of time-dependent PDEs...
 
Number set_error_temporal_data()
Set column k (i.e.
 
std::vector< std::unique_ptr< NumericVector< Number > > > temporal_data
Dense matrix to store the data that we use for the temporal POD.
 
virtual void load_rb_solution() override
Load the RB solution from the current time-level into the libMesh solution vector.
 
virtual void update()
Update the local values to reflect the solution on neighboring processors.
 
virtual void zero()=0
Set all entries to 0.
 
std::unique_ptr< LinearSolver< Number > > linear_solver
The LinearSolver defines the interface used to solve the linear_implicit system.
 
void mass_matrix_scaled_matvec(Number scalar, NumericVector< Number > &dest, NumericVector< Number > &arg)
Perform a matrix-vector multiplication with the current mass matrix and store the result in dest.
 
SparseMatrix< Number > * get_M_q(unsigned int q)
Get a pointer to M_q.
 
NumericVector< Number > & get_basis_function(unsigned int i)
Get a reference to the i^th basis function.
 
virtual T dot(const NumericVector< T > &v) const =0
 
virtual void truth_assembly() override
Assemble the truth system in the transient linear case.
 
virtual Real train_reduced_basis(const bool resize_rb_eval_data=true)
Train the reduced basis.
 
RBAssemblyExpansion & get_rb_assembly_expansion()
 
ElemAssembly & get_L2_assembly()