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

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

#include <rb_evaluation.h>

Inheritance diagram for libMesh::RBEvaluation:
[legend]

Public Member Functions

 RBEvaluation (const Parallel::Communicator &comm)
 Constructor. More...
 
 RBEvaluation (RBEvaluation &&)=default
 Special functions. More...
 
 RBEvaluation (const RBEvaluation &)=delete
 
RBEvaluationoperator= (const RBEvaluation &)=delete
 
RBEvaluationoperator= (RBEvaluation &&)=default
 
virtual ~RBEvaluation ()
 
virtual void clear () override
 Clear this RBEvaluation object. 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...
 
const RBThetaExpansionget_rb_theta_expansion () const
 
bool is_rb_theta_expansion_initialized () const
 
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. More...
 
NumericVector< Number > & get_basis_function (unsigned int i)
 Get a reference to the i^th basis function. More...
 
const NumericVector< Number > & get_basis_function (unsigned int i) const
 
virtual Real rb_solve (unsigned int N)
 Perform online solve with the N RB basis functions, for the set of parameters in current_params, where 0 <= N <= RB_size. More...
 
virtual Real rb_solve (unsigned int N, const std::vector< Number > *evaluated_thetas)
 The same as above, except that we pass in evaluated_thetas instead of recomputing the theta values. More...
 
virtual Real get_error_bound_normalization ()
 
virtual Real compute_residual_dual_norm (const unsigned int N)
 Compute the dual norm of the residual for the solution saved in RB_solution_vector. More...
 
virtual Real compute_residual_dual_norm (const unsigned int N, const std::vector< Number > *evaluated_thetas)
 The same as above, except that we pass in evaluated thetas instead of recomputing the theta values. 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 std::vector< Number > *evaluated_thetas)
 Evaluate the dual norm of output n for the current parameters, or using the pre-evaluted theta values provided in the "evaluated_thetas" array. 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 clear_riesz_representors ()
 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)
 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)
 Read in the saved Offline reduced basis data to initialize the system for Online solves. 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 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 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...
 
const RBParametersget_parameters () const
 Get the current parameters. More...
 
bool set_parameters (const RBParameters &params)
 Set the current parameters to params The parameters are checked for validity; an error is thrown if the number of parameters or samples is different than expected. 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
 

Static Public Member Functions

static 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...
 
static void read_in_vectors (System &sys, std::vector< std::unique_ptr< 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...
 
static void read_in_vectors_from_multiple_files (System &sys, std::vector< std::vector< std::unique_ptr< 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...
 
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_stream=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

std::vector< std::unique_ptr< 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< std::unique_ptr< 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 increment_constructor_count (const std::string &name) noexcept
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name) noexcept
 Increments the destruction counter. More...
 

Static Protected Member Functions

static void assert_file_exists (const std::string &file_name)
 Helper function that checks if file_name exists. 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...
 

Private Member Functions

void check_evaluated_thetas_size (const std::vector< Number > *evaluated_thetas) const
 For interfaces like rb_solve() and compute_residual_dual_norm() that optinally take a vector of "pre-evaluated" theta values, this function checks to make sure that, when provided, it is the right size. More...
 

Private Attributes

RBThetaExpansionrb_theta_expansion
 A pointer to to the object that stores the theta expansion. More...
 

Detailed Description

This class is part of the rbOOmit framework.

RBEvaluation encapsulates the functionality required to evaluate a given reduced basis model.

Author
David J. Knezevic
Date
2011

Definition at line 50 of file rb_evaluation.h.

Member Typedef Documentation

◆ Counts

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.

Constructor & Destructor Documentation

◆ RBEvaluation() [1/3]

libMesh::RBEvaluation::RBEvaluation ( const Parallel::Communicator comm)

Constructor.

Definition at line 48 of file rb_evaluation.C.

49  :
50  ParallelObject(comm_in),
53  rb_theta_expansion(nullptr)
54 {
55 }
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
bool compute_RB_inner_product
Boolean flag to indicate whether we compute the RB_inner_product_matrix.
bool evaluate_RB_error_bound
Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called...
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.

◆ RBEvaluation() [2/3]

libMesh::RBEvaluation::RBEvaluation ( RBEvaluation &&  )
default

Special functions.

  • This class contains unique_ptrs, so it can't be default copy constructed/assigned.
  • The destructor is defaulted out of line.

◆ RBEvaluation() [3/3]

libMesh::RBEvaluation::RBEvaluation ( const RBEvaluation )
delete

◆ ~RBEvaluation()

libMesh::RBEvaluation::~RBEvaluation ( )
virtualdefault

Member Function Documentation

◆ assert_file_exists()

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

Helper function that checks if file_name exists.

Definition at line 977 of file rb_evaluation.C.

Referenced by libMesh::TransientRBEvaluation::legacy_read_offline_data_from_files(), legacy_read_offline_data_from_files(), and read_in_vectors_from_multiple_files().

978 {
979  libmesh_error_msg_if(!std::ifstream(file_name.c_str()), "File missing: " << file_name);
980 }

◆ check_evaluated_thetas_size()

void libMesh::RBEvaluation::check_evaluated_thetas_size ( const std::vector< Number > *  evaluated_thetas) const
private

For interfaces like rb_solve() and compute_residual_dual_norm() that optinally take a vector of "pre-evaluated" theta values, this function checks to make sure that, when provided, it is the right size.

Definition at line 1196 of file rb_evaluation.C.

References libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::RBThetaExpansion::get_total_n_output_terms(), and rb_theta_expansion.

Referenced by compute_residual_dual_norm(), and rb_solve().

1197 {
1198  if (rb_theta_expansion && evaluated_thetas)
1199  {
1200  auto actual_size = evaluated_thetas->size();
1201  auto expected_size =
1205 
1206  libmesh_error_msg_if(actual_size != expected_size,
1207  "ERROR: Evaluated thetas vector has size " <<
1208  actual_size << ", but we expected " <<
1209  rb_theta_expansion->get_n_A_terms() << " A term(s), " <<
1210  rb_theta_expansion->get_n_F_terms() << " F term(s), and " <<
1211  rb_theta_expansion->get_total_n_output_terms() << " output term(s), " <<
1212  "for a total of " << expected_size << " terms.");
1213  }
1214 }
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
unsigned int get_total_n_output_terms() const
Returns the total number of affine terms associated with all outputs.
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.

◆ clear()

void libMesh::RBEvaluation::clear ( )
overridevirtual

Clear this RBEvaluation object.

Delete the basis functions and clear and extra data in subclasses.

Reimplemented from libMesh::RBParametrized.

Reimplemented in libMesh::TransientRBEvaluation.

Definition at line 59 of file rb_evaluation.C.

References basis_functions, clear_riesz_representors(), greedy_param_list, and set_n_basis_functions().

Referenced by libMesh::TransientRBEvaluation::clear().

60 {
61  LOG_SCOPE("clear()", "RBEvaluation");
62 
63  // Clear the basis functions
64  basis_functions.clear();
66 
68 
69  // Clear the Greedy param list
70  for (auto & plist : greedy_param_list)
71  plist.clear();
72  greedy_param_list.clear();
73 }
std::vector< std::unique_ptr< NumericVector< Number > > > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
std::vector< RBParameters > greedy_param_list
The list of parameters selected by the Greedy algorithm in generating the Reduced Basis associated wi...
virtual void set_n_basis_functions(unsigned int n_bfs)
Set the number of basis functions.
Definition: rb_evaluation.C:75
virtual void clear_riesz_representors()
Clear all the Riesz representors that are used to compute the RB residual (and hence error bound)...

◆ clear_riesz_representors()

void libMesh::RBEvaluation::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.

Reimplemented in libMesh::TransientRBEvaluation.

Definition at line 511 of file rb_evaluation.C.

References Aq_representor.

Referenced by clear(), libMesh::TransientRBEvaluation::clear_riesz_representors(), and resize_data_structures().

512 {
513  Aq_representor.clear();
514 }
std::vector< std::vector< std::unique_ptr< NumericVector< Number > > > > Aq_representor
Vector storing the residual representors associated with the left-hand side.

◆ comm()

const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inlineinherited
Returns
A reference to the Parallel::Communicator object used by this mesh.

Definition at line 97 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_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::UniformRefinementEstimator::_estimate_error(), libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult_add(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::DofMap::add_constraints_to_send_list(), add_cube_convex_hull_to_mesh(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::RBEIMEvaluation::add_interpolation_data(), libMesh::CondensedEigenSystem::add_matrices(), libMesh::EigenSystem::add_matrices(), libMesh::System::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::DofMap::add_variable(), libMesh::DofMap::add_variables(), libMesh::System::add_vector(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::AdvectionSystem::assemble_claw_rhs(), libMesh::FEMSystem::assemble_qoi(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::MeshCommunication::assign_global_indices(), libMesh::Partitioner::assign_partitioning(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::PetscDMWrapper::build_sf(), libMesh::MeshBase::cache_elem_data(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::MeshTetInterface::check_hull_integrity(), libMesh::MeshBase::complete_preparation(), 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::RBConstruction::compute_residual_dual_norm_slow(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::DofMap::computed_sparsity_already(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ContinuationSystem::ContinuationSystem(), libMesh::MeshBase::copy_constraint_rows(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::CondensedEigenSystem::copy_super_to_sub(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), libMesh::DofMap::create_dof_constraints(), 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::PetscMatrix< T >::create_submatrix_nosort(), create_wrapped_function(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::RBEIMEvaluation::distribute_bfs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::DTKSolutionTransfer::DTKSolutionTransfer(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::EpetraVector< T >::EpetraVector(), AssembleOptimization::equality_constraints(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::SmoothnessEstimator::estimate_smoothness(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::DofMap::gather_constraints(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::RBEIMEvaluation::get_eim_basis_function_node_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_side_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_value(), libMesh::System::get_info(), libMesh::MeshBase::get_info(), libMesh::DofMap::get_info(), libMesh::RBEIMEvaluation::get_interior_basis_functions_as_vecs(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::RBEIMConstruction::get_max_abs_value(), libMesh::RBEIMConstruction::get_node_max_abs_value(), libMesh::RBEIMEvaluation::get_parametrized_function_node_value(), libMesh::RBEIMEvaluation::get_parametrized_function_side_value(), libMesh::RBEIMEvaluation::get_parametrized_function_value(), libMesh::RBEIMConstruction::get_random_point(), libMesh::MeshTetInterface::improve_hull_integrity(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::StaticCondensation::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::AdvectionSystem::init_data(), libMesh::ClawSystem::init_data(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBEIMConstruction::inner_product(), integrate_function(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_equal_connectivity(), libMesh::MeshTools::libmesh_assert_equal_points(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), 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_constraint_rows(), 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::libmesh_petsc_linesearch_shellfunc(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_recalculate_monitor(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_interface(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_precheck(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::LinearImplicitSystem::LinearImplicitSystem(), 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_bcids_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::TriangulatorInterface::MeshedHole::MeshedHole(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::MeshTools::n_connected_components(), libMesh::DofMap::n_constrained_dofs(), libMesh::MeshBase::n_constraint_rows(), libMesh::DofMap::n_dofs(), libMesh::DofMap::n_dofs_per_processor(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), MixedOrderTest::n_neighbor_links(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::SparsityPattern::Build::n_nonzeros(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::RBEIMEvaluation::node_distribute_bfs(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::RBEIMConstruction::node_inner_product(), libMesh::PetscVector< libMesh::Number >::operator=(), libMesh::MeshBase::operator==(), 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::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::MeshTools::paranoid_n_levels(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Partitioner::processor_pairs_to_interface_nodes(), libMesh::InterMeshProjection::project_system_vectors(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO::read_header(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEIMEvaluation::read_in_interior_basis_functions(), libMesh::RBEIMEvaluation::read_in_node_basis_functions(), libMesh::RBEIMEvaluation::read_in_side_basis_functions(), read_in_vectors_from_multiple_files(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), MeshFunctionTest::read_variable_info_from_output_data(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::BoundaryInfo::remove_edge_id(), libMesh::BoundaryInfo::remove_node_id(), libMesh::BoundaryInfo::remove_shellface_id(), libMesh::BoundaryInfo::remove_side_id(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), scale_mesh_and_plot(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::send_and_insert_dof_values(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_linear(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::RBEIMEvaluation::side_distribute_bfs(), libMesh::RBEIMEvaluation::side_gather_bfs(), libMesh::RBEIMConstruction::side_inner_product(), libMesh::Partitioner::single_partition(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::VariationalMeshSmoother::smooth(), libMesh::ClawSystem::solve_conservation_law(), libMesh::split_mesh(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::MeshBase::sync_subdomain_name_map(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), libMesh::MeshRefinement::test_unflagged(), DofMapTest::testBadElemFECombo(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), VolumeTest::testC0PolygonMethods(), VolumeTest::testC0PolyhedronMethods(), ConstraintOperatorTest::testCoreform(), ConnectedComponentsTest::testEdge(), MeshInputTest::testExodusIGASidesets(), MeshTriangulationTest::testFoundCenters(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), PointLocatorTest::testPlanar(), MeshTriangulationTest::testPoly2TriRefinementBase(), SystemsTest::testProjectCubeWithMeshFunction(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testSelectiveRenumber(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), MeshSmootherTest::testVariationalSmoother(), libMesh::MeshTools::total_weight(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::Poly2TriTriangulator::triangulate(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), update_current_local_solution(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::VTKIO::write_nodal_data(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), 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().

98  { return _communicator; }
const Parallel::Communicator & _communicator

◆ compute_residual_dual_norm() [1/2]

Real libMesh::RBEvaluation::compute_residual_dual_norm ( const unsigned int  N)
virtual

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

Reimplemented in libMesh::TransientRBEvaluation.

Definition at line 351 of file rb_evaluation.C.

Referenced by rb_solve().

352 {
353  return compute_residual_dual_norm(N, nullptr);
354 }
virtual Real compute_residual_dual_norm(const unsigned int N)
Compute the dual norm of the residual for the solution saved in RB_solution_vector.

◆ compute_residual_dual_norm() [2/2]

Real libMesh::RBEvaluation::compute_residual_dual_norm ( const unsigned int  N,
const std::vector< Number > *  evaluated_thetas 
)
virtual

The same as above, except that we pass in evaluated thetas instead of recomputing the theta values.

Definition at line 356 of file rb_evaluation.C.

References Aq_Aq_representor_innerprods, check_evaluated_thetas_size(), libMesh::RBThetaExpansion::eval_A_theta(), libMesh::RBThetaExpansion::eval_F_theta(), Fq_Aq_representor_innerprods, Fq_representor_innerprods, libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::RBParametrized::get_parameters(), libMesh::libmesh_conj(), libMesh::libmesh_real(), RB_solution, rb_theta_expansion, and libMesh::Real.

358 {
359  LOG_SCOPE("compute_residual_dual_norm()", "RBEvaluation");
360 
361  // In case the theta functions have been pre-evaluated, first check the size for consistency
362  this->check_evaluated_thetas_size(evaluated_thetas);
363 
364  // If evaluated_thetas is provided, then mu is not actually used for anything
365  const RBParameters & mu = get_parameters();
366 
367  const unsigned int n_A_terms = rb_theta_expansion->get_n_A_terms();
368  const unsigned int n_F_terms = rb_theta_expansion->get_n_F_terms();
369 
370  // Use the stored representor inner product values
371  // to evaluate the residual norm
372  Number residual_norm_sq = 0.;
373 
374  // Lambdas to help with evaluating F_theta and A_theta functions
375  // using either the pre-evaluated thetas (if provided) or by calling
376  // eval_{F,A}_theta()
377  auto eval_F = [&](unsigned int index)
378  {
379  return (evaluated_thetas) ? (*evaluated_thetas)[index + n_A_terms] : rb_theta_expansion->eval_F_theta(index, mu);
380  };
381  auto eval_A = [&](unsigned int index)
382  {
383  return (evaluated_thetas) ? (*evaluated_thetas)[index] : rb_theta_expansion->eval_A_theta(index, mu);
384  };
385 
386  unsigned int q=0;
387  for (unsigned int q_f1=0; q_f1<n_F_terms; q_f1++)
388  {
389  const Number val_q_f1 = eval_F(q_f1);
390 
391  for (unsigned int q_f2=q_f1; q_f2<n_F_terms; q_f2++)
392  {
393  const Number val_q_f2 = eval_F(q_f2);
394 
395  Real delta = (q_f1==q_f2) ? 1. : 2.;
396  residual_norm_sq += delta * libmesh_real(val_q_f1 * libmesh_conj(val_q_f2) * Fq_representor_innerprods[q] );
397 
398  q++;
399  }
400  }
401 
402  for (unsigned int q_f=0; q_f<n_F_terms; q_f++)
403  {
404  const Number val_q_f = eval_F(q_f);
405 
406  for (unsigned int q_a=0; q_a<n_A_terms; q_a++)
407  {
408  const Number val_q_a = eval_A(q_a);
409 
410  for (unsigned int i=0; i<N; i++)
411  {
412  Real delta = 2.;
413  residual_norm_sq +=
414  delta * libmesh_real( val_q_f * libmesh_conj(val_q_a) *
416  }
417  }
418  }
419 
420  q=0;
421  for (unsigned int q_a1=0; q_a1<n_A_terms; q_a1++)
422  {
423  const Number val_q_a1 = eval_A(q_a1);
424 
425  for (unsigned int q_a2=q_a1; q_a2<n_A_terms; q_a2++)
426  {
427  const Number val_q_a2 = eval_A(q_a2);
428 
429  Real delta = (q_a1==q_a2) ? 1. : 2.;
430 
431  for (unsigned int i=0; i<N; i++)
432  {
433  for (unsigned int j=0; j<N; j++)
434  {
435  residual_norm_sq +=
436  delta * libmesh_real( libmesh_conj(val_q_a1) * val_q_a2 *
438  }
439  }
440 
441  q++;
442  }
443  }
444 
445  if (libmesh_real(residual_norm_sq) < 0.)
446  {
447  // libMesh::out << "Warning: Square of residual norm is negative "
448  // << "in RBSystem::compute_residual_dual_norm()" << std::endl;
449 
450  // Sometimes this is negative due to rounding error,
451  // but when this occurs the error is on the order of 1.e-10,
452  // so shouldn't affect error bound much...
453  residual_norm_sq = std::abs(residual_norm_sq);
454  }
455 
456  return std::sqrt( libmesh_real(residual_norm_sq) );
457 }
T libmesh_real(T a)
virtual Number eval_A_theta(unsigned int q, const RBParameters &mu) const
Evaluate theta_q_a at the current parameter.
std::vector< Number > Fq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
T libmesh_conj(T a)
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
DenseVector< Number > RB_solution
The RB solution vector.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
virtual Number eval_F_theta(unsigned int q, const RBParameters &mu) const
Evaluate theta_q_f at the current parameter.
const RBParameters & get_parameters() const
Get the current parameters.
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 check_evaluated_thetas_size(const std::vector< Number > *evaluated_thetas) const
For interfaces like rb_solve() and compute_residual_dual_norm() that optinally take a vector of "pre-...
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
std::vector< std::vector< std::vector< Number > > > Aq_Aq_representor_innerprods

◆ disable_print_counter_info()

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = false;
103  return;
104 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ enable_print_counter_info()

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

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

Enabled by default.

Definition at line 94 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

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

95 {
96  _enable_print_counter = true;
97  return;
98 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ eval_output_dual_norm()

Real libMesh::RBEvaluation::eval_output_dual_norm ( unsigned int  n,
const std::vector< Number > *  evaluated_thetas 
)

Evaluate the dual norm of output n for the current parameters, or using the pre-evaluted theta values provided in the "evaluated_thetas" array.

Definition at line 474 of file rb_evaluation.C.

References libMesh::RBThetaExpansion::eval_output_theta(), libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::RBThetaExpansion::get_n_output_terms(), libMesh::RBParametrized::get_parameters(), libMesh::libmesh_conj(), libMesh::libmesh_real(), output_dual_innerprods, libMesh::RBThetaExpansion::output_index_1D(), rb_theta_expansion, and libMesh::Real.

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

476 {
477  // Return value
478  Number output_bound_sq = 0.;
479 
480  // mu is only used if evaluated_thetas == nullptr
481  const RBParameters & mu = this->get_parameters();
482 
483  // Index into output_dual_innerprods
484  unsigned int q=0;
485  for (unsigned int q_l1=0; q_l1<rb_theta_expansion->get_n_output_terms(n); q_l1++)
486  {
487  for (unsigned int q_l2=q_l1; q_l2<rb_theta_expansion->get_n_output_terms(n); q_l2++)
488  {
489  Real delta = (q_l1==q_l2) ? 1. : 2.;
490 
491  Number val_l1 =
492  evaluated_thetas ?
495 
496  Number val_l2 =
497  evaluated_thetas ?
500 
501  output_bound_sq += delta * libmesh_real(
502  libmesh_conj(val_l1) * val_l2 * output_dual_innerprods[n][q]);
503 
504  q++;
505  }
506  }
507 
508  return libmesh_real(std::sqrt( output_bound_sq ));
509 }
T libmesh_real(T a)
virtual Number eval_output_theta(unsigned int output_index, unsigned int q_l, const RBParameters &mu) const
Evaluate theta_q_l at the current parameter.
T libmesh_conj(T a)
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
std::vector< std::vector< Number > > output_dual_innerprods
The vector storing the dual norm inner product terms for each output.
unsigned int output_index_1D(unsigned int n, unsigned int q_l) const
Computes the one-dimensional index for output n, term q_l implied by a "row-major" ordering of the ou...
const RBParameters & get_parameters() const
Get the current parameters.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.

◆ get_basis_function() [1/2]

NumericVector< Number > & libMesh::RBEvaluation::get_basis_function ( unsigned int  i)

Get a reference to the i^th basis function.

Definition at line 207 of file rb_evaluation.C.

References basis_functions.

Referenced by libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::RBConstruction::load_basis_function(), and libMesh::TransientRBConstruction::update_RB_system_matrices().

208 {
209  libmesh_assert_less (i, basis_functions.size());
210 
211  return *(basis_functions[i]);
212 }
std::vector< std::unique_ptr< NumericVector< Number > > > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.

◆ get_basis_function() [2/2]

const NumericVector< Number > & libMesh::RBEvaluation::get_basis_function ( unsigned int  i) const

Definition at line 214 of file rb_evaluation.C.

References basis_functions.

215 {
216  libmesh_assert_less (i, basis_functions.size());
217 
218  return *(basis_functions[i]);
219 }
std::vector< std::unique_ptr< NumericVector< Number > > > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.

◆ get_closest_value()

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 432 of file rb_parametrized.C.

References distance(), libMesh::Real, and value.

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

433 {
434  libmesh_error_msg_if(list_of_values.empty(), "Error: list_of_values is empty.");
435 
436  Real min_distance = std::numeric_limits<Real>::max();
437  Real closest_val = 0.;
438  for (const auto & current_value : list_of_values)
439  {
440  Real distance = std::abs(value - current_value);
441  if (distance < min_distance)
442  {
443  min_distance = distance;
444  closest_val = current_value;
445  }
446  }
447 
448  return closest_val;
449 }
Real distance(const Point &p)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const bool value
Definition: xdr_io.C:55

◆ get_discrete_parameter_values()

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 359 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::check_if_valid_params(), libMesh::RBParametrized::get_n_discrete_params(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBParametrized::print_discrete_parameter_values(), and libMesh::RBParametrized::write_discrete_parameter_values_to_file().

360 {
361  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_discrete_parameter_values");
362 
364 }
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.

◆ get_error_bound_normalization()

Real libMesh::RBEvaluation::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 in libMesh::TransientRBEvaluation.

Definition at line 340 of file rb_evaluation.C.

References rb_solve(), and libMesh::Real.

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

341 {
342  // Normalize the error based on the error bound in the
343  // case of an empty reduced basis. The error bound is based
344  // on the residual F - AU, so with an empty basis this gives
345  // a value based on the norm of F at the current parameters.
346 
347  Real normalization = rb_solve(0);
348  return normalization;
349 }
virtual Real rb_solve(unsigned int N)
Perform online solve with the N RB basis functions, for the set of parameters in current_params, where 0 <= N <= RB_size.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ get_info()

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 (const auto & [name, cd] : _counts)
59  oss << "| " << name << " reference count information:\n"
60  << "| Creations: " << cd.first << '\n'
61  << "| Destructions: " << cd.second << '\n';
62 
63  oss << " ---------------------------------------------------------------------------- \n";
64 
65  return oss.str();
66 
67 #else
68 
69  return "";
70 
71 #endif
72 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
static Counts _counts
Actually holds the data.

◆ get_n_basis_functions()

virtual unsigned int libMesh::RBEvaluation::get_n_basis_functions ( ) const
inlinevirtual

Get the current number of basis functions.

Definition at line 169 of file rb_evaluation.h.

References basis_functions.

Referenced by libMesh::RBDataSerialization::add_rb_evaluation_data_to_builder(), libMesh::RBDataSerialization::add_transient_rb_evaluation_data_to_builder(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), libMesh::RBConstruction::enrich_RB_space(), libMesh::RBConstruction::greedy_termination_test(), libMesh::TransientRBEvaluation::legacy_read_offline_data_from_files(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), legacy_write_offline_data_to_files(), libMesh::TransientRBConstruction::load_rb_solution(), libMesh::RBConstruction::load_rb_solution(), libMesh::RBConstruction::print_basis_function_orthogonality(), libMesh::TransientRBEvaluation::rb_solve(), rb_solve(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::recompute_all_residual_terms(), resize_data_structures(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::RBConstruction::train_reduced_basis_with_greedy(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), 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().

170  { return cast_int<unsigned int>(basis_functions.size()); }
std::vector< std::unique_ptr< NumericVector< Number > > > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.

◆ get_n_continuous_params()

unsigned int libMesh::RBParametrized::get_n_continuous_params ( ) const
inherited

Get the number of continuous parameters.

Definition at line 112 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().

113 {
114  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_n_continuous_params");
115 
117 
118  return static_cast<unsigned int>(get_n_params() - get_n_discrete_params());
119 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
unsigned int get_n_discrete_params() const
Get the number of discrete parameters.
libmesh_assert(ctx)
unsigned int get_n_params() const
Get the number of parameters.

◆ get_n_discrete_params()

unsigned int libMesh::RBParametrized::get_n_discrete_params ( ) const
inherited

Get the number of discrete parameters.

Definition at line 121 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(), and libMesh::RBParametrized::write_discrete_parameter_values_to_file().

122 {
123  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_n_discrete_params");
124 
125  return cast_int<unsigned int>
127 }
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.

◆ get_n_params()

unsigned int libMesh::RBParametrized::get_n_params ( ) const
inherited

Get the number of parameters.

Definition at line 103 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::RBParametrized::check_if_valid_params(), libMesh::RBEIMConstruction::compute_max_eim_error(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::RBParametrized::get_n_continuous_params(), libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), libMesh::RBConstruction::print_info(), libMesh::RBEIMEvaluation::set_eim_error_indicator_active(), and libMesh::RBConstruction::train_reduced_basis_with_POD().

104 {
105  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_n_params");
106 
107  libmesh_assert_equal_to ( parameters_min.n_parameters(), parameters_max.n_parameters() );
108 
109  return parameters_min.n_parameters();
110 }
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.
unsigned int n_parameters() const
Get the number of parameters that have been added.

◆ get_parameter_max()

Real libMesh::RBParametrized::get_parameter_max ( const std::string &  param_name) const
inherited

Get maximum allowable value of parameter param_name.

Definition at line 171 of file rb_parametrized.C.

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

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

172 {
173  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameter_max");
174 
175  return parameters_max.get_value(param_name);
176 }
Real get_value(const std::string &param_name) const
Get the value of the specified parameter, throw an error if it does not exist.
Definition: rb_parameters.C:65
bool parameters_initialized
Flag indicating whether the parameters have been initialized.

◆ get_parameter_min()

Real libMesh::RBParametrized::get_parameter_min ( const std::string &  param_name) const
inherited

Get minimum allowable value of parameter param_name.

Definition at line 164 of file rb_parametrized.C.

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

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

165 {
166  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameter_min");
167 
168  return parameters_min.get_value(param_name);
169 }
Real get_value(const std::string &param_name) const
Get the value of the specified parameter, throw an error if it does not exist.
Definition: rb_parameters.C:65
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.

◆ get_parameters()

const RBParameters & libMesh::RBParametrized::get_parameters ( ) const
inherited

Get the current parameters.

Definition at line 143 of file rb_parametrized.C.

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

Referenced by libMesh::TransientRBConstruction::add_scaled_mass_matrix(), libMesh::TransientRBEvaluation::cache_online_residual_terms(), compute_residual_dual_norm(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBSCMConstruction::enrich_C_J(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), eval_output_dual_norm(), 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::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBSCMEvaluation::legacy_read_offline_data_from_files(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::RBConstruction::preevaluate_thetas(), libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), libMesh::RBConstruction::print_info(), libMesh::RBParametrized::print_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::TransientRBEvaluation::rb_solve(), rb_solve(), libMesh::RBSCMEvaluation::save_current_parameters(), libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), libMesh::RBEIMConstruction::train_eim_approximation_with_POD(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::truth_solve(), libMesh::RBConstruction::truth_solve(), libMesh::TransientRBEvaluation::uncached_compute_residual_dual_norm(), and libMesh::RBConstruction::update_greedy_param_list().

144 {
145  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameters");
146 
147  return parameters;
148 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
RBParameters parameters
Vector storing the current parameters.

◆ get_parameters_max()

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 157 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::RBEIMConstruction::set_rb_construction_parameters(), libMesh::RBConstruction::set_rb_construction_parameters(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

158 {
159  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameters_max");
160 
161  return parameters_max;
162 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.

◆ get_parameters_min()

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 150 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::RBEIMConstruction::set_rb_construction_parameters(), libMesh::RBConstruction::set_rb_construction_parameters(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

151 {
152  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameters_min");
153 
154  return parameters_min;
155 }
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.

◆ get_rb_theta_expansion() [1/2]

RBThetaExpansion & libMesh::RBEvaluation::get_rb_theta_expansion ( )

◆ get_rb_theta_expansion() [2/2]

const RBThetaExpansion & libMesh::RBEvaluation::get_rb_theta_expansion ( ) const

Definition at line 93 of file rb_evaluation.C.

References is_rb_theta_expansion_initialized(), and rb_theta_expansion.

94 {
95  libmesh_error_msg_if(!is_rb_theta_expansion_initialized(),
96  "Error: rb_theta_expansion hasn't been initialized yet");
97 
98  return *rb_theta_expansion;
99 }
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
bool is_rb_theta_expansion_initialized() const

◆ get_stability_lower_bound()

Real libMesh::RBEvaluation::get_stability_lower_bound ( )
virtual

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 459 of file rb_evaluation.C.

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

460 {
461  // Return a default value of 1, this function should
462  // be overloaded to specify a problem-dependent stability
463  // factor lower bound
464  return 1.;
465 }

◆ increment_constructor_count()

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the construction counter.

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

Definition at line 183 of file reference_counter.h.

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

184 {
185  libmesh_try
186  {
187  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
188  std::pair<unsigned int, unsigned int> & p = _counts[name];
189  p.first++;
190  }
191  libmesh_catch (...)
192  {
193  auto stream = libMesh::err.get();
194  stream->exceptions(stream->goodbit); // stream must not throw
195  libMesh::err << "Encountered unrecoverable error while calling "
196  << "ReferenceCounter::increment_constructor_count() "
197  << "for a(n) " << name << " object." << std::endl;
198  std::terminate();
199  }
200 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
OStreamProxy err
static Counts _counts
Actually holds the data.
streamT * get()
Rather than implement every ostream/ios/ios_base function, we&#39;ll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:30

◆ increment_destructor_count()

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the destruction counter.

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

Definition at line 207 of file reference_counter.h.

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

208 {
209  libmesh_try
210  {
211  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
212  std::pair<unsigned int, unsigned int> & p = _counts[name];
213  p.second++;
214  }
215  libmesh_catch (...)
216  {
217  auto stream = libMesh::err.get();
218  stream->exceptions(stream->goodbit); // stream must not throw
219  libMesh::err << "Encountered unrecoverable error while calling "
220  << "ReferenceCounter::increment_destructor_count() "
221  << "for a(n) " << name << " object." << std::endl;
222  std::terminate();
223  }
224 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
OStreamProxy err
static Counts _counts
Actually holds the data.
streamT * get()
Rather than implement every ostream/ios/ios_base function, we&#39;ll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:30

◆ initialize_parameters() [1/2]

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.

Parameter ranges are inclusive. The input min/max RBParameters should have exactly 1 sample each. Vector-valued samples are not currently supported for the min/max parameters or for discrete parameters.

Definition at line 53 of file rb_parametrized.C.

References libMesh::RBParametrized::_discrete_parameter_values, libMesh::RBParameters::begin_serialized(), libMesh::RBParameters::end_serialized(), libMesh::RBParameters::n_parameters(), libMesh::RBParameters::n_samples(), libMesh::Quality::name(), 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::RBConstruction::enrich_basis_from_rhs_terms(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBDataDeserialization::load_parameter_ranges(), libMesh::RBSCMConstruction::perform_SCM_greedy(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBParametrized::read_parameter_data_from_files(), libMesh::RBEIMConstruction::set_rb_construction_parameters(), libMesh::RBConstruction::set_rb_construction_parameters(), RBParametersTest::testRBParametrized(), libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), libMesh::RBEIMConstruction::train_eim_approximation_with_POD(), libMesh::RBConstruction::train_reduced_basis_with_greedy(), and libMesh::RBConstruction::train_reduced_basis_with_POD().

56 {
57  // Check that the min/max vectors have the same size.
58  libmesh_error_msg_if(mu_min_in.n_parameters() != mu_max_in.n_parameters(),
59  "Error: Invalid mu_min/mu_max in initialize_parameters(), different number of parameters.");
60  libmesh_error_msg_if(mu_min_in.n_samples() != 1 ||
61  mu_max_in.n_samples() != 1,
62  "Error: Invalid mu_min/mu_max in initialize_parameters(), only 1 sample supported.");
63 
64  // Ensure all the values are valid for min and max.
65  auto pr_min = mu_min_in.begin_serialized();
66  auto pr_max = mu_max_in.begin_serialized();
67  for (; pr_min != mu_min_in.end_serialized(); ++pr_min, ++pr_max)
68  libmesh_error_msg_if((*pr_min).second > (*pr_max).second,
69  "Error: Invalid mu_min/mu_max in RBParameters constructor.");
70 
71  parameters_min = mu_min_in;
72  parameters_max = mu_max_in;
73 
74  // Add in min/max values due to the discrete parameters
75  for (const auto & [name, vals] : discrete_parameter_values)
76  {
77  libmesh_error_msg_if(vals.empty(), "Error: List of discrete parameters for " << name << " is empty.");
78 
79  Real min_val = *std::min_element(vals.begin(), vals.end());
80  Real max_val = *std::max_element(vals.begin(), vals.end());
81 
82  libmesh_assert_less_equal(min_val, max_val);
83 
84  parameters_min.set_value(name, min_val);
85  parameters_max.set_value(name, max_val);
86  }
87 
88  _discrete_parameter_values = discrete_parameter_values;
89 
91 
92  // Initialize the current parameters to parameters_min
94 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
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.
std::map< std::string, std::vector< Real > > _discrete_parameter_values
Map that defines the allowable values of any discrete parameters.
bool set_parameters(const RBParameters &params)
Set the current parameters to params The parameters are checked for validity; an error is thrown if t...
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.

◆ initialize_parameters() [2/2]

void libMesh::RBParametrized::initialize_parameters ( const RBParametrized rb_parametrized)
inherited

Initialize the parameter ranges and set current_parameters.

Definition at line 96 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().

97 {
98  initialize_parameters(rb_parametrized.get_parameters_min(),
99  rb_parametrized.get_parameters_max(),
100  rb_parametrized.get_discrete_parameter_values());
101 }
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.

◆ is_discrete_parameter()

bool libMesh::RBParametrized::is_discrete_parameter ( const std::string &  mu_name) const
inherited

Is parameter mu_name discrete?

Definition at line 351 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::RBEIMConstruction::print_info(), libMesh::RBConstruction::print_info(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

352 {
353  libmesh_error_msg_if(!parameters_initialized,
354  "Error: parameters not initialized in RBParametrized::is_discrete_parameter");
355 
356  return _discrete_parameter_values.count(mu_name);
357 }
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.

◆ is_rb_theta_expansion_initialized()

bool libMesh::RBEvaluation::is_rb_theta_expansion_initialized ( ) const
Returns
true if the theta expansion has been initialized.

Definition at line 101 of file rb_evaluation.C.

References rb_theta_expansion.

Referenced by get_rb_theta_expansion().

102 {
103  if (rb_theta_expansion)
104  {
105  return true;
106  }
107  else
108  {
109  return false;
110  }
111 }
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.

◆ legacy_read_offline_data_from_files()

void libMesh::RBEvaluation::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 in libMesh::TransientRBEvaluation.

Definition at line 744 of file rb_evaluation.C.

References Aq_Aq_representor_innerprods, assert_file_exists(), basis_functions, libMesh::Xdr::close(), compute_RB_inner_product, libMesh::DECODE, Fq_Aq_representor_innerprods, Fq_representor_innerprods, libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::RBThetaExpansion::get_n_output_terms(), libMesh::RBThetaExpansion::get_n_outputs(), output_dual_innerprods, RB_Aq_vector, RB_Fq_vector, RB_inner_product_matrix, RB_output_vectors, rb_theta_expansion, libMesh::READ, libMesh::RBParametrized::read_parameter_data_from_files(), resize_data_structures(), set_n_basis_functions(), and value.

Referenced by libMesh::TransientRBEvaluation::legacy_read_offline_data_from_files().

747 {
748  LOG_SCOPE("legacy_read_offline_data_from_files()", "RBEvaluation");
749 
750  // The reading mode: DECODE for binary, READ for ASCII
751  XdrMODE mode = read_binary_data ? DECODE : READ;
752 
753  // The suffix to use for all the files that are written out
754  const std::string suffix = read_binary_data ? ".xdr" : ".dat";
755 
756  // The string stream we'll use to make the file names
757  std::ostringstream file_name;
758 
759  // First, find out how many basis functions we had when Greedy terminated
760  unsigned int n_bfs;
761  {
762  file_name << directory_name << "/n_bfs" << suffix;
763  assert_file_exists(file_name.str());
764 
765  Xdr n_bfs_in(file_name.str(), mode);
766  n_bfs_in >> n_bfs;
767  n_bfs_in.close();
768  }
769  resize_data_structures(n_bfs, read_error_bound_data);
770 
771  // Read in the parameter ranges
772  file_name.str("");
773  file_name << directory_name << "/parameter_ranges" << suffix;
774  std::string continuous_param_file_name = file_name.str();
775 
776  // Read in the discrete parameter values
777  file_name.str("");
778  file_name << directory_name << "/discrete_parameter_values" << suffix;
779  std::string discrete_param_file_name = file_name.str();
780  read_parameter_data_from_files(continuous_param_file_name,
781  discrete_param_file_name,
782  read_binary_data);
783 
784  // Read in output data in multiple files
785  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
786  {
787  for (unsigned int q_l=0; q_l<rb_theta_expansion->get_n_output_terms(n); q_l++)
788  {
789  file_name.str("");
790  file_name << directory_name << "/output_";
791  file_name << std::setw(3)
792  << std::setprecision(0)
793  << std::setfill('0')
794  << std::right
795  << n;
796  file_name << "_";
797  file_name << std::setw(3)
798  << std::setprecision(0)
799  << std::setfill('0')
800  << std::right
801  << q_l;
802  file_name << suffix;
803  assert_file_exists(file_name.str());
804 
805  Xdr output_n_in(file_name.str(), mode);
806 
807  for (unsigned int j=0; j<n_bfs; j++)
808  {
809  Number value;
810  output_n_in >> value;
811  RB_output_vectors[n][q_l](j) = value;
812  }
813  output_n_in.close();
814  }
815  }
816 
818  {
819  // Next read in the inner product matrix
820  file_name.str("");
821  file_name << directory_name << "/RB_inner_product_matrix" << suffix;
822  assert_file_exists(file_name.str());
823 
824  Xdr RB_inner_product_matrix_in(file_name.str(), mode);
825 
826  for (unsigned int i=0; i<n_bfs; i++)
827  {
828  for (unsigned int j=0; j<n_bfs; j++)
829  {
830  Number value;
831  RB_inner_product_matrix_in >> value;
833  }
834  }
835  RB_inner_product_matrix_in.close();
836  }
837 
838  // Next read in the Fq vectors
839  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
840  {
841  file_name.str("");
842  file_name << directory_name << "/RB_F_";
843  file_name << std::setw(3)
844  << std::setprecision(0)
845  << std::setfill('0')
846  << std::right
847  << q_f;
848  file_name << suffix;
849  assert_file_exists(file_name.str());
850 
851  Xdr RB_Fq_f_in(file_name.str(), mode);
852 
853  for (unsigned int i=0; i<n_bfs; i++)
854  {
855  Number value;
856  RB_Fq_f_in >> value;
857  RB_Fq_vector[q_f](i) = value;
858  }
859  RB_Fq_f_in.close();
860  }
861 
862  // Next read in the Aq matrices
863  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
864  {
865  file_name.str("");
866  file_name << directory_name << "/RB_A_";
867  file_name << std::setw(3)
868  << std::setprecision(0)
869  << std::setfill('0')
870  << std::right
871  << q_a;
872  file_name << suffix;
873  assert_file_exists(file_name.str());
874 
875  Xdr RB_Aq_a_in(file_name.str(), mode);
876 
877  for (unsigned int i=0; i<n_bfs; i++)
878  {
879  for (unsigned int j=0; j<n_bfs; j++)
880  {
881  Number value;
882  RB_Aq_a_in >> value;
883  RB_Aq_vector[q_a](i,j) = value;
884  }
885  }
886  RB_Aq_a_in.close();
887  }
888 
889 
890  if (read_error_bound_data)
891  {
892  // Next read in Fq representor norm data
893  file_name.str("");
894  file_name << directory_name << "/Fq_innerprods" << suffix;
895  assert_file_exists(file_name.str());
896 
897  Xdr RB_Fq_innerprods_in(file_name.str(), mode);
898 
899  unsigned int Q_f_hat = rb_theta_expansion->get_n_F_terms()*(rb_theta_expansion->get_n_F_terms()+1)/2;
900  for (unsigned int i=0; i<Q_f_hat; i++)
901  {
902  RB_Fq_innerprods_in >> Fq_representor_innerprods[i];
903  }
904  RB_Fq_innerprods_in.close();
905 
906  // Read in output data
907  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
908  {
909  file_name.str("");
910  file_name << directory_name << "/output_";
911  file_name << std::setw(3)
912  << std::setprecision(0)
913  << std::setfill('0')
914  << std::right
915  << n;
916  file_name << "_dual_innerprods" << suffix;
917  assert_file_exists(file_name.str());
918 
919  Xdr output_dual_innerprods_in(file_name.str(), mode);
920 
921  unsigned int Q_l_hat = rb_theta_expansion->get_n_output_terms(n)*(rb_theta_expansion->get_n_output_terms(n)+1)/2;
922  for (unsigned int q=0; q<Q_l_hat; q++)
923  {
924  output_dual_innerprods_in >> output_dual_innerprods[n][q];
925  }
926  output_dual_innerprods_in.close();
927  }
928 
929 
930  // Next read in Fq_Aq representor norm data
931  file_name.str("");
932  file_name << directory_name << "/Fq_Aq_innerprods" << suffix;
933  assert_file_exists(file_name.str());
934 
935  Xdr RB_Fq_Aq_innerprods_in(file_name.str(), mode);
936 
937  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
938  {
939  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
940  {
941  for (unsigned int i=0; i<n_bfs; i++)
942  {
943  RB_Fq_Aq_innerprods_in >> Fq_Aq_representor_innerprods[q_f][q_a][i];
944  }
945  }
946  }
947  RB_Fq_Aq_innerprods_in.close();
948 
949  // Next read in Aq_Aq representor norm data
950  file_name.str("");
951  file_name << directory_name << "/Aq_Aq_innerprods" << suffix;
952  assert_file_exists(file_name.str());
953 
954  Xdr RB_Aq_Aq_innerprods_in(file_name.str(), mode);
955 
956  unsigned int Q_a_hat = rb_theta_expansion->get_n_A_terms()*(rb_theta_expansion->get_n_A_terms()+1)/2;
957  for (unsigned int i=0; i<Q_a_hat; i++)
958  {
959  for (unsigned int j=0; j<n_bfs; j++)
960  {
961  for (unsigned int l=0; l<n_bfs; l++)
962  {
963  RB_Aq_Aq_innerprods_in >> Aq_Aq_representor_innerprods[i][j][l];
964  }
965  }
966  }
967  RB_Aq_Aq_innerprods_in.close();
968  }
969 
970  // Resize basis_functions even if we don't read them in so that
971  // get_n_bfs() returns the correct value. Initialize the pointers
972  // to nullptr.
973  basis_functions.clear();
974  set_n_basis_functions(n_bfs);
975 }
bool compute_RB_inner_product
Boolean flag to indicate whether we compute the RB_inner_product_matrix.
std::vector< Number > Fq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
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_inner_product_matrix
The inner product matrix.
std::vector< std::unique_ptr< NumericVector< Number > > > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
std::vector< std::vector< Number > > output_dual_innerprods
The vector storing the dual norm inner product terms for each output.
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.
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
XdrMODE
Defines an enum for read/write mode in Xdr format.
Definition: enum_xdr_mode.h:35
std::vector< DenseVector< Number > > RB_Fq_vector
Dense vector for the RHS.
virtual void set_n_basis_functions(unsigned int n_bfs)
Set the number of basis functions.
Definition: rb_evaluation.C:75
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...
std::vector< DenseMatrix< Number > > RB_Aq_vector
Dense matrices for the RB computations.
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
static 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:55
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
std::vector< std::vector< std::vector< Number > > > Aq_Aq_representor_innerprods
std::vector< std::vector< DenseVector< Number > > > RB_output_vectors
The vectors storing the RB output vectors.

◆ legacy_write_offline_data_to_files()

void libMesh::RBEvaluation::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 in libMesh::TransientRBEvaluation.

Definition at line 516 of file rb_evaluation.C.

References Aq_Aq_representor_innerprods, libMesh::Xdr::close(), compute_RB_inner_product, libMesh::ENCODE, Fq_Aq_representor_innerprods, Fq_representor_innerprods, libMesh::RBThetaExpansion::get_n_A_terms(), get_n_basis_functions(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::RBThetaExpansion::get_n_output_terms(), libMesh::RBThetaExpansion::get_n_outputs(), greedy_param_list, libMesh::Utility::mkdir(), output_dual_innerprods, libMesh::ParallelObject::processor_id(), RB_Aq_vector, RB_Fq_vector, RB_inner_product_matrix, RB_output_vectors, rb_theta_expansion, libMesh::Real, libMesh::WRITE, and libMesh::RBParametrized::write_parameter_data_to_files().

Referenced by libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), and main().

518 {
519  LOG_SCOPE("legacy_write_offline_data_to_files()", "RBEvaluation");
520 
521  // Get the number of basis functions
522  unsigned int n_bfs = get_n_basis_functions();
523 
524  // The writing mode: ENCODE for binary, WRITE for ASCII
525  XdrMODE mode = write_binary_data ? ENCODE : WRITE;
526 
527  // The suffix to use for all the files that are written out
528  const std::string suffix = write_binary_data ? ".xdr" : ".dat";
529 
530  if (this->processor_id() == 0)
531  {
532 
533  // Make a directory to store all the data files
534  Utility::mkdir(directory_name.c_str());
535  // if (mkdir(directory_name.c_str(), 0777) == -1)
536  // {
537  // libMesh::out << "In RBEvaluation::write_offline_data_to_files, directory "
538  // << directory_name << " already exists, overwriting contents." << std::endl;
539  // }
540 
541  // First, write out how many basis functions we have generated
542  std::ostringstream file_name;
543  {
544  file_name << directory_name << "/n_bfs" << suffix;
545  Xdr n_bfs_out(file_name.str(), mode);
546  n_bfs_out << n_bfs;
547  n_bfs_out.close();
548  }
549 
550  // Write out the parameter ranges
551  file_name.str("");
552  file_name << directory_name << "/parameter_ranges" << suffix;
553  std::string continuous_param_file_name = file_name.str();
554 
555  // Write out the discrete parameter values
556  file_name.str("");
557  file_name << directory_name << "/discrete_parameter_values" << suffix;
558  std::string discrete_param_file_name = file_name.str();
559 
560  write_parameter_data_to_files(continuous_param_file_name,
561  discrete_param_file_name,
562  write_binary_data);
563 
564  // Write out Fq representor norm data
565  file_name.str("");
566  file_name << directory_name << "/Fq_innerprods" << suffix;
567  Xdr RB_Fq_innerprods_out(file_name.str(), mode);
568  unsigned int Q_f_hat = rb_theta_expansion->get_n_F_terms()*(rb_theta_expansion->get_n_F_terms()+1)/2;
569  for (unsigned int i=0; i<Q_f_hat; i++)
570  {
571  RB_Fq_innerprods_out << Fq_representor_innerprods[i];
572  }
573  RB_Fq_innerprods_out.close();
574 
575  // Write out output data
576  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
577  {
578  file_name.str("");
579  file_name << directory_name << "/output_";
580  file_name << std::setw(3)
581  << std::setprecision(0)
582  << std::setfill('0')
583  << std::right
584  << n;
585 
586  file_name << "_dual_innerprods" << suffix;
587  Xdr output_dual_innerprods_out(file_name.str(), mode);
588 
589  unsigned int Q_l_hat = rb_theta_expansion->get_n_output_terms(n)*(rb_theta_expansion->get_n_output_terms(n)+1)/2;
590  for (unsigned int q=0; q<Q_l_hat; q++)
591  {
592  output_dual_innerprods_out << output_dual_innerprods[n][q];
593  }
594  output_dual_innerprods_out.close();
595  }
596 
597 
598  // Write out output data to multiple files
599  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
600  {
601  for (unsigned int q_l=0; q_l<rb_theta_expansion->get_n_output_terms(n); q_l++)
602  {
603  file_name.str("");
604  file_name << directory_name << "/output_";
605  file_name << std::setw(3)
606  << std::setprecision(0)
607  << std::setfill('0')
608  << std::right
609  << n;
610  file_name << "_";
611  file_name << std::setw(3)
612  << std::setprecision(0)
613  << std::setfill('0')
614  << std::right
615  << q_l;
616  file_name << suffix;
617  Xdr output_n_out(file_name.str(), mode);
618 
619  for (unsigned int j=0; j<n_bfs; j++)
620  {
621  output_n_out << RB_output_vectors[n][q_l](j);
622  }
623  output_n_out.close();
624  }
625  }
626 
628  {
629  // Next write out the inner product matrix
630  file_name.str("");
631  file_name << directory_name << "/RB_inner_product_matrix" << suffix;
632  Xdr RB_inner_product_matrix_out(file_name.str(), mode);
633  for (unsigned int i=0; i<n_bfs; i++)
634  {
635  for (unsigned int j=0; j<n_bfs; j++)
636  {
637  RB_inner_product_matrix_out << RB_inner_product_matrix(i,j);
638  }
639  }
640  RB_inner_product_matrix_out.close();
641  }
642 
643  // Next write out the Fq vectors
644  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
645  {
646  file_name.str("");
647  file_name << directory_name << "/RB_F_";
648  file_name << std::setw(3)
649  << std::setprecision(0)
650  << std::setfill('0')
651  << std::right
652  << q_f;
653  file_name << suffix;
654  Xdr RB_Fq_f_out(file_name.str(), mode);
655 
656  for (unsigned int i=0; i<n_bfs; i++)
657  {
658  RB_Fq_f_out << RB_Fq_vector[q_f](i);
659  }
660  RB_Fq_f_out.close();
661  }
662 
663  // Next write out the Aq matrices
664  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
665  {
666  file_name.str("");
667  file_name << directory_name << "/RB_A_";
668  file_name << std::setw(3)
669  << std::setprecision(0)
670  << std::setfill('0')
671  << std::right
672  << q_a;
673  file_name << suffix;
674  Xdr RB_Aq_a_out(file_name.str(), mode);
675 
676  for (unsigned int i=0; i<n_bfs; i++)
677  {
678  for (unsigned int j=0; j<n_bfs; j++)
679  {
680  RB_Aq_a_out << RB_Aq_vector[q_a](i,j);
681  }
682  }
683  RB_Aq_a_out.close();
684  }
685 
686  // Next write out Fq_Aq representor norm data
687  file_name.str("");
688  file_name << directory_name << "/Fq_Aq_innerprods" << suffix;
689  Xdr RB_Fq_Aq_innerprods_out(file_name.str(), mode);
690 
691  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
692  {
693  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
694  {
695  for (unsigned int i=0; i<n_bfs; i++)
696  {
697  RB_Fq_Aq_innerprods_out << Fq_Aq_representor_innerprods[q_f][q_a][i];
698  }
699  }
700  }
701  RB_Fq_Aq_innerprods_out.close();
702 
703  // Next write out Aq_Aq representor norm data
704  file_name.str("");
705  file_name << directory_name << "/Aq_Aq_innerprods" << suffix;
706  Xdr RB_Aq_Aq_innerprods_out(file_name.str(), mode);
707 
708  unsigned int Q_a_hat = rb_theta_expansion->get_n_A_terms()*(rb_theta_expansion->get_n_A_terms()+1)/2;
709  for (unsigned int i=0; i<Q_a_hat; i++)
710  {
711  for (unsigned int j=0; j<n_bfs; j++)
712  {
713  for (unsigned int l=0; l<n_bfs; l++)
714  {
715  RB_Aq_Aq_innerprods_out << Aq_Aq_representor_innerprods[i][j][l];
716  }
717  }
718  }
719  RB_Aq_Aq_innerprods_out.close();
720 
721  // Also, write out the greedily selected parameters
722  {
723  file_name.str("");
724  file_name << directory_name << "/greedy_params" << suffix;
725  Xdr greedy_params_out(file_name.str(), mode);
726 
727  for (const auto & param : greedy_param_list)
728  for (const auto & pr : param)
729  for (const auto & value_vector : pr.second)
730  {
731  // Need to make a copy of the value so that it's not const
732  // Xdr is not templated on const's
733  libmesh_error_msg_if(value_vector.size() != 1,
734  "Error: multi-value RB parameters are not yet supported here.");
735  Real param_value = value_vector[0];
736  greedy_params_out << param_value;
737  }
738  greedy_params_out.close();
739  }
740 
741  }
742 }
bool compute_RB_inner_product
Boolean flag to indicate whether we compute the RB_inner_product_matrix.
std::vector< Number > Fq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
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.
DenseMatrix< Number > RB_inner_product_matrix
The inner product matrix.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
int mkdir(const char *pathname)
Create a directory.
Definition: utility.C:152
std::vector< std::vector< Number > > output_dual_innerprods
The vector storing the dual norm inner product terms for each output.
std::vector< RBParameters > greedy_param_list
The list of parameters selected by the Greedy algorithm in generating the Reduced Basis associated wi...
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
XdrMODE
Defines an enum for read/write mode in Xdr format.
Definition: enum_xdr_mode.h:35
std::vector< DenseVector< Number > > RB_Fq_vector
Dense vector for the RHS.
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...
std::vector< DenseMatrix< Number > > RB_Aq_vector
Dense matrices for the RB computations.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
processor_id_type processor_id() const
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
std::vector< std::vector< std::vector< Number > > > Aq_Aq_representor_innerprods
std::vector< std::vector< DenseVector< Number > > > RB_output_vectors
The vectors storing the RB output vectors.

◆ n_objects()

static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 85 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

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

86  { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects
The number of objects.

◆ n_processors()

processor_id_type libMesh::ParallelObject::n_processors ( ) const
inlineinherited
Returns
The number of processors in the group.

Definition at line 103 of file parallel_object.h.

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

Referenced by libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::DofMap::add_constraints_to_send_list(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::System::add_vector(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::Partitioner::build_graph(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::UnstructuredMesh::copy_nodes_and_elements(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::MeshBase::get_info(), libMesh::StaticCondensation::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::NumericVector< Number >::is_effectively_ghosted(), libMesh::NumericVector< Number >::is_effectively_serial(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), 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::DofMap::n_dofs_per_processor(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::prepare_send_list(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), OverlappingFunctorTest::run_partitioner_test(), libMesh::DofMap::scatter_constraints(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), WriteVecAndScalar::setupTests(), libMesh::RBEIMEvaluation::side_gather_bfs(), DistributedMeshTest::testRemoteElemError(), CheckpointIOTest::testSplitter(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

104  {
105  processor_id_type returnval =
106  cast_int<processor_id_type>(_communicator.size());
107  libmesh_assert(returnval); // We never have an empty comm
108  return returnval;
109  }
const Parallel::Communicator & _communicator
processor_id_type size() const
uint8_t processor_id_type
libmesh_assert(ctx)

◆ operator=() [1/2]

RBEvaluation& libMesh::RBEvaluation::operator= ( const RBEvaluation )
delete

◆ operator=() [2/2]

RBEvaluation& libMesh::RBEvaluation::operator= ( RBEvaluation &&  )
default

◆ print_discrete_parameter_values()

void libMesh::RBParametrized::print_discrete_parameter_values ( ) const
inherited

Print out all the discrete parameter values.

Definition at line 366 of file rb_parametrized.C.

References libMesh::RBParametrized::get_discrete_parameter_values(), libMesh::Quality::name(), libMesh::out, and value.

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

367 {
368  for (const auto & [name, values] : get_discrete_parameter_values())
369  {
370  libMesh::out << "Discrete parameter " << name << ", values: ";
371 
372  for (const auto & value : values)
373  libMesh::out << value << " ";
374  libMesh::out << std::endl;
375  }
376 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values() const
Get a const reference to the discrete parameter values.
OStreamProxy out
static const bool value
Definition: xdr_io.C:55

◆ print_info()

void libMesh::ReferenceCounter::print_info ( std::ostream &  out_stream = libMesh::out)
staticinherited

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

Definition at line 81 of file reference_counter.C.

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

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

82 {
84  out_stream << ReferenceCounter::get_info();
85 }
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...

◆ print_parameters()

void libMesh::RBParametrized::print_parameters ( ) const
inherited

Print the current parameters.

Definition at line 178 of file rb_parametrized.C.

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

Referenced by libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), and libMesh::RBConstruction::train_reduced_basis_with_greedy().

179 {
180  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::print_current_parameters");
181 
182  get_parameters().print();
183 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
void print(unsigned precision=6, int max_values=5) const
Print the parameters.
const RBParameters & get_parameters() const
Get the current parameters.

◆ processor_id()

processor_id_type libMesh::ParallelObject::processor_id ( ) const
inlineinherited
Returns
The rank of this processor in the group.

Definition at line 114 of file parallel_object.h.

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

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshFunction::check_found_elem(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), 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::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMapBase::end_dof(), libMesh::DofMapBase::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMapBase::first_dof(), libMesh::DofMapBase::first_old_dof(), libMesh::RBEIMEvaluation::gather_bfs(), 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::RBEIMEvaluation::get_interior_basis_functions_as_vecs(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::DofMap::get_local_constraints(), libMesh::MeshBase::get_local_constraints(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::LaplaceMeshSmoother::init(), libMesh::SystemSubsetBySubdomain::init(), HeatSystem::init_data(), 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(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), legacy_write_offline_data_to_files(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), 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::TriangulatorInterface::MeshedHole::MeshedHole(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::MeshTools::n_connected_components(), libMesh::MeshBase::n_constraint_rows(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMapBase::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::DistributedMesh::own_node(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), 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::XdrIO::read(), libMesh::CheckpointIO::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::ExodusII_IO::read_header(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::DynaIO::read_mesh(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::RBEIMEvaluation::side_gather_bfs(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), ExodusTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), MeshInputTest::testAbaqusRead(), MeshInputTest::testBadGmsh(), BoundaryInfoTest::testBoundaryIDs(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaFileMappings(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusFileMappings(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), MeshInputTest::testGmshBCIDOverlap(), MeshInputTest::testGoodGmsh(), MeshInputTest::testGoodSTL(), MeshInputTest::testGoodSTLBinary(), BoundaryInfoTest::testInternalBoundary(), MeshInputTest::testLowOrderEdgeBlocks(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), WriteVecAndScalar::testSolution(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshSmootherTest::testVariationalSmoother(), libMesh::MeshTools::total_weight(), libMesh::NetGenMeshInterface::triangulate(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::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_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elemset_data(), libMesh::ExodusII_IO_Helper::write_elemsets(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), 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::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodeset_data(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), write_output_solvedata(), libMesh::System::write_parallel_data(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

115  { return cast_int<processor_id_type>(_communicator.rank()); }
processor_id_type rank() const
const Parallel::Communicator & _communicator

◆ rb_solve() [1/2]

Real libMesh::RBEvaluation::rb_solve ( unsigned int  N)
virtual

Perform online solve with the N RB basis functions, for the set of parameters in current_params, where 0 <= N <= RB_size.

Returns
The (absolute) error bound associated with the RB approximation. With an empty RB space (N=0), our RB solution is zero, but we still obtain a meaningful error bound associated with the forcing terms.

Reimplemented in libMesh::TransientRBEvaluation.

Definition at line 221 of file rb_evaluation.C.

Referenced by libMesh::TransientRBConstruction::enrich_RB_space(), get_error_bound_normalization(), and libMesh::RBConstruction::get_RB_error_bound().

222 {
223  return rb_solve(N, nullptr);
224 }
virtual Real rb_solve(unsigned int N)
Perform online solve with the N RB basis functions, for the set of parameters in current_params, where 0 <= N <= RB_size.

◆ rb_solve() [2/2]

Real libMesh::RBEvaluation::rb_solve ( unsigned int  N,
const std::vector< Number > *  evaluated_thetas 
)
virtual

The same as above, except that we pass in evaluated_thetas instead of recomputing the theta values.

Definition at line 226 of file rb_evaluation.C.

References libMesh::DenseVector< T >::add(), libMesh::DenseMatrix< T >::add(), check_evaluated_thetas_size(), compute_residual_dual_norm(), libMesh::DenseVector< T >::dot(), libMesh::RBThetaExpansion::eval_A_theta(), libMesh::RBThetaExpansion::eval_F_theta(), eval_output_dual_norm(), libMesh::RBThetaExpansion::eval_output_theta(), evaluate_RB_error_bound, libMesh::RBThetaExpansion::get_n_A_terms(), get_n_basis_functions(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::RBThetaExpansion::get_n_output_terms(), libMesh::RBThetaExpansion::get_n_outputs(), libMesh::RBParametrized::get_parameters(), get_stability_lower_bound(), libMesh::DenseMatrix< T >::lu_solve(), RB_Aq_vector, RB_Fq_vector, RB_output_error_bounds, RB_output_vectors, RB_outputs, RB_solution, rb_theta_expansion, libMesh::Real, residual_scaling_denom(), libMesh::DenseVector< T >::resize(), libMesh::DenseMatrix< T >::zero(), and libMesh::DenseVector< T >::zero().

228 {
229  LOG_SCOPE("rb_solve()", "RBEvaluation");
230 
231  libmesh_error_msg_if(N > get_n_basis_functions(),
232  "ERROR: N cannot be larger than the number of basis functions in rb_solve");
233 
234  // In case the theta functions have been pre-evaluated, first check the size for consistency. The
235  // size of the input "evaluated_thetas" vector must match the sum of the "A", "F", and "output" terms
236  // in the expansion.
237  this->check_evaluated_thetas_size(evaluated_thetas);
238 
239  const RBParameters & mu = get_parameters();
240 
241  // Resize (and clear) the solution vector
242  RB_solution.resize(N);
243 
244  // Assemble the RB system
245  DenseMatrix<Number> RB_system_matrix(N,N);
246  RB_system_matrix.zero();
247 
248  DenseMatrix<Number> RB_Aq_a;
249  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
250  {
251  RB_Aq_vector[q_a].get_principal_submatrix(N, RB_Aq_a);
252 
253  if (evaluated_thetas)
254  RB_system_matrix.add((*evaluated_thetas)[q_a], RB_Aq_a);
255  else
256  RB_system_matrix.add(rb_theta_expansion->eval_A_theta(q_a, mu), RB_Aq_a);
257  }
258 
259  // Assemble the RB rhs
260  DenseVector<Number> RB_rhs(N);
261  RB_rhs.zero();
262 
263  DenseVector<Number> RB_Fq_f;
264  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
265  {
266  RB_Fq_vector[q_f].get_principal_subvector(N, RB_Fq_f);
267 
268  if (evaluated_thetas)
269  RB_rhs.add((*evaluated_thetas)[q_f+rb_theta_expansion->get_n_A_terms()], RB_Fq_f);
270  else
271  RB_rhs.add(rb_theta_expansion->eval_F_theta(q_f, mu), RB_Fq_f);
272  }
273 
274  // Solve the linear system
275  if (N > 0)
276  {
277  RB_system_matrix.lu_solve(RB_rhs, RB_solution);
278  }
279 
280  // Place to store the output of get_principal_subvector() calls
281  DenseVector<Number> RB_output_vector_N;
282 
283  // Evaluate RB outputs
284  unsigned int output_counter = 0;
285  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
286  {
287  RB_outputs[n] = 0.;
288  for (unsigned int q_l=0; q_l<rb_theta_expansion->get_n_output_terms(n); q_l++)
289  {
290  RB_output_vectors[n][q_l].get_principal_subvector(N, RB_output_vector_N);
291 
292  // Compute dot product with current output vector and RB_solution
293  auto dot_prod = RB_output_vector_N.dot(RB_solution);
294 
295  // Determine the coefficient depending on whether or not
296  // pre-evaluated thetas were provided. Note that if
297  // pre-evaluated thetas were provided, they must come after
298  // the "A" and "F" thetas and be in "row-major" order. In
299  // other words, there is a possibly "ragged" 2D array of
300  // output thetas ordered by output index "n" and term index
301  // "q_l" which is accessed in row-major order.
302  auto coeff = evaluated_thetas ?
303  (*evaluated_thetas)[output_counter + rb_theta_expansion->get_n_A_terms() + rb_theta_expansion->get_n_F_terms()] :
305 
306  // Finally, accumulate the result in RB_outputs[n]
307  RB_outputs[n] += coeff * dot_prod;
308 
309  // Go to next output
310  output_counter++;
311  }
312  }
313 
314  if (evaluate_RB_error_bound) // Calculate the error bounds
315  {
316  // Evaluate the dual norm of the residual for RB_solution_vector
317  Real epsilon_N = compute_residual_dual_norm(N, evaluated_thetas);
318 
319  // Get lower bound for coercivity constant
320  const Real alpha_LB = get_stability_lower_bound();
321  // alpha_LB needs to be positive to get a valid error bound
322  libmesh_assert_greater ( alpha_LB, 0. );
323 
324  // Evaluate the (absolute) error bound
325  Real abs_error_bound = epsilon_N / residual_scaling_denom(alpha_LB);
326 
327  // Now compute the output error bounds
328  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
329  RB_output_error_bounds[n] = abs_error_bound * this->eval_output_dual_norm(n, evaluated_thetas);
330 
331  return abs_error_bound;
332  }
333  else // Don't calculate the error bounds
334  {
335  // Just return -1. if we did not compute the error bound
336  return -1.;
337  }
338 }
Real eval_output_dual_norm(unsigned int n, const std::vector< Number > *evaluated_thetas)
Evaluate the dual norm of output n for the current parameters, or using the pre-evaluted theta values...
virtual Number eval_output_theta(unsigned int output_index, unsigned int q_l, const RBParameters &mu) const
Evaluate theta_q_l at the current parameter.
virtual Number eval_A_theta(unsigned int q, const RBParameters &mu) const
Evaluate theta_q_a at the current parameter.
bool evaluate_RB_error_bound
Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called...
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
DenseVector< Number > RB_solution
The RB solution vector.
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:396
virtual Real compute_residual_dual_norm(const unsigned int N)
Compute the dual norm of the residual for the solution saved in RB_solution_vector.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
std::vector< DenseVector< Number > > RB_Fq_vector
Dense vector for the RHS.
virtual Real get_stability_lower_bound()
Get a lower bound for the stability constant (e.g.
virtual Number eval_F_theta(unsigned int q, const RBParameters &mu) const
Evaluate theta_q_f at the current parameter.
std::vector< Real > RB_output_error_bounds
const RBParameters & get_parameters() const
Get the current parameters.
virtual Real residual_scaling_denom(Real alpha_LB)
Specifies the residual scaling on the denominator to be used in the a posteriori error bound...
std::vector< DenseMatrix< Number > > RB_Aq_vector
Dense matrices for the RB computations.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
void check_evaluated_thetas_size(const std::vector< Number > *evaluated_thetas) const
For interfaces like rb_solve() and compute_residual_dual_norm() that optinally take a vector of "pre-...
std::vector< Number > RB_outputs
The vectors storing the RB output values and corresponding error bounds.
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
std::vector< std::vector< DenseVector< Number > > > RB_output_vectors
The vectors storing the RB output vectors.

◆ read_in_basis_functions()

void libMesh::RBEvaluation::read_in_basis_functions ( System sys,
const std::string &  directory_name = "offline_data",
const bool  read_binary_basis_functions = true 
)
virtual

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 1065 of file rb_evaluation.C.

References basis_functions, and read_in_vectors().

1068 {
1069  LOG_SCOPE("read_in_basis_functions()", "RBEvaluation");
1070 
1071  read_in_vectors(sys,
1073  directory_name,
1074  "bf",
1075  read_binary_basis_functions);
1076 }
std::vector< std::unique_ptr< NumericVector< Number > > > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
static void read_in_vectors(System &sys, std::vector< std::unique_ptr< 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...

◆ read_in_vectors()

void libMesh::RBEvaluation::read_in_vectors ( System sys,
std::vector< std::unique_ptr< NumericVector< Number >>> &  vectors,
const std::string &  directory_name,
const std::string &  data_name,
const bool  read_binary_vectors 
)
static

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 1078 of file rb_evaluation.C.

References read_in_vectors_from_multiple_files().

Referenced by read_in_basis_functions().

1083 {
1084  std::vector<std::vector<std::unique_ptr<NumericVector<Number>>> *> vectors_vec;
1085  vectors_vec.push_back(&vectors);
1086 
1087  std::vector<std::string> directory_name_vec;
1088  directory_name_vec.push_back(directory_name);
1089 
1090  std::vector<std::string> data_name_vec;
1091  data_name_vec.push_back(data_name);
1092 
1094  vectors_vec,
1095  directory_name_vec,
1096  data_name_vec,
1097  read_binary_vectors);
1098 }
static void read_in_vectors_from_multiple_files(System &sys, std::vector< std::vector< std::unique_ptr< 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.

◆ read_in_vectors_from_multiple_files()

void libMesh::RBEvaluation::read_in_vectors_from_multiple_files ( System sys,
std::vector< std::vector< std::unique_ptr< 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 
)
static

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 1100 of file rb_evaluation.C.

References assert_file_exists(), TIMPI::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, TIMPI::Communicator::rank(), libMesh::READ, libMesh::System::read_header(), and libMesh::System::read_serialized_vectors().

Referenced by read_in_vectors().

1105 {
1106  LOG_SCOPE("read_in_vectors_from_multiple_files()", "RBEvaluation");
1107 
1108  std::size_t n_files = multiple_vectors.size();
1109  std::size_t n_directories = multiple_directory_names.size();
1110  libmesh_assert((n_files == n_directories) && (n_files == multiple_data_names.size()));
1111 
1112  if (n_files == 0)
1113  return;
1114 
1115  // Make sure processors are synced up before we begin
1116  sys.comm().barrier();
1117 
1118  std::ostringstream file_name;
1119  const std::string basis_function_suffix = (read_binary_vectors ? ".xdr" : ".dat");
1120 
1121  // Following EquationSystemsIO::read, we use a temporary numbering (node major)
1122  // before writing out the data. For the sake of efficiency, we do this once for
1123  // all the vectors that we read in.
1125 
1126  for (std::size_t data_index=0; data_index<n_directories; data_index++)
1127  {
1128  std::vector<std::unique_ptr<NumericVector<Number>>> & vectors = *multiple_vectors[data_index];
1129 
1130  // Allocate storage for each vector
1131  for (auto & vec : vectors)
1132  {
1133  // vectors should all be nullptr, otherwise we get a memory leak when
1134  // we create the new vectors in RBEvaluation::read_in_vectors.
1135  libmesh_error_msg_if(vec, "Non-nullptr vector passed to read_in_vectors_from_multiple_files");
1136 
1137  vec = NumericVector<Number>::build(sys.comm());
1138 
1139  vec->init (sys.n_dofs(),
1140  sys.n_local_dofs(),
1141  false,
1142  PARALLEL);
1143  }
1144 
1145  file_name.str("");
1146  file_name << multiple_directory_names[data_index]
1147  << "/" << multiple_data_names[data_index]
1148  << "_data" << basis_function_suffix;
1149 
1150  // On processor zero check to be sure the file exists
1151  if (sys.comm().rank() == 0)
1152  {
1153  struct stat stat_info;
1154  int stat_result = stat(file_name.str().c_str(), &stat_info);
1155 
1156  libmesh_error_msg_if(stat_result != 0, "File does not exist: " << file_name.str());
1157  }
1158 
1159  assert_file_exists(file_name.str());
1160  Xdr vector_data(file_name.str(),
1161  read_binary_vectors ? DECODE : READ);
1162 
1163  // Read the header data. This block of code is based on EquationSystems::_read_impl.
1164  {
1165  std::string version;
1166  vector_data.data(version);
1167 
1168  const std::string libMesh_label = "libMesh-";
1169  std::string::size_type lm_pos = version.find(libMesh_label);
1170  libmesh_error_msg_if(lm_pos == std::string::npos, "version info missing in Xdr header");
1171 
1172  std::istringstream iss(version.substr(lm_pos + libMesh_label.size()));
1173  int ver_major = 0, ver_minor = 0, ver_patch = 0;
1174  char dot;
1175  iss >> ver_major >> dot >> ver_minor >> dot >> ver_patch;
1176  vector_data.set_version(LIBMESH_VERSION_ID(ver_major, ver_minor, ver_patch));
1177 
1178  // Actually read the header data. When we do this, set read_header=false
1179  // so that we do not reinit sys, since we assume that it has already been
1180  // set up properly (e.g. the appropriate variables have already been added).
1181  sys.read_header(vector_data, version, /*read_header=*/false, /*read_additional_data=*/false);
1182  }
1183 
1184  // Comply with the System::read_serialized_vectors() interface which uses dumb pointers.
1185  std::vector<NumericVector<Number> *> vec_in;
1186  for (auto & vec : vectors)
1187  vec_in.push_back(vec.get());
1188 
1189  sys.read_serialized_vectors (vector_data, vec_in);
1190  }
1191 
1192  // Undo the temporary renumbering
1193  sys.get_mesh().fix_broken_node_and_element_numbering();
1194 }
libmesh_assert(ctx)
void globally_renumber_nodes_and_elements(MeshBase &)
There is no reason for a user to ever call this function.
Definition: mesh_tools.C:2657
static void assert_file_exists(const std::string &file_name)
Helper function that checks if file_name exists.
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, SolverPackage solver_package=libMesh::default_solver_package(), ParallelType parallel_type=AUTOMATIC)
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...

◆ read_parameter_data_from_files()

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 262 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::RBSCMEvaluation::legacy_read_offline_data_from_files(), and legacy_read_offline_data_from_files().

265 {
266  RBParameters param_min;
267  RBParameters param_max;
268  read_parameter_ranges_from_file(continuous_param_file_name,
269  read_binary_data,
270  param_min,
271  param_max);
272 
273  std::map<std::string, std::vector<Real>> discrete_parameter_values_in;
274  read_discrete_parameter_values_from_file(discrete_param_file_name,
275  read_binary_data,
276  discrete_parameter_values_in);
277 
278  initialize_parameters(param_min, param_max, discrete_parameter_values_in);
279 }
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.

◆ residual_scaling_denom()

Real libMesh::RBEvaluation::residual_scaling_denom ( Real  alpha_LB)
virtual

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 467 of file rb_evaluation.C.

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

468 {
469  // Here we implement the residual scaling for a coercive
470  // problem.
471  return alpha_LB;
472 }

◆ resize_data_structures()

void libMesh::RBEvaluation::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. Override to also clear and resize any extra data in subclasses.

Reimplemented in libMesh::TransientRBEvaluation.

Definition at line 113 of file rb_evaluation.C.

References Aq_Aq_representor_innerprods, Aq_representor, clear_riesz_representors(), compute_RB_inner_product, Fq_Aq_representor_innerprods, Fq_representor_innerprods, libMesh::RBThetaExpansion::get_n_A_terms(), get_n_basis_functions(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::RBThetaExpansion::get_n_output_terms(), libMesh::RBThetaExpansion::get_n_outputs(), output_dual_innerprods, RB_Aq_vector, RB_Fq_vector, RB_inner_product_matrix, RB_output_error_bounds, RB_output_vectors, RB_outputs, rb_theta_expansion, and libMesh::DenseMatrix< T >::resize().

Referenced by libMesh::RBConstruction::enrich_basis_from_rhs_terms(), legacy_read_offline_data_from_files(), libMesh::RBDataDeserialization::load_rb_evaluation_data(), libMesh::TransientRBEvaluation::resize_data_structures(), libMesh::RBConstruction::train_reduced_basis_with_greedy(), and libMesh::RBConstruction::train_reduced_basis_with_POD().

115 {
116  LOG_SCOPE("resize_data_structures()", "RBEvaluation");
117 
118  libmesh_error_msg_if(Nmax < this->get_n_basis_functions(),
119  "Error: Cannot set Nmax to be less than the current number of basis functions.");
120 
121  // Resize/clear inner product matrix
123  RB_inner_product_matrix.resize(Nmax,Nmax);
124 
125  // Allocate dense matrices for RB solves
127 
128  for (unsigned int q=0; q<rb_theta_expansion->get_n_A_terms(); q++)
129  {
130  // Initialize the memory for the RB matrices
131  RB_Aq_vector[q].resize(Nmax,Nmax);
132  }
133 
135 
136  for (unsigned int q=0; q<rb_theta_expansion->get_n_F_terms(); q++)
137  {
138  // Initialize the memory for the RB vectors
139  RB_Fq_vector[q].resize(Nmax);
140  }
141 
142 
143  // Initialize the RB output vectors
145  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
146  {
148  for (unsigned int q_l=0; q_l<rb_theta_expansion->get_n_output_terms(n); q_l++)
149  {
150  RB_output_vectors[n][q_l].resize(Nmax);
151  }
152  }
153 
154  // Initialize vectors storing output data
156 
157 
158  if (resize_error_bound_data)
159  {
160  // Initialize vectors for the norms of the Fq representors
161  unsigned int Q_f_hat = rb_theta_expansion->get_n_F_terms()*(rb_theta_expansion->get_n_F_terms()+1)/2;
162  Fq_representor_innerprods.resize(Q_f_hat);
163 
164  // Initialize vectors for the norms of the representors
166  for (unsigned int i=0; i<rb_theta_expansion->get_n_F_terms(); i++)
167  {
169  for (unsigned int j=0; j<rb_theta_expansion->get_n_A_terms(); j++)
170  {
171  Fq_Aq_representor_innerprods[i][j].resize(Nmax, 0.);
172  }
173  }
174 
175  unsigned int Q_a_hat = rb_theta_expansion->get_n_A_terms()*(rb_theta_expansion->get_n_A_terms()+1)/2;
176  Aq_Aq_representor_innerprods.resize(Q_a_hat);
177  for (unsigned int i=0; i<Q_a_hat; i++)
178  {
179  Aq_Aq_representor_innerprods[i].resize(Nmax);
180  for (unsigned int j=0; j<Nmax; j++)
181  {
182  Aq_Aq_representor_innerprods[i][j].resize(Nmax, 0.);
183  }
184  }
185 
187 
188  // Resize the output dual norm vectors
190  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
191  {
192  unsigned int Q_l_hat = rb_theta_expansion->get_n_output_terms(n)*(rb_theta_expansion->get_n_output_terms(n)+1)/2;
193  output_dual_innerprods[n].resize(Q_l_hat);
194  }
195 
196  // Clear and resize the vector of Aq_representors
198 
200  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
201  {
202  Aq_representor[q_a].resize(Nmax);
203  }
204  }
205 }
std::vector< std::vector< std::unique_ptr< NumericVector< Number > > > > Aq_representor
Vector storing the residual representors associated with the left-hand side.
bool compute_RB_inner_product
Boolean flag to indicate whether we compute the RB_inner_product_matrix.
std::vector< Number > Fq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
DenseMatrix< Number > RB_inner_product_matrix
The inner product matrix.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
std::vector< std::vector< Number > > output_dual_innerprods
The vector storing the dual norm inner product terms for each output.
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
std::vector< DenseVector< Number > > RB_Fq_vector
Dense vector for the RHS.
std::vector< Real > RB_output_error_bounds
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...
virtual void clear_riesz_representors()
Clear all the Riesz representors that are used to compute the RB residual (and hence error bound)...
std::vector< DenseMatrix< Number > > RB_Aq_vector
Dense matrices for the RB computations.
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero().
Definition: dense_matrix.h:895
std::vector< Number > RB_outputs
The vectors storing the RB output values and corresponding error bounds.
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
std::vector< std::vector< std::vector< Number > > > Aq_Aq_representor_innerprods
std::vector< std::vector< DenseVector< Number > > > RB_output_vectors
The vectors storing the RB output vectors.

◆ set_n_basis_functions()

void libMesh::RBEvaluation::set_n_basis_functions ( unsigned int  n_bfs)
virtual

Set the number of basis functions.

Useful when reading in stored data.

Definition at line 75 of file rb_evaluation.C.

References basis_functions.

Referenced by clear(), legacy_read_offline_data_from_files(), and libMesh::RBDataDeserialization::load_rb_evaluation_data().

76 {
77  basis_functions.resize(n_bfs);
78 }
std::vector< std::unique_ptr< NumericVector< Number > > > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.

◆ set_parameters()

bool libMesh::RBParametrized::set_parameters ( const RBParameters params)
inherited

Set the current parameters to params The parameters are checked for validity; an error is thrown if the number of parameters or samples is different than expected.

We

Returns
a boolean true if the new parameters are within the min/max range, and false otherwise (but the parameters are set regardless). Enabling the "verbose_mode" flag will also print more details.

Definition at line 129 of file rb_parametrized.C.

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

Referenced by libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), 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(), and RBParametersTest::testRBParametrized().

130 {
131  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::set_parameters");
132 
133  // Terminate if params has the wrong number of parameters or samples.
134  // If the parameters are outside the min/max range, return false.
135  const bool valid_params = check_if_valid_params(params);
136 
137  // Make a copy of params (default assignment operator just does memberwise copy, which is sufficient here)
138  this->parameters = params;
139 
140  return valid_params;
141 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
bool check_if_valid_params(const RBParameters &params) const
Helper function to check that params is valid:
RBParameters parameters
Vector storing the current parameters.

◆ set_rb_theta_expansion()

void libMesh::RBEvaluation::set_rb_theta_expansion ( RBThetaExpansion rb_theta_expansion_in)

Set the RBThetaExpansion object.

Definition at line 80 of file rb_evaluation.C.

References rb_theta_expansion.

Referenced by SimpleRBEvaluation::SimpleRBEvaluation().

81 {
82  rb_theta_expansion = &rb_theta_expansion_in;
83 }
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.

◆ write_out_basis_functions()

void libMesh::RBEvaluation::write_out_basis_functions ( System sys,
const std::string &  directory_name = "offline_data",
const bool  write_binary_basis_functions = true 
)
virtual

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 982 of file rb_evaluation.C.

References basis_functions, and write_out_vectors().

Referenced by main().

985 {
986  LOG_SCOPE("write_out_basis_functions()", "RBEvaluation");
987 
988  std::vector<NumericVector<Number>*> basis_functions_ptrs;
989  for (std::size_t i=0; i<basis_functions.size(); i++)
990  {
991  basis_functions_ptrs.push_back(basis_functions[i].get());
992  }
993 
994  write_out_vectors(sys,
995  basis_functions_ptrs,
996  directory_name,
997  "bf",
998  write_binary_basis_functions);
999 }
std::vector< std::unique_ptr< NumericVector< Number > > > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
static 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...

◆ write_out_vectors()

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 
)
static

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

Definition at line 1001 of file rb_evaluation.C.

References TIMPI::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(), TIMPI::Communicator::rank(), libMesh::WRITE, libMesh::System::write_header(), and libMesh::System::write_serialized_vectors().

Referenced by write_out_basis_functions().

1006 {
1007  LOG_SCOPE("write_out_vectors()", "RBEvaluation");
1008 
1009  if (sys.comm().rank() == 0)
1010  {
1011  // Make a directory to store all the data files
1012  Utility::mkdir(directory_name.c_str());
1013  }
1014 
1015  // Make sure processors are synced up before we begin
1016  sys.comm().barrier();
1017 
1018  std::ostringstream file_name;
1019  const std::string basis_function_suffix = (write_binary_vectors ? ".xdr" : ".dat");
1020 
1021  file_name << directory_name << "/" << data_name << "_data" << basis_function_suffix;
1022  Xdr bf_data(file_name.str(),
1023  write_binary_vectors ? ENCODE : WRITE);
1024 
1025  // Following EquationSystems::write(), we should only write the header information
1026  // if we're proc 0
1027  if (sys.comm().rank() == 0)
1028  {
1029  std::string version("libMesh-" + libMesh::get_io_compatibility_version());
1030 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1031  version += " with infinite elements";
1032 #endif
1033  bf_data.data(version ,"# File Format Identifier");
1034 
1035  sys.write_header(bf_data, /*(unused arg)*/ version, /*write_additional_data=*/false);
1036  }
1037 
1038  // Following EquationSystemsIO::write, we use a temporary numbering (node major)
1039  // before writing out the data
1041 
1042  // Write all vectors at once.
1043  {
1044  // Note the API wants pointers to constant vectors, hence this...
1045  std::vector<const NumericVector<Number> *> bf_out;
1046  for (const auto & vec : vectors)
1047  bf_out.push_back(vec);
1048 
1049  // for (auto & val : vectors)
1050  // bf_out.push_back(val);
1051  sys.write_serialized_vectors (bf_data, bf_out);
1052  }
1053 
1054 
1055  // set the current version
1056  bf_data.set_version(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION,
1057  LIBMESH_MINOR_VERSION,
1058  LIBMESH_MICRO_VERSION));
1059 
1060 
1061  // Undo the temporary renumbering
1062  sys.get_mesh().fix_broken_node_and_element_numbering();
1063 }
int mkdir(const char *pathname)
Create a directory.
Definition: utility.C:152
std::string get_io_compatibility_version()
Specifier for I/O file compatibility features.
void globally_renumber_nodes_and_elements(MeshBase &)
There is no reason for a user to ever call this function.
Definition: mesh_tools.C:2657

◆ write_parameter_data_to_files()

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 185 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::RBSCMEvaluation::legacy_write_offline_data_to_files(), and legacy_write_offline_data_to_files().

188 {
189  write_parameter_ranges_to_file(continuous_param_file_name, write_binary_data);
190  write_discrete_parameter_values_to_file(discrete_param_file_name, write_binary_data);
191 }
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

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _counts

ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

Actually holds the data.

Definition at line 124 of file reference_counter.h.

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

◆ _enable_print_counter

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().

◆ _mutex

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.

◆ _n_objects

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().

◆ Aq_Aq_representor_innerprods

std::vector<std::vector<std::vector<Number> > > libMesh::RBEvaluation::Aq_Aq_representor_innerprods

◆ Aq_representor

std::vector<std::vector<std::unique_ptr<NumericVector<Number> > > > libMesh::RBEvaluation::Aq_representor

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 340 of file rb_evaluation.h.

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

◆ basis_functions

std::vector<std::unique_ptr<NumericVector<Number> > > libMesh::RBEvaluation::basis_functions

◆ compute_RB_inner_product

bool libMesh::RBEvaluation::compute_RB_inner_product

◆ evaluate_RB_error_bound

bool libMesh::RBEvaluation::evaluate_RB_error_bound

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

Definition at line 346 of file rb_evaluation.h.

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

◆ Fq_Aq_representor_innerprods

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

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 323 of file rb_evaluation.h.

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

◆ Fq_representor_innerprods

std::vector<Number> libMesh::RBEvaluation::Fq_representor_innerprods

◆ greedy_param_list

std::vector<RBParameters> libMesh::RBEvaluation::greedy_param_list

◆ output_dual_innerprods

std::vector<std::vector<Number > > libMesh::RBEvaluation::output_dual_innerprods

The vector storing the dual norm inner product terms for each output.

These values are independent of a basis, hence they can be copied over directly from an RBSystem.

Definition at line 332 of file rb_evaluation.h.

Referenced by libMesh::RBDataSerialization::add_rb_evaluation_data_to_builder(), libMesh::RBConstruction::compute_output_dual_innerprods(), eval_output_dual_norm(), legacy_read_offline_data_from_files(), legacy_write_offline_data_to_files(), libMesh::RBDataDeserialization::load_rb_evaluation_data(), and resize_data_structures().

◆ RB_Aq_vector

std::vector<DenseMatrix<Number> > libMesh::RBEvaluation::RB_Aq_vector

◆ RB_Fq_vector

std::vector<DenseVector<Number> > libMesh::RBEvaluation::RB_Fq_vector

◆ RB_inner_product_matrix

DenseMatrix<Number> libMesh::RBEvaluation::RB_inner_product_matrix

The inner product matrix.

This should be close to the identity, we need to calculate this rather than assume diagonality in order to accurately perform projections since orthogonality degrades with increasing N.

Definition at line 279 of file rb_evaluation.h.

Referenced by libMesh::RBDataSerialization::add_rb_evaluation_data_to_builder(), legacy_read_offline_data_from_files(), legacy_write_offline_data_to_files(), libMesh::RBDataDeserialization::load_rb_evaluation_data(), resize_data_structures(), libMesh::TransientRBConstruction::set_error_temporal_data(), and libMesh::RBConstruction::update_RB_system_matrices().

◆ RB_output_error_bounds

std::vector<Real > libMesh::RBEvaluation::RB_output_error_bounds

Definition at line 306 of file rb_evaluation.h.

Referenced by rb_solve(), and resize_data_structures().

◆ RB_output_vectors

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

◆ RB_outputs

std::vector<Number > libMesh::RBEvaluation::RB_outputs

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

Definition at line 305 of file rb_evaluation.h.

Referenced by rb_solve(), and resize_data_structures().

◆ RB_solution

DenseVector<Number> libMesh::RBEvaluation::RB_solution

◆ rb_theta_expansion

RBThetaExpansion* libMesh::RBEvaluation::rb_theta_expansion
private

A pointer to to the object that stores the theta expansion.

This is not a std::unique_ptr since we may want to share it.

Note
A shared_ptr would be a good option here.

Definition at line 368 of file rb_evaluation.h.

Referenced by check_evaluated_thetas_size(), compute_residual_dual_norm(), eval_output_dual_norm(), get_rb_theta_expansion(), is_rb_theta_expansion_initialized(), legacy_read_offline_data_from_files(), legacy_write_offline_data_to_files(), rb_solve(), resize_data_structures(), and set_rb_theta_expansion().

◆ verbose_mode

bool libMesh::RBParametrized::verbose_mode
inherited

Public boolean to toggle verbose mode.

Definition at line 181 of file rb_parametrized.h.

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


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