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

#include <rb_classes.h>

Inheritance diagram for ElasticityRBEvaluation:
[legend]

Public Member Functions

 ElasticityRBEvaluation (const Parallel::Communicator &comm)
 Constructor. More...
 
virtual Real get_stability_lower_bound ()
 Return a "dummy" lower bound for the coercivity constant. More...
 
virtual void clear () libmesh_override
 Clear this RBEvaluation object. More...
 
void set_rb_theta_expansion (RBThetaExpansion &rb_theta_expansion_in)
 Set the RBThetaExpansion object. More...
 
RBThetaExpansion & get_rb_theta_expansion ()
 Get a reference to the rb_theta_expansion. More...
 
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...
 
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 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 residual_scaling_denom (Real alpha_LB)
 Specifies the residual scaling on the denominator to be used in the a posteriori error bound. More...
 
Real eval_output_dual_norm (unsigned int n, const RBParameters &mu)
 Evaluate the dual norm of output n for the current parameters. More...
 
virtual 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 write_out_vectors (System &sys, std::vector< NumericVector< Number > * > &vectors, const std::string &directory_name="offline_data", const std::string &data_name="bf", const bool write_binary_basis_functions=true)
 Same as write_out_basis_functions, except in this case we pass in the vectors to be written. More...
 
virtual void read_in_basis_functions (System &sys, const std::string &directory_name="offline_data", const bool read_binary_basis_functions=true)
 Read in all the basis functions from file. More...
 
void read_in_vectors (System &sys, std::vector< NumericVector< Number > * > &vectors, const std::string &directory_name, const std::string &data_name, const bool read_binary_vectors)
 Same as read_in_basis_functions, except in this case we pass in the vectors to be written. More...
 
void read_in_vectors_from_multiple_files (System &sys, std::vector< std::vector< NumericVector< Number > * > * > multiple_vectors, const std::vector< std::string > &multiple_directory_names, const std::vector< std::string > &multiple_data_names, const bool read_binary_vectors)
 Performs read_in_vectors for a list of directory names and data names. More...
 
void initialize_parameters (const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values)
 Initialize the parameter ranges and set current_parameters. More...
 
void initialize_parameters (const RBParametrized &rb_parametrized)
 Initialize the parameter ranges and set current_parameters. More...
 
unsigned int get_n_params () const
 Get the number of parameters. More...
 
unsigned int get_n_continuous_params () const
 Get the number of continuous parameters. More...
 
unsigned int get_n_discrete_params () const
 Get the number of discrete parameters. More...
 
std::set< std::string > get_parameter_names () const
 Get a set that stores the parameter names. More...
 
const RBParameters & get_parameters () const
 Get the current parameters. More...
 
void set_parameters (const RBParameters &params)
 Set the current parameters to params. More...
 
const RBParameters & get_parameters_min () const
 Get an RBParameters object that specifies the minimum allowable value for each parameter. More...
 
const RBParameters & get_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::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

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

Public Attributes

ElasticityThetaExpansion elasticity_theta_expansion
 The object that stores the "theta" expansion of the parameter dependent PDE, i.e. More...
 
std::vector< NumericVector< Number > * > basis_functions
 The libMesh vectors storing the finite element coefficients of the RB basis functions. More...
 
std::vector< RBParameters > greedy_param_list
 The list of parameters selected by the Greedy algorithm in generating the Reduced Basis associated with this RBEvaluation object. More...
 
DenseMatrix< Number > RB_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< Number > RB_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< Number > RB_outputs
 The vectors storing the RB output values and corresponding error bounds. More...
 
std::vector< Real > RB_output_error_bounds
 
std::vector< Number > Fq_representor_innerprods
 Vectors storing the residual representor inner products to be used in computing the residuals online. More...
 
std::vector< std::vector< std::vector< Number > > > Fq_Aq_representor_innerprods
 Vectors storing the residual representor inner products to be used in computing the residuals online. More...
 
std::vector< std::vector< std::vector< Number > > > Aq_Aq_representor_innerprods
 
std::vector< std::vector< Number > > output_dual_innerprods
 The vector storing the dual norm inner product terms for each output. More...
 
std::vector< std::vector< NumericVector< Number > * > > Aq_representor
 Vector storing the residual representors associated with the left-hand side. More...
 
bool evaluate_RB_error_bound
 Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called. More...
 
bool compute_RB_inner_product
 Boolean flag to indicate whether we compute the RB_inner_product_matrix. More...
 
bool verbose_mode
 Public boolean to toggle verbose mode. More...
 

Protected Types

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

Protected Member Functions

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

Protected Attributes

const Parallel::Communicator & _communicator
 

Static Protected Attributes

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

Detailed Description

Definition at line 18 of file rb_classes.h.

Member Typedef Documentation

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

Data structure to log the information.

The log is identified by the class name.

Definition at line 119 of file reference_counter.h.

Constructor & Destructor Documentation

ElasticityRBEvaluation::ElasticityRBEvaluation ( const Parallel::Communicator comm)

Constructor.

Just set the theta expansion.

Definition at line 25 of file rb_classes.h.

26  : RBEvaluation(comm)
27  {
29  }
ElasticityThetaExpansion elasticity_theta_expansion
The object that stores the "theta" expansion of the parameter dependent PDE, i.e. ...
Definition: rb_classes.h:41
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
Definition: rb_evaluation.C:84
RBEvaluation(const Parallel::Communicator &comm LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
Constructor.
Definition: rb_evaluation.C:45

Member Function Documentation

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

Helper function that checks if file_name exists.

Definition at line 894 of file rb_evaluation.C.

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

895 {
896  if (!std::ifstream(file_name.c_str()))
897  libmesh_error_msg("File missing: " + file_name);
898 }
void libMesh::RBEvaluation::clear ( )
virtualinherited

Clear this RBEvaluation object.

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

Reimplemented from libMesh::RBParametrized.

Reimplemented in libMesh::RBEIMEvaluation, and libMesh::TransientRBEvaluation.

Definition at line 60 of file rb_evaluation.C.

References libMesh::RBEvaluation::basis_functions, libMesh::RBEvaluation::clear_riesz_representors(), libMesh::RBEvaluation::greedy_param_list, libmesh_nullptr, and libMesh::RBEvaluation::set_n_basis_functions().

Referenced by libMesh::RBEIMEvaluation::clear(), libMesh::TransientRBEvaluation::clear(), and libMesh::RBEvaluation::~RBEvaluation().

61 {
62  LOG_SCOPE("clear()", "RBEvaluation");
63 
64  // Clear the basis functions
65  for (std::size_t i=0; i<basis_functions.size(); i++)
66  {
67  if (basis_functions[i])
68  {
69  basis_functions[i]->clear();
70  delete basis_functions[i];
72  }
73  }
75 
77 
78  // Clear the Greedy param list
79  for (std::size_t i=0; i<greedy_param_list.size(); i++)
81  greedy_param_list.clear();
82 }
std::vector< NumericVector< Number > * > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
virtual void set_n_basis_functions(unsigned int n_bfs)
Set the number of basis functions.
const class libmesh_nullptr_t libmesh_nullptr
std::vector< RBParameters > greedy_param_list
The list of parameters selected by the Greedy algorithm in generating the Reduced Basis associated wi...
virtual void clear_riesz_representors()
Clear all the Riesz representors that are used to compute the RB residual (and hence error bound)...
virtual void clear() libmesh_override
Clear this RBEvaluation object.
Definition: rb_evaluation.C:60
void libMesh::RBEvaluation::clear_riesz_representors ( )
virtualinherited

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

References libMesh::RBEvaluation::Aq_representor, and libmesh_nullptr.

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

413 {
414 
415  // Clear the Aq_representors
416  for (std::size_t q_a=0; q_a<Aq_representor.size(); q_a++)
417  for (std::size_t i=0; i<Aq_representor[q_a].size(); i++)
418  {
419  delete Aq_representor[q_a][i];
421  }
422 }
std::vector< std::vector< NumericVector< Number > * > > Aq_representor
Vector storing the residual representors associated with the left-hand side.
const class libmesh_nullptr_t libmesh_nullptr
const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inherited
Returns
A reference to the Parallel::Communicator object used by this mesh.

Definition at line 87 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

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

88  { return _communicator; }
const Parallel::Communicator & _communicator
Real libMesh::RBEvaluation::compute_residual_dual_norm ( const unsigned int  N)
virtualinherited

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

Reimplemented in libMesh::TransientRBEvaluation.

Definition at line 303 of file rb_evaluation.C.

References std::abs(), libMesh::RBEvaluation::Aq_Aq_representor_innerprods, libMesh::RBThetaExpansion::eval_A_theta(), libMesh::RBThetaExpansion::eval_F_theta(), libMesh::RBEvaluation::Fq_Aq_representor_innerprods, libMesh::RBEvaluation::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(), libMesh::RBEvaluation::RB_solution, libMesh::RBEvaluation::rb_theta_expansion, and libMesh::Real.

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

304 {
305  LOG_SCOPE("compute_residual_dual_norm()", "RBEvaluation");
306 
307  const RBParameters & mu = get_parameters();
308 
309  // Use the stored representor inner product values
310  // to evaluate the residual norm
311  Number residual_norm_sq = 0.;
312 
313  unsigned int q=0;
314  for (unsigned int q_f1=0; q_f1<rb_theta_expansion->get_n_F_terms(); q_f1++)
315  {
316  for (unsigned int q_f2=q_f1; q_f2<rb_theta_expansion->get_n_F_terms(); q_f2++)
317  {
318  Real delta = (q_f1==q_f2) ? 1. : 2.;
319  residual_norm_sq += delta * libmesh_real(
322 
323  q++;
324  }
325  }
326 
327  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
328  {
329  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
330  {
331  for (unsigned int i=0; i<N; i++)
332  {
333  Real delta = 2.;
334  residual_norm_sq +=
335  delta * libmesh_real( rb_theta_expansion->eval_F_theta(q_f, mu) *
338  }
339  }
340  }
341 
342  q=0;
343  for (unsigned int q_a1=0; q_a1<rb_theta_expansion->get_n_A_terms(); q_a1++)
344  {
345  for (unsigned int q_a2=q_a1; q_a2<rb_theta_expansion->get_n_A_terms(); q_a2++)
346  {
347  Real delta = (q_a1==q_a2) ? 1. : 2.;
348 
349  for (unsigned int i=0; i<N; i++)
350  {
351  for (unsigned int j=0; j<N; j++)
352  {
353  residual_norm_sq +=
355  rb_theta_expansion->eval_A_theta(q_a2, mu) *
357  }
358  }
359 
360  q++;
361  }
362  }
363 
364  if (libmesh_real(residual_norm_sq) < 0.)
365  {
366  // libMesh::out << "Warning: Square of residual norm is negative "
367  // << "in RBSystem::compute_residual_dual_norm()" << std::endl;
368 
369  // Sometimes this is negative due to rounding error,
370  // but when this occurs the error is on the order of 1.e-10,
371  // so shouldn't affect error bound much...
372  residual_norm_sq = std::abs(residual_norm_sq);
373  }
374 
375  return std::sqrt( libmesh_real(residual_norm_sq) );
376 }
T libmesh_real(T a)
double abs(double a)
std::vector< Number > Fq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
virtual Number eval_A_theta(unsigned int q, const RBParameters &mu)
Evaluate theta_q_a at the current parameter.
T libmesh_conj(T a)
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.
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
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 Number eval_F_theta(unsigned int q, const RBParameters &mu)
Evaluate theta_q_f at the current parameter.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const RBParameters & get_parameters() const
Get the current parameters.
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
void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 107 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

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

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

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

Definition at line 101 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

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

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

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

Definition at line 393 of file rb_evaluation.C.

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

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

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

Definition at line 464 of file rb_parametrized.C.

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

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

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

Get a const reference to the discrete parameter values.

Definition at line 403 of file rb_parametrized.C.

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

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

404 {
406  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_discrete_parameter_values");
407 
409 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
std::map< std::string, std::vector< Real > > _discrete_parameter_values
Map that defines the allowable values of any discrete parameters.
Real libMesh::RBEvaluation::get_error_bound_normalization ( )
virtualinherited
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::RBEIMEvaluation, and libMesh::TransientRBEvaluation.

Definition at line 292 of file rb_evaluation.C.

References libMesh::RBEvaluation::rb_solve(), and libMesh::Real.

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

293 {
294  // Normalize the error based on the error bound in the
295  // case of an empty reduced basis. The error bound is based
296  // on the residual F - AU, so with an empty basis this gives
297  // a value based on the norm of F at the current parameters.
298 
299  Real normalization = rb_solve(0);
300  return normalization;
301 }
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
std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

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

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

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

Get the current number of basis functions.

Definition at line 146 of file rb_evaluation.h.

References libMesh::RBEvaluation::basis_functions.

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

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

Get the number of continuous parameters.

Definition at line 133 of file rb_parametrized.C.

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

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

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

Get the number of discrete parameters.

Definition at line 143 of file rb_parametrized.C.

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

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

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

Get the number of parameters.

Definition at line 123 of file rb_parametrized.C.

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

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

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

Get maximum allowable value of parameter param_name.

Definition at line 206 of file rb_parametrized.C.

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

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

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

Get minimum allowable value of parameter param_name.

Definition at line 198 of file rb_parametrized.C.

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

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

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

Get a set that stores the parameter names.

Definition at line 152 of file rb_parametrized.C.

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

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

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

Get the current parameters.

Definition at line 174 of file rb_parametrized.C.

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

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

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

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

Definition at line 190 of file rb_parametrized.C.

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

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

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

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

Definition at line 182 of file rb_parametrized.C.

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

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

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

Return a "dummy" lower bound for the coercivity constant.

To do this rigorously we should use the SCM classes.

Reimplemented from libMesh::RBEvaluation.

Definition at line 35 of file rb_classes.h.

35 { return 1.; }
void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
protectedinherited

Increments the construction counter.

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

Definition at line 185 of file reference_counter.h.

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

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

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

Increments the destruction counter.

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

Definition at line 198 of file reference_counter.h.

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

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

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

Initialize the parameter ranges and set current_parameters.

Definition at line 60 of file rb_parametrized.C.

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

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

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

Initialize the parameter ranges and set current_parameters.

Definition at line 116 of file rb_parametrized.C.

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

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

Is parameter mu_name discrete?

Definition at line 395 of file rb_parametrized.C.

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

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

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

Definition at line 97 of file rb_evaluation.C.

References libMesh::RBEvaluation::rb_theta_expansion.

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

98 {
100  {
101  return true;
102  }
103  else
104  {
105  return false;
106  }
107 }
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
void 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 
)
virtualinherited

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::RBEIMEvaluation, and libMesh::TransientRBEvaluation.

Definition at line 653 of file rb_evaluation.C.

References libMesh::RBEvaluation::Aq_Aq_representor_innerprods, libMesh::RBEvaluation::assert_file_exists(), libMesh::RBEvaluation::basis_functions, libMesh::Xdr::close(), libMesh::RBEvaluation::compute_RB_inner_product, libMesh::DECODE, libMesh::RBEvaluation::Fq_Aq_representor_innerprods, libMesh::RBEvaluation::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(), libmesh_nullptr, libMesh::RBEvaluation::output_dual_innerprods, libMesh::RBEvaluation::RB_Aq_vector, libMesh::RBEvaluation::RB_Fq_vector, libMesh::RBEvaluation::RB_inner_product_matrix, libMesh::RBEvaluation::RB_output_vectors, libMesh::RBEvaluation::rb_theta_expansion, libMesh::READ, libMesh::RBParametrized::read_parameter_data_from_files(), libMesh::RBEvaluation::resize_data_structures(), libMesh::RBEvaluation::set_n_basis_functions(), and value.

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

656 {
657  LOG_SCOPE("legacy_read_offline_data_from_files()", "RBEvaluation");
658 
659  // The reading mode: DECODE for binary, READ for ASCII
660  XdrMODE mode = read_binary_data ? DECODE : READ;
661 
662  // The suffix to use for all the files that are written out
663  const std::string suffix = read_binary_data ? ".xdr" : ".dat";
664 
665  // The string stream we'll use to make the file names
666  std::ostringstream file_name;
667 
668  // First, find out how many basis functions we had when Greedy terminated
669  unsigned int n_bfs;
670  {
671  file_name << directory_name << "/n_bfs" << suffix;
672  assert_file_exists(file_name.str());
673 
674  Xdr n_bfs_in(file_name.str(), mode);
675  n_bfs_in >> n_bfs;
676  n_bfs_in.close();
677  }
678  resize_data_structures(n_bfs, read_error_bound_data);
679 
680  // Read in the parameter ranges
681  file_name.str("");
682  file_name << directory_name << "/parameter_ranges" << suffix;
683  std::string continuous_param_file_name = file_name.str();
684 
685  // Read in the discrete parameter values
686  file_name.str("");
687  file_name << directory_name << "/discrete_parameter_values" << suffix;
688  std::string discrete_param_file_name = file_name.str();
689  read_parameter_data_from_files(continuous_param_file_name,
690  discrete_param_file_name,
691  read_binary_data);
692 
693  // Read in output data in multiple files
694  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
695  {
696  for (unsigned int q_l=0; q_l<rb_theta_expansion->get_n_output_terms(n); q_l++)
697  {
698  file_name.str("");
699  file_name << directory_name << "/output_";
700  file_name << std::setw(3)
701  << std::setprecision(0)
702  << std::setfill('0')
703  << std::right
704  << n;
705  file_name << "_";
706  file_name << std::setw(3)
707  << std::setprecision(0)
708  << std::setfill('0')
709  << std::right
710  << q_l;
711  file_name << suffix;
712  assert_file_exists(file_name.str());
713 
714  Xdr output_n_in(file_name.str(), mode);
715 
716  for (unsigned int j=0; j<n_bfs; j++)
717  {
718  Number value;
719  output_n_in >> value;
720  RB_output_vectors[n][q_l](j) = value;
721  }
722  output_n_in.close();
723  }
724  }
725 
727  {
728  // Next read in the inner product matrix
729  file_name.str("");
730  file_name << directory_name << "/RB_inner_product_matrix" << suffix;
731  assert_file_exists(file_name.str());
732 
733  Xdr RB_inner_product_matrix_in(file_name.str(), mode);
734 
735  for (unsigned int i=0; i<n_bfs; i++)
736  {
737  for (unsigned int j=0; j<n_bfs; j++)
738  {
739  Number value;
740  RB_inner_product_matrix_in >> value;
742  }
743  }
744  RB_inner_product_matrix_in.close();
745  }
746 
747  // Next read in the Fq vectors
748  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
749  {
750  file_name.str("");
751  file_name << directory_name << "/RB_F_";
752  file_name << std::setw(3)
753  << std::setprecision(0)
754  << std::setfill('0')
755  << std::right
756  << q_f;
757  file_name << suffix;
758  assert_file_exists(file_name.str());
759 
760  Xdr RB_Fq_f_in(file_name.str(), mode);
761 
762  for (unsigned int i=0; i<n_bfs; i++)
763  {
764  Number value;
765  RB_Fq_f_in >> value;
766  RB_Fq_vector[q_f](i) = value;
767  }
768  RB_Fq_f_in.close();
769  }
770 
771  // Next read in the Aq matrices
772  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
773  {
774  file_name.str("");
775  file_name << directory_name << "/RB_A_";
776  file_name << std::setw(3)
777  << std::setprecision(0)
778  << std::setfill('0')
779  << std::right
780  << q_a;
781  file_name << suffix;
782  assert_file_exists(file_name.str());
783 
784  Xdr RB_Aq_a_in(file_name.str(), mode);
785 
786  for (unsigned int i=0; i<n_bfs; i++)
787  {
788  for (unsigned int j=0; j<n_bfs; j++)
789  {
790  Number value;
791  RB_Aq_a_in >> value;
792  RB_Aq_vector[q_a](i,j) = value;
793  }
794  }
795  RB_Aq_a_in.close();
796  }
797 
798 
799  if (read_error_bound_data)
800  {
801  // Next read in Fq representor norm data
802  file_name.str("");
803  file_name << directory_name << "/Fq_innerprods" << suffix;
804  assert_file_exists(file_name.str());
805 
806  Xdr RB_Fq_innerprods_in(file_name.str(), mode);
807 
808  unsigned int Q_f_hat = rb_theta_expansion->get_n_F_terms()*(rb_theta_expansion->get_n_F_terms()+1)/2;
809  for (unsigned int i=0; i<Q_f_hat; i++)
810  {
811  RB_Fq_innerprods_in >> Fq_representor_innerprods[i];
812  }
813  RB_Fq_innerprods_in.close();
814 
815  // Read in output data
816  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
817  {
818  file_name.str("");
819  file_name << directory_name << "/output_";
820  file_name << std::setw(3)
821  << std::setprecision(0)
822  << std::setfill('0')
823  << std::right
824  << n;
825  file_name << "_dual_innerprods" << suffix;
826  assert_file_exists(file_name.str());
827 
828  Xdr output_dual_innerprods_in(file_name.str(), mode);
829 
830  unsigned int Q_l_hat = rb_theta_expansion->get_n_output_terms(n)*(rb_theta_expansion->get_n_output_terms(n)+1)/2;
831  for (unsigned int q=0; q<Q_l_hat; q++)
832  {
833  output_dual_innerprods_in >> output_dual_innerprods[n][q];
834  }
835  output_dual_innerprods_in.close();
836  }
837 
838 
839  // Next read in Fq_Aq representor norm data
840  file_name.str("");
841  file_name << directory_name << "/Fq_Aq_innerprods" << suffix;
842  assert_file_exists(file_name.str());
843 
844  Xdr RB_Fq_Aq_innerprods_in(file_name.str(), mode);
845 
846  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
847  {
848  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
849  {
850  for (unsigned int i=0; i<n_bfs; i++)
851  {
852  RB_Fq_Aq_innerprods_in >> Fq_Aq_representor_innerprods[q_f][q_a][i];
853  }
854  }
855  }
856  RB_Fq_Aq_innerprods_in.close();
857 
858  // Next read in Aq_Aq representor norm data
859  file_name.str("");
860  file_name << directory_name << "/Aq_Aq_innerprods" << suffix;
861  assert_file_exists(file_name.str());
862 
863  Xdr RB_Aq_Aq_innerprods_in(file_name.str(), mode);
864 
865  unsigned int Q_a_hat = rb_theta_expansion->get_n_A_terms()*(rb_theta_expansion->get_n_A_terms()+1)/2;
866  for (unsigned int i=0; i<Q_a_hat; i++)
867  {
868  for (unsigned int j=0; j<n_bfs; j++)
869  {
870  for (unsigned int l=0; l<n_bfs; l++)
871  {
872  RB_Aq_Aq_innerprods_in >> Aq_Aq_representor_innerprods[i][j][l];
873  }
874  }
875  }
876  RB_Aq_Aq_innerprods_in.close();
877  }
878 
879  // Resize basis_functions even if we don't read them in so that
880  // get_n_bfs() returns the correct value. Initialize the pointers
881  // to NULL
882  set_n_basis_functions(n_bfs);
883  for (std::size_t i=0; i<basis_functions.size(); i++)
884  {
885  if (basis_functions[i])
886  {
887  basis_functions[i]->clear();
888  delete basis_functions[i];
889  }
891  }
892 }
std::vector< NumericVector< Number > * > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
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...
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.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
DenseMatrix< Number > RB_inner_product_matrix
The inner product matrix.
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
virtual void set_n_basis_functions(unsigned int n_bfs)
Set the number of basis functions.
const class libmesh_nullptr_t libmesh_nullptr
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.
std::vector< DenseVector< Number > > RB_Fq_vector
Dense vector for the RHS.
XdrMODE
Defines an enum for read/write mode in Xdr format.
Definition: enum_xdr_mode.h:32
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
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...
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
std::vector< DenseMatrix< Number > > RB_Aq_vector
Dense matrices for the RB computations.
void assert_file_exists(const std::string &file_name)
Helper function that checks if file_name exists.
static const bool value
Definition: xdr_io.C:108
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.
void libMesh::RBEvaluation::legacy_write_offline_data_to_files ( const std::string &  directory_name = "offline_data",
const bool  write_binary_data = true 
)
virtualinherited

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::RBEIMEvaluation, and libMesh::TransientRBEvaluation.

Definition at line 424 of file rb_evaluation.C.

References libMesh::RBEvaluation::Aq_Aq_representor_innerprods, libMesh::Xdr::close(), libMesh::RBEvaluation::compute_RB_inner_product, libMesh::ENCODE, libMesh::RBEvaluation::Fq_Aq_representor_innerprods, libMesh::RBEvaluation::Fq_representor_innerprods, libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBEvaluation::get_n_basis_functions(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::RBThetaExpansion::get_n_output_terms(), libMesh::RBThetaExpansion::get_n_outputs(), libMesh::RBEvaluation::greedy_param_list, libMesh::Utility::mkdir(), libMesh::RBEvaluation::output_dual_innerprods, libMesh::ParallelObject::processor_id(), libMesh::RBEvaluation::RB_Aq_vector, libMesh::RBEvaluation::RB_Fq_vector, libMesh::RBEvaluation::RB_inner_product_matrix, libMesh::RBEvaluation::RB_output_vectors, libMesh::RBEvaluation::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(), libMesh::RBEIMEvaluation::legacy_write_offline_data_to_files(), main(), and libMesh::RBEvaluation::set_n_basis_functions().

426 {
427  LOG_SCOPE("legacy_write_offline_data_to_files()", "RBEvaluation");
428 
429  // Get the number of basis functions
430  unsigned int n_bfs = get_n_basis_functions();
431 
432  // The writing mode: ENCODE for binary, WRITE for ASCII
433  XdrMODE mode = write_binary_data ? ENCODE : WRITE;
434 
435  // The suffix to use for all the files that are written out
436  const std::string suffix = write_binary_data ? ".xdr" : ".dat";
437 
438  if (this->processor_id() == 0)
439  {
440 
441  // Make a directory to store all the data files
442  Utility::mkdir(directory_name.c_str());
443  // if (mkdir(directory_name.c_str(), 0777) == -1)
444  // {
445  // libMesh::out << "In RBEvaluation::write_offline_data_to_files, directory "
446  // << directory_name << " already exists, overwriting contents." << std::endl;
447  // }
448 
449  // First, write out how many basis functions we have generated
450  std::ostringstream file_name;
451  {
452  file_name << directory_name << "/n_bfs" << suffix;
453  Xdr n_bfs_out(file_name.str(), mode);
454  n_bfs_out << n_bfs;
455  n_bfs_out.close();
456  }
457 
458  // Write out the parameter ranges
459  file_name.str("");
460  file_name << directory_name << "/parameter_ranges" << suffix;
461  std::string continuous_param_file_name = file_name.str();
462 
463  // Write out the discrete parameter values
464  file_name.str("");
465  file_name << directory_name << "/discrete_parameter_values" << suffix;
466  std::string discrete_param_file_name = file_name.str();
467 
468  write_parameter_data_to_files(continuous_param_file_name,
469  discrete_param_file_name,
470  write_binary_data);
471 
472  // Write out Fq representor norm data
473  file_name.str("");
474  file_name << directory_name << "/Fq_innerprods" << suffix;
475  Xdr RB_Fq_innerprods_out(file_name.str(), mode);
476  unsigned int Q_f_hat = rb_theta_expansion->get_n_F_terms()*(rb_theta_expansion->get_n_F_terms()+1)/2;
477  for (unsigned int i=0; i<Q_f_hat; i++)
478  {
479  RB_Fq_innerprods_out << Fq_representor_innerprods[i];
480  }
481  RB_Fq_innerprods_out.close();
482 
483  // Write out output data
484  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
485  {
486  file_name.str("");
487  file_name << directory_name << "/output_";
488  file_name << std::setw(3)
489  << std::setprecision(0)
490  << std::setfill('0')
491  << std::right
492  << n;
493 
494  file_name << "_dual_innerprods" << suffix;
495  Xdr output_dual_innerprods_out(file_name.str(), mode);
496 
497  unsigned int Q_l_hat = rb_theta_expansion->get_n_output_terms(n)*(rb_theta_expansion->get_n_output_terms(n)+1)/2;
498  for (unsigned int q=0; q<Q_l_hat; q++)
499  {
500  output_dual_innerprods_out << output_dual_innerprods[n][q];
501  }
502  output_dual_innerprods_out.close();
503  }
504 
505 
506  // Write out output data to multiple files
507  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
508  {
509  for (unsigned int q_l=0; q_l<rb_theta_expansion->get_n_output_terms(n); q_l++)
510  {
511  file_name.str("");
512  file_name << directory_name << "/output_";
513  file_name << std::setw(3)
514  << std::setprecision(0)
515  << std::setfill('0')
516  << std::right
517  << n;
518  file_name << "_";
519  file_name << std::setw(3)
520  << std::setprecision(0)
521  << std::setfill('0')
522  << std::right
523  << q_l;
524  file_name << suffix;
525  Xdr output_n_out(file_name.str(), mode);
526 
527  for (unsigned int j=0; j<n_bfs; j++)
528  {
529  output_n_out << RB_output_vectors[n][q_l](j);
530  }
531  output_n_out.close();
532  }
533  }
534 
536  {
537  // Next write out the inner product matrix
538  file_name.str("");
539  file_name << directory_name << "/RB_inner_product_matrix" << suffix;
540  Xdr RB_inner_product_matrix_out(file_name.str(), mode);
541  for (unsigned int i=0; i<n_bfs; i++)
542  {
543  for (unsigned int j=0; j<n_bfs; j++)
544  {
545  RB_inner_product_matrix_out << RB_inner_product_matrix(i,j);
546  }
547  }
548  RB_inner_product_matrix_out.close();
549  }
550 
551  // Next write out the Fq vectors
552  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
553  {
554  file_name.str("");
555  file_name << directory_name << "/RB_F_";
556  file_name << std::setw(3)
557  << std::setprecision(0)
558  << std::setfill('0')
559  << std::right
560  << q_f;
561  file_name << suffix;
562  Xdr RB_Fq_f_out(file_name.str(), mode);
563 
564  for (unsigned int i=0; i<n_bfs; i++)
565  {
566  RB_Fq_f_out << RB_Fq_vector[q_f](i);
567  }
568  RB_Fq_f_out.close();
569  }
570 
571  // Next write out the Aq matrices
572  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
573  {
574  file_name.str("");
575  file_name << directory_name << "/RB_A_";
576  file_name << std::setw(3)
577  << std::setprecision(0)
578  << std::setfill('0')
579  << std::right
580  << q_a;
581  file_name << suffix;
582  Xdr RB_Aq_a_out(file_name.str(), mode);
583 
584  for (unsigned int i=0; i<n_bfs; i++)
585  {
586  for (unsigned int j=0; j<n_bfs; j++)
587  {
588  RB_Aq_a_out << RB_Aq_vector[q_a](i,j);
589  }
590  }
591  RB_Aq_a_out.close();
592  }
593 
594  // Next write out Fq_Aq representor norm data
595  file_name.str("");
596  file_name << directory_name << "/Fq_Aq_innerprods" << suffix;
597  Xdr RB_Fq_Aq_innerprods_out(file_name.str(), mode);
598 
599  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
600  {
601  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
602  {
603  for (unsigned int i=0; i<n_bfs; i++)
604  {
605  RB_Fq_Aq_innerprods_out << Fq_Aq_representor_innerprods[q_f][q_a][i];
606  }
607  }
608  }
609  RB_Fq_Aq_innerprods_out.close();
610 
611  // Next write out Aq_Aq representor norm data
612  file_name.str("");
613  file_name << directory_name << "/Aq_Aq_innerprods" << suffix;
614  Xdr RB_Aq_Aq_innerprods_out(file_name.str(), mode);
615 
616  unsigned int Q_a_hat = rb_theta_expansion->get_n_A_terms()*(rb_theta_expansion->get_n_A_terms()+1)/2;
617  for (unsigned int i=0; i<Q_a_hat; i++)
618  {
619  for (unsigned int j=0; j<n_bfs; j++)
620  {
621  for (unsigned int l=0; l<n_bfs; l++)
622  {
623  RB_Aq_Aq_innerprods_out << Aq_Aq_representor_innerprods[i][j][l];
624  }
625  }
626  }
627  RB_Aq_Aq_innerprods_out.close();
628 
629  // Also, write out the greedily selected parameters
630  {
631  file_name.str("");
632  file_name << directory_name << "/greedy_params" << suffix;
633  Xdr greedy_params_out(file_name.str(), mode);
634 
635  for (std::size_t i=0; i<greedy_param_list.size(); i++)
636  {
639  for ( ; it != it_end; ++it)
640  {
641  // Need to make a copy of the value so that it's not const
642  // Xdr is not templated on const's
643  Real param_value = it->second;
644  greedy_params_out << param_value;
645  }
646  }
647  greedy_params_out.close();
648  }
649 
650  }
651 }
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...
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.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
DenseMatrix< Number > RB_inner_product_matrix
The inner product matrix.
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
int mkdir(const char *pathname)
Create a directory.
Definition: utility.C:140
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...
std::vector< DenseVector< Number > > RB_Fq_vector
Dense vector for the RHS.
XdrMODE
Defines an enum for read/write mode in Xdr format.
Definition: enum_xdr_mode.h:32
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
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...
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
std::vector< DenseMatrix< Number > > RB_Aq_vector
Dense matrices for the RB computations.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
std::map< std::string, Real >::const_iterator const_iterator
Definition: rb_parameters.h:57
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
processor_id_type processor_id() const
std::vector< std::vector< DenseVector< Number > > > RB_output_vectors
The vectors storing the RB output vectors.
static unsigned int libMesh::ReferenceCounter::n_objects ( )
staticinherited
processor_id_type libMesh::ParallelObject::n_processors ( ) const
inherited
Returns
The number of processors in the group.

Definition at line 93 of file parallel_object.h.

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

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

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

Print out all the discrete parameter values.

Definition at line 411 of file rb_parametrized.C.

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

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

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

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

Definition at line 88 of file reference_counter.C.

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

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

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

Print the current parameters.

Definition at line 214 of file rb_parametrized.C.

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

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

215 {
217  libmesh_error_msg("Error: parameters not initialized in RBParametrized::print_current_parameters");
218 
219  get_parameters().print();
220 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
void print() const
Print the parameters.
const RBParameters & get_parameters() const
Get the current parameters.
processor_id_type libMesh::ParallelObject::processor_id ( ) const
inherited
Returns
The rank of this processor in the group.

Definition at line 99 of file parallel_object.h.

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

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

100  { return cast_int<processor_id_type>(_communicator.rank()); }
const Parallel::Communicator & _communicator
unsigned int rank() const
Definition: parallel.h:724
Real libMesh::RBEvaluation::rb_solve ( unsigned int  N)
virtualinherited

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::RBEIMEvaluation, and libMesh::TransientRBEvaluation.

Definition at line 210 of file rb_evaluation.C.

References libMesh::DenseVector< T >::add(), libMesh::DenseMatrix< T >::add(), libMesh::RBEvaluation::compute_residual_dual_norm(), libMesh::DenseVector< T >::dot(), libMesh::RBThetaExpansion::eval_A_theta(), libMesh::RBThetaExpansion::eval_F_theta(), libMesh::RBEvaluation::eval_output_dual_norm(), libMesh::RBThetaExpansion::eval_output_theta(), libMesh::RBEvaluation::evaluate_RB_error_bound, libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBEvaluation::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(), libMesh::RBEvaluation::get_stability_lower_bound(), libMesh::DenseMatrix< T >::lu_solve(), libMesh::RBEvaluation::RB_Aq_vector, libMesh::RBEvaluation::RB_Fq_vector, libMesh::RBEvaluation::RB_output_error_bounds, libMesh::RBEvaluation::RB_output_vectors, libMesh::RBEvaluation::RB_outputs, libMesh::RBEvaluation::RB_solution, libMesh::RBEvaluation::rb_theta_expansion, libMesh::Real, libMesh::RBEvaluation::residual_scaling_denom(), libMesh::DenseVector< T >::resize(), libMesh::DenseMatrix< T >::zero(), and libMesh::DenseVector< T >::zero().

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

211 {
212  LOG_SCOPE("rb_solve()", "RBEvaluation");
213 
214  if (N > get_n_basis_functions())
215  libmesh_error_msg("ERROR: N cannot be larger than the number of basis functions in rb_solve");
216 
217  const RBParameters & mu = get_parameters();
218 
219  // Resize (and clear) the solution vector
220  RB_solution.resize(N);
221 
222  // Assemble the RB system
223  DenseMatrix<Number> RB_system_matrix(N,N);
224  RB_system_matrix.zero();
225 
226  DenseMatrix<Number> RB_Aq_a;
227  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
228  {
229  RB_Aq_vector[q_a].get_principal_submatrix(N, RB_Aq_a);
230 
231  RB_system_matrix.add(rb_theta_expansion->eval_A_theta(q_a, mu), RB_Aq_a);
232  }
233 
234  // Assemble the RB rhs
235  DenseVector<Number> RB_rhs(N);
236  RB_rhs.zero();
237 
238  DenseVector<Number> RB_Fq_f;
239  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
240  {
241  RB_Fq_vector[q_f].get_principal_subvector(N, RB_Fq_f);
242 
243  RB_rhs.add(rb_theta_expansion->eval_F_theta(q_f, mu), RB_Fq_f);
244  }
245 
246  // Solve the linear system
247  if (N > 0)
248  {
249  RB_system_matrix.lu_solve(RB_rhs, RB_solution);
250  }
251 
252  // Evaluate RB outputs
253  DenseVector<Number> RB_output_vector_N;
254  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
255  {
256  RB_outputs[n] = 0.;
257  for (unsigned int q_l=0; q_l<rb_theta_expansion->get_n_output_terms(n); q_l++)
258  {
259  RB_output_vectors[n][q_l].get_principal_subvector(N, RB_output_vector_N);
260  RB_outputs[n] += rb_theta_expansion->eval_output_theta(n,q_l,mu)*RB_output_vector_N.dot(RB_solution);
261  }
262  }
263 
264  if (evaluate_RB_error_bound) // Calculate the error bounds
265  {
266  // Evaluate the dual norm of the residual for RB_solution_vector
267  Real epsilon_N = compute_residual_dual_norm(N);
268 
269  // Get lower bound for coercivity constant
270  const Real alpha_LB = get_stability_lower_bound();
271  // alpha_LB needs to be positive to get a valid error bound
272  libmesh_assert_greater ( alpha_LB, 0. );
273 
274  // Evaluate the (absolute) error bound
275  Real abs_error_bound = epsilon_N / residual_scaling_denom(alpha_LB);
276 
277  // Now compute the output error bounds
278  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
279  {
280  RB_output_error_bounds[n] = abs_error_bound * eval_output_dual_norm(n, mu);
281  }
282 
283  return abs_error_bound;
284  }
285  else // Don't calculate the error bounds
286  {
287  // Just return -1. if we did not compute the error bound
288  return -1.;
289  }
290 }
bool evaluate_RB_error_bound
Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called...
virtual Number eval_A_theta(unsigned int q, const RBParameters &mu)
Evaluate theta_q_a at the current parameter.
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.
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:350
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
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.
virtual Number eval_output_theta(unsigned int output_index, unsigned int q_l, const RBParameters &mu)
Evaluate theta_q_l at the current parameter.
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.
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
std::vector< Real > RB_output_error_bounds
virtual Real residual_scaling_denom(Real alpha_LB)
Specifies the residual scaling on the denominator to be used in the a posteriori error bound...
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
virtual Number eval_F_theta(unsigned int q, const RBParameters &mu)
Evaluate theta_q_f at the current parameter.
std::vector< DenseMatrix< Number > > RB_Aq_vector
Dense matrices for the RB computations.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real eval_output_dual_norm(unsigned int n, const RBParameters &mu)
Evaluate the dual norm of output n for the current parameters.
std::vector< Number > RB_outputs
The vectors storing the RB output values and corresponding error bounds.
const RBParameters & get_parameters() const
Get the current parameters.
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
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.
void libMesh::RBEvaluation::read_in_basis_functions ( System sys,
const std::string &  directory_name = "offline_data",
const bool  read_binary_basis_functions = true 
)
virtualinherited

Read in all the basis functions from file.

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

Definition at line 970 of file rb_evaluation.C.

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

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

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

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

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

Definition at line 983 of file rb_evaluation.C.

References libMesh::RBEvaluation::read_in_vectors_from_multiple_files().

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

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

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

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

Definition at line 1005 of file rb_evaluation.C.

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

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

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

Read in the parameter ranges from files.

Definition at line 301 of file rb_parametrized.C.

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

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

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

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

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

Definition at line 386 of file rb_evaluation.C.

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

387 {
388  // Here we implement the residual scaling for a coercive
389  // problem.
390  return alpha_LB;
391 }
void libMesh::RBEvaluation::resize_data_structures ( const unsigned int  Nmax,
bool  resize_error_bound_data = true 
)
virtualinherited

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, and libMesh::RBEIMEvaluation.

Definition at line 109 of file rb_evaluation.C.

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

Referenced by libMesh::RBEvaluation::legacy_read_offline_data_from_files(), libMesh::RBDataDeserialization::load_rb_evaluation_data(), libMesh::RBEIMEvaluation::resize_data_structures(), libMesh::TransientRBEvaluation::resize_data_structures(), and libMesh::RBConstruction::train_reduced_basis().

111 {
112  LOG_SCOPE("resize_data_structures()", "RBEvaluation");
113 
114  if (Nmax < this->get_n_basis_functions())
115  libmesh_error_msg("Error: Cannot set Nmax to be less than the current number of basis functions.");
116 
117  // Resize/clear inner product matrix
119  RB_inner_product_matrix.resize(Nmax,Nmax);
120 
121  // Allocate dense matrices for RB solves
123 
124  for (unsigned int q=0; q<rb_theta_expansion->get_n_A_terms(); q++)
125  {
126  // Initialize the memory for the RB matrices
127  RB_Aq_vector[q].resize(Nmax,Nmax);
128  }
129 
131 
132  for (unsigned int q=0; q<rb_theta_expansion->get_n_F_terms(); q++)
133  {
134  // Initialize the memory for the RB vectors
135  RB_Fq_vector[q].resize(Nmax);
136  }
137 
138 
139  // Initialize the RB output vectors
141  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
142  {
144  for (unsigned int q_l=0; q_l<rb_theta_expansion->get_n_output_terms(n); q_l++)
145  {
146  RB_output_vectors[n][q_l].resize(Nmax);
147  }
148  }
149 
150  // Initialize vectors storing output data
152 
153 
154  if (resize_error_bound_data)
155  {
156  // Initialize vectors for the norms of the Fq representors
157  unsigned int Q_f_hat = rb_theta_expansion->get_n_F_terms()*(rb_theta_expansion->get_n_F_terms()+1)/2;
158  Fq_representor_innerprods.resize(Q_f_hat);
159 
160  // Initialize vectors for the norms of the representors
162  for (unsigned int i=0; i<rb_theta_expansion->get_n_F_terms(); i++)
163  {
165  for (unsigned int j=0; j<rb_theta_expansion->get_n_A_terms(); j++)
166  {
167  Fq_Aq_representor_innerprods[i][j].resize(Nmax, 0.);
168  }
169  }
170 
171  unsigned int Q_a_hat = rb_theta_expansion->get_n_A_terms()*(rb_theta_expansion->get_n_A_terms()+1)/2;
172  Aq_Aq_representor_innerprods.resize(Q_a_hat);
173  for (unsigned int i=0; i<Q_a_hat; i++)
174  {
175  Aq_Aq_representor_innerprods[i].resize(Nmax);
176  for (unsigned int j=0; j<Nmax; j++)
177  {
178  Aq_Aq_representor_innerprods[i][j].resize(Nmax, 0.);
179  }
180  }
181 
183 
184  // Resize the output dual norm vectors
186  for (unsigned int n=0; n<rb_theta_expansion->get_n_outputs(); n++)
187  {
188  unsigned int Q_l_hat = rb_theta_expansion->get_n_output_terms(n)*(rb_theta_expansion->get_n_output_terms(n)+1)/2;
189  output_dual_innerprods[n].resize(Q_l_hat);
190  }
191 
192  // Clear and resize the vector of Aq_representors
194 
196  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
197  {
198  Aq_representor[q_a].resize(Nmax);
199  }
200  }
201 }
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_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
std::vector< std::vector< NumericVector< Number > * > > Aq_representor
Vector storing the residual representors associated with the left-hand side.
DenseMatrix< Number > RB_inner_product_matrix
The inner product matrix.
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
std::vector< std::vector< Number > > output_dual_innerprods
The vector storing the dual norm inner product terms for each output.
std::vector< DenseVector< Number > > RB_Fq_vector
Dense vector for the RHS.
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
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...
unsigned int get_n_outputs() const
Get n_outputs, the number output functionals.
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.
void resize(const unsigned int new_m, const unsigned int new_n)
Resize the matrix.
Definition: dense_matrix.h:776
std::vector< Number > RB_outputs
The vectors storing the RB output values and corresponding error bounds.
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
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.
virtual void libMesh::RBEvaluation::set_n_basis_functions ( unsigned int  n_bfs)
virtualinherited
void libMesh::RBParametrized::set_parameters ( const RBParameters params)
inherited

Set the current parameters to params.

Definition at line 163 of file rb_parametrized.C.

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

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

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

Set the RBThetaExpansion object.

Definition at line 84 of file rb_evaluation.C.

References libMesh::RBEvaluation::rb_theta_expansion.

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

85 {
86  rb_theta_expansion = &rb_theta_expansion_in;
87 }
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
void libMesh::RBEvaluation::write_out_basis_functions ( System sys,
const std::string &  directory_name = "offline_data",
const bool  write_binary_basis_functions = true 
)
virtualinherited

Write out all the basis functions to file.

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

Definition at line 900 of file rb_evaluation.C.

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

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

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

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

Definition at line 913 of file rb_evaluation.C.

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

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

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

Write out the parameter ranges to files.

Definition at line 222 of file rb_parametrized.C.

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

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

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

Member Data Documentation

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

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

Definition at line 143 of file reference_counter.h.

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

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

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 137 of file reference_counter.h.

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

The number of objects.

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

Definition at line 132 of file reference_counter.h.

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

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

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

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

Definition at line 317 of file rb_evaluation.h.

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

std::vector<NumericVector<Number> *> libMesh::RBEvaluation::basis_functions
inherited
bool libMesh::RBEvaluation::compute_RB_inner_product
inherited
ElasticityThetaExpansion ElasticityRBEvaluation::elasticity_theta_expansion

The object that stores the "theta" expansion of the parameter dependent PDE, i.e.

the set of parameter-dependent functions in the affine expansion of the PDE.

Definition at line 41 of file rb_classes.h.

bool libMesh::RBEvaluation::evaluate_RB_error_bound
inherited

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

Definition at line 323 of file rb_evaluation.h.

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

std::vector<std::vector<std::vector<Number> > > libMesh::RBEvaluation::Fq_Aq_representor_innerprods
inherited
std::vector<Number> libMesh::RBEvaluation::Fq_representor_innerprods
inherited
std::vector<RBParameters> libMesh::RBEvaluation::greedy_param_list
inherited
std::vector<std::vector<Number > > libMesh::RBEvaluation::output_dual_innerprods
inherited
std::vector<DenseMatrix<Number> > libMesh::RBEvaluation::RB_Aq_vector
inherited
std::vector<DenseVector<Number> > libMesh::RBEvaluation::RB_Fq_vector
inherited
DenseMatrix<Number> libMesh::RBEvaluation::RB_inner_product_matrix
inherited
std::vector<Real > libMesh::RBEvaluation::RB_output_error_bounds
inherited
std::vector<std::vector<DenseVector<Number> > > libMesh::RBEvaluation::RB_output_vectors
inherited
std::vector<Number > libMesh::RBEvaluation::RB_outputs
inherited

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

Definition at line 282 of file rb_evaluation.h.

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

DenseVector<Number> libMesh::RBEvaluation::RB_solution
inherited
bool libMesh::RBParametrized::verbose_mode
inherited

Public boolean to toggle verbose mode.

Definition at line 170 of file rb_parametrized.h.

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


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