libMesh
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
libMesh::TransientRBEvaluation Class Reference

This class is part of the rbOOmit framework. More...

#include <transient_rb_evaluation.h>

Inheritance diagram for libMesh::TransientRBEvaluation:
[legend]

Public Types

typedef RBEvaluation Parent
 The type of the parent. More...
 

Public Member Functions

 TransientRBEvaluation (const Parallel::Communicator &comm_in LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
 Constructor. More...
 
 ~TransientRBEvaluation ()
 Destructor. More...
 
virtual void clear () libmesh_override
 Clear this TransientRBEvaluation object. More...
 
virtual void resize_data_structures (const unsigned int Nmax, bool resize_error_bound_data=true) libmesh_override
 Resize and clear the data vectors corresponding to the value of Nmax. More...
 
virtual Real rb_solve (unsigned int N) libmesh_override
 Perform online solve for current_params with the N basis functions. More...
 
virtual Real rb_solve_again ()
 If a solve has already been performed, then we cached some data and we can perform a new solve much more rapidly (with the same parameters but a possibly different initial condition/rhs control). More...
 
virtual Real get_error_bound_normalization () libmesh_override
 
virtual Real residual_scaling_numer (Real alpha_LB)
 Specifies the residual scaling on the numerator to be used in the a posteriori error bound. More...
 
virtual Real compute_residual_dual_norm (const unsigned int N) libmesh_override
 Compute the dual norm of the residual for the solution saved in RB_solution. More...
 
virtual Real uncached_compute_residual_dual_norm (const unsigned int N)
 Compute the dual norm of the residual for the solution saved in RB_solution. More...
 
void cache_online_residual_terms (const unsigned int N)
 Helper function for caching the terms in the online residual assembly that do not change in time. More...
 
virtual void clear_riesz_representors () libmesh_override
 Clear all the Riesz representors that are used to compute the RB residual (and hence error bound). More...
 
virtual void legacy_write_offline_data_to_files (const std::string &directory_name="offline_data", const bool write_binary_data=true) libmesh_override
 Write out all the data to text files in order to segregate the Offline stage from the Online stage. More...
 
virtual void legacy_read_offline_data_from_files (const std::string &directory_name="offline_data", bool read_error_bound_data=true, const bool read_binary_data=true) libmesh_override
 Read in the saved Offline reduced basis data to initialize the system for Online solves. More...
 
void set_rb_theta_expansion (RBThetaExpansion &rb_theta_expansion_in)
 Set the RBThetaExpansion object. More...
 
RBThetaExpansionget_rb_theta_expansion ()
 Get a reference to the rb_theta_expansion. More...
 
bool is_rb_theta_expansion_initialized () const
 
NumericVector< Number > & get_basis_function (unsigned int i)
 Get a reference to the i^th basis function. More...
 
virtual Real residual_scaling_denom (Real alpha_LB)
 Specifies the residual scaling on the denominator to be used in the a posteriori error bound. More...
 
Real eval_output_dual_norm (unsigned int n, const RBParameters &mu)
 Evaluate the dual norm of output n for the current parameters. More...
 
virtual Real get_stability_lower_bound ()
 Get a lower bound for the stability constant (e.g. More...
 
virtual unsigned int get_n_basis_functions () const
 Get the current number of basis functions. More...
 
virtual void set_n_basis_functions (unsigned int n_bfs)
 Set the number of basis functions. More...
 
virtual void write_out_basis_functions (System &sys, const std::string &directory_name="offline_data", const bool write_binary_basis_functions=true)
 Write out all the basis functions to file. More...
 
virtual void write_out_vectors (System &sys, std::vector< NumericVector< Number > * > &vectors, const std::string &directory_name="offline_data", const std::string &data_name="bf", const bool write_binary_basis_functions=true)
 Same as write_out_basis_functions, except in this case we pass in the vectors to be written. More...
 
virtual void read_in_basis_functions (System &sys, const std::string &directory_name="offline_data", const bool read_binary_basis_functions=true)
 Read in all the basis functions from file. More...
 
void read_in_vectors (System &sys, std::vector< NumericVector< Number > * > &vectors, const std::string &directory_name, const std::string &data_name, const bool read_binary_vectors)
 Same as read_in_basis_functions, except in this case we pass in the vectors to be written. More...
 
void read_in_vectors_from_multiple_files (System &sys, std::vector< std::vector< NumericVector< Number > * > * > multiple_vectors, const std::vector< std::string > &multiple_directory_names, const std::vector< std::string > &multiple_data_names, const bool read_binary_vectors)
 Performs read_in_vectors for a list of directory names and data names. More...
 
void initialize_parameters (const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values)
 Initialize the parameter ranges and set current_parameters. More...
 
void initialize_parameters (const RBParametrized &rb_parametrized)
 Initialize the parameter ranges and set current_parameters. More...
 
unsigned int get_n_params () const
 Get the number of parameters. More...
 
unsigned int get_n_continuous_params () const
 Get the number of continuous parameters. More...
 
unsigned int get_n_discrete_params () const
 Get the number of discrete parameters. More...
 
std::set< std::string > get_parameter_names () const
 Get a set that stores the parameter names. More...
 
const RBParametersget_parameters () const
 Get the current parameters. More...
 
void set_parameters (const RBParameters &params)
 Set the current parameters to params. More...
 
const RBParametersget_parameters_min () const
 Get an RBParameters object that specifies the minimum allowable value for each parameter. More...
 
const RBParametersget_parameters_max () const
 Get an RBParameters object that specifies the maximum allowable value for each parameter. More...
 
Real get_parameter_min (const std::string &param_name) const
 Get minimum allowable value of parameter param_name. More...
 
Real get_parameter_max (const std::string &param_name) const
 Get maximum allowable value of parameter param_name. More...
 
void print_parameters () const
 Print the current parameters. More...
 
void write_parameter_data_to_files (const std::string &continuous_param_file_name, const std::string &discrete_param_file_name, const bool write_binary_data)
 Write out the parameter ranges to files. More...
 
void read_parameter_data_from_files (const std::string &continuous_param_file_name, const std::string &discrete_param_file_name, const bool read_binary_data)
 Read in the parameter ranges from files. More...
 
bool is_discrete_parameter (const std::string &mu_name) const
 Is parameter mu_name discrete? More...
 
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values () const
 Get a const reference to the discrete parameter values. More...
 
void print_discrete_parameter_values () const
 Print out all the discrete parameter values. More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
Real get_delta_t () const
 Get/set delta_t, the time-step size. More...
 
void set_delta_t (const Real delta_t_in)
 
Real get_euler_theta () const
 Get/set euler_theta, parameter that determines the temporal discretization. More...
 
void set_euler_theta (const Real euler_theta_in)
 
unsigned int get_time_step () const
 Get/set the current time-step. More...
 
void set_time_step (const unsigned int k)
 
unsigned int get_n_time_steps () const
 Get/set the total number of time-steps. More...
 
void set_n_time_steps (const unsigned int K)
 
Real get_control (const unsigned int k) const
 Get/set the RHS control. More...
 
void set_control (const std::vector< Real > &control)
 
void process_temporal_parameters_file (const std::string &parameters_filename)
 Read in and initialize parameters from parameters_filename. More...
 
void pull_temporal_discretization_data (RBTemporalDiscretization &other)
 Pull the temporal discretization data from other. More...
 

Static Public Member Functions

static Real get_closest_value (Real value, const std::vector< Real > &list_of_values)
 
static std::string get_info ()
 Gets a string containing the reference information. More...
 
static void print_info (std::ostream &out=libMesh::out)
 Prints the reference information, by default to libMesh::out. More...
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects. More...
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info() More...
 
static void disable_print_counter_info ()
 

Public Attributes

DenseMatrix< NumberRB_L2_matrix
 Dense RB L2 matrix. More...
 
DenseMatrix< NumberRB_LHS_matrix
 Cached data for subsequent solves. More...
 
DenseMatrix< NumberRB_RHS_matrix
 
DenseVector< NumberRB_RHS_save
 
std::vector< DenseMatrix< Number > > RB_M_q_vector
 Dense matrices for the RB mass matrices. More...
 
std::vector< std::vector< Number > > RB_outputs_all_k
 The RB outputs for all time-levels from the most recent rb_solve. More...
 
std::vector< std::vector< Real > > RB_output_error_bounds_all_k
 The error bounds for each RB output for all time-levels from the most recent rb_solve. More...
 
DenseVector< Numberold_RB_solution
 The RB solution at the previous time-level. More...
 
std::vector< DenseVector< Number > > RB_temporal_solution_data
 Array storing the solution data at each time level from the most recent solve. More...
 
std::vector< Realerror_bound_all_k
 The error bound data for all time-levels from the most recent rb_solve. More...
 
std::vector< Realinitial_L2_error_all_N
 Vector storing initial L2 error for all 1 <= N <= RB_size. More...
 
std::vector< DenseVector< Number > > RB_initial_condition_all_N
 The RB initial conditions (i.e. More...
 
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. More...
 
std::vector< std::vector< std::vector< Number > > > Mq_Mq_representor_innerprods
 
std::vector< std::vector< std::vector< std::vector< Number > > > > Aq_Mq_representor_innerprods
 
Number cached_Fq_term
 Cached residual terms. More...
 
DenseVector< Numbercached_Fq_Aq_vector
 
DenseMatrix< Numbercached_Aq_Aq_matrix
 
DenseVector< Numbercached_Fq_Mq_vector
 
DenseMatrix< Numbercached_Aq_Mq_matrix
 
DenseMatrix< Numbercached_Mq_Mq_matrix
 
std::vector< std::vector< NumericVector< Number > * > > M_q_representor
 Vector storing the mass matrix representors. More...
 
bool _rb_solve_data_cached
 Check that the data has been cached in case of using rb_solve_again. More...
 
std::vector< NumericVector< Number > * > basis_functions
 The libMesh vectors storing the finite element coefficients of the RB basis functions. More...
 
std::vector< RBParametersgreedy_param_list
 The list of parameters selected by the Greedy algorithm in generating the Reduced Basis associated with this RBEvaluation object. More...
 
DenseMatrix< NumberRB_inner_product_matrix
 The inner product matrix. More...
 
std::vector< DenseMatrix< Number > > RB_Aq_vector
 Dense matrices for the RB computations. More...
 
std::vector< DenseVector< Number > > RB_Fq_vector
 Dense vector for the RHS. More...
 
DenseVector< NumberRB_solution
 The RB solution vector. More...
 
std::vector< std::vector< DenseVector< Number > > > RB_output_vectors
 The vectors storing the RB output vectors. More...
 
std::vector< NumberRB_outputs
 The vectors storing the RB output values and corresponding error bounds. More...
 
std::vector< RealRB_output_error_bounds
 
std::vector< NumberFq_representor_innerprods
 Vectors storing the residual representor inner products to be used in computing the residuals online. More...
 
std::vector< std::vector< std::vector< Number > > > Fq_Aq_representor_innerprods
 Vectors storing the residual representor inner products to be used in computing the residuals online. More...
 
std::vector< std::vector< std::vector< Number > > > Aq_Aq_representor_innerprods
 
std::vector< std::vector< Number > > output_dual_innerprods
 The vector storing the dual norm inner product terms for each output. More...
 
std::vector< std::vector< NumericVector< Number > * > > Aq_representor
 Vector storing the residual representors associated with the left-hand side. More...
 
bool evaluate_RB_error_bound
 Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called. More...
 
bool compute_RB_inner_product
 Boolean flag to indicate whether we compute the RB_inner_product_matrix. More...
 
bool verbose_mode
 Public boolean to toggle verbose mode. More...
 

Protected Types

typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 Data structure to log the information. More...
 

Protected Member Functions

void assert_file_exists (const std::string &file_name)
 Helper function that checks if file_name exists. More...
 
void increment_constructor_count (const std::string &name)
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name)
 Increments the destruction counter. More...
 

Protected Attributes

const Parallel::Communicator_communicator
 

Static Protected Attributes

static Counts _counts
 Actually holds the data. More...
 
static Threads::atomic< unsigned int_n_objects
 The number of objects. More...
 
static Threads::spin_mutex _mutex
 Mutual exclusion object to enable thread-safe reference counting. More...
 
static bool _enable_print_counter = true
 Flag to control whether reference count information is printed when print_info is called. More...
 

Detailed Description

This class is part of the rbOOmit framework.

TransientRBEvaluation extends RBEvaluation to encapsulate the code and data required to perform "online" RB evaluations for Linear Time Invariant (LTI) transient problems.

We can handle time controls on the RHS as h(t)*f(x, $ \mu $). See Martin Grepl's thesis for more details.

Author
David J. Knezevic
Date
2011

Definition at line 50 of file transient_rb_evaluation.h.

Member Typedef Documentation

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information.

The log is identified by the class name.

Definition at line 119 of file reference_counter.h.

The type of the parent.

Definition at line 68 of file transient_rb_evaluation.h.

Constructor & Destructor Documentation

TransientRBEvaluation::TransientRBEvaluation ( const Parallel::Communicator &comm_in  LIBMESH_CAN_DEFAULT_TO_COMMWORLD)

Constructor.

Definition at line 39 of file transient_rb_evaluation.C.

References libMesh::RBEvaluation::compute_RB_inner_product.

39  :
40  RBEvaluation(comm_in),
42 {
43  // Indicate that we need to compute the RB
44  // inner product matrix in this case
46 }
bool compute_RB_inner_product
Boolean flag to indicate whether we compute the RB_inner_product_matrix.
bool _rb_solve_data_cached
Check that the data has been cached in case of using rb_solve_again.
RBEvaluation(const Parallel::Communicator &comm LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
Constructor.
Definition: rb_evaluation.C:45
TransientRBEvaluation::~TransientRBEvaluation ( )

Destructor.

Definition at line 48 of file transient_rb_evaluation.C.

References clear().

49 {
50  clear();
51 }
virtual void clear() libmesh_override
Clear this TransientRBEvaluation object.

Member Function Documentation

void libMesh::RBEvaluation::assert_file_exists ( const std::string &  file_name)
protectedinherited

Helper function that checks if file_name exists.

Definition at line 894 of file rb_evaluation.C.

Referenced by legacy_read_offline_data_from_files(), libMesh::RBEIMEvaluation::legacy_read_offline_data_from_files(), libMesh::RBEvaluation::legacy_read_offline_data_from_files(), and libMesh::RBEvaluation::read_in_vectors_from_multiple_files().

895 {
896  if (!std::ifstream(file_name.c_str()))
897  libmesh_error_msg("File missing: " + file_name);
898 }
void TransientRBEvaluation::cache_online_residual_terms ( const unsigned int  N)

Helper function for caching the terms in the online residual assembly that do not change in time.

(This is only useful when the parameter is fixed in time.)

Definition at line 429 of file transient_rb_evaluation.C.

References libMesh::RBEvaluation::Aq_Aq_representor_innerprods, Aq_Mq_representor_innerprods, cached_Aq_Aq_matrix, cached_Aq_Mq_matrix, cached_Fq_Aq_vector, cached_Fq_Mq_vector, cached_Fq_term, cached_Mq_Mq_matrix, libMesh::RBThetaExpansion::eval_A_theta(), libMesh::RBThetaExpansion::eval_F_theta(), libMesh::TransientRBThetaExpansion::eval_M_theta(), libMesh::RBEvaluation::Fq_Aq_representor_innerprods, Fq_Mq_representor_innerprods, libMesh::RBEvaluation::Fq_representor_innerprods, libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::TransientRBThetaExpansion::get_n_M_terms(), libMesh::RBParametrized::get_parameters(), libMesh::RBEvaluation::get_rb_theta_expansion(), Mq_Mq_representor_innerprods, libMesh::Real, libMesh::DenseVector< T >::resize(), and libMesh::DenseMatrix< T >::resize().

Referenced by rb_solve().

430 {
431  LOG_SCOPE("cache_online_residual_terms()", "TransientRBEvaluation");
432 
433  const RBParameters mu = get_parameters();
434 
435  TransientRBThetaExpansion & trans_theta_expansion =
436  cast_ref<TransientRBThetaExpansion &>(get_rb_theta_expansion());
437  const unsigned int Q_m = trans_theta_expansion.get_n_M_terms();
438  const unsigned int Q_a = trans_theta_expansion.get_n_A_terms();
439  const unsigned int Q_f = trans_theta_expansion.get_n_F_terms();
440 
441  cached_Fq_term = 0.;
442  unsigned int q=0;
443  for (unsigned int q_f1=0; q_f1<Q_f; q_f1++)
444  {
445  Number cached_theta_q_f1 = trans_theta_expansion.eval_F_theta(q_f1,mu);
446  for (unsigned int q_f2=q_f1; q_f2<Q_f; q_f2++)
447  {
448  Real delta = (q_f1==q_f2) ? 1. : 2.;
449  cached_Fq_term += delta*cached_theta_q_f1*trans_theta_expansion.eval_F_theta(q_f2,mu) *
451 
452  q++;
453  }
454  }
455 
457  for (unsigned int q_f=0; q_f<Q_f; q_f++)
458  {
459  Number cached_theta_q_f = trans_theta_expansion.eval_F_theta(q_f,mu);
460  for (unsigned int q_a=0; q_a<Q_a; q_a++)
461  {
462  Number cached_theta_q_a = trans_theta_expansion.eval_A_theta(q_a,mu);
463  for (unsigned int i=0; i<N; i++)
464  {
465  cached_Fq_Aq_vector(i) += 2.*cached_theta_q_f*cached_theta_q_a*
466  Fq_Aq_representor_innerprods[q_f][q_a][i];
467  }
468  }
469  }
470 
472  q=0;
473  for (unsigned int q_a1=0; q_a1<Q_a; q_a1++)
474  {
475  Number cached_theta_q_a1 = trans_theta_expansion.eval_A_theta(q_a1,mu);
476  for (unsigned int q_a2=q_a1; q_a2<Q_a; q_a2++)
477  {
478  Number cached_theta_q_a2 = trans_theta_expansion.eval_A_theta(q_a2,mu);
479  Real delta = (q_a1==q_a2) ? 1. : 2.;
480 
481  for (unsigned int i=0; i<N; i++)
482  {
483  for (unsigned int j=0; j<N; j++)
484  {
485  cached_Aq_Aq_matrix(i,j) += delta*
486  cached_theta_q_a1*cached_theta_q_a2*
488  }
489  }
490  q++;
491  }
492  }
493 
495  for (unsigned int q_f=0; q_f<Q_f; q_f++)
496  {
497  Number cached_theta_q_f = trans_theta_expansion.eval_F_theta(q_f,mu);
498  for (unsigned int q_m=0; q_m<Q_m; q_m++)
499  {
500  Number cached_theta_q_m = trans_theta_expansion.eval_M_theta(q_m,mu);
501  for (unsigned int i=0; i<N; i++)
502  {
503  cached_Fq_Mq_vector(i) += 2.*cached_theta_q_f * cached_theta_q_m * Fq_Mq_representor_innerprods[q_f][q_m][i];
504  }
505  }
506  }
507 
509  for (unsigned int q_a=0; q_a<Q_a; q_a++)
510  {
511  Number cached_theta_q_a = trans_theta_expansion.eval_A_theta(q_a,mu);
512 
513  for (unsigned int q_m=0; q_m<Q_m; q_m++)
514  {
515  Number cached_theta_q_m = trans_theta_expansion.eval_M_theta(q_m,mu);
516 
517  for (unsigned int i=0; i<N; i++)
518  {
519  for (unsigned int j=0; j<N; j++)
520  {
521  cached_Aq_Mq_matrix(i,j) += 2.*cached_theta_q_a*cached_theta_q_m*Aq_Mq_representor_innerprods[q_a][q_m][i][j];
522  }
523  }
524  }
525  }
526 
528  q=0;
529  for (unsigned int q_m1=0; q_m1<Q_m; q_m1++)
530  {
531  Number cached_theta_q_m1 = trans_theta_expansion.eval_M_theta(q_m1,mu);
532  for (unsigned int q_m2=q_m1; q_m2<Q_m; q_m2++)
533  {
534  Number cached_theta_q_m2 = trans_theta_expansion.eval_M_theta(q_m2,mu);
535  Real delta = (q_m1==q_m2) ? 1. : 2.;
536 
537  for (unsigned int i=0; i<N; i++)
538  {
539  for (unsigned int j=0; j<N; j++)
540  {
541  cached_Mq_Mq_matrix(i,j) += delta*
542  cached_theta_q_m1*cached_theta_q_m2*
544  }
545  }
546  q++;
547  }
548  }
549 }
std::vector< std::vector< std::vector< Number > > > Mq_Mq_representor_innerprods
std::vector< Number > Fq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
Number cached_Fq_term
Cached residual terms.
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:350
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...
std::vector< std::vector< std::vector< Number > > > Fq_Aq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void resize(const unsigned int new_m, const unsigned int new_n)
Resize the matrix.
Definition: dense_matrix.h:776
std::vector< std::vector< std::vector< std::vector< Number > > > > Aq_Mq_representor_innerprods
const RBParameters & get_parameters() const
Get the current parameters.
RBThetaExpansion & get_rb_theta_expansion()
Get a reference to the rb_theta_expansion.
Definition: rb_evaluation.C:89
std::vector< std::vector< std::vector< Number > > > Aq_Aq_representor_innerprods
void TransientRBEvaluation::clear ( )
virtual

Clear this TransientRBEvaluation object.

Override to also clear the M_q representors

Reimplemented from libMesh::RBEvaluation.

Definition at line 53 of file transient_rb_evaluation.C.

References libMesh::RBEvaluation::clear(), and clear_riesz_representors().

Referenced by ~TransientRBEvaluation().

54 {
55  Parent::clear();
56 
58 }
virtual void clear_riesz_representors() libmesh_override
Clear all the Riesz representors that are used to compute the RB residual (and hence error bound)...
virtual void clear() libmesh_override
Clear this RBEvaluation object.
Definition: rb_evaluation.C:60
void TransientRBEvaluation::clear_riesz_representors ( )
virtual

Clear all the Riesz representors that are used to compute the RB residual (and hence error bound).

This is useful since once we complete the Greedy we may not need the representors any more. Override to clear the M_q representors.

Reimplemented from libMesh::RBEvaluation.

Definition at line 60 of file transient_rb_evaluation.C.

References libMesh::RBEvaluation::clear_riesz_representors(), libmesh_nullptr, and M_q_representor.

Referenced by clear().

61 {
63 
64  // Delete the M_q representors
65  for (std::size_t q_m=0; q_m<M_q_representor.size(); q_m++)
66  for (std::size_t i=0; i<M_q_representor[q_m].size(); i++)
67  {
68  if (M_q_representor[q_m][i])
69  {
70  M_q_representor[q_m][i]->clear();
71  delete M_q_representor[q_m][i];
73  }
74  }
75 }
const class libmesh_nullptr_t libmesh_nullptr
std::vector< std::vector< NumericVector< Number > * > > M_q_representor
Vector storing the mass matrix representors.
virtual void clear_riesz_representors()
Clear all the Riesz representors that are used to compute the RB residual (and hence error bound)...
const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inherited
Returns
A reference to the Parallel::Communicator object used by this mesh.

Definition at line 87 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_preconditioner_apply(), libMesh::__libmesh_petsc_snes_jacobian(), libMesh::__libmesh_petsc_snes_postcheck(), libMesh::__libmesh_petsc_snes_residual(), libMesh::__libmesh_tao_equality_constraints(), libMesh::__libmesh_tao_equality_constraints_jacobian(), libMesh::__libmesh_tao_gradient(), libMesh::__libmesh_tao_hessian(), libMesh::__libmesh_tao_inequality_constraints(), libMesh::__libmesh_tao_inequality_constraints_jacobian(), libMesh::__libmesh_tao_objective(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), add_cube_convex_hull_to_mesh(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::ImplicitSystem::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::System::add_vector(), libMesh::EigenSparseLinearSolver< T >::adjoint_solve(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::Parallel::BinSorter< KeyType, IdxType >::binsort(), libMesh::Parallel::Sort< KeyType, IdxType >::binsort(), libMesh::MeshCommunication::broadcast(), libMesh::SparseMatrix< T >::build(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::Parallel::Histogram< KeyType, IdxType >::build_histogram(), libMesh::PetscNonlinearSolver< T >::build_mat_null_space(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::Parallel::Sort< KeyType, IdxType >::communicate_bins(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::MeshTools::create_subdomain_bounding_box(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::RBConstruction::enrich_RB_space(), AssembleOptimization::equality_constraints(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::RBEIMConstruction::evaluate_mesh_function(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::EquationSystems::get_solution(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TopologyMap::init(), libMesh::PetscDiffSolver::init(), libMesh::TimeSolver::init(), libMesh::TaoOptimizationSolver< T >::init(), libMesh::PetscNonlinearSolver< T >::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_rb_construction(), integrate_function(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshSerializer::MeshSerializer(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), new_function_base(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::ReplicatedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_n_elem(), libMesh::DistributedMesh::parallel_n_nodes(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::MeshTools::paranoid_n_levels(), libMesh::Partitioner::partition(), libMesh::MetisPartitioner::partition_range(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::SparseMatrix< T >::print(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshCommunication::redistribute(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::DistributedMesh::renumber_dof_objects(), LinearElasticityWithContact::residual_and_jacobian(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::RBEIMConstruction::set_explicit_sys_subvector(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::Parallel::Sort< KeyType, IdxType >::sort(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), libMesh::MeshRefinement::test_unflagged(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), SystemsTest::testProjectCubeWithMeshFunction(), libMesh::MeshTools::total_weight(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBEIMConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::RBEvaluation::write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::TransientRBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::RBEIMEvaluationSerialization::write_to_file(), and libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file().

88  { return _communicator; }
const Parallel::Communicator & _communicator
Real TransientRBEvaluation::compute_residual_dual_norm ( const unsigned int  N)
virtual

Compute the dual norm of the residual for the solution saved in RB_solution.

This function uses the cached time-independent data.

Reimplemented from libMesh::RBEvaluation.

Definition at line 551 of file transient_rb_evaluation.C.

References std::abs(), cached_Aq_Aq_matrix, cached_Aq_Mq_matrix, cached_Fq_Aq_vector, cached_Fq_Mq_vector, cached_Fq_term, cached_Mq_Mq_matrix, libMesh::DenseVector< T >::dot(), libMesh::RBTemporalDiscretization::get_control(), libMesh::RBTemporalDiscretization::get_delta_t(), libMesh::RBTemporalDiscretization::get_euler_theta(), libMesh::RBTemporalDiscretization::get_time_step(), libMesh::libmesh_real(), old_RB_solution, libMesh::out, libMesh::RBEvaluation::RB_solution, and libMesh::Real.

Referenced by rb_solve().

552 {
553  LOG_SCOPE("compute_residual_dual_norm()", "TransientRBEvaluation");
554 
555  // This assembly assumes we have already called cache_online_residual_terms
556  // and that the rb_solve parameter is constant in time
557 
558  const Real dt = get_delta_t();
559  const Real euler_theta = get_euler_theta();
560  const Real current_control = get_control(get_time_step());
561 
562  DenseVector<Number> RB_u_euler_theta(N);
563  DenseVector<Number> mass_coeffs(N);
564  for (unsigned int i=0; i<N; i++)
565  {
566  RB_u_euler_theta(i) = euler_theta*RB_solution(i) +
567  (1.-euler_theta)*old_RB_solution(i);
568  mass_coeffs(i) = -(RB_solution(i) - old_RB_solution(i))/dt;
569  }
570 
571  Number residual_norm_sq = current_control*current_control*cached_Fq_term;
572 
573  residual_norm_sq += current_control*RB_u_euler_theta.dot(cached_Fq_Aq_vector);
574  residual_norm_sq += current_control*mass_coeffs.dot(cached_Fq_Mq_vector);
575 
576  for (unsigned int i=0; i<N; i++)
577  for (unsigned int j=0; j<N; j++)
578  {
579  residual_norm_sq += RB_u_euler_theta(i)*RB_u_euler_theta(j)*cached_Aq_Aq_matrix(i,j);
580  residual_norm_sq += mass_coeffs(i)*mass_coeffs(j)*cached_Mq_Mq_matrix(i,j);
581  residual_norm_sq += RB_u_euler_theta(i)*mass_coeffs(j)*cached_Aq_Mq_matrix(i,j);
582  }
583 
584 
585  if (libmesh_real(residual_norm_sq) < 0)
586  {
587  libMesh::out << "Warning: Square of residual norm is negative "
588  << "in TransientRBEvaluation::compute_residual_dual_norm()" << std::endl;
589 
590  // Sometimes this is negative due to rounding error,
591  // but error is on the order of 1.e-10, so shouldn't
592  // affect result
593  residual_norm_sq = std::abs(residual_norm_sq);
594  }
595 
596  return libmesh_real(std::sqrt( residual_norm_sq ));
597 }
T libmesh_real(T a)
double abs(double a)
DenseVector< Number > RB_solution
The RB solution vector.
Number cached_Fq_term
Cached residual terms.
DenseVector< Number > old_RB_solution
The RB solution at the previous time-level.
Real get_euler_theta() const
Get/set euler_theta, parameter that determines the temporal discretization.
Real get_control(const unsigned int k) const
Get/set the RHS control.
Real get_delta_t() const
Get/set delta_t, the time-step size.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int get_time_step() const
Get/set the current time-step.
OStreamProxy out
void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 107 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

Referenced by libMesh::LibMeshInit::LibMeshInit(), and libMesh::ReferenceCounter::n_objects().

108 {
109  _enable_print_counter = false;
110  return;
111 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...
void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info()

Definition at line 101 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

Referenced by libMesh::ReferenceCounter::n_objects().

102 {
103  _enable_print_counter = true;
104  return;
105 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...
Real libMesh::RBEvaluation::eval_output_dual_norm ( unsigned int  n,
const RBParameters mu 
)
inherited

Evaluate the dual norm of output n for the current parameters.

Definition at line 393 of file rb_evaluation.C.

References libMesh::RBThetaExpansion::eval_output_theta(), libMesh::RBThetaExpansion::get_n_output_terms(), libMesh::libmesh_conj(), libMesh::libmesh_real(), libMesh::RBEvaluation::output_dual_innerprods, libMesh::RBEvaluation::rb_theta_expansion, and libMesh::Real.

Referenced by rb_solve(), and libMesh::RBEvaluation::rb_solve().

394 {
395  Number output_bound_sq = 0.;
396  unsigned int q=0;
397  for (unsigned int q_l1=0; q_l1<rb_theta_expansion->get_n_output_terms(n); q_l1++)
398  {
399  for (unsigned int q_l2=q_l1; q_l2<rb_theta_expansion->get_n_output_terms(n); q_l2++)
400  {
401  Real delta = (q_l1==q_l2) ? 1. : 2.;
402  output_bound_sq += delta * libmesh_real(
405  q++;
406  }
407  }
408 
409  return libmesh_real(std::sqrt( output_bound_sq ));
410 }
T libmesh_real(T a)
T libmesh_conj(T a)
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
std::vector< std::vector< Number > > output_dual_innerprods
The vector storing the dual norm inner product terms for each output.
virtual Number eval_output_theta(unsigned int output_index, unsigned int q_l, const RBParameters &mu)
Evaluate theta_q_l at the current parameter.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
NumericVector< Number > & libMesh::RBEvaluation::get_basis_function ( unsigned int  i)
inherited
Real libMesh::RBParametrized::get_closest_value ( Real  value,
const std::vector< Real > &  list_of_values 
)
staticinherited
Returns
The closest entry to value from list_of_values.

Definition at line 464 of file rb_parametrized.C.

References std::abs(), distance(), std::max(), and libMesh::Real.

Referenced by libMesh::RBConstructionBase< Base >::initialize_training_parameters(), and libMesh::RBParametrized::is_value_in_list().

465 {
466  if (list_of_values.empty())
467  libmesh_error_msg("Error: list_of_values is empty.");
468 
469  std::vector<Real>::const_iterator it = list_of_values.begin();
470  std::vector<Real>::const_iterator it_end = list_of_values.end();
471 
472  Real min_distance = std::numeric_limits<Real>::max();
473  Real closest_val = 0.;
474  for ( ; it != it_end; ++it)
475  {
476  Real distance = std::abs(value - *it);
477  if (distance < min_distance)
478  {
479  min_distance = distance;
480  closest_val = *it;
481  }
482  }
483 
484  return closest_val;
485 }
double abs(double a)
long double max(long double a, double b)
Real distance(const Point &p)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const bool value
Definition: xdr_io.C:108
Real libMesh::RBTemporalDiscretization::get_control ( const unsigned int  k) const
inherited

Get/set the RHS control.

Definition at line 79 of file rb_temporal_discretization.C.

References libMesh::RBTemporalDiscretization::_control, and libMesh::RBTemporalDiscretization::get_n_time_steps().

Referenced by compute_residual_dual_norm(), rb_solve(), rb_solve_again(), and libMesh::TransientRBConstruction::truth_assembly().

80 {
81  libmesh_assert_less_equal (k, get_n_time_steps());
82  return _control[k];
83 }
std::vector< Real > _control
The RHS control (scalar function of time).
unsigned int get_n_time_steps() const
Get/set the total number of time-steps.
Real libMesh::RBTemporalDiscretization::get_delta_t ( ) const
inherited
const std::map< std::string, std::vector< Real > > & libMesh::RBParametrized::get_discrete_parameter_values ( ) const
inherited

Get a const reference to the discrete parameter values.

Definition at line 403 of file rb_parametrized.C.

References libMesh::RBParametrized::_discrete_parameter_values, and libMesh::RBParametrized::parameters_initialized.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBParametrized::get_n_discrete_params(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBConstructionBase< Base >::initialize_training_parameters(), libMesh::RBParametrized::print_discrete_parameter_values(), libMesh::RBParametrized::valid_params(), and libMesh::RBParametrized::write_discrete_parameter_values_to_file().

404 {
406  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_discrete_parameter_values");
407 
409 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
std::map< std::string, std::vector< Real > > _discrete_parameter_values
Map that defines the allowable values of any discrete parameters.
Real TransientRBEvaluation::get_error_bound_normalization ( )
virtual
Returns
A scaling factor that we can use to provide a consistent scaling of the RB error bound across different parameter values.

Reimplemented from libMesh::RBEvaluation.

Definition at line 415 of file transient_rb_evaluation.C.

416 {
417  // Just set the normalization factor to 1 in this case.
418  // Users can override this method if specific behavior
419  // is required.
420 
421  return 1.;
422 }
Real libMesh::RBTemporalDiscretization::get_euler_theta ( ) const
inherited
std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().

Referenced by libMesh::ReferenceCounter::print_info().

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (Counts::iterator it = _counts.begin();
59  it != _counts.end(); ++it)
60  {
61  const std::string name(it->first);
62  const unsigned int creations = it->second.first;
63  const unsigned int destructions = it->second.second;
64 
65  oss << "| " << name << " reference count information:\n"
66  << "| Creations: " << creations << '\n'
67  << "| Destructions: " << destructions << '\n';
68  }
69 
70  oss << " ---------------------------------------------------------------------------- \n";
71 
72  return oss.str();
73 
74 #else
75 
76  return "";
77 
78 #endif
79 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:39
static Counts _counts
Actually holds the data.
virtual unsigned int libMesh::RBEvaluation::get_n_basis_functions ( ) const
virtualinherited

Get the current number of basis functions.

Definition at line 146 of file rb_evaluation.h.

References libMesh::RBEvaluation::basis_functions.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder(), libMesh::RBDataSerialization::add_rb_evaluation_data_to_builder(), libMesh::RBDataSerialization::add_transient_rb_evaluation_data_to_builder(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::RBEIMConstruction::compute_best_fit_error(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::RBConstruction::enrich_RB_space(), libMesh::RBEIMTheta::evaluate(), libMesh::RBEIMConstruction::initialize_eim_assembly_objects(), libMesh::RBEIMEvaluation::initialize_eim_theta_objects(), libMesh::RBEIMEvaluation::legacy_read_in_interpolation_points_elem(), legacy_read_offline_data_from_files(), libMesh::RBEIMEvaluation::legacy_read_offline_data_from_files(), legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBDataDeserialization::load_rb_eim_evaluation_data(), libMesh::RBEIMConstruction::load_rb_solution(), libMesh::RBConstruction::load_rb_solution(), libMesh::TransientRBConstruction::load_rb_solution(), libMesh::RBConstruction::print_basis_function_orthogonality(), rb_solve(), libMesh::RBEvaluation::rb_solve(), libMesh::RBEIMEvaluation::rb_solve(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::recompute_all_residual_terms(), libMesh::RBEvaluation::resize_data_structures(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::RBConstruction::train_reduced_basis(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBEIMConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), and libMesh::RBConstruction::write_riesz_representors_to_files().

147  { return cast_int<unsigned int>(basis_functions.size()); }
std::vector< NumericVector< Number > * > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
unsigned int libMesh::RBParametrized::get_n_continuous_params ( ) const
inherited

Get the number of continuous parameters.

Definition at line 133 of file rb_parametrized.C.

References libMesh::RBParametrized::get_n_discrete_params(), libMesh::RBParametrized::get_n_params(), libMesh::libmesh_assert(), and libMesh::RBParametrized::parameters_initialized.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

134 {
136  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_n_continuous_params");
137 
139 
140  return static_cast<unsigned int>(get_n_params() - get_n_discrete_params());
141 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
unsigned int get_n_params() const
Get the number of parameters.
libmesh_assert(j)
unsigned int get_n_discrete_params() const
Get the number of discrete parameters.
unsigned int libMesh::RBParametrized::get_n_discrete_params ( ) const
inherited

Get the number of discrete parameters.

Definition at line 143 of file rb_parametrized.C.

References libMesh::RBParametrized::get_discrete_parameter_values(), and libMesh::RBParametrized::parameters_initialized.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBParametrized::get_n_continuous_params(), libMesh::RBConstructionBase< Base >::initialize_training_parameters(), and libMesh::RBParametrized::write_discrete_parameter_values_to_file().

144 {
146  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_n_discrete_params");
147 
148  return cast_int<unsigned int>
150 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values() const
Get a const reference to the discrete parameter values.
unsigned int libMesh::RBParametrized::get_n_params ( ) const
inherited

Get the number of parameters.

Definition at line 123 of file rb_parametrized.C.

References libMesh::RBParameters::n_parameters(), libMesh::RBParametrized::parameters_initialized, libMesh::RBParametrized::parameters_max, and libMesh::RBParametrized::parameters_min.

Referenced by libMesh::RBConstruction::compute_max_error_bound(), libMesh::RBEIMTheta::evaluate(), libMesh::RBParametrized::get_n_continuous_params(), libMesh::RBConstructionBase< Base >::load_training_set(), libMesh::RBSCMConstruction::print_info(), libMesh::RBConstruction::print_info(), and libMesh::RBParametrized::valid_params().

124 {
126  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_n_params");
127 
128  libmesh_assert_equal_to ( parameters_min.n_parameters(), parameters_max.n_parameters() );
129 
130  return parameters_min.n_parameters();
131 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
unsigned int n_parameters() const
Get the number of parameters that have been added.
Definition: rb_parameters.C:62
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
unsigned int libMesh::RBTemporalDiscretization::get_n_time_steps ( ) const
inherited
Real libMesh::RBParametrized::get_parameter_max ( const std::string &  param_name) const
inherited

Get maximum allowable value of parameter param_name.

Definition at line 206 of file rb_parametrized.C.

References libMesh::RBParameters::get_value(), libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::parameters_max.

Referenced by libMesh::RBSCMConstruction::print_info(), libMesh::RBConstruction::print_info(), and libMesh::RBParametrized::valid_params().

207 {
209  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameter_max");
210 
211  return parameters_max.get_value(param_name);
212 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
Real get_value(const std::string &param_name) const
Get the value of the specific parameter.
Definition: rb_parameters.C:45
Real libMesh::RBParametrized::get_parameter_min ( const std::string &  param_name) const
inherited

Get minimum allowable value of parameter param_name.

Definition at line 198 of file rb_parametrized.C.

References libMesh::RBParameters::get_value(), libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::parameters_min.

Referenced by libMesh::RBSCMConstruction::print_info(), libMesh::RBConstruction::print_info(), and libMesh::RBParametrized::valid_params().

199 {
201  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameter_min");
202 
203  return parameters_min.get_value(param_name);
204 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
Real get_value(const std::string &param_name) const
Get the value of the specific parameter.
Definition: rb_parameters.C:45
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
std::set< std::string > libMesh::RBParametrized::get_parameter_names ( ) const
inherited

Get a set that stores the parameter names.

Definition at line 152 of file rb_parametrized.C.

References libMesh::RBParameters::get_parameter_names(), libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::parameters_min.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder().

153 {
155  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameter_names");
156 
157  std::set<std::string> parameter_names;
158  parameters_min.get_parameter_names(parameter_names);
159 
160  return parameter_names;
161 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
void get_parameter_names(std::set< std::string > &param_names) const
Fill param_names with the names of the parameters.
Definition: rb_parameters.C:68
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
const RBParameters & libMesh::RBParametrized::get_parameters ( ) const
inherited

Get the current parameters.

Definition at line 174 of file rb_parametrized.C.

References libMesh::RBParametrized::parameters, and libMesh::RBParametrized::parameters_initialized.

Referenced by libMesh::TransientRBConstruction::add_scaled_mass_matrix(), libMesh::RBConstructionBase< Base >::broadcast_parameters(), cache_online_residual_terms(), libMesh::RBEIMConstruction::compute_best_fit_error(), libMesh::RBEvaluation::compute_residual_dual_norm(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBSCMConstruction::enrich_C_J(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::RBEIMTheta::evaluate(), libMesh::RBEIMEvaluation::evaluate_parametrized_function(), libMesh::RBSCMConstruction::evaluate_stability_constant(), libMesh::RBConstruction::get_RB_error_bound(), libMesh::RBSCMEvaluation::get_SCM_LB(), libMesh::RBSCMEvaluation::get_SCM_UB(), SimpleRBEvaluation::get_stability_lower_bound(), libMesh::RBConstruction::greedy_termination_test(), libMesh::RBSCMEvaluation::legacy_read_offline_data_from_files(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::RBSCMConstruction::print_info(), libMesh::RBConstruction::print_info(), libMesh::RBParametrized::print_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), rb_solve(), libMesh::RBEvaluation::rb_solve(), libMesh::RBEIMEvaluation::rb_solve(), libMesh::RBSCMEvaluation::save_current_parameters(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::truth_solve(), libMesh::RBEIMConstruction::truth_solve(), libMesh::RBConstruction::truth_solve(), uncached_compute_residual_dual_norm(), and libMesh::RBConstruction::update_greedy_param_list().

175 {
177  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_current_parameters");
178 
179  return parameters;
180 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
RBParameters parameters
Vector storing the current parameters.
const RBParameters & libMesh::RBParametrized::get_parameters_max ( ) const
inherited

Get an RBParameters object that specifies the maximum allowable value for each parameter.

Definition at line 190 of file rb_parametrized.C.

References libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::parameters_max.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBConstruction::set_rb_construction_parameters(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

191 {
193  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameters_max");
194 
195  return parameters_max;
196 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
const RBParameters & libMesh::RBParametrized::get_parameters_min ( ) const
inherited

Get an RBParameters object that specifies the minimum allowable value for each parameter.

Definition at line 182 of file rb_parametrized.C.

References libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::parameters_min.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBConstruction::set_rb_construction_parameters(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

183 {
185  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameters_min");
186 
187  return parameters_min;
188 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
RBThetaExpansion & libMesh::RBEvaluation::get_rb_theta_expansion ( )
inherited
Real libMesh::RBEvaluation::get_stability_lower_bound ( )
virtualinherited

Get a lower bound for the stability constant (e.g.

coercivity constant or inf-sup constant) at the current parameter value.

Reimplemented in SimpleRBEvaluation, SimpleRBEvaluation, SimpleRBEvaluation, SimpleRBEvaluation, SimpleRBEvaluation, and ElasticityRBEvaluation.

Definition at line 378 of file rb_evaluation.C.

Referenced by rb_solve(), and libMesh::RBEvaluation::rb_solve().

379 {
380  // Return a default value of 1, this function should
381  // be overloaded to specify a problem-dependent stability
382  // factor lower bound
383  return 1.;
384 }
unsigned int libMesh::RBTemporalDiscretization::get_time_step ( ) const
inherited
void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
protectedinherited

Increments the construction counter.

Should be called in the constructor of any derived class that will be reference counted.

Definition at line 185 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCounter::n_objects(), and libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

186 {
187  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
188  std::pair<unsigned int, unsigned int> & p = _counts[name];
189 
190  p.first++;
191 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:39
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:29
static Counts _counts
Actually holds the data.
void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
protectedinherited

Increments the destruction counter.

Should be called in the destructor of any derived class that will be reference counted.

Definition at line 198 of file reference_counter.h.

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCounter::n_objects(), and libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

199 {
200  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
201  std::pair<unsigned int, unsigned int> & p = _counts[name];
202 
203  p.second++;
204 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:39
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:29
static Counts _counts
Actually holds the data.
void libMesh::RBParametrized::initialize_parameters ( const RBParameters mu_min_in,
const RBParameters mu_max_in,
const std::map< std::string, std::vector< Real >> &  discrete_parameter_values 
)
inherited

Initialize the parameter ranges and set current_parameters.

Definition at line 60 of file rb_parametrized.C.

References libMesh::RBParametrized::_discrete_parameter_values, libMesh::RBParameters::begin(), libMesh::RBParameters::end(), libMesh::RBParameters::get_value(), libMesh::RBParameters::n_parameters(), libMesh::RBParametrized::parameters_initialized, libMesh::RBParametrized::parameters_max, libMesh::RBParametrized::parameters_min, libMesh::Real, libMesh::RBParametrized::set_parameters(), and libMesh::RBParameters::set_value().

Referenced by libMesh::RBParametrized::initialize_parameters(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBDataDeserialization::load_parameter_ranges(), libMesh::RBSCMConstruction::perform_SCM_greedy(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBParametrized::read_parameter_data_from_files(), libMesh::RBConstruction::set_rb_construction_parameters(), and libMesh::RBConstruction::train_reduced_basis().

63 {
64  // Check that the min/max vectors are valid
65  {
66  const std::string err_string = "Error: Invalid mu_min/mu_max in RBParameters constructor.";
67  bool valid_min_max = (mu_min_in.n_parameters() == mu_max_in.n_parameters());
68  if (!valid_min_max)
69  libmesh_error_msg(err_string);
70 
71  else
72  {
73  RBParameters::const_iterator it = mu_min_in.begin();
74  RBParameters::const_iterator it_end = mu_min_in.end();
75  for ( ; it != it_end; ++it)
76  {
77  std::string param_name = it->first;
78  if (mu_min_in.get_value(param_name) > mu_max_in.get_value(param_name))
79  libmesh_error_msg(err_string);
80  }
81  }
82  }
83 
84  parameters_min = mu_min_in;
85  parameters_max = mu_max_in;
86 
87  // Add in min/max values due to the discrete parameters
88  {
89  std::map<std::string, std::vector<Real>>::const_iterator it =
90  discrete_parameter_values.begin();
91  const std::map<std::string, std::vector<Real>>::const_iterator it_end =
92  discrete_parameter_values.end();
93  for ( ; it != it_end; ++it)
94  {
95  if (it->second.empty())
96  libmesh_error_msg("Error: List of discrete parameters for " << it->first << " is empty.");
97 
98  Real min_val = *std::min_element(it->second.begin(), it->second.end());
99  Real max_val = *std::max_element(it->second.begin(), it->second.end());
100 
101  libmesh_assert_less_equal(min_val,max_val);
102 
103  parameters_min.set_value(it->first, min_val);
104  parameters_max.set_value(it->first, max_val);
105  }
106 
107  _discrete_parameter_values = discrete_parameter_values;
108  }
109 
110  parameters_initialized = true;
111 
112  // Initialize the current parameters to parameters_min
114 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
void set_parameters(const RBParameters &params)
Set the current parameters to params.
std::map< std::string, std::vector< Real > > _discrete_parameter_values
Map that defines the allowable values of any discrete parameters.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void set_value(const std::string &param_name, Real value)
Set the value of the specified parameter.
Definition: rb_parameters.C:57
const_iterator begin() const
Get a constant iterator to beginning of this RBParameters object.
Definition: rb_parameters.C:80
std::map< std::string, Real >::const_iterator const_iterator
Definition: rb_parameters.h:57
void libMesh::RBParametrized::initialize_parameters ( const RBParametrized rb_parametrized)
inherited

Initialize the parameter ranges and set current_parameters.

Definition at line 116 of file rb_parametrized.C.

References libMesh::RBParametrized::get_discrete_parameter_values(), libMesh::RBParametrized::get_parameters_max(), libMesh::RBParametrized::get_parameters_min(), and libMesh::RBParametrized::initialize_parameters().

117 {
118  initialize_parameters(rb_parametrized.get_parameters_min(),
119  rb_parametrized.get_parameters_max(),
120  rb_parametrized.get_discrete_parameter_values());
121 }
void initialize_parameters(const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values)
Initialize the parameter ranges and set current_parameters.
bool libMesh::RBParametrized::is_discrete_parameter ( const std::string &  mu_name) const
inherited

Is parameter mu_name discrete?

Definition at line 395 of file rb_parametrized.C.

References libMesh::RBParametrized::_discrete_parameter_values, and libMesh::RBParametrized::parameters_initialized.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBConstructionBase< Base >::initialize_training_parameters(), libMesh::RBConstruction::print_info(), libMesh::RBParametrized::valid_params(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

396 {
398  libmesh_error_msg("Error: parameters not initialized in RBParametrized::is_discrete_parameter");
399 
400  return (_discrete_parameter_values.find(mu_name) != _discrete_parameter_values.end());
401 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
std::map< std::string, std::vector< Real > > _discrete_parameter_values
Map that defines the allowable values of any discrete parameters.
bool libMesh::RBEvaluation::is_rb_theta_expansion_initialized ( ) const
inherited
Returns
true if the theta expansion has been initialized.

Definition at line 97 of file rb_evaluation.C.

References libMesh::RBEvaluation::rb_theta_expansion.

Referenced by libMesh::RBEvaluation::get_rb_theta_expansion().

98 {
100  {
101  return true;
102  }
103  else
104  {
105  return false;
106  }
107 }
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
void TransientRBEvaluation::legacy_read_offline_data_from_files ( const std::string &  directory_name = "offline_data",
bool  read_error_bound_data = true,
const bool  read_binary_data = true 
)
virtual

Read in the saved Offline reduced basis data to initialize the system for Online solves.

Note
This is a legacy method, use RBDataSerialization instead.

Reimplemented from libMesh::RBEvaluation.

Definition at line 902 of file transient_rb_evaluation.C.

References Aq_Mq_representor_innerprods, libMesh::RBEvaluation::assert_file_exists(), libMesh::DECODE, Fq_Mq_representor_innerprods, libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBEvaluation::get_n_basis_functions(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::TransientRBThetaExpansion::get_n_M_terms(), libMesh::RBEvaluation::get_rb_theta_expansion(), initial_L2_error_all_N, libMesh::RBEvaluation::legacy_read_offline_data_from_files(), Mq_Mq_representor_innerprods, RB_initial_condition_all_N, RB_L2_matrix, RB_M_q_vector, libMesh::READ, libMesh::Real, libMesh::RBTemporalDiscretization::set_delta_t(), libMesh::RBTemporalDiscretization::set_euler_theta(), libMesh::RBTemporalDiscretization::set_n_time_steps(), libMesh::RBTemporalDiscretization::set_time_step(), and value.

905 {
906  LOG_SCOPE("legacy_read_offline_data_from_files()", "TransientRBEvaluation");
907 
909 
910  TransientRBThetaExpansion & trans_theta_expansion =
911  cast_ref<TransientRBThetaExpansion &>(get_rb_theta_expansion());
912  const unsigned int Q_m = trans_theta_expansion.get_n_M_terms();
913  const unsigned int Q_a = trans_theta_expansion.get_n_A_terms();
914  const unsigned int Q_f = trans_theta_expansion.get_n_F_terms();
915 
916  // First, find out how many basis functions we had when Greedy terminated
917  // This was set in RBSystem::read_offline_data_from_files
918  unsigned int n_bfs = this->get_n_basis_functions();
919 
920  // The reading mode: DECODE for binary, READ for ASCII
921  XdrMODE mode = read_binary_data ? DECODE : READ;
922 
923  // The suffix to use for all the files that are written out
924  const std::string suffix = read_binary_data ? ".xdr" : ".dat";
925 
926  // The string stream we'll use to make the file names
927  std::ostringstream file_name;
928 
929  // Write out the temporal discretization data
930  file_name.str("");
931  file_name << directory_name << "/temporal_discretization_data" << suffix;
932  assert_file_exists(file_name.str());
933 
934  Xdr temporal_discretization_data_in(file_name.str(), mode);
935 
936  Real real_value; unsigned int int_value;
937  temporal_discretization_data_in >> real_value; set_delta_t(real_value);
938  temporal_discretization_data_in >> real_value; set_euler_theta(real_value);
939  temporal_discretization_data_in >> int_value; set_n_time_steps(int_value);
940  temporal_discretization_data_in >> int_value; set_time_step(int_value);
941  temporal_discretization_data_in.close();
942 
943  file_name.str("");
944  file_name << directory_name << "/RB_L2_matrix" << suffix;
945  assert_file_exists(file_name.str());
946 
947  Xdr RB_L2_matrix_in(file_name.str(), mode);
948 
949  for (unsigned int i=0; i<n_bfs; i++)
950  {
951  for (unsigned int j=0; j<n_bfs; j++)
952  {
953  Number value;
954  RB_L2_matrix_in >> value;
955  RB_L2_matrix(i,j) = value;
956  }
957  }
958  RB_L2_matrix_in.close();
959 
960  // Read in the M_q matrices
961  for (unsigned int q_m=0; q_m<Q_m; q_m++)
962  {
963  file_name.str("");
964  file_name << directory_name << "/RB_M_";
965  file_name << std::setw(3)
966  << std::setprecision(0)
967  << std::setfill('0')
968  << std::right
969  << q_m;
970 
971  file_name << suffix;
972  assert_file_exists(file_name.str());
973 
974  Xdr RB_M_q_m_in(file_name.str(), mode);
975 
976  for (unsigned int i=0; i<n_bfs; i++)
977  {
978  for (unsigned int j=0; j<n_bfs; j++)
979  {
980  Number value;
981  RB_M_q_m_in >> value;
982  RB_M_q_vector[q_m](i,j) = value;
983  }
984  }
985  RB_M_q_m_in.close();
986  }
987 
988 
989  // Read in the initial condition data
990  // and the initial L2 error for all N
991  file_name.str("");
992  file_name << directory_name << "/initial_conditions" << suffix;
993  assert_file_exists(file_name.str());
994 
995  Xdr initial_conditions_in(file_name.str(), mode);
996 
997  file_name.str("");
998  file_name << directory_name << "/initial_L2_error" << suffix;
999  assert_file_exists(file_name.str());
1000 
1001  Xdr initial_L2_error_in(file_name.str(), mode);
1002 
1003  for (unsigned int i=0; i<n_bfs; i++)
1004  {
1005  initial_L2_error_in >> initial_L2_error_all_N[i];
1006  for (unsigned int j=0; j<=i; j++)
1007  {
1008  initial_conditions_in >> RB_initial_condition_all_N[i](j);
1009  }
1010  }
1011  initial_conditions_in.close();
1012  initial_L2_error_in.close();
1013 
1014 
1015  if (read_error_bound_data)
1016  {
1017  // Next read in the Fq_Mq representor norm data
1018  file_name.str("");
1019  file_name << directory_name << "/Fq_Mq_terms" << suffix;
1020  assert_file_exists(file_name.str());
1021 
1022  Xdr RB_Fq_Mq_terms_in(file_name.str(), mode);
1023 
1024  for (unsigned int q_f=0; q_f<Q_f; q_f++)
1025  {
1026  for (unsigned int q_m=0; q_m<Q_m; q_m++)
1027  {
1028  for (unsigned int i=0; i<n_bfs; i++)
1029  {
1030  RB_Fq_Mq_terms_in >> Fq_Mq_representor_innerprods[q_f][q_m][i];
1031  }
1032  }
1033  }
1034  RB_Fq_Mq_terms_in.close();
1035 
1036  // Next read in the Mq_Mq representor norm data
1037  file_name.str("");
1038  file_name << directory_name << "/Mq_Mq_terms" << suffix;
1039  assert_file_exists(file_name.str());
1040 
1041  Xdr RB_Mq_Mq_terms_in(file_name.str(), mode);
1042 
1043  unsigned int Q_m_hat = Q_m*(Q_m+1)/2;
1044  for (unsigned int q=0; q<Q_m_hat; q++)
1045  {
1046  for (unsigned int i=0; i<n_bfs; i++)
1047  {
1048  for (unsigned int j=0; j<n_bfs; j++)
1049  {
1050  RB_Mq_Mq_terms_in >> Mq_Mq_representor_innerprods[q][i][j];
1051  }
1052  }
1053  }
1054  RB_Mq_Mq_terms_in.close();
1055 
1056  // Next read in the Aq_Mq representor norm data
1057  file_name.str("");
1058  file_name << directory_name << "/Aq_Mq_terms" << suffix;
1059  assert_file_exists(file_name.str());
1060 
1061  Xdr RB_Aq_Mq_terms_in(file_name.str(), mode);
1062 
1063  for (unsigned int q_a=0; q_a<Q_a; q_a++)
1064  {
1065  for (unsigned int q_m=0; q_m<Q_m; q_m++)
1066  {
1067  for (unsigned int i=0; i<n_bfs; i++)
1068  {
1069  for (unsigned int j=0; j<n_bfs; j++)
1070  {
1071  RB_Aq_Mq_terms_in >> Aq_Mq_representor_innerprods[q_a][q_m][i][j];
1072  }
1073  }
1074  }
1075  }
1076  RB_Aq_Mq_terms_in.close();
1077  }
1078 }
std::vector< std::vector< std::vector< Number > > > Mq_Mq_representor_innerprods
std::vector< DenseMatrix< Number > > RB_M_q_vector
Dense matrices for the RB mass matrices.
std::vector< Real > initial_L2_error_all_N
Vector storing initial L2 error for all 1 <= N <= RB_size.
XdrMODE
Defines an enum for read/write mode in Xdr format.
Definition: enum_xdr_mode.h:32
virtual void legacy_read_offline_data_from_files(const std::string &directory_name="offline_data", bool read_error_bound_data=true, const bool read_binary_data=true)
Read in the saved Offline reduced basis data to initialize the system for Online solves.
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...
std::vector< DenseVector< Number > > RB_initial_condition_all_N
The RB initial conditions (i.e.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void assert_file_exists(const std::string &file_name)
Helper function that checks if file_name exists.
static const bool value
Definition: xdr_io.C:108
void set_euler_theta(const Real euler_theta_in)
std::vector< std::vector< std::vector< std::vector< Number > > > > Aq_Mq_representor_innerprods
void set_n_time_steps(const unsigned int K)
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
RBThetaExpansion & get_rb_theta_expansion()
Get a reference to the rb_theta_expansion.
Definition: rb_evaluation.C:89
DenseMatrix< Number > RB_L2_matrix
Dense RB L2 matrix.
void TransientRBEvaluation::legacy_write_offline_data_to_files ( const std::string &  directory_name = "offline_data",
const bool  write_binary_data = true 
)
virtual

Write out all the data to text files in order to segregate the Offline stage from the Online stage.

Note
This is a legacy method, use RBDataSerialization instead.

Reimplemented from libMesh::RBEvaluation.

Definition at line 750 of file transient_rb_evaluation.C.

References Aq_Mq_representor_innerprods, libMesh::ENCODE, Fq_Mq_representor_innerprods, libMesh::RBTemporalDiscretization::get_delta_t(), libMesh::RBTemporalDiscretization::get_euler_theta(), libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBEvaluation::get_n_basis_functions(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::TransientRBThetaExpansion::get_n_M_terms(), libMesh::RBTemporalDiscretization::get_n_time_steps(), libMesh::RBEvaluation::get_rb_theta_expansion(), libMesh::RBTemporalDiscretization::get_time_step(), initial_L2_error_all_N, libMesh::RBEvaluation::legacy_write_offline_data_to_files(), Mq_Mq_representor_innerprods, libMesh::ParallelObject::processor_id(), RB_initial_condition_all_N, RB_L2_matrix, RB_M_q_vector, libMesh::Real, and libMesh::WRITE.

752 {
753  LOG_SCOPE("legacy_write_offline_data_to_files()", "TransientRBEvaluation");
754 
756 
757  TransientRBThetaExpansion & trans_theta_expansion =
758  cast_ref<TransientRBThetaExpansion &>(get_rb_theta_expansion());
759  const unsigned int Q_m = trans_theta_expansion.get_n_M_terms();
760  const unsigned int Q_a = trans_theta_expansion.get_n_A_terms();
761  const unsigned int Q_f = trans_theta_expansion.get_n_F_terms();
762 
763  const unsigned int n_bfs = get_n_basis_functions();
764 
765  // The writing mode: ENCODE for binary, WRITE for ASCII
766  XdrMODE mode = write_binary_data ? ENCODE : WRITE;
767 
768  // The suffix to use for all the files that are written out
769  const std::string suffix = write_binary_data ? ".xdr" : ".dat";
770 
771  if (this->processor_id() == 0)
772  {
773  std::ostringstream file_name;
774 
775  // Write out the temporal discretization data
776  file_name.str("");
777  file_name << directory_name << "/temporal_discretization_data" << suffix;
778  Xdr temporal_discretization_data_out(file_name.str(), mode);
779 
780  Real real_value; unsigned int int_value;
781  real_value = get_delta_t(); temporal_discretization_data_out << real_value;
782  real_value = get_euler_theta(); temporal_discretization_data_out << real_value;
783  int_value = get_n_time_steps(); temporal_discretization_data_out << int_value;
784  int_value = get_time_step(); temporal_discretization_data_out << int_value;
785  temporal_discretization_data_out.close();
786 
787 
788  // Write out the L2 matrix
789  file_name.str("");
790  file_name << directory_name << "/RB_L2_matrix" << suffix;
791  Xdr RB_L2_matrix_out(file_name.str(), mode);
792 
793  for (unsigned int i=0; i<n_bfs; i++)
794  {
795  for (unsigned int j=0; j<n_bfs; j++)
796  {
797  RB_L2_matrix_out << RB_L2_matrix(i,j);
798  }
799  }
800  RB_L2_matrix_out.close();
801 
802  // Write out the M_q matrices
803  for (unsigned int q_m=0; q_m<Q_m; q_m++)
804  {
805  file_name.str("");
806  file_name << directory_name << "/RB_M_";
807  file_name << std::setw(3)
808  << std::setprecision(0)
809  << std::setfill('0')
810  << std::right
811  << q_m;
812  file_name << suffix;
813  Xdr RB_M_q_m_out(file_name.str(), mode);
814 
815  for (unsigned int i=0; i<n_bfs; i++)
816  {
817  for (unsigned int j=0; j<n_bfs; j++)
818  {
819  RB_M_q_m_out << RB_M_q_vector[q_m](i,j);
820  }
821  }
822  RB_M_q_m_out.close();
823  }
824 
825  // Write out the initial condition data
826  // and the initial L2 error for all N
827  file_name.str("");
828  file_name << directory_name << "/initial_conditions" << suffix;
829  Xdr initial_conditions_out(file_name.str(), mode);
830  file_name.str("");
831  file_name << directory_name << "/initial_L2_error" << suffix;
832  Xdr initial_L2_error_out(file_name.str(), mode);
833 
834  for (unsigned int i=0; i<n_bfs; i++)
835  {
836  initial_L2_error_out << initial_L2_error_all_N[i];
837  for (unsigned int j=0; j<=i; j++)
838  {
839  initial_conditions_out << RB_initial_condition_all_N[i](j);
840  }
841  }
842  initial_conditions_out.close();
843  initial_L2_error_out.close();
844 
845  // Next write out the Fq_Mq representor norm data
846  file_name.str("");
847  file_name << directory_name << "/Fq_Mq_terms" << suffix;
848  Xdr RB_Fq_Mq_terms_out(file_name.str(), mode);
849 
850  for (unsigned int q_f=0; q_f<Q_f; q_f++)
851  {
852  for (unsigned int q_m=0; q_m<Q_m; q_m++)
853  {
854  for (unsigned int i=0; i<n_bfs; i++)
855  {
856  RB_Fq_Mq_terms_out << Fq_Mq_representor_innerprods[q_f][q_m][i];
857  }
858  }
859  }
860  RB_Fq_Mq_terms_out.close();
861 
862  // Next write out the Mq_Mq representor norm data
863  file_name.str("");
864  file_name << directory_name << "/Mq_Mq_terms" << suffix;
865  Xdr RB_Mq_Mq_terms_out(file_name.str(), mode);
866 
867  unsigned int Q_m_hat = Q_m*(Q_m+1)/2;
868  for (unsigned int q=0; q<Q_m_hat; q++)
869  {
870  for (unsigned int i=0; i<n_bfs; i++)
871  {
872  for (unsigned int j=0; j<n_bfs; j++)
873  {
874  RB_Mq_Mq_terms_out << Mq_Mq_representor_innerprods[q][i][j];
875  }
876  }
877  }
878  RB_Mq_Mq_terms_out.close();
879 
880  // Next write out the Aq_Mq representor norm data
881  file_name.str("");
882  file_name << directory_name << "/Aq_Mq_terms" << suffix;
883  Xdr RB_Aq_Mq_terms_out(file_name.str(), mode);
884 
885  for (unsigned int q_a=0; q_a<Q_a; q_a++)
886  {
887  for (unsigned int q_m=0; q_m<Q_m; q_m++)
888  {
889  for (unsigned int i=0; i<n_bfs; i++)
890  {
891  for (unsigned int j=0; j<n_bfs; j++)
892  {
893  RB_Aq_Mq_terms_out << Aq_Mq_representor_innerprods[q_a][q_m][i][j];
894  }
895  }
896  }
897  }
898  RB_Aq_Mq_terms_out.close();
899  }
900 }
std::vector< std::vector< std::vector< Number > > > Mq_Mq_representor_innerprods
std::vector< DenseMatrix< Number > > RB_M_q_vector
Dense matrices for the RB mass matrices.
Real get_euler_theta() const
Get/set euler_theta, parameter that determines the temporal discretization.
std::vector< Real > initial_L2_error_all_N
Vector storing initial L2 error for all 1 <= N <= RB_size.
XdrMODE
Defines an enum for read/write mode in Xdr format.
Definition: enum_xdr_mode.h:32
virtual void legacy_write_offline_data_to_files(const std::string &directory_name="offline_data", const bool write_binary_data=true)
Write out all the data to text files in order to segregate the Offline stage from the Online stage...
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...
std::vector< DenseVector< Number > > RB_initial_condition_all_N
The RB initial conditions (i.e.
Real get_delta_t() const
Get/set delta_t, the time-step size.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int get_time_step() const
Get/set the current time-step.
unsigned int get_n_time_steps() const
Get/set the total number of time-steps.
std::vector< std::vector< std::vector< std::vector< Number > > > > Aq_Mq_representor_innerprods
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
RBThetaExpansion & get_rb_theta_expansion()
Get a reference to the rb_theta_expansion.
Definition: rb_evaluation.C:89
DenseMatrix< Number > RB_L2_matrix
Dense RB L2 matrix.
processor_id_type processor_id() const
static unsigned int libMesh::ReferenceCounter::n_objects ( )
staticinherited
processor_id_type libMesh::ParallelObject::n_processors ( ) const
inherited
Returns
The number of processors in the group.

Definition at line 93 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::size().

Referenced by libMesh::ParmetisPartitioner::_do_repartition(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::DistributedMesh::add_elem(), libMesh::DistributedMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::MeshCommunication::broadcast(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::DistributedMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::MeshBase::get_info(), libMesh::EquationSystems::get_solution(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::SparseMatrix< T >::print(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Parallel::Sort< KeyType, IdxType >::sort(), WriteVecAndScalar::testWrite(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

94  { return cast_int<processor_id_type>(_communicator.size()); }
unsigned int size() const
Definition: parallel.h:726
const Parallel::Communicator & _communicator
void libMesh::RBParametrized::print_discrete_parameter_values ( ) const
inherited

Print out all the discrete parameter values.

Definition at line 411 of file rb_parametrized.C.

References libMesh::RBParametrized::get_discrete_parameter_values(), and libMesh::out.

Referenced by libMesh::RBSCMConstruction::print_info(), and libMesh::RBConstruction::print_info().

412 {
413  std::map<std::string, std::vector<Real>>::const_iterator it =
415  const std::map<std::string, std::vector<Real>>::const_iterator it_end =
417 
418  for ( ; it != it_end; ++it)
419  {
420  libMesh::out << "Discrete parameter " << it->first << ", values: ";
421 
422  std::vector<Real> values = it->second;
423  for (std::size_t i=0; i<values.size(); i++)
424  libMesh::out << values[i] << " ";
425  libMesh::out << std::endl;
426  }
427 }
OStreamProxy out
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values() const
Get a const reference to the discrete parameter values.
void libMesh::ReferenceCounter::print_info ( std::ostream &  out = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

Definition at line 88 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().

Referenced by libMesh::LibMeshInit::LibMeshInit().

89 {
91  out_stream << ReferenceCounter::get_info();
92 }
static std::string get_info()
Gets a string containing the reference information.
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...
void libMesh::RBParametrized::print_parameters ( ) const
inherited

Print the current parameters.

Definition at line 214 of file rb_parametrized.C.

References libMesh::RBParametrized::get_parameters(), libMesh::RBParametrized::parameters_initialized, and libMesh::RBParameters::print().

Referenced by libMesh::RBConstruction::train_reduced_basis().

215 {
217  libmesh_error_msg("Error: parameters not initialized in RBParametrized::print_current_parameters");
218 
219  get_parameters().print();
220 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
void print() const
Print the parameters.
const RBParameters & get_parameters() const
Get the current parameters.
void libMesh::RBTemporalDiscretization::process_temporal_parameters_file ( const std::string &  parameters_filename)
inherited

Read in and initialize parameters from parameters_filename.

Definition at line 93 of file rb_temporal_discretization.C.

References libMesh::RBTemporalDiscretization::get_delta_t(), libMesh::RBTemporalDiscretization::get_euler_theta(), libMesh::RBTemporalDiscretization::get_n_time_steps(), libMesh::Real, libMesh::RBTemporalDiscretization::set_delta_t(), libMesh::RBTemporalDiscretization::set_euler_theta(), libMesh::RBTemporalDiscretization::set_n_time_steps(), and libMesh::RBTemporalDiscretization::set_time_step().

Referenced by libMesh::TransientRBConstruction::process_parameters_file().

94 {
95  // Read in data from parameters_filename
96  GetPot infile(parameters_filename);
97 
98  // Read in parameters related to temporal discretization
99  unsigned int n_time_steps_in = infile("n_time_steps", get_n_time_steps());
100  const Real delta_t_in = infile("delta_t", get_delta_t());
101  const Real euler_theta_in = infile("euler_theta", get_euler_theta());
102 
103  // and set the relevant member variables
104  set_n_time_steps(n_time_steps_in);
105  set_delta_t(delta_t_in);
106  set_euler_theta(euler_theta_in);
107  set_time_step(0);
108 }
Real get_euler_theta() const
Get/set euler_theta, parameter that determines the temporal discretization.
Real get_delta_t() const
Get/set delta_t, the time-step size.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void set_euler_theta(const Real euler_theta_in)
unsigned int get_n_time_steps() const
Get/set the total number of time-steps.
void set_n_time_steps(const unsigned int K)
processor_id_type libMesh::ParallelObject::processor_id ( ) const
inherited
Returns
The rank of this processor in the group.

Definition at line 99 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::rank().

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::EquationSystems::_read_impl(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::MeshRefinement::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::MeshCommunication::broadcast(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::DofMap::build_sparsity(), libMesh::DistributedMesh::clear(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::DistributedMesh::delete_node(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMConstruction::evaluate_mesh_function(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::MeshBase::get_info(), libMesh::DofMap::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::EquationSystems::get_solution(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::SystemSubsetBySubdomain::init(), HeatSystem::init_data(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::DofMap::is_evaluable(), libMesh::SparsityPattern::Build::join(), legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_out_interpolation_points_elem(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DofMap::local_variable_indices(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::MetisPartitioner::partition_range(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::SparseMatrix< T >::print(), libMesh::NumericVector< T >::print_global(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), BoundaryInfoTest::testShellFaceConstraints(), WriteVecAndScalar::testWrite(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::MeshTools::weight(), libMesh::NameBasedIO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEvaluation::write_out_vectors(), write_output_solvedata(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().

100  { return cast_int<processor_id_type>(_communicator.rank()); }
const Parallel::Communicator & _communicator
unsigned int rank() const
Definition: parallel.h:724
void libMesh::RBTemporalDiscretization::pull_temporal_discretization_data ( RBTemporalDiscretization other)
inherited

Pull the temporal discretization data from other.

Definition at line 110 of file rb_temporal_discretization.C.

References libMesh::RBTemporalDiscretization::_control, libMesh::RBTemporalDiscretization::get_delta_t(), libMesh::RBTemporalDiscretization::get_euler_theta(), libMesh::RBTemporalDiscretization::get_n_time_steps(), libMesh::RBTemporalDiscretization::get_time_step(), libMesh::RBTemporalDiscretization::set_control(), libMesh::RBTemporalDiscretization::set_delta_t(), libMesh::RBTemporalDiscretization::set_euler_theta(), libMesh::RBTemporalDiscretization::set_n_time_steps(), and libMesh::RBTemporalDiscretization::set_time_step().

Referenced by libMesh::TransientRBConstruction::process_parameters_file().

111 {
112  this->set_delta_t( other.get_delta_t() );
113  this->set_euler_theta( other.get_euler_theta() );
114  this->set_n_time_steps( other.get_n_time_steps() );
115  this->set_time_step( other.get_time_step() );
116  this->set_control( other._control );
117 }
void set_euler_theta(const Real euler_theta_in)
void set_n_time_steps(const unsigned int K)
void set_control(const std::vector< Real > &control)
Real TransientRBEvaluation::rb_solve ( unsigned int  N)
virtual

Perform online solve for current_params with the N basis functions.

Overridden to perform a time-dependent solve.

Reimplemented from libMesh::RBEvaluation.

Definition at line 163 of file transient_rb_evaluation.C.

References _rb_solve_data_cached, libMesh::DenseVector< T >::add(), libMesh::DenseMatrix< T >::add(), cache_online_residual_terms(), compute_residual_dual_norm(), libMesh::DenseVector< T >::dot(), error_bound_all_k, libMesh::RBThetaExpansion::eval_A_theta(), libMesh::RBThetaExpansion::eval_F_theta(), libMesh::TransientRBThetaExpansion::eval_M_theta(), libMesh::RBEvaluation::eval_output_dual_norm(), libMesh::RBThetaExpansion::eval_output_theta(), libMesh::RBEvaluation::evaluate_RB_error_bound, libMesh::RBTemporalDiscretization::get_control(), libMesh::RBTemporalDiscretization::get_delta_t(), libMesh::RBTemporalDiscretization::get_euler_theta(), libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBEvaluation::get_n_basis_functions(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::TransientRBThetaExpansion::get_n_M_terms(), libMesh::RBThetaExpansion::get_n_output_terms(), libMesh::RBThetaExpansion::get_n_outputs(), libMesh::RBTemporalDiscretization::get_n_time_steps(), libMesh::RBParametrized::get_parameters(), libMesh::RBEvaluation::get_rb_theta_expansion(), libMesh::RBEvaluation::get_stability_lower_bound(), libMesh::RBTemporalDiscretization::get_time_step(), initial_L2_error_all_N, libMesh::DenseMatrix< T >::lu_solve(), old_RB_solution, std::pow(), libMesh::RBEvaluation::RB_Aq_vector, libMesh::RBEvaluation::RB_Fq_vector, RB_initial_condition_all_N, RB_LHS_matrix, RB_M_q_vector, RB_output_error_bounds_all_k, libMesh::RBEvaluation::RB_output_vectors, RB_outputs_all_k, RB_RHS_matrix, RB_RHS_save, libMesh::RBEvaluation::RB_solution, RB_temporal_solution_data, libMesh::Real, libMesh::RBEvaluation::residual_scaling_denom(), residual_scaling_numer(), libMesh::DenseVector< T >::resize(), libMesh::DenseMatrix< T >::resize(), libMesh::RBTemporalDiscretization::set_time_step(), libMesh::DenseMatrix< T >::vector_mult(), libMesh::DenseMatrix< T >::zero(), and libMesh::DenseVector< T >::zero().

164 {
165  LOG_SCOPE("rb_solve()", "TransientRBEvaluation");
166 
167  if (N > get_n_basis_functions())
168  libmesh_error_msg("ERROR: N cannot be larger than the number of basis functions in rb_solve");
169 
170  const RBParameters & mu = get_parameters();
171 
172  TransientRBThetaExpansion & trans_theta_expansion =
173  cast_ref<TransientRBThetaExpansion &>(get_rb_theta_expansion());
174  const unsigned int Q_m = trans_theta_expansion.get_n_M_terms();
175  const unsigned int Q_a = trans_theta_expansion.get_n_A_terms();
176  const unsigned int Q_f = trans_theta_expansion.get_n_F_terms();
177 
178  const unsigned int n_time_steps = get_n_time_steps();
179  const Real dt = get_delta_t();
180  const Real euler_theta = get_euler_theta();
181 
182  // Resize the RB and error bound vectors
183  error_bound_all_k.resize(n_time_steps+1);
184  RB_outputs_all_k.resize(trans_theta_expansion.get_n_outputs());
185  RB_output_error_bounds_all_k.resize(trans_theta_expansion.get_n_outputs());
186  for (unsigned int n=0; n<trans_theta_expansion.get_n_outputs(); n++)
187  {
188  RB_outputs_all_k[n].resize(n_time_steps+1, 0.);
189  RB_output_error_bounds_all_k[n].resize(n_time_steps+1, 0.);
190  }
191 
192  // First assemble the mass matrix
193  DenseMatrix<Number> RB_mass_matrix_N(N,N);
194  RB_mass_matrix_N.zero();
195  DenseMatrix<Number> RB_M_q_m;
196  for (unsigned int q_m=0; q_m<Q_m; q_m++)
197  {
198  RB_M_q_vector[q_m].get_principal_submatrix(N, RB_M_q_m);
199  RB_mass_matrix_N.add(trans_theta_expansion.eval_M_theta(q_m, mu), RB_M_q_m);
200  }
201 
202  RB_LHS_matrix.resize(N,N);
204 
205  RB_RHS_matrix.resize(N,N);
207 
208  RB_LHS_matrix.add(1./dt, RB_mass_matrix_N);
209  RB_RHS_matrix.add(1./dt, RB_mass_matrix_N);
210 
211  DenseMatrix<Number> RB_Aq_a;
212  for (unsigned int q_a=0; q_a<Q_a; q_a++)
213  {
214  RB_Aq_vector[q_a].get_principal_submatrix(N, RB_Aq_a);
215 
216  RB_LHS_matrix.add( euler_theta*trans_theta_expansion.eval_A_theta(q_a,mu), RB_Aq_a);
217  RB_RHS_matrix.add( -(1.-euler_theta)*trans_theta_expansion.eval_A_theta(q_a,mu), RB_Aq_a);
218  }
219 
220  // Add forcing terms
221  DenseVector<Number> RB_Fq_f;
222  RB_RHS_save.resize(N);
223  RB_RHS_save.zero();
224  for (unsigned int q_f=0; q_f<Q_f; q_f++)
225  {
226  RB_Fq_vector[q_f].get_principal_subvector(N, RB_Fq_f);
227  RB_RHS_save.add(trans_theta_expansion.eval_F_theta(q_f,mu), RB_Fq_f);
228  }
229 
230  // Set system time level to 0
231  set_time_step(0);
232 
233  // Resize/clear the solution vector
234  RB_solution.resize(N);
235 
236  // Load the initial condition into RB_solution
237  if (N > 0)
238  {
240  }
241 
242  // Resize/clear the old solution vector
244 
245  // Initialize the RB rhs
246  DenseVector<Number> RB_rhs(N);
247  RB_rhs.zero();
248 
249  // Initialize the vectors storing solution data
250  RB_temporal_solution_data.resize(n_time_steps+1);
251  for (unsigned int time_level=0; time_level<=n_time_steps; time_level++)
252  {
253  RB_temporal_solution_data[time_level].resize(N);
254  }
255  // and load the initial data
257 
258  // Set outputs at initial time
259  {
260  DenseVector<Number> RB_output_vector_N;
261  for (unsigned int n=0; n<trans_theta_expansion.get_n_outputs(); n++)
262  {
263  RB_outputs_all_k[n][0] = 0.;
264  for (unsigned int q_l=0; q_l<trans_theta_expansion.get_n_output_terms(n); q_l++)
265  {
266  RB_output_vectors[n][q_l].get_principal_subvector(N, RB_output_vector_N);
267  RB_outputs_all_k[n][0] += trans_theta_expansion.eval_output_theta(n,q_l,mu)*RB_output_vector_N.dot(RB_solution);
268  }
269  }
270  }
271 
272  // Initialize error bounds, if necessary
273  Real error_bound_sum = 0.;
274  Real alpha_LB = 0.;
276  {
277  if (N > 0)
278  {
279  error_bound_sum += pow( initial_L2_error_all_N[N-1], 2.);
280  }
281 
282  // Set error bound at the initial time
283  error_bound_all_k[get_time_step()] = std::sqrt(error_bound_sum);
284 
285  // Compute the outputs and associated error bounds at the initial time
286  DenseVector<Number> RB_output_vector_N;
287  for (unsigned int n=0; n<trans_theta_expansion.get_n_outputs(); n++)
288  {
289  RB_outputs_all_k[n][0] = 0.;
290  for (unsigned int q_l=0; q_l<trans_theta_expansion.get_n_output_terms(n); q_l++)
291  {
292  RB_output_vectors[n][q_l].get_principal_subvector(N, RB_output_vector_N);
293  RB_outputs_all_k[n][0] += trans_theta_expansion.eval_output_theta(n,q_l,mu)*RB_output_vector_N.dot(RB_solution);
294  }
295 
297  }
298 
299  alpha_LB = get_stability_lower_bound();
300 
301  // Precompute time-invariant parts of the dual norm of the residual.
303  }
304 
305  for (unsigned int time_level=1; time_level<=n_time_steps; time_level++)
306  {
307  set_time_step(time_level);
309 
310  // Compute RB_rhs, as RB_LHS_matrix x old_RB_solution
312 
313  // Add forcing terms
314  RB_rhs.add(get_control(time_level), RB_RHS_save);
315 
316  if (N > 0)
317  {
319  }
320 
321  // Save RB_solution for current time level
323 
324  // Evaluate outputs
325  DenseVector<Number> RB_output_vector_N;
326  for (unsigned int n=0; n<trans_theta_expansion.get_n_outputs(); n++)
327  {
328  RB_outputs_all_k[n][time_level] = 0.;
329  for (unsigned int q_l=0; q_l<trans_theta_expansion.get_n_output_terms(n); q_l++)
330  {
331  RB_output_vectors[n][q_l].get_principal_subvector(N, RB_output_vector_N);
332  RB_outputs_all_k[n][time_level] += trans_theta_expansion.eval_output_theta(n,q_l,mu)*
333  RB_output_vector_N.dot(RB_solution);
334  }
335  }
336 
337  // Calculate RB error bounds
339  {
340  // Evaluate the dual norm of the residual for RB_solution_vector
341  // Real epsilon_N = uncached_compute_residual_dual_norm(N);
342  Real epsilon_N = compute_residual_dual_norm(N);
343 
344  error_bound_sum += residual_scaling_numer(alpha_LB) * pow(epsilon_N, 2.);
345 
346  // store error bound at time-level _k
347  error_bound_all_k[time_level] = std::sqrt(error_bound_sum/residual_scaling_denom(alpha_LB));
348 
349  // Now evaluated output error bounds
350  for (unsigned int n=0; n<trans_theta_expansion.get_n_outputs(); n++)
351  {
352  RB_output_error_bounds_all_k[n][time_level] = error_bound_all_k[time_level] *
353  eval_output_dual_norm(n,mu);
354  }
355  }
356  }
357 
358  _rb_solve_data_cached = true ;
359 
360  if (evaluate_RB_error_bound) // Calculate the error bounds
361  {
362  return error_bound_all_k[n_time_steps];
363  }
364  else // Don't calculate the error bounds
365  {
366  // Just return -1. if we did not compute the error bound
367  return -1.;
368  }
369 }
bool evaluate_RB_error_bound
Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called...
boostcopy::enable_if_c< ScalarTraits< T2 >::value, void >::type add(const T2 factor, const DenseVector< T3 > &vec)
Adds factor times vec to this vector.
Definition: dense_vector.h:431
virtual void zero() libmesh_override
Set every element in the matrix to 0.
Definition: dense_matrix.h:792
DenseVector< Number > RB_solution
The RB solution vector.
DenseMatrix< Number > RB_LHS_matrix
Cached data for subsequent solves.
std::vector< DenseMatrix< Number > > RB_M_q_vector
Dense matrices for the RB mass matrices.
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:350
void cache_online_residual_terms(const unsigned int N)
Helper function for caching the terms in the online residual assembly that do not change in time...
virtual void zero() libmesh_override
Set every element in the vector to 0.
Definition: dense_vector.h:374
DenseVector< Number > old_RB_solution
The RB solution at the previous time-level.
virtual Real compute_residual_dual_norm(const unsigned int N) libmesh_override
Compute the dual norm of the residual for the solution saved in RB_solution.
Real get_euler_theta() const
Get/set euler_theta, parameter that determines the temporal discretization.
std::vector< DenseVector< Number > > RB_Fq_vector
Dense vector for the RHS.
bool _rb_solve_data_cached
Check that the data has been cached in case of using rb_solve_again.
std::vector< Real > initial_L2_error_all_N
Vector storing initial L2 error for all 1 <= N <= RB_size.
virtual Real get_stability_lower_bound()
Get a lower bound for the stability constant (e.g.
virtual Real residual_scaling_numer(Real alpha_LB)
Specifies the residual scaling on the numerator to be used in the a posteriori error bound...
Real get_control(const unsigned int k) const
Get/set the RHS control.
boostcopy::enable_if_c< ScalarTraits< T2 >::value, void >::type add(const T2 factor, const DenseMatrix< T3 > &mat)
Adds factor times mat to this matrix.
Definition: dense_matrix.h:883
std::vector< std::vector< Real > > RB_output_error_bounds_all_k
The error bounds for each RB output for all time-levels from the most recent rb_solve.
std::vector< Real > error_bound_all_k
The error bound data for all time-levels from the most recent rb_solve.
virtual Real residual_scaling_denom(Real alpha_LB)
Specifies the residual scaling on the denominator to be used in the a posteriori error bound...
double pow(double a, int b)
std::vector< DenseVector< Number > > RB_initial_condition_all_N
The RB initial conditions (i.e.
Real get_delta_t() const
Get/set delta_t, the time-step size.
std::vector< DenseMatrix< Number > > RB_Aq_vector
Dense matrices for the RB computations.
void lu_solve(const DenseVector< T > &b, DenseVector< T > &x)
Solve the system Ax=b given the input vector b.
Definition: dense_matrix.C:589
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int get_time_step() const
Get/set the current time-step.
Real eval_output_dual_norm(unsigned int n, const RBParameters &mu)
Evaluate the dual norm of output n for the current parameters.
std::vector< DenseVector< Number > > RB_temporal_solution_data
Array storing the solution data at each time level from the most recent solve.
void resize(const unsigned int new_m, const unsigned int new_n)
Resize the matrix.
Definition: dense_matrix.h:776
std::vector< std::vector< Number > > RB_outputs_all_k
The RB outputs for all time-levels from the most recent rb_solve.
unsigned int get_n_time_steps() const
Get/set the total number of time-steps.
const RBParameters & get_parameters() const
Get the current parameters.
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
void vector_mult(DenseVector< T > &dest, const DenseVector< T > &arg) const
Performs the matrix-vector multiplication, dest := (*this) * arg.
Definition: dense_matrix.C:382
RBThetaExpansion & get_rb_theta_expansion()
Get a reference to the rb_theta_expansion.
Definition: rb_evaluation.C:89
std::vector< std::vector< DenseVector< Number > > > RB_output_vectors
The vectors storing the RB output vectors.
Real TransientRBEvaluation::rb_solve_again ( )
virtual

If a solve has already been performed, then we cached some data and we can perform a new solve much more rapidly (with the same parameters but a possibly different initial condition/rhs control).

Definition at line 371 of file transient_rb_evaluation.C.

References _rb_solve_data_cached, libMesh::DenseVector< T >::add(), libMesh::RBTemporalDiscretization::get_control(), libMesh::RBTemporalDiscretization::get_n_time_steps(), libMesh::libmesh_assert(), libMesh::DenseMatrix< T >::lu_solve(), old_RB_solution, RB_initial_condition_all_N, RB_LHS_matrix, RB_RHS_matrix, RB_RHS_save, libMesh::RBEvaluation::RB_solution, libMesh::DenseVector< T >::resize(), libMesh::RBTemporalDiscretization::set_time_step(), libMesh::DenseVector< T >::size(), libMesh::DenseMatrix< T >::vector_mult(), and libMesh::DenseVector< T >::zero().

372 {
374 
375  const unsigned int n_time_steps = get_n_time_steps();
376  // Set system time level to 0
377  set_time_step(0);
378 
379  // Resize/clear the solution vector
380  const unsigned int N = RB_RHS_save.size();
381  RB_solution.resize(N);
382 
383  // Load the initial condition into RB_solution
384  if (N > 0)
386 
387  // Resize/clear the old solution vector
389 
390  // Initialize the RB rhs
391  DenseVector<Number> RB_rhs(N);
392  RB_rhs.zero();
393 
394  for (unsigned int time_level=1; time_level<=n_time_steps; time_level++)
395  {
396  set_time_step(time_level);
398 
399  // Compute RB_rhs, as *RB_lhs_matrix x old_RB_solution
401 
402  // Add forcing terms
403  RB_rhs.add(get_control(time_level), RB_RHS_save);
404 
405  if (N > 0)
407  }
408 
409  {
410  // Just return -1. We did not compute the error bound
411  return -1.;
412  }
413 }
DenseVector< Number > RB_solution
The RB solution vector.
DenseMatrix< Number > RB_LHS_matrix
Cached data for subsequent solves.
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:350
DenseVector< Number > old_RB_solution
The RB solution at the previous time-level.
virtual unsigned int size() const libmesh_override
Definition: dense_vector.h:87
libmesh_assert(j)
bool _rb_solve_data_cached
Check that the data has been cached in case of using rb_solve_again.
Real get_control(const unsigned int k) const
Get/set the RHS control.
std::vector< DenseVector< Number > > RB_initial_condition_all_N
The RB initial conditions (i.e.
void lu_solve(const DenseVector< T > &b, DenseVector< T > &x)
Solve the system Ax=b given the input vector b.
Definition: dense_matrix.C:589
unsigned int get_n_time_steps() const
Get/set the total number of time-steps.
void vector_mult(DenseVector< T > &dest, const DenseVector< T > &arg) const
Performs the matrix-vector multiplication, dest := (*this) * arg.
Definition: dense_matrix.C:382
void libMesh::RBEvaluation::read_in_basis_functions ( System sys,
const std::string &  directory_name = "offline_data",
const bool  read_binary_basis_functions = true 
)
virtualinherited

Read in all the basis functions from file.

Parameters
sysUsed for file IO.
directory_nameSpecifies which directory to write files to.
read_binary_basis_functionsIndicates whether to expect binary or ASCII data.

Definition at line 970 of file rb_evaluation.C.

References libMesh::RBEvaluation::basis_functions, and libMesh::RBEvaluation::read_in_vectors().

Referenced by libMesh::RBEvaluation::set_n_basis_functions().

973 {
974  LOG_SCOPE("read_in_basis_functions()", "RBEvaluation");
975 
978  directory_name,
979  "bf",
980  read_binary_basis_functions);
981 }
std::vector< NumericVector< Number > * > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
ImplicitSystem & sys
void read_in_vectors(System &sys, std::vector< NumericVector< Number > * > &vectors, const std::string &directory_name, const std::string &data_name, const bool read_binary_vectors)
Same as read_in_basis_functions, except in this case we pass in the vectors to be written...
void libMesh::RBEvaluation::read_in_vectors ( System sys,
std::vector< NumericVector< Number > * > &  vectors,
const std::string &  directory_name,
const std::string &  data_name,
const bool  read_binary_vectors 
)
inherited

Same as read_in_basis_functions, except in this case we pass in the vectors to be written.

We assume that the size of vectors indicates the number of vectors that need to be read in.

Definition at line 983 of file rb_evaluation.C.

References libMesh::RBEvaluation::read_in_vectors_from_multiple_files().

Referenced by libMesh::RBEvaluation::read_in_basis_functions(), and libMesh::RBEvaluation::set_n_basis_functions().

988 {
989  std::vector<std::vector<NumericVector<Number> *> *> vectors_vec;
990  vectors_vec.push_back(&vectors);
991 
992  std::vector<std::string> directory_name_vec;
993  directory_name_vec.push_back(directory_name);
994 
995  std::vector<std::string> data_name_vec;
996  data_name_vec.push_back(data_name);
997 
999  vectors_vec,
1000  directory_name_vec,
1001  data_name_vec,
1002  read_binary_vectors);
1003 }
ImplicitSystem & sys
void read_in_vectors_from_multiple_files(System &sys, std::vector< std::vector< NumericVector< Number > * > * > multiple_vectors, const std::vector< std::string > &multiple_directory_names, const std::vector< std::string > &multiple_data_names, const bool read_binary_vectors)
Performs read_in_vectors for a list of directory names and data names.
void libMesh::RBEvaluation::read_in_vectors_from_multiple_files ( System sys,
std::vector< std::vector< NumericVector< Number > * > * >  multiple_vectors,
const std::vector< std::string > &  multiple_directory_names,
const std::vector< std::string > &  multiple_data_names,
const bool  read_binary_vectors 
)
inherited

Performs read_in_vectors for a list of directory names and data names.

Reading in vectors requires us to renumber the dofs in a partition-independent way. This function only renumbers the dofs once at the start (and reverts it at the end), which can save a lot of work compared to renumbering on every read.

Definition at line 1005 of file rb_evaluation.C.

References libMesh::RBEvaluation::assert_file_exists(), libMesh::Parallel::Communicator::barrier(), libMesh::NumericVector< T >::build(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::DECODE, libMesh::MeshBase::fix_broken_node_and_element_numbering(), libMesh::System::get_mesh(), libMesh::MeshTools::Private::globally_renumber_nodes_and_elements(), libMesh::libmesh_assert(), libMesh::System::n_dofs(), libMesh::System::n_local_dofs(), libMesh::PARALLEL, libMesh::ParallelObject::processor_id(), libMesh::READ, libMesh::System::read_header(), and libMesh::System::read_serialized_vectors().

Referenced by libMesh::RBEvaluation::read_in_vectors(), and libMesh::RBEvaluation::set_n_basis_functions().

1010 {
1011  LOG_SCOPE("read_in_vectors_from_multiple_files()", "RBEvaluation");
1012 
1013  unsigned int n_files = multiple_vectors.size();
1014  unsigned int n_directories = multiple_directory_names.size();
1015  libmesh_assert((n_files == n_directories) && (n_files == multiple_data_names.size()));
1016 
1017  if (n_files == 0)
1018  return;
1019 
1020  // Make sure processors are synced up before we begin
1021  this->comm().barrier();
1022 
1023  std::ostringstream file_name;
1024  const std::string basis_function_suffix = (read_binary_vectors ? ".xdr" : ".dat");
1025 
1026  // Following EquationSystemsIO::read, we use a temporary numbering (node major)
1027  // before writing out the data. For the sake of efficiency, we do this once for
1028  // all the vectors that we read in.
1030 
1031  for (unsigned int data_index=0; data_index<n_directories; data_index++)
1032  {
1033  std::vector<NumericVector<Number> *> & vectors = *multiple_vectors[data_index];
1034 
1035  // Allocate storage for each vector
1036  for (std::size_t i=0; i<vectors.size(); i++)
1037  {
1038  // vectors should all be NULL, otherwise we get a memory leak when
1039  // we create the new vectors in RBEvaluation::read_in_vectors.
1040  if (vectors[i])
1041  libmesh_error_msg("Non-NULL vector passed to read_in_vectors_from_multiple_files");
1042 
1043  vectors[i] = NumericVector<Number>::build(sys.comm()).release();
1044 
1045  vectors[i]->init (sys.n_dofs(),
1046  sys.n_local_dofs(),
1047  false,
1048  PARALLEL);
1049  }
1050 
1051  file_name.str("");
1052  file_name << multiple_directory_names[data_index]
1053  << "/" << multiple_data_names[data_index]
1054  << "_data" << basis_function_suffix;
1055 
1056  // On processor zero check to be sure the file exists
1057  if (this->processor_id() == 0)
1058  {
1059  struct stat stat_info;
1060  int stat_result = stat(file_name.str().c_str(), &stat_info);
1061 
1062  if (stat_result != 0)
1063  libmesh_error_msg("File does not exist: " << file_name.str());
1064  }
1065 
1066  assert_file_exists(file_name.str());
1067  Xdr vector_data(file_name.str(),
1068  read_binary_vectors ? DECODE : READ);
1069 
1070  // Read the header data. This block of code is based on EquationSystems::_read_impl.
1071  {
1072  std::string version;
1073  vector_data.data(version);
1074 
1075  const std::string libMesh_label = "libMesh-";
1076  std::string::size_type lm_pos = version.find(libMesh_label);
1077  if (lm_pos==std::string::npos)
1078  {
1079  libmesh_error_msg("version info missing in Xdr header");
1080  }
1081 
1082  std::istringstream iss(version.substr(lm_pos + libMesh_label.size()));
1083  int ver_major = 0, ver_minor = 0, ver_patch = 0;
1084  char dot;
1085  iss >> ver_major >> dot >> ver_minor >> dot >> ver_patch;
1086  vector_data.set_version(LIBMESH_VERSION_ID(ver_major, ver_minor, ver_patch));
1087 
1088  // Actually read the header data. When we do this, set read_header=false
1089  // so taht we do not reinit sys, since we assume that it has already been
1090  // set up properly (e.g. the appropriate variables have already been added).
1091  sys.read_header(vector_data, version, /*read_header=*/false, /*read_additional_data=*/false);
1092  }
1093 
1094  sys.read_serialized_vectors (vector_data, vectors);
1095  }
1096 
1097  // Undo the temporary renumbering
1099 }
ImplicitSystem & sys
virtual void fix_broken_node_and_element_numbering()=0
There is no reason for a user to ever call this function.
libmesh_assert(j)
static UniquePtr< 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 MeshBase & get_mesh() const
Definition: system.h:2014
void read_header(Xdr &io, const std::string &version, const bool read_header=true, const bool read_additional_data=true, const bool read_legacy_format=false)
Reads the basic data header for this System.
Definition: system_io.C:115
void barrier() const
Pause execution until all processors reach a certain point.
void globally_renumber_nodes_and_elements(MeshBase &)
There is no reason for a user to ever call this function.
Definition: mesh_tools.C:1968
dof_id_type n_local_dofs() const
Definition: system.C:185
void assert_file_exists(const std::string &file_name)
Helper function that checks if file_name exists.
const Parallel::Communicator & comm() const
std::size_t read_serialized_vectors(Xdr &io, const std::vector< NumericVector< Number > * > &vectors) const
Read a number of identically distributed vectors.
Definition: system_io.C:2236
dof_id_type n_dofs() const
Definition: system.C:148
processor_id_type processor_id() const
void libMesh::RBParametrized::read_parameter_data_from_files ( const std::string &  continuous_param_file_name,
const std::string &  discrete_param_file_name,
const bool  read_binary_data 
)
inherited

Read in the parameter ranges from files.

Definition at line 301 of file rb_parametrized.C.

References libMesh::RBParametrized::initialize_parameters(), libMesh::RBParametrized::read_discrete_parameter_values_from_file(), and libMesh::RBParametrized::read_parameter_ranges_from_file().

Referenced by libMesh::RBEvaluation::legacy_read_offline_data_from_files(), and libMesh::RBSCMEvaluation::legacy_read_offline_data_from_files().

304 {
305  RBParameters param_min;
306  RBParameters param_max;
307  read_parameter_ranges_from_file(continuous_param_file_name,
308  read_binary_data,
309  param_min,
310  param_max);
311 
312  std::map<std::string, std::vector<Real>> discrete_parameter_values_in;
313  read_discrete_parameter_values_from_file(discrete_param_file_name,
314  read_binary_data,
315  discrete_parameter_values_in);
316 
317  initialize_parameters(param_min, param_max, discrete_parameter_values_in);
318 }
void read_parameter_ranges_from_file(const std::string &file_name, const bool read_binary, RBParameters &param_min, RBParameters &param_max)
Read in the parameter ranges from file.
void read_discrete_parameter_values_from_file(const std::string &file_name, const bool read_binary_data, std::map< std::string, std::vector< Real >> &discrete_parameter_values_in)
Read in the discrete parameter values from file, if we have any.
void initialize_parameters(const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values)
Initialize the parameter ranges and set current_parameters.
Real libMesh::RBEvaluation::residual_scaling_denom ( Real  alpha_LB)
virtualinherited

Specifies the residual scaling on the denominator to be used in the a posteriori error bound.

Override in subclass in order to obtain the desired error bound.

Definition at line 386 of file rb_evaluation.C.

Referenced by rb_solve(), and libMesh::RBEvaluation::rb_solve().

387 {
388  // Here we implement the residual scaling for a coercive
389  // problem.
390  return alpha_LB;
391 }
Real TransientRBEvaluation::residual_scaling_numer ( Real  alpha_LB)
virtual

Specifies the residual scaling on the numerator to be used in the a posteriori error bound.

Override in subclass in order to obtain the desired error bound.

Definition at line 424 of file transient_rb_evaluation.C.

References libMesh::RBTemporalDiscretization::get_delta_t().

Referenced by rb_solve().

425 {
426  return get_delta_t();
427 }
Real get_delta_t() const
Get/set delta_t, the time-step size.
void TransientRBEvaluation::resize_data_structures ( const unsigned int  Nmax,
bool  resize_error_bound_data = true 
)
virtual

Resize and clear the data vectors corresponding to the value of Nmax.

Optionally resize the data structures required for the error bound. Overridden to resize data relevant in the time-dependent case.

Reimplemented from libMesh::RBEvaluation.

Definition at line 77 of file transient_rb_evaluation.C.

References Aq_Mq_representor_innerprods, Fq_Mq_representor_innerprods, libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::TransientRBThetaExpansion::get_n_M_terms(), libMesh::RBEvaluation::get_rb_theta_expansion(), initial_L2_error_all_N, M_q_representor, Mq_Mq_representor_innerprods, RB_initial_condition_all_N, RB_L2_matrix, RB_LHS_matrix, RB_M_q_vector, RB_RHS_matrix, RB_RHS_save, libMesh::DenseVector< T >::resize(), libMesh::DenseMatrix< T >::resize(), and libMesh::RBEvaluation::resize_data_structures().

79 {
80  LOG_SCOPE("resize_data_structures()", "TransientRBEvaluation");
81 
82  Parent::resize_data_structures(Nmax, resize_error_bound_data);
83 
84  RB_L2_matrix.resize(Nmax,Nmax);
85  RB_LHS_matrix.resize(Nmax,Nmax);
86  RB_RHS_matrix.resize(Nmax,Nmax);
87  RB_RHS_save.resize(Nmax);
88 
89  TransientRBThetaExpansion & trans_theta_expansion =
90  cast_ref<TransientRBThetaExpansion &>(get_rb_theta_expansion());
91  const unsigned int Q_m = trans_theta_expansion.get_n_M_terms();
92  const unsigned int Q_a = trans_theta_expansion.get_n_A_terms();
93  const unsigned int Q_f = trans_theta_expansion.get_n_F_terms();
94 
95  // Allocate dense matrices for RB solves
96  RB_M_q_vector.resize(Q_m);
97  for (unsigned int q=0; q<Q_m; q++)
98  {
99  // Initialize the memory for the RB matrices
100  RB_M_q_vector[q].resize(Nmax,Nmax);
101  }
102 
103  // Initialize the initial condition storage
104  RB_initial_condition_all_N.resize(Nmax);
105  for (std::size_t i=0; i<RB_initial_condition_all_N.size(); i++)
106  {
107  // The i^th row holds a vector of lenght i+1
108  RB_initial_condition_all_N[i].resize(i+1);
109  }
110 
111  initial_L2_error_all_N.resize(Nmax, 0.);
112 
113 
114  if (resize_error_bound_data)
115  {
116  // Initialize vectors for the norms of the representors
117  Fq_Mq_representor_innerprods.resize(Q_f);
118  for (unsigned int i=0; i<Q_f; i++)
119  {
120  Fq_Mq_representor_innerprods[i].resize(Q_m);
121  for (unsigned int j=0; j<Q_m; j++)
122  {
123  Fq_Mq_representor_innerprods[i][j].resize(Nmax, 0.);
124  }
125  }
126 
127  unsigned int Q_m_hat = Q_m*(Q_m+1)/2;
128  Mq_Mq_representor_innerprods.resize(Q_m_hat);
129  for (unsigned int i=0; i<Q_m_hat; i++)
130  {
131  Mq_Mq_representor_innerprods[i].resize(Nmax);
132  for (unsigned int j=0; j<Nmax; j++)
133  {
134  Mq_Mq_representor_innerprods[i][j].resize(Nmax, 0.);
135  }
136  }
137 
138  Aq_Mq_representor_innerprods.resize(Q_a);
139  for (unsigned int i=0; i<Q_a; i++)
140  {
141  Aq_Mq_representor_innerprods[i].resize(Q_m);
142  for (unsigned int j=0; j<Q_m; j++)
143  {
144  Aq_Mq_representor_innerprods[i][j].resize(Nmax);
145  for (unsigned int k=0; k<Nmax; k++)
146  {
147  Aq_Mq_representor_innerprods[i][j][k].resize(Nmax, 0.);
148  }
149  }
150  }
151 
152  // Resize M_q_representor
153  // This is cleared in the call to clear_riesz_representors
154  // in Parent::resize_RB_data, so just resize here
155  M_q_representor.resize(Q_m);
156  for (unsigned int q_m=0; q_m<Q_m; q_m++)
157  {
158  M_q_representor[q_m].resize(Nmax);
159  }
160  }
161 }
std::vector< std::vector< std::vector< Number > > > Mq_Mq_representor_innerprods
virtual void resize_data_structures(const unsigned int Nmax, bool resize_error_bound_data=true)
Resize and clear the data vectors corresponding to the value of Nmax.
DenseMatrix< Number > RB_LHS_matrix
Cached data for subsequent solves.
std::vector< DenseMatrix< Number > > RB_M_q_vector
Dense matrices for the RB mass matrices.
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:350
std::vector< std::vector< NumericVector< Number > * > > M_q_representor
Vector storing the mass matrix representors.
std::vector< Real > initial_L2_error_all_N
Vector storing initial L2 error for all 1 <= N <= RB_size.
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...
std::vector< DenseVector< Number > > RB_initial_condition_all_N
The RB initial conditions (i.e.
void resize(const unsigned int new_m, const unsigned int new_n)
Resize the matrix.
Definition: dense_matrix.h:776
std::vector< std::vector< std::vector< std::vector< Number > > > > Aq_Mq_representor_innerprods
RBThetaExpansion & get_rb_theta_expansion()
Get a reference to the rb_theta_expansion.
Definition: rb_evaluation.C:89
DenseMatrix< Number > RB_L2_matrix
Dense RB L2 matrix.
void libMesh::RBTemporalDiscretization::set_control ( const std::vector< Real > &  control)
inherited

Definition at line 85 of file rb_temporal_discretization.C.

References libMesh::RBTemporalDiscretization::_control, and libMesh::RBTemporalDiscretization::_n_time_steps.

Referenced by libMesh::RBTemporalDiscretization::pull_temporal_discretization_data().

86 {
87  libmesh_assert_less_equal(control.size(),_n_time_steps+1);
88  _control = control;
89  // If the input vector is smaller than the number of time steps (+1), we complete it with zeros
90  _control.resize(_n_time_steps+1);
91 }
std::vector< Real > _control
The RHS control (scalar function of time).
unsigned int _n_time_steps
The number of time-steps.
void libMesh::RBTemporalDiscretization::set_delta_t ( const Real  delta_t_in)
inherited
void libMesh::RBTemporalDiscretization::set_euler_theta ( const Real  euler_theta_in)
inherited
virtual void libMesh::RBEvaluation::set_n_basis_functions ( unsigned int  n_bfs)
virtualinherited
void libMesh::RBTemporalDiscretization::set_n_time_steps ( const unsigned int  K)
inherited
void libMesh::RBParametrized::set_parameters ( const RBParameters params)
inherited

Set the current parameters to params.

Definition at line 163 of file rb_parametrized.C.

References libMesh::RBParametrized::parameters, libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::valid_params().

Referenced by libMesh::RBConstructionBase< Base >::broadcast_parameters(), libMesh::RBEIMConstruction::compute_best_fit_error(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::RBEIMTheta::evaluate(), libMesh::RBConstruction::get_RB_error_bound(), SimpleRBEvaluation::get_stability_lower_bound(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBSCMEvaluation::reload_current_parameters(), libMesh::RBSCMEvaluation::set_current_parameters_from_C_J(), libMesh::RBConstructionBase< Base >::set_params_from_training_set(), and libMesh::RBEIMConstruction::truth_solve().

164 {
166  libmesh_error_msg("Error: parameters not initialized in RBParametrized::set_current_parameters");
167 
168  valid_params(params); // Terminates if params has the wrong number of parameters
169 
170  // Make a copy of params (default assignment operator just does memberwise copy, which is sufficient here)
171  this->parameters = params;
172 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
bool valid_params(const RBParameters &params)
Helper function to check that params is valid.
RBParameters parameters
Vector storing the current parameters.
void libMesh::RBEvaluation::set_rb_theta_expansion ( RBThetaExpansion rb_theta_expansion_in)
inherited

Set the RBThetaExpansion object.

Definition at line 84 of file rb_evaluation.C.

References libMesh::RBEvaluation::rb_theta_expansion.

Referenced by libMesh::RBEIMEvaluation::RBEIMEvaluation(), and SimpleRBEvaluation::SimpleRBEvaluation().

85 {
86  rb_theta_expansion = &rb_theta_expansion_in;
87 }
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
void libMesh::RBTemporalDiscretization::set_time_step ( const unsigned int  k)
inherited
Real TransientRBEvaluation::uncached_compute_residual_dual_norm ( const unsigned int  N)
virtual

Compute the dual norm of the residual for the solution saved in RB_solution.

This function does not used the cached data and therefore also works when the parameter changes as a function of time.

Definition at line 599 of file transient_rb_evaluation.C.

References std::abs(), libMesh::RBEvaluation::Aq_Aq_representor_innerprods, Aq_Mq_representor_innerprods, libMesh::RBThetaExpansion::eval_A_theta(), libMesh::RBThetaExpansion::eval_F_theta(), libMesh::TransientRBThetaExpansion::eval_M_theta(), libMesh::RBEvaluation::Fq_Aq_representor_innerprods, Fq_Mq_representor_innerprods, libMesh::RBEvaluation::Fq_representor_innerprods, libMesh::RBTemporalDiscretization::get_delta_t(), libMesh::RBTemporalDiscretization::get_euler_theta(), libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::TransientRBThetaExpansion::get_n_M_terms(), libMesh::RBParametrized::get_parameters(), libMesh::RBEvaluation::get_rb_theta_expansion(), libMesh::libmesh_real(), Mq_Mq_representor_innerprods, old_RB_solution, libMesh::out, libMesh::RBEvaluation::RB_solution, and libMesh::Real.

600 {
601  LOG_SCOPE("uncached_compute_residual_dual_norm()", "TransientRBEvaluation");
602 
603  // Use the stored representor inner product values
604  // to evaluate the residual norm
605 
606  const RBParameters & mu = get_parameters();
607 
608  TransientRBThetaExpansion & trans_theta_expansion =
609  cast_ref<TransientRBThetaExpansion &>(get_rb_theta_expansion());
610  const unsigned int Q_m = trans_theta_expansion.get_n_M_terms();
611  const unsigned int Q_a = trans_theta_expansion.get_n_A_terms();
612  const unsigned int Q_f = trans_theta_expansion.get_n_F_terms();
613 
614  const Real dt = get_delta_t();
615  const Real euler_theta = get_euler_theta();
616 
617  std::vector<Number> RB_u_euler_theta(N);
618  std::vector<Number> mass_coeffs(N);
619  for (unsigned int i=0; i<N; i++)
620  {
621  RB_u_euler_theta[i] = euler_theta*RB_solution(i) +
622  (1.-euler_theta)*old_RB_solution(i);
623  mass_coeffs[i] = -(RB_solution(i) - old_RB_solution(i))/dt;
624  }
625 
626  Number residual_norm_sq = 0.;
627 
628  unsigned int q=0;
629  for (unsigned int q_f1=0; q_f1<Q_f; q_f1++)
630  {
631  Number cached_theta_q_f1 = trans_theta_expansion.eval_F_theta(q_f1,mu);
632  for (unsigned int q_f2=q_f1; q_f2<Q_f; q_f2++)
633  {
634  Real delta = (q_f1==q_f2) ? 1. : 2.;
635  residual_norm_sq += delta*cached_theta_q_f1*trans_theta_expansion.eval_F_theta(q_f2,mu) * Fq_representor_innerprods[q];
636 
637  q++;
638  }
639  }
640 
641  for (unsigned int q_f=0; q_f<Q_f; q_f++)
642  {
643  Number cached_theta_q_f = trans_theta_expansion.eval_F_theta(q_f,mu);
644  for (unsigned int q_a=0; q_a<Q_a; q_a++)
645  {
646  Number cached_theta_q_a = trans_theta_expansion.eval_A_theta(q_a,mu);
647  for (unsigned int i=0; i<N; i++)
648  {
649  residual_norm_sq += 2.*RB_u_euler_theta[i]*cached_theta_q_f*cached_theta_q_a*
650  Fq_Aq_representor_innerprods[q_f][q_a][i];
651  }
652  }
653  }
654 
655  q=0;
656  for (unsigned int q_a1=0; q_a1<Q_a; q_a1++)
657  {
658  Number cached_theta_q_a1 = trans_theta_expansion.eval_A_theta(q_a1,mu);
659  for (unsigned int q_a2=q_a1; q_a2<Q_a; q_a2++)
660  {
661  Number cached_theta_q_a2 = trans_theta_expansion.eval_A_theta(q_a2,mu);
662  Real delta = (q_a1==q_a2) ? 1. : 2.;
663 
664  for (unsigned int i=0; i<N; i++)
665  {
666  for (unsigned int j=0; j<N; j++)
667  {
668  residual_norm_sq += delta*RB_u_euler_theta[i]*RB_u_euler_theta[j]*
669  cached_theta_q_a1*cached_theta_q_a2*
671  }
672  }
673  q++;
674  }
675  }
676 
677  // Now add the terms due to the time-derivative
678  q=0;
679  for (unsigned int q_m1=0; q_m1<Q_m; q_m1++)
680  {
681  Number cached_theta_q_m1 = trans_theta_expansion.eval_M_theta(q_m1,mu);
682  for (unsigned int q_m2=q_m1; q_m2<Q_m; q_m2++)
683  {
684  Number cached_theta_q_m2 = trans_theta_expansion.eval_M_theta(q_m2,mu);
685  Real delta = (q_m1==q_m2) ? 1. : 2.;
686 
687  for (unsigned int i=0; i<N; i++)
688  {
689  for (unsigned int j=0; j<N; j++)
690  {
691  residual_norm_sq += delta*mass_coeffs[i]*mass_coeffs[j]*
692  cached_theta_q_m1*cached_theta_q_m2*
694  }
695  }
696  q++;
697  }
698  }
699 
700  for (unsigned int q_f=0; q_f<Q_f; q_f++)
701  {
702  Number cached_theta_q_f = trans_theta_expansion.eval_F_theta(q_f,mu);
703  for (unsigned int q_m=0; q_m<Q_m; q_m++)
704  {
705  Number cached_theta_q_m = trans_theta_expansion.eval_M_theta(q_m,mu);
706  for (unsigned int i=0; i<N; i++)
707  {
708  residual_norm_sq += 2.*mass_coeffs[i]*cached_theta_q_f * cached_theta_q_m * Fq_Mq_representor_innerprods[q_f][q_m][i];
709  }
710  }
711  }
712 
713  for (unsigned int q_a=0; q_a<Q_a; q_a++)
714  {
715  Number cached_theta_q_a = trans_theta_expansion.eval_A_theta(q_a,mu);
716 
717  for (unsigned int q_m=0; q_m<Q_m; q_m++)
718  {
719  Number cached_theta_q_m = trans_theta_expansion.eval_M_theta(q_m,mu);
720 
721  for (unsigned int i=0; i<N; i++)
722  {
723  for (unsigned int j=0; j<N; j++)
724  {
725  residual_norm_sq += 2.*RB_u_euler_theta[i]*mass_coeffs[j]*
726  cached_theta_q_a*cached_theta_q_m*
727  Aq_Mq_representor_innerprods[q_a][q_m][i][j];
728  }
729  }
730  }
731  }
732 
733  if (libmesh_real(residual_norm_sq) < 0)
734  {
735  libMesh::out << "Warning: Square of residual norm is negative "
736  << "in TransientRBEvaluation::compute_residual_dual_norm()" << std::endl;
737 
738  // Sometimes this is negative due to rounding error,
739  // but error is on the order of 1.e-10, so shouldn't
740  // affect result
741  residual_norm_sq = std::abs(residual_norm_sq);
742  }
743 
744  // libMesh::out << "slow residual_sq = " << slow_residual_norm_sq
745  // << ", fast residual_sq = " << residual_norm_sq << std::endl;
746 
747  return libmesh_real(std::sqrt( residual_norm_sq ));
748 }
T libmesh_real(T a)
std::vector< std::vector< std::vector< Number > > > Mq_Mq_representor_innerprods
double abs(double a)
std::vector< Number > Fq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
DenseVector< Number > RB_solution
The RB solution vector.
DenseVector< Number > old_RB_solution
The RB solution at the previous time-level.
Real get_euler_theta() const
Get/set euler_theta, parameter that determines the temporal discretization.
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...
std::vector< std::vector< std::vector< Number > > > Fq_Aq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
Real get_delta_t() const
Get/set delta_t, the time-step size.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
OStreamProxy out
std::vector< std::vector< std::vector< std::vector< Number > > > > Aq_Mq_representor_innerprods
const RBParameters & get_parameters() const
Get the current parameters.
RBThetaExpansion & get_rb_theta_expansion()
Get a reference to the rb_theta_expansion.
Definition: rb_evaluation.C:89
std::vector< std::vector< std::vector< Number > > > Aq_Aq_representor_innerprods
void libMesh::RBEvaluation::write_out_basis_functions ( System sys,
const std::string &  directory_name = "offline_data",
const bool  write_binary_basis_functions = true 
)
virtualinherited

Write out all the basis functions to file.

sys is used for file IO directory_name specifies which directory to write files to read_binary_basis_functions indicates whether to expect binary or ASCII data

Definition at line 900 of file rb_evaluation.C.

References libMesh::RBEvaluation::basis_functions, and libMesh::RBEvaluation::write_out_vectors().

Referenced by main(), and libMesh::RBEvaluation::set_n_basis_functions().

903 {
904  LOG_SCOPE("write_out_basis_functions()", "RBEvaluation");
905 
908  directory_name,
909  "bf",
910  write_binary_basis_functions);
911 }
std::vector< NumericVector< Number > * > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
ImplicitSystem & sys
virtual void write_out_vectors(System &sys, std::vector< NumericVector< Number > * > &vectors, const std::string &directory_name="offline_data", const std::string &data_name="bf", const bool write_binary_basis_functions=true)
Same as write_out_basis_functions, except in this case we pass in the vectors to be written...
void libMesh::RBEvaluation::write_out_vectors ( System sys,
std::vector< NumericVector< Number > * > &  vectors,
const std::string &  directory_name = "offline_data",
const std::string &  data_name = "bf",
const bool  write_binary_basis_functions = true 
)
virtualinherited

Same as write_out_basis_functions, except in this case we pass in the vectors to be written.

Definition at line 913 of file rb_evaluation.C.

References libMesh::Parallel::Communicator::barrier(), libMesh::ParallelObject::comm(), libMesh::ENCODE, libMesh::MeshBase::fix_broken_node_and_element_numbering(), libMesh::get_io_compatibility_version(), libMesh::System::get_mesh(), libMesh::MeshTools::Private::globally_renumber_nodes_and_elements(), libMesh::Utility::mkdir(), libMesh::ParallelObject::processor_id(), libMesh::WRITE, libMesh::System::write_header(), and libMesh::System::write_serialized_vectors().

Referenced by libMesh::RBEvaluation::set_n_basis_functions(), and libMesh::RBEvaluation::write_out_basis_functions().

918 {
919  LOG_SCOPE("write_out_vectors()", "RBEvaluation");
920 
921  if (this->processor_id() == 0)
922  {
923  // Make a directory to store all the data files
924  Utility::mkdir(directory_name.c_str());
925  }
926 
927  // Make sure processors are synced up before we begin
928  this->comm().barrier();
929 
930  std::ostringstream file_name;
931  const std::string basis_function_suffix = (write_binary_vectors ? ".xdr" : ".dat");
932 
933  file_name << directory_name << "/" << data_name << "_data" << basis_function_suffix;
934  Xdr bf_data(file_name.str(),
935  write_binary_vectors ? ENCODE : WRITE);
936 
937  std::string version("libMesh-" + libMesh::get_io_compatibility_version());
938 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
939  version += " with infinite elements";
940 #endif
941  bf_data.data(version ,"# File Format Identifier");
942 
943  sys.write_header(bf_data, /*(unused arg)*/ version, /*write_additional_data=*/false);
944 
945  // Following EquationSystemsIO::write, we use a temporary numbering (node major)
946  // before writing out the data
948 
949  // Write all vectors at once.
950  {
951  // Note the API wants pointers to constant vectors, hence this...
952  std::vector<const NumericVector<Number> *> bf_out(vectors.begin(),
953  vectors.end());
954  // for (std::size_t i=0; i<vectors.size(); i++)
955  // bf_out.push_back(vectors[i]);
956  sys.write_serialized_vectors (bf_data, bf_out);
957  }
958 
959 
960  // set the current version
961  bf_data.set_version(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION,
962  LIBMESH_MINOR_VERSION,
963  LIBMESH_MICRO_VERSION));
964 
965 
966  // Undo the temporary renumbering
968 }
ImplicitSystem & sys
virtual void fix_broken_node_and_element_numbering()=0
There is no reason for a user to ever call this function.
int mkdir(const char *pathname)
Create a directory.
Definition: utility.C:140
std::size_t write_serialized_vectors(Xdr &io, const std::vector< const NumericVector< Number > * > &vectors) const
Serialize & write a number of identically distributed vectors.
Definition: system_io.C:2330
const MeshBase & get_mesh() const
Definition: system.h:2014
void write_header(Xdr &io, const std::string &version, const bool write_additional_data) const
Writes the basic data header for this System.
Definition: system_io.C:1313
std::string get_io_compatibility_version()
Specifier for I/O file compatibility features.
void barrier() const
Pause execution until all processors reach a certain point.
void globally_renumber_nodes_and_elements(MeshBase &)
There is no reason for a user to ever call this function.
Definition: mesh_tools.C:1968
const Parallel::Communicator & comm() const
processor_id_type processor_id() const
void libMesh::RBParametrized::write_parameter_data_to_files ( const std::string &  continuous_param_file_name,
const std::string &  discrete_param_file_name,
const bool  write_binary_data 
)
inherited

Write out the parameter ranges to files.

Definition at line 222 of file rb_parametrized.C.

References libMesh::RBParametrized::write_discrete_parameter_values_to_file(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

Referenced by libMesh::RBEvaluation::legacy_write_offline_data_to_files(), and libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files().

225 {
226  write_parameter_ranges_to_file(continuous_param_file_name, write_binary_data);
227  write_discrete_parameter_values_to_file(discrete_param_file_name, write_binary_data);
228 }
void write_discrete_parameter_values_to_file(const std::string &file_name, const bool write_binary_data)
Write out the discrete parameter values to file.
void write_parameter_ranges_to_file(const std::string &file_name, const bool write_binary)
Write out the parameter ranges to file.

Member Data Documentation

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited
ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited
bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 143 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 137 of file reference_counter.h.

Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

The number of objects.

Print the reference count information when the number returns to 0.

Definition at line 132 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().

bool libMesh::TransientRBEvaluation::_rb_solve_data_cached

Check that the data has been cached in case of using rb_solve_again.

Definition at line 250 of file transient_rb_evaluation.h.

Referenced by rb_solve(), and rb_solve_again().

std::vector<std::vector<std::vector<Number> > > libMesh::RBEvaluation::Aq_Aq_representor_innerprods
inherited
std::vector<std::vector<std::vector<std::vector<Number> > > > libMesh::TransientRBEvaluation::Aq_Mq_representor_innerprods
std::vector<std::vector<NumericVector<Number> *> > libMesh::RBEvaluation::Aq_representor
inherited

Vector storing the residual representors associated with the left-hand side.

These are basis dependent and hence stored here, whereas the Fq_representors are stored in RBSystem.

Definition at line 317 of file rb_evaluation.h.

Referenced by libMesh::RBEvaluation::clear_riesz_representors(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::RBEvaluation::resize_data_structures(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), and libMesh::RBConstruction::write_riesz_representors_to_files().

std::vector<NumericVector<Number> *> libMesh::RBEvaluation::basis_functions
inherited
DenseMatrix<Number> libMesh::TransientRBEvaluation::cached_Aq_Aq_matrix
DenseMatrix<Number> libMesh::TransientRBEvaluation::cached_Aq_Mq_matrix
DenseVector<Number> libMesh::TransientRBEvaluation::cached_Fq_Aq_vector
DenseVector<Number> libMesh::TransientRBEvaluation::cached_Fq_Mq_vector
Number libMesh::TransientRBEvaluation::cached_Fq_term

Cached residual terms.

These can be used to accelerate residual calculations when we have an LTI system.

Definition at line 234 of file transient_rb_evaluation.h.

Referenced by cache_online_residual_terms(), and compute_residual_dual_norm().

DenseMatrix<Number> libMesh::TransientRBEvaluation::cached_Mq_Mq_matrix
bool libMesh::RBEvaluation::compute_RB_inner_product
inherited
std::vector<Real > libMesh::TransientRBEvaluation::error_bound_all_k

The error bound data for all time-levels from the most recent rb_solve.

Definition at line 207 of file transient_rb_evaluation.h.

Referenced by rb_solve().

bool libMesh::RBEvaluation::evaluate_RB_error_bound
inherited

Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called.

Definition at line 323 of file rb_evaluation.h.

Referenced by libMesh::RBEIMConstruction::compute_best_fit_error(), rb_solve(), libMesh::RBEvaluation::rb_solve(), and libMesh::RBEIMEvaluation::rb_solve().

std::vector<std::vector<std::vector<Number> > > libMesh::RBEvaluation::Fq_Aq_representor_innerprods
inherited

Vectors storing the residual representor inner products to be used in computing the residuals online.

We store the Aq-dependent representor inner products because they depend on a reduced basis space. The basis independent representors are stored in RBSystem.

Definition at line 300 of file rb_evaluation.h.

Referenced by libMesh::RBDataSerialization::add_rb_evaluation_data_to_builder(), cache_online_residual_terms(), libMesh::RBEvaluation::compute_residual_dual_norm(), libMesh::RBEvaluation::legacy_read_offline_data_from_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBDataDeserialization::load_rb_evaluation_data(), libMesh::RBEvaluation::resize_data_structures(), uncached_compute_residual_dual_norm(), and libMesh::RBConstruction::update_residual_terms().

std::vector<std::vector<std::vector<Number> > > libMesh::TransientRBEvaluation::Fq_Mq_representor_innerprods
std::vector<Number> libMesh::RBEvaluation::Fq_representor_innerprods
inherited
std::vector<RBParameters> libMesh::RBEvaluation::greedy_param_list
inherited
std::vector<Real> libMesh::TransientRBEvaluation::initial_L2_error_all_N
std::vector<std::vector<NumericVector<Number> * > > libMesh::TransientRBEvaluation::M_q_representor

Vector storing the mass matrix representors.

These are basis dependent and hence stored here.

Definition at line 245 of file transient_rb_evaluation.h.

Referenced by clear_riesz_representors(), resize_data_structures(), libMesh::TransientRBConstruction::update_residual_terms(), and libMesh::TransientRBConstruction::write_riesz_representors_to_files().

std::vector<std::vector<std::vector<Number> > > libMesh::TransientRBEvaluation::Mq_Mq_representor_innerprods
DenseVector<Number> libMesh::TransientRBEvaluation::old_RB_solution

The RB solution at the previous time-level.

Definition at line 196 of file transient_rb_evaluation.h.

Referenced by compute_residual_dual_norm(), rb_solve(), rb_solve_again(), and uncached_compute_residual_dual_norm().

std::vector<std::vector<Number > > libMesh::RBEvaluation::output_dual_innerprods
inherited
std::vector<DenseMatrix<Number> > libMesh::RBEvaluation::RB_Aq_vector
inherited
std::vector<DenseVector<Number> > libMesh::RBEvaluation::RB_Fq_vector
inherited
std::vector<DenseVector<Number> > libMesh::TransientRBEvaluation::RB_initial_condition_all_N
DenseMatrix<Number> libMesh::RBEvaluation::RB_inner_product_matrix
inherited
DenseMatrix<Number> libMesh::TransientRBEvaluation::RB_L2_matrix
DenseMatrix<Number> libMesh::TransientRBEvaluation::RB_LHS_matrix

Cached data for subsequent solves.

Definition at line 172 of file transient_rb_evaluation.h.

Referenced by rb_solve(), rb_solve_again(), and resize_data_structures().

std::vector<DenseMatrix<Number> > libMesh::TransientRBEvaluation::RB_M_q_vector
std::vector<Real > libMesh::RBEvaluation::RB_output_error_bounds
inherited
std::vector<std::vector<Real> > libMesh::TransientRBEvaluation::RB_output_error_bounds_all_k

The error bounds for each RB output for all time-levels from the most recent rb_solve.

Definition at line 191 of file transient_rb_evaluation.h.

Referenced by rb_solve().

std::vector<std::vector<DenseVector<Number> > > libMesh::RBEvaluation::RB_output_vectors
inherited
std::vector<Number > libMesh::RBEvaluation::RB_outputs
inherited

The vectors storing the RB output values and corresponding error bounds.

Definition at line 282 of file rb_evaluation.h.

Referenced by libMesh::RBEvaluation::rb_solve(), and libMesh::RBEvaluation::resize_data_structures().

std::vector<std::vector<Number> > libMesh::TransientRBEvaluation::RB_outputs_all_k

The RB outputs for all time-levels from the most recent rb_solve.

Definition at line 185 of file transient_rb_evaluation.h.

Referenced by rb_solve().

DenseMatrix<Number> libMesh::TransientRBEvaluation::RB_RHS_matrix

Definition at line 173 of file transient_rb_evaluation.h.

Referenced by rb_solve(), rb_solve_again(), and resize_data_structures().

DenseVector<Number> libMesh::TransientRBEvaluation::RB_RHS_save

Definition at line 174 of file transient_rb_evaluation.h.

Referenced by rb_solve(), rb_solve_again(), and resize_data_structures().

DenseVector<Number> libMesh::RBEvaluation::RB_solution
inherited
std::vector<DenseVector<Number> > libMesh::TransientRBEvaluation::RB_temporal_solution_data

Array storing the solution data at each time level from the most recent solve.

Definition at line 201 of file transient_rb_evaluation.h.

Referenced by libMesh::TransientRBConstruction::load_rb_solution(), and rb_solve().

bool libMesh::RBParametrized::verbose_mode
inherited

Public boolean to toggle verbose mode.

Definition at line 170 of file rb_parametrized.h.

Referenced by libMesh::RBParametrized::valid_params().


The documentation for this class was generated from the following files: