libMesh::RBConstruction Class Reference

#include <rb_construction.h>

Inheritance diagram for libMesh::RBConstruction:

Public Types

typedef RBConstruction sys_type
 
typedef RBConstructionBase< LinearImplicitSystemParent
 
typedef std::map< std::string, SparseMatrix< Number > * >::iterator matrices_iterator
 
typedef std::map< std::string, SparseMatrix< Number > * >::const_iterator const_matrices_iterator
 
typedef Number(* ValueFunctionPointer) (const Point &p, const Parameters &Parameters, const std::string &sys_name, const std::string &unknown_name)
 
typedef Gradient(* GradientFunctionPointer) (const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name)
 
typedef std::map< std::string, NumericVector< Number > * >::iterator vectors_iterator
 
typedef std::map< std::string, NumericVector< Number > * >::const_iterator const_vectors_iterator
 

Public Member Functions

 RBConstruction (EquationSystems &es, const std::string &name, const unsigned int number)
 
virtual ~RBConstruction ()
 
virtual void solve_for_matrix_and_rhs (LinearSolver< Number > &input_solver, SparseMatrix< Number > &input_matrix, NumericVector< Number > &input_rhs)
 
void set_rb_evaluation (RBEvaluation &rb_eval_in)
 
RBEvaluationget_rb_evaluation ()
 
bool is_rb_eval_initialized () const
 
RBThetaExpansionget_rb_theta_expansion ()
 
void set_rb_assembly_expansion (RBAssemblyExpansion &rb_assembly_expansion_in)
 
RBAssemblyExpansionget_rb_assembly_expansion ()
 
sys_typesystem ()
 
virtual void clear () override
 
virtual std::string system_type () const override
 
virtual Real truth_solve (int plot_solution)
 
virtual Real train_reduced_basis (const bool resize_rb_eval_data=true)
 
void enrich_basis_from_rhs_terms (const bool resize_rb_eval_data=true)
 
virtual Real compute_max_error_bound ()
 
const RBParametersget_greedy_parameter (unsigned int i)
 
void set_rel_training_tolerance (Real new_training_tolerance)
 
Real get_rel_training_tolerance ()
 
void set_abs_training_tolerance (Real new_training_tolerance)
 
Real get_abs_training_tolerance ()
 
void set_normalize_rb_bound_in_greedy (bool normalize_rb_bound_in_greedy_in)
 
bool get_normalize_rb_bound_in_greedy ()
 
unsigned int get_Nmax () const
 
virtual void set_Nmax (unsigned int Nmax)
 
virtual void load_basis_function (unsigned int i)
 
virtual void load_rb_solution ()
 
SparseMatrix< Number > * get_inner_product_matrix ()
 
SparseMatrix< Number > * get_non_dirichlet_inner_product_matrix ()
 
SparseMatrix< Number > * get_non_dirichlet_inner_product_matrix_if_avail ()
 
SparseMatrix< Number > * get_Aq (unsigned int q)
 
SparseMatrix< Number > * get_non_dirichlet_Aq (unsigned int q)
 
SparseMatrix< Number > * get_non_dirichlet_Aq_if_avail (unsigned int q)
 
virtual void initialize_rb_construction (bool skip_matrix_assembly=false, bool skip_vector_assembly=false)
 
NumericVector< Number > * get_Fq (unsigned int q)
 
NumericVector< Number > * get_non_dirichlet_Fq (unsigned int q)
 
NumericVector< Number > * get_non_dirichlet_Fq_if_avail (unsigned int q)
 
NumericVector< Number > * get_output_vector (unsigned int n, unsigned int q_l)
 
NumericVector< Number > * get_non_dirichlet_output_vector (unsigned int n, unsigned int q_l)
 
virtual void get_all_matrices (std::map< std::string, SparseMatrix< Number > *> &all_matrices)
 
virtual void get_all_vectors (std::map< std::string, NumericVector< Number > *> &all_vectors)
 
virtual void get_output_vectors (std::map< std::string, NumericVector< Number > *> &all_vectors)
 
virtual void assemble_affine_expansion (bool skip_matrix_assembly, bool skip_vector_assembly)
 
void assemble_inner_product_matrix (SparseMatrix< Number > *input_matrix, bool apply_dof_constraints=true)
 
void assemble_Aq_matrix (unsigned int q, SparseMatrix< Number > *input_matrix, bool apply_dof_constraints=true)
 
void assemble_Fq_vector (unsigned int q, NumericVector< Number > *input_vector, bool apply_dof_constraints=true)
 
void add_scaled_Aq (Number scalar, unsigned int q_a, SparseMatrix< Number > *input_matrix, bool symmetrize)
 
virtual void write_riesz_representors_to_files (const std::string &riesz_representors_dir, const bool write_binary_residual_representors)
 
virtual void read_riesz_representors_from_files (const std::string &riesz_representors_dir, const bool write_binary_residual_representors)
 
virtual void recompute_all_residual_terms (const bool compute_inner_products=true)
 
virtual void process_parameters_file (const std::string &parameters_filename)
 
void set_rb_construction_parameters (unsigned int n_training_samples_in, bool deterministic_training_in, unsigned int training_parameters_random_seed_in, bool quiet_mode_in, unsigned int Nmax_in, Real rel_training_tolerance_in, Real abs_training_tolerance_in, bool normalize_rb_error_bound_in_greedy_in, RBParameters mu_min_in, RBParameters mu_max_in, std::map< std::string, std::vector< Real >> discrete_parameter_values_in, std::map< std::string, bool > log_scaling)
 
virtual void print_info ()
 
void print_basis_function_orthogonality ()
 
unsigned int get_delta_N () const
 
void set_inner_product_assembly (ElemAssembly &inner_product_assembly_in)
 
ElemAssemblyget_inner_product_assembly ()
 
void zero_constrained_dofs_on_vector (NumericVector< Number > &vector)
 
void set_convergence_assertion_flag (bool flag)
 
void set_quiet_mode (bool quiet_mode_in)
 
bool is_quiet () const
 
numeric_index_type get_n_training_samples () const
 
numeric_index_type get_local_n_training_samples () const
 
numeric_index_type get_first_local_training_index () const
 
numeric_index_type get_last_local_training_index () const
 
virtual void initialize_training_parameters (const RBParameters &mu_min, const RBParameters &mu_max, unsigned int n_training_parameters, std::map< std::string, bool > log_param_scale, bool deterministic=true)
 
virtual void load_training_set (std::map< std::string, std::vector< Number >> &new_training_set)
 
void broadcast_parameters (unsigned int proc_id)
 
void set_training_random_seed (unsigned int seed)
 
void set_deterministic_training_parameter_name (const std::string &name)
 
const std::string & get_deterministic_training_parameter_name () const
 
void set_deterministic_training_parameter_repeats (unsigned int repeats)
 
unsigned int get_deterministic_training_parameter_repeats () const
 
virtual void reinit () override
 
virtual void assemble () override
 
virtual void restrict_solve_to (const SystemSubset *subset, const SubsetSolveMode subset_solve_mode=SUBSET_ZERO) override
 
virtual void solve () override
 
virtual LinearSolver< Number > * get_linear_solver () const override
 
virtual void release_linear_solver (LinearSolver< Number > *) const override
 
virtual void assembly (bool get_residual, bool get_jacobian, bool apply_heterogeneous_constraints=false, bool apply_no_constraints=false) override
 
unsigned int n_linear_iterations () const
 
Real final_linear_residual () const
 
void attach_shell_matrix (ShellMatrix< Number > *shell_matrix)
 
void detach_shell_matrix ()
 
ShellMatrix< Number > * get_shell_matrix ()
 
virtual void disable_cache () override
 
virtual std::pair< unsigned int, Realget_linear_solve_parameters () const
 
virtual void assemble_residual_derivatives (const ParameterVector &parameters) override
 
virtual std::pair< unsigned int, Realsensitivity_solve (const ParameterVector &parameters) override
 
virtual std::pair< unsigned int, Realweighted_sensitivity_solve (const ParameterVector &parameters, const ParameterVector &weights) override
 
virtual std::pair< unsigned int, Realadjoint_solve (const QoISet &qoi_indices=QoISet()) override
 
virtual std::pair< unsigned int, Realweighted_sensitivity_adjoint_solve (const ParameterVector &parameters, const ParameterVector &weights, const QoISet &qoi_indices=QoISet()) override
 
virtual void adjoint_qoi_parameter_sensitivity (const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities) override
 
virtual void forward_qoi_parameter_sensitivity (const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities) override
 
virtual void qoi_parameter_hessian (const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &hessian) override
 
virtual void qoi_parameter_hessian_vector_product (const QoISet &qoi_indices, const ParameterVector &parameters, const ParameterVector &vector, SensitivityData &product) override
 
SparseMatrix< Number > & add_matrix (const std::string &mat_name)
 
void remove_matrix (const std::string &mat_name)
 
bool have_matrix (const std::string &mat_name) const
 
const SparseMatrix< Number > * request_matrix (const std::string &mat_name) const
 
SparseMatrix< Number > * request_matrix (const std::string &mat_name)
 
const SparseMatrix< Number > & get_matrix (const std::string &mat_name) const
 
SparseMatrix< Number > & get_matrix (const std::string &mat_name)
 
virtual unsigned int n_matrices () const override
 
virtual void assemble_qoi (const QoISet &qoi_indices=QoISet()) override
 
virtual void assemble_qoi_derivative (const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true) override
 
void init ()
 
virtual void reinit_constraints ()
 
bool is_initialized ()
 
virtual void update ()
 
bool is_adjoint_already_solved () const
 
void set_adjoint_already_solved (bool setting)
 
virtual void qoi_parameter_sensitivity (const QoISet &qoi_indices, const ParameterVector &parameters, SensitivityData &sensitivities)
 
virtual bool compare (const System &other_system, const Real threshold, const bool verbose) const
 
const std::string & name () const
 
void project_solution (FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
 
void project_solution (FEMFunctionBase< Number > *f, FEMFunctionBase< Gradient > *g=nullptr) const
 
void project_solution (ValueFunctionPointer fptr, GradientFunctionPointer gptr, const Parameters &parameters) const
 
void project_vector (NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
 
void project_vector (NumericVector< Number > &new_vector, FEMFunctionBase< Number > *f, FEMFunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
 
void project_vector (ValueFunctionPointer fptr, GradientFunctionPointer gptr, const Parameters &parameters, NumericVector< Number > &new_vector, int is_adjoint=-1) const
 
void boundary_project_solution (const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr)
 
void boundary_project_solution (const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, ValueFunctionPointer fptr, GradientFunctionPointer gptr, const Parameters &parameters)
 
void boundary_project_vector (const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
 
void boundary_project_vector (const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, ValueFunctionPointer fptr, GradientFunctionPointer gptr, const Parameters &parameters, NumericVector< Number > &new_vector, int is_adjoint=-1) const
 
unsigned int number () const
 
void update_global_solution (std::vector< Number > &global_soln) const
 
void update_global_solution (std::vector< Number > &global_soln, const processor_id_type dest_proc) const
 
const MeshBaseget_mesh () const
 
MeshBaseget_mesh ()
 
const DofMapget_dof_map () const
 
DofMapget_dof_map ()
 
const EquationSystemsget_equation_systems () const
 
EquationSystemsget_equation_systems ()
 
bool active () const
 
void activate ()
 
void deactivate ()
 
void set_basic_system_only ()
 
vectors_iterator vectors_begin ()
 
const_vectors_iterator vectors_begin () const
 
vectors_iterator vectors_end ()
 
const_vectors_iterator vectors_end () const
 
NumericVector< Number > & add_vector (const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
 
void remove_vector (const std::string &vec_name)
 
bool & project_solution_on_reinit (void)
 
bool have_vector (const std::string &vec_name) const
 
const NumericVector< Number > * request_vector (const std::string &vec_name) const
 
NumericVector< Number > * request_vector (const std::string &vec_name)
 
const NumericVector< Number > * request_vector (const unsigned int vec_num) const
 
NumericVector< Number > * request_vector (const unsigned int vec_num)
 
const NumericVector< Number > & get_vector (const std::string &vec_name) const
 
NumericVector< Number > & get_vector (const std::string &vec_name)
 
const NumericVector< Number > & get_vector (const unsigned int vec_num) const
 
NumericVector< Number > & get_vector (const unsigned int vec_num)
 
const std::string & vector_name (const unsigned int vec_num) const
 
const std::string & vector_name (const NumericVector< Number > &vec_reference) const
 
void set_vector_as_adjoint (const std::string &vec_name, int qoi_num)
 
int vector_is_adjoint (const std::string &vec_name) const
 
void set_vector_preservation (const std::string &vec_name, bool preserve)
 
bool vector_preservation (const std::string &vec_name) const
 
NumericVector< Number > & add_adjoint_solution (unsigned int i=0)
 
NumericVector< Number > & get_adjoint_solution (unsigned int i=0)
 
const NumericVector< Number > & get_adjoint_solution (unsigned int i=0) const
 
NumericVector< Number > & add_sensitivity_solution (unsigned int i=0)
 
NumericVector< Number > & get_sensitivity_solution (unsigned int i=0)
 
const NumericVector< Number > & get_sensitivity_solution (unsigned int i=0) const
 
NumericVector< Number > & add_weighted_sensitivity_adjoint_solution (unsigned int i=0)
 
NumericVector< Number > & get_weighted_sensitivity_adjoint_solution (unsigned int i=0)
 
const NumericVector< Number > & get_weighted_sensitivity_adjoint_solution (unsigned int i=0) const
 
NumericVector< Number > & add_weighted_sensitivity_solution ()
 
NumericVector< Number > & get_weighted_sensitivity_solution ()
 
const NumericVector< Number > & get_weighted_sensitivity_solution () const
 
NumericVector< Number > & add_adjoint_rhs (unsigned int i=0)
 
NumericVector< Number > & get_adjoint_rhs (unsigned int i=0)
 
const NumericVector< Number > & get_adjoint_rhs (unsigned int i=0) const
 
NumericVector< Number > & add_sensitivity_rhs (unsigned int i=0)
 
NumericVector< Number > & get_sensitivity_rhs (unsigned int i=0)
 
const NumericVector< Number > & get_sensitivity_rhs (unsigned int i=0) const
 
unsigned int n_vectors () const
 
unsigned int n_vars () const
 
unsigned int n_variable_groups () const
 
unsigned int n_components () const
 
dof_id_type n_dofs () const
 
dof_id_type n_active_dofs () const
 
dof_id_type n_constrained_dofs () const
 
dof_id_type n_local_constrained_dofs () const
 
dof_id_type n_local_dofs () const
 
unsigned int add_variable (const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
 
unsigned int add_variable (const std::string &var, const Order order=FIRST, const FEFamily=LAGRANGE, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
 
unsigned int add_variables (const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
 
unsigned int add_variables (const std::vector< std::string > &vars, const Order order=FIRST, const FEFamily=LAGRANGE, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
 
const Variablevariable (unsigned int var) const
 
const VariableGroupvariable_group (unsigned int vg) const
 
bool has_variable (const std::string &var) const
 
const std::string & variable_name (const unsigned int i) const
 
unsigned short int variable_number (const std::string &var) const
 
void get_all_variable_numbers (std::vector< unsigned int > &all_variable_numbers) const
 
unsigned int variable_scalar_number (const std::string &var, unsigned int component) const
 
unsigned int variable_scalar_number (unsigned int var_num, unsigned int component) const
 
const FETypevariable_type (const unsigned int i) const
 
const FETypevariable_type (const std::string &var) const
 
bool identify_variable_groups () const
 
void identify_variable_groups (const bool)
 
Real calculate_norm (const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
 
Real calculate_norm (const NumericVector< Number > &v, const SystemNorm &norm, std::set< unsigned int > *skip_dimensions=nullptr) const
 
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)
 
void read_legacy_data (Xdr &io, const bool read_additional_data=true)
 
template<typename ValType >
void read_serialized_data (Xdr &io, const bool read_additional_data=true)
 
void read_serialized_data (Xdr &io, const bool read_additional_data=true)
 
template<typename InValType >
std::size_t read_serialized_vectors (Xdr &io, const std::vector< NumericVector< Number > *> &vectors) const
 
std::size_t read_serialized_vectors (Xdr &io, const std::vector< NumericVector< Number > *> &vectors) const
 
template<typename InValType >
void read_parallel_data (Xdr &io, const bool read_additional_data)
 
void read_parallel_data (Xdr &io, const bool read_additional_data)
 
void write_header (Xdr &io, const std::string &version, const bool write_additional_data) const
 
void write_serialized_data (Xdr &io, const bool write_additional_data=true) const
 
std::size_t write_serialized_vectors (Xdr &io, const std::vector< const NumericVector< Number > *> &vectors) const
 
void write_parallel_data (Xdr &io, const bool write_additional_data) const
 
std::string get_info () const
 
void attach_init_function (void fptr(EquationSystems &es, const std::string &name))
 
void attach_init_object (Initialization &init)
 
void attach_assemble_function (void fptr(EquationSystems &es, const std::string &name))
 
void attach_assemble_object (Assembly &assemble)
 
void attach_constraint_function (void fptr(EquationSystems &es, const std::string &name))
 
void attach_constraint_object (Constraint &constrain)
 
void attach_QOI_function (void fptr(EquationSystems &es, const std::string &name, const QoISet &qoi_indices))
 
void attach_QOI_object (QOI &qoi)
 
void attach_QOI_derivative (void fptr(EquationSystems &es, const std::string &name, const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints))
 
void attach_QOI_derivative_object (QOIDerivative &qoi_derivative)
 
virtual void user_initialization ()
 
virtual void user_assembly ()
 
virtual void user_constrain ()
 
virtual void user_QOI (const QoISet &qoi_indices)
 
virtual void user_QOI_derivative (const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
 
virtual void re_update ()
 
virtual void restrict_vectors ()
 
virtual void prolong_vectors ()
 
Number current_solution (const dof_id_type global_dof_number) const
 
unsigned int n_qois () const
 
Number point_value (unsigned int var, const Point &p, const bool insist_on_success=true) const
 
Number point_value (unsigned int var, const Point &p, const Elem &e) const
 
Number point_value (unsigned int var, const Point &p, const Elem *e) const
 
Gradient point_gradient (unsigned int var, const Point &p, const bool insist_on_success=true) const
 
Gradient point_gradient (unsigned int var, const Point &p, const Elem &e) const
 
Gradient point_gradient (unsigned int var, const Point &p, const Elem *e) const
 
Tensor point_hessian (unsigned int var, const Point &p, const bool insist_on_success=true) const
 
Tensor point_hessian (unsigned int var, const Point &p, const Elem &e) const
 
Tensor point_hessian (unsigned int var, const Point &p, const Elem *e) const
 
void local_dof_indices (const unsigned int var, std::set< dof_id_type > &var_indices) const
 
void zero_variable (NumericVector< Number > &v, unsigned int var_num) const
 
bool & hide_output ()
 
void projection_matrix (SparseMatrix< Number > &proj_mat) const
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
void initialize_parameters (const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values)
 
void initialize_parameters (const RBParametrized &rb_parametrized)
 
unsigned int get_n_params () const
 
unsigned int get_n_continuous_params () const
 
unsigned int get_n_discrete_params () const
 
std::set< std::string > get_parameter_names () const
 
const RBParametersget_parameters () const
 
void set_parameters (const RBParameters &params)
 
const RBParametersget_parameters_min () const
 
const RBParametersget_parameters_max () const
 
Real get_parameter_min (const std::string &param_name) const
 
Real get_parameter_max (const std::string &param_name) const
 
void print_parameters () const
 
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)
 
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)
 
bool is_discrete_parameter (const std::string &mu_name) const
 
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values () const
 
void print_discrete_parameter_values () const
 

Static Public Member Functions

static std::unique_ptr< DirichletBoundarybuild_zero_dirichlet_boundary_object ()
 
static std::string get_info ()
 
static std::string get_info ()
 
static void print_info (std::ostream &out=libMesh::out)
 
static void print_info (std::ostream &out=libMesh::out)
 
static unsigned int n_objects ()
 
static unsigned int n_objects ()
 
static void enable_print_counter_info ()
 
static void enable_print_counter_info ()
 
static void disable_print_counter_info ()
 
static void disable_print_counter_info ()
 
static Real get_closest_value (Real value, const std::vector< Real > &list_of_values)
 

Public Attributes

std::vector< Realtraining_error_bounds
 
std::unique_ptr< LinearSolver< Number > > inner_product_solver
 
LinearSolver< Number > * extra_linear_solver
 
std::unique_ptr< SparseMatrix< Number > > inner_product_matrix
 
std::vector< Numbertruth_outputs
 
std::vector< std::vector< Number > > output_dual_innerprods
 
std::vector< std::unique_ptr< NumericVector< Number > > > Fq_representor
 
std::vector< NumberFq_representor_innerprods
 
bool skip_residual_in_train_reduced_basis
 
bool exit_on_repeated_greedy_parameters
 
bool impose_internal_fluxes
 
bool skip_degenerate_sides
 
bool compute_RB_inner_product
 
bool store_non_dirichlet_operators
 
bool use_empty_rb_solve_in_greedy
 
bool Fq_representor_innerprods_computed
 
std::unique_ptr< LinearSolver< Number > > linear_solver
 
SparseMatrix< Number > * matrix
 
bool zero_out_matrix_and_rhs
 
NumericVector< Number > * rhs
 
bool assemble_before_solve
 
bool use_fixed_solution
 
int extra_quadrature_order
 
std::unique_ptr< NumericVector< Number > > solution
 
std::unique_ptr< NumericVector< Number > > current_local_solution
 
Real time
 
std::vector< Numberqoi
 
bool verbose_mode
 

Protected Types

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

Protected Member Functions

virtual void allocate_data_structures ()
 
virtual void truth_assembly ()
 
virtual std::unique_ptr< DGFEMContextbuild_context ()
 
virtual SparseMatrix< Number > & get_matrix_for_output_dual_solves ()
 
virtual bool greedy_termination_test (Real abs_greedy_error, Real initial_greedy_error, int count)
 
void update_greedy_param_list ()
 
void add_scaled_matrix_and_vector (Number scalar, ElemAssembly *elem_assembly, SparseMatrix< Number > *input_matrix, NumericVector< Number > *input_vector, bool symmetrize=false, bool apply_dof_constraints=true)
 
virtual void set_context_solution_vec (NumericVector< Number > &vec)
 
virtual void assemble_misc_matrices ()
 
virtual void assemble_all_affine_operators ()
 
virtual void assemble_all_affine_vectors ()
 
virtual void assemble_all_output_vectors ()
 
virtual void compute_output_dual_innerprods ()
 
virtual void compute_Fq_representor_innerprods (bool compute_inner_products=true)
 
virtual void enrich_RB_space ()
 
virtual void update_system ()
 
virtual Real get_RB_error_bound ()
 
virtual void update_RB_system_matrices ()
 
virtual void update_residual_terms (bool compute_inner_products=true)
 
virtual void init_context (FEMContext &)
 
bool get_convergence_assertion_flag () const
 
void check_convergence (LinearSolver< Number > &input_solver)
 
virtual void init_data ()
 
RBParameters get_params_from_training_set (unsigned int index)
 
void set_params_from_training_set (unsigned int index)
 
virtual void set_params_from_training_set_and_broadcast (unsigned int index)
 
virtual void init_matrices ()
 
void project_vector (NumericVector< Number > &, int is_adjoint=-1) const
 
void project_vector (const NumericVector< Number > &, NumericVector< Number > &, int is_adjoint=-1) const
 
void increment_constructor_count (const std::string &name)
 
void increment_constructor_count (const std::string &name)
 
void increment_destructor_count (const std::string &name)
 
void increment_destructor_count (const std::string &name)
 

Static Protected Member Functions

static void get_global_max_error_pair (const Parallel::Communicator &communicator, std::pair< numeric_index_type, Real > &error_pair)
 
static void generate_training_parameters_random (const Parallel::Communicator &communicator, std::map< std::string, bool > log_param_scale, std::map< std::string, std::unique_ptr< NumericVector< Number >>> &training_parameters_in, unsigned int n_training_samples_in, const RBParameters &min_parameters, const RBParameters &max_parameters, int training_parameters_random_seed=-1, bool serial_training_set=false)
 
static void generate_training_parameters_deterministic (const Parallel::Communicator &communicator, std::map< std::string, bool > log_param_scale, std::map< std::string, std::unique_ptr< NumericVector< Number >>> &training_parameters_in, unsigned int n_training_samples_in, const RBParameters &min_parameters, const RBParameters &max_parameters, bool serial_training_set=false)
 

Protected Attributes

unsigned int Nmax
 
unsigned int delta_N
 
bool output_dual_innerprods_computed
 
bool assert_convergence
 
bool quiet_mode
 
bool serial_training_set
 
std::unique_ptr< NumericVector< Number > > inner_product_storage_vector
 
unsigned int _n_linear_iterations
 
Real _final_linear_residual
 
ShellMatrix< Number > * _shell_matrix
 
const SystemSubset_subset
 
SubsetSolveMode _subset_solve_mode
 
const Parallel::Communicator_communicator
 

Static Protected Attributes

static Counts _counts
 
static Counts _counts
 
static Threads::atomic< unsigned int > _n_objects
 
static Threads::atomic< unsigned int > _n_objects
 
static Threads::spin_mutex _mutex
 
static Threads::spin_mutex _mutex
 
static bool _enable_print_counter = true
 
static bool _enable_print_counter = true
 

Private Attributes

RBEvaluationrb_eval
 
RBAssemblyExpansionrb_assembly_expansion
 
ElemAssemblyinner_product_assembly
 
std::vector< std::unique_ptr< SparseMatrix< Number > > > Aq_vector
 
std::vector< std::unique_ptr< NumericVector< Number > > > Fq_vector
 
std::vector< std::vector< std::unique_ptr< NumericVector< Number > > > > outputs_vector
 
std::vector< std::unique_ptr< SparseMatrix< Number > > > non_dirichlet_Aq_vector
 
std::vector< std::unique_ptr< NumericVector< Number > > > non_dirichlet_Fq_vector
 
std::vector< std::vector< std::unique_ptr< NumericVector< Number > > > > non_dirichlet_outputs_vector
 
std::unique_ptr< SparseMatrix< Number > > non_dirichlet_inner_product_matrix
 
Real rel_training_tolerance
 
Real abs_training_tolerance
 
bool normalize_rb_bound_in_greedy
 

Detailed Description

This class is part of the rbOOmit framework.

RBConstruction implements the Construction stage of the certified reduced basis method for steady-state elliptic parametrized PDEs.

Author
David J. Knezevic
Date
2009

Definition at line 53 of file rb_construction.h.

Member Typedef Documentation

◆ const_matrices_iterator

typedef std::map<std::string, SparseMatrix<Number> *>::const_iterator libMesh::ImplicitSystem::const_matrices_iterator
inherited

Definition at line 306 of file implicit_system.h.

◆ const_vectors_iterator

typedef std::map<std::string, NumericVector<Number> *>::const_iterator libMesh::System::const_vectors_iterator
inherited

Definition at line 749 of file system.h.

◆ Counts [1/2]

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 117 of file reference_counter.h.

◆ Counts [2/2]

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 117 of file reference_counter.h.

◆ GradientFunctionPointer

typedef Gradient(* libMesh::System::GradientFunctionPointer) (const Point &p, const Parameters &parameters, const std::string &sys_name, const std::string &unknown_name)
inherited

Definition at line 524 of file system.h.

◆ matrices_iterator

typedef std::map<std::string, SparseMatrix<Number> *>::iterator libMesh::ImplicitSystem::matrices_iterator
inherited

Matrix iterator typedefs.

Definition at line 305 of file implicit_system.h.

◆ Parent

The type of the parent.

Definition at line 122 of file rb_construction.h.

◆ sys_type

The type of system.

Definition at line 73 of file rb_construction.h.

◆ ValueFunctionPointer

typedef Number(* libMesh::System::ValueFunctionPointer) (const Point &p, const Parameters &Parameters, const std::string &sys_name, const std::string &unknown_name)
inherited

Projects arbitrary functions onto the current solution. The function value fptr and its gradient gptr are represented by function pointers. A gradient gptr is only required/used for projecting onto finite element spaces with continuous derivatives.

Definition at line 520 of file system.h.

◆ vectors_iterator

typedef std::map<std::string, NumericVector<Number> *>::iterator libMesh::System::vectors_iterator
inherited

Vector iterator typedefs.

Definition at line 748 of file system.h.

Constructor & Destructor Documentation

◆ RBConstruction()

libMesh::RBConstruction::RBConstruction ( EquationSystems es,
const std::string &  name,
const unsigned int  number 
)

Constructor. Optionally initializes required data structures.

◆ ~RBConstruction()

virtual libMesh::RBConstruction::~RBConstruction ( )
virtual

Destructor.

Member Function Documentation

◆ activate()

void libMesh::System::activate ( )
inlineinherited

Activates the system. Only active systems are solved.

Definition at line 2073 of file system.h.

References libMesh::System::_active.

2074 {
2075  _active = true;
2076 }

◆ active()

bool libMesh::System::active ( ) const
inlineinherited
Returns
true if the system is active, false otherwise. An active system will be solved.

Definition at line 2065 of file system.h.

References libMesh::System::_active.

2066 {
2067  return _active;
2068 }

◆ add_adjoint_rhs()

NumericVector< Number > & libMesh::System::add_adjoint_rhs ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's adjoint rhs vectors, by default the one corresponding to the first qoi. Creates the vector if it doesn't already exist.

Definition at line 1021 of file system.C.

References libMesh::System::add_vector().

Referenced by libMesh::ExplicitSystem::assemble_qoi_derivative(), and libMesh::FEMSystem::assemble_qoi_derivative().

1022 {
1023  std::ostringstream adjoint_rhs_name;
1024  adjoint_rhs_name << "adjoint_rhs" << i;
1025 
1026  return this->add_vector(adjoint_rhs_name.str(), false);
1027 }
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Definition: system.C:661

◆ add_adjoint_solution()

NumericVector< Number > & libMesh::System::add_adjoint_solution ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's adjoint solution vectors, by default the one corresponding to the first qoi. Creates the vector if it doesn't already exist.

Definition at line 957 of file system.C.

References libMesh::System::add_vector(), and libMesh::System::set_vector_as_adjoint().

Referenced by libMesh::ImplicitSystem::adjoint_solve().

958 {
959  std::ostringstream adjoint_name;
960  adjoint_name << "adjoint_solution" << i;
961 
962  NumericVector<Number> & returnval = this->add_vector(adjoint_name.str());
963  this->set_vector_as_adjoint(adjoint_name.str(), i);
964  return returnval;
965 }
void set_vector_as_adjoint(const std::string &vec_name, int qoi_num)
Definition: system.C:885
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Definition: system.C:661

◆ add_matrix()

SparseMatrix< Number > & libMesh::ImplicitSystem::add_matrix ( const std::string &  mat_name)
inherited

Adds the additional matrix mat_name to this system. Only allowed prior to assemble(). All additional matrices have the same sparsity pattern as the matrix used during solution. When not System but the user wants to initialize the mayor matrix, then all the additional matrices, if existent, have to be initialized by the user, too.

Definition at line 203 of file implicit_system.C.

References libMesh::ImplicitSystem::_can_add_matrices, libMesh::ImplicitSystem::_matrices, libMesh::SparseMatrix< T >::build(), libMesh::ParallelObject::comm(), and libMesh::ImplicitSystem::have_matrix().

Referenced by libMesh::ImplicitSystem::add_system_matrix(), libMesh::EigenTimeSolver::init(), and libMesh::NewmarkSystem::NewmarkSystem().

204 {
205  // only add matrices before initializing...
206  if (!_can_add_matrices)
207  libmesh_error_msg("ERROR: Too late. Cannot add matrices to the system after initialization"
208  << "\n any more. You should have done this earlier.");
209 
210  // Return the matrix if it is already there.
211  if (this->have_matrix(mat_name))
212  return *(_matrices[mat_name]);
213 
214  // Otherwise build the matrix and return it.
215  SparseMatrix<Number> * buf = SparseMatrix<Number>::build(this->comm()).release();
216  _matrices.insert (std::make_pair (mat_name, buf));
217 
218  return *buf;
219 }
static std::unique_ptr< SparseMatrix< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
bool have_matrix(const std::string &mat_name) const
const Parallel::Communicator & comm() const
std::map< std::string, SparseMatrix< Number > * > _matrices

◆ add_scaled_Aq()

void libMesh::RBConstruction::add_scaled_Aq ( Number  scalar,
unsigned int  q_a,
SparseMatrix< Number > *  input_matrix,
bool  symmetrize 
)

Add the scaled q^th affine matrix to input_matrix. If symmetrize==true, then we symmetrize Aq before adding it.

◆ add_scaled_matrix_and_vector()

void libMesh::RBConstruction::add_scaled_matrix_and_vector ( Number  scalar,
ElemAssembly elem_assembly,
SparseMatrix< Number > *  input_matrix,
NumericVector< Number > *  input_vector,
bool  symmetrize = false,
bool  apply_dof_constraints = true 
)
protected

This function loops over the mesh and applies the specified interior and/or boundary assembly routines, then adds the scaled result to input_matrix and/or input_vector. If symmetrize==true then we assemble the symmetric part of the matrix, 0.5*(A + A^T)

◆ add_sensitivity_rhs()

NumericVector< Number > & libMesh::System::add_sensitivity_rhs ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's sensitivity rhs vectors, by default the one corresponding to the first parameter. Creates the vector if it doesn't already exist.

Definition at line 1051 of file system.C.

References libMesh::System::add_vector().

Referenced by libMesh::ImplicitSystem::assemble_residual_derivatives().

1052 {
1053  std::ostringstream sensitivity_rhs_name;
1054  sensitivity_rhs_name << "sensitivity_rhs" << i;
1055 
1056  return this->add_vector(sensitivity_rhs_name.str(), false);
1057 }
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Definition: system.C:661

◆ add_sensitivity_solution()

NumericVector< Number > & libMesh::System::add_sensitivity_solution ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's solution sensitivity vectors, by default the one corresponding to the first parameter. Creates the vector if it doesn't already exist.

Definition at line 906 of file system.C.

References libMesh::System::add_vector().

Referenced by libMesh::ImplicitSystem::sensitivity_solve().

907 {
908  std::ostringstream sensitivity_name;
909  sensitivity_name << "sensitivity_solution" << i;
910 
911  return this->add_vector(sensitivity_name.str());
912 }
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Definition: system.C:661

◆ add_variable() [1/2]

unsigned int libMesh::System::add_variable ( const std::string &  var,
const FEType type,
const std::set< subdomain_id_type > *const  active_subdomains = nullptr 
)
inherited

Adds the variable var to the list of variables for this system.

Returns
The index number for the new variable.

Definition at line 1081 of file system.C.

References libMesh::System::_variable_groups, libMesh::System::_variable_numbers, libMesh::System::_variables, libMesh::System::add_variables(), libMesh::VariableGroup::append(), libMesh::System::identify_variable_groups(), libMesh::System::is_initialized(), libMesh::System::n_variable_groups(), libMesh::System::n_vars(), libMesh::System::number(), libMesh::System::variable_name(), and libMesh::System::variable_type().

Referenced by libMesh::DifferentiableSystem::add_second_order_dot_vars(), libMesh::System::add_variable(), libMesh::ErrorVector::plot_error(), and libMesh::System::read_header().

1084 {
1085  libmesh_assert(!this->is_initialized());
1086 
1087  // Make sure the variable isn't there already
1088  // or if it is, that it's the type we want
1089  for (unsigned int v=0; v<this->n_vars(); v++)
1090  if (this->variable_name(v) == var)
1091  {
1092  if (this->variable_type(v) == type)
1093  return _variables[v].number();
1094 
1095  libmesh_error_msg("ERROR: incompatible variable " << var << " has already been added for this system!");
1096  }
1097 
1098  // Optimize for VariableGroups here - if the user is adding multiple
1099  // variables of the same FEType and subdomain restriction, catch
1100  // that here and add them as members of the same VariableGroup.
1101  //
1102  // start by setting this flag to whatever the user has requested
1103  // and then consider the conditions which should negate it.
1104  bool should_be_in_vg = this->identify_variable_groups();
1105 
1106  // No variable groups, nothing to add to
1107  if (!this->n_variable_groups())
1108  should_be_in_vg = false;
1109 
1110  else
1111  {
1112  VariableGroup & vg(_variable_groups.back());
1113 
1114  // get a pointer to their subdomain restriction, if any.
1115  const std::set<subdomain_id_type> * const
1116  their_active_subdomains (vg.implicitly_active() ?
1117  nullptr : &vg.active_subdomains());
1118 
1119  // Different types?
1120  if (vg.type() != type)
1121  should_be_in_vg = false;
1122 
1123  // they are restricted, we aren't?
1124  if (their_active_subdomains && !active_subdomains)
1125  should_be_in_vg = false;
1126 
1127  // they aren't restricted, we are?
1128  if (!their_active_subdomains && active_subdomains)
1129  should_be_in_vg = false;
1130 
1131  if (their_active_subdomains && active_subdomains)
1132  // restricted to different sets?
1133  if (*their_active_subdomains != *active_subdomains)
1134  should_be_in_vg = false;
1135 
1136  // OK, after all that, append the variable to the vg if none of the conditions
1137  // were violated
1138  if (should_be_in_vg)
1139  {
1140  const unsigned short curr_n_vars = cast_int<unsigned short>
1141  (this->n_vars());
1142 
1143  vg.append (var);
1144 
1145  _variables.push_back(vg(vg.n_variables()-1));
1146  _variable_numbers[var] = curr_n_vars;
1147  return curr_n_vars;
1148  }
1149  }
1150 
1151  // otherwise, fall back to adding a single variable group
1152  return this->add_variables (std::vector<std::string>(1, var),
1153  type,
1154  active_subdomains);
1155 }
unsigned int add_variables(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Definition: system.C:1171
std::map< std::string, unsigned short int > _variable_numbers
Definition: system.h:1922
unsigned int n_variable_groups() const
Definition: system.h:2113
std::vector< Variable > _variables
Definition: system.h:1911
unsigned int number() const
Definition: system.h:2025
std::vector< VariableGroup > _variable_groups
Definition: system.h:1916
bool is_initialized()
Definition: system.h:2089
const std::string & variable_name(const unsigned int i) const
Definition: system.h:2153
bool identify_variable_groups() const
Definition: system.h:2201
const FEType & variable_type(const unsigned int i) const
Definition: system.h:2183
unsigned int n_vars() const
Definition: system.h:2105

◆ add_variable() [2/2]

unsigned int libMesh::System::add_variable ( const std::string &  var,
const Order  order = FIRST,
const FEFamily  family = LAGRANGE,
const std::set< subdomain_id_type > *const  active_subdomains = nullptr 
)
inherited

Adds the variable var to the list of variables for this system. Same as before, but assumes LAGRANGE as default value for FEType.family.

Definition at line 1159 of file system.C.

References libMesh::System::add_variable().

1163 {
1164  return this->add_variable(var,
1165  FEType(order, family),
1166  active_subdomains);
1167 }
unsigned int add_variable(const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Definition: system.C:1081

◆ add_variables() [1/2]

unsigned int libMesh::System::add_variables ( const std::vector< std::string > &  vars,
const FEType type,
const std::set< subdomain_id_type > *const  active_subdomains = nullptr 
)
inherited

Adds the variable var to the list of variables for this system.

Returns
The index number for the new variable.

Definition at line 1171 of file system.C.

References libMesh::System::_variable_groups, libMesh::System::_variable_numbers, libMesh::System::_variables, libMesh::System::is_initialized(), libMesh::System::n_components(), libMesh::System::n_vars(), libMesh::System::number(), libMesh::System::variable_name(), and libMesh::System::variable_type().

Referenced by libMesh::System::add_variable(), and libMesh::System::add_variables().

1174 {
1175  libmesh_assert(!this->is_initialized());
1176 
1177  // Make sure the variable isn't there already
1178  // or if it is, that it's the type we want
1179  for (std::size_t ov=0; ov<vars.size(); ov++)
1180  for (unsigned int v=0; v<this->n_vars(); v++)
1181  if (this->variable_name(v) == vars[ov])
1182  {
1183  if (this->variable_type(v) == type)
1184  return _variables[v].number();
1185 
1186  libmesh_error_msg("ERROR: incompatible variable " << vars[ov] << " has already been added for this system!");
1187  }
1188 
1189  const unsigned short curr_n_vars = cast_int<unsigned short>
1190  (this->n_vars());
1191 
1192  const unsigned int next_first_component = this->n_components();
1193 
1194  // Add the variable group to the list
1195  _variable_groups.push_back((active_subdomains == nullptr) ?
1196  VariableGroup(this, vars, curr_n_vars,
1197  next_first_component, type) :
1198  VariableGroup(this, vars, curr_n_vars,
1199  next_first_component, type, *active_subdomains));
1200 
1201  const VariableGroup & vg (_variable_groups.back());
1202 
1203  // Add each component of the group individually
1204  for (auto v : IntRange<unsigned int>(0, vars.size()))
1205  {
1206  _variables.push_back (vg(v));
1207  _variable_numbers[vars[v]] = cast_int<unsigned short>
1208  (curr_n_vars+v);
1209  }
1210 
1211  libmesh_assert_equal_to ((curr_n_vars+vars.size()), this->n_vars());
1212 
1213  // BSK - Defer this now to System::init_data() so we can detect
1214  // VariableGroups 12/28/2012
1215  // // Add the variable group to the _dof_map
1216  // _dof_map->add_variable_group (vg);
1217 
1218  // Return the number of the new variable
1219  return cast_int<unsigned int>(curr_n_vars+vars.size()-1);
1220 }
std::map< std::string, unsigned short int > _variable_numbers
Definition: system.h:1922
unsigned int n_components() const
Definition: system.h:2121
std::vector< Variable > _variables
Definition: system.h:1911
unsigned int number() const
Definition: system.h:2025
std::vector< VariableGroup > _variable_groups
Definition: system.h:1916
bool is_initialized()
Definition: system.h:2089
const std::string & variable_name(const unsigned int i) const
Definition: system.h:2153
const FEType & variable_type(const unsigned int i) const
Definition: system.h:2183
unsigned int n_vars() const
Definition: system.h:2105

◆ add_variables() [2/2]

unsigned int libMesh::System::add_variables ( const std::vector< std::string > &  vars,
const Order  order = FIRST,
const FEFamily  family = LAGRANGE,
const std::set< subdomain_id_type > *const  active_subdomains = nullptr 
)
inherited

Adds the variable var to the list of variables for this system. Same as before, but assumes LAGRANGE as default value for FEType.family.

Definition at line 1224 of file system.C.

References libMesh::System::add_variables().

1228 {
1229  return this->add_variables(vars,
1230  FEType(order, family),
1231  active_subdomains);
1232 }
unsigned int add_variables(const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Definition: system.C:1171

◆ add_vector()

NumericVector< Number > & libMesh::System::add_vector ( const std::string &  vec_name,
const bool  projections = true,
const ParallelType  type = PARALLEL 
)
inherited

Adds the additional vector vec_name to this system. All the additional vectors are similarly distributed, like the solution, and initialized to zero.

By default vectors added by add_vector are projected to changed grids by reinit(). To zero them instead (more efficient), pass "false" as the second argument

Definition at line 661 of file system.C.

References libMesh::System::_dof_map, libMesh::System::_is_initialized, libMesh::System::_vector_is_adjoint, libMesh::System::_vector_projections, libMesh::System::_vector_types, libMesh::System::_vectors, libMesh::NumericVector< T >::build(), libMesh::ParallelObject::comm(), libMesh::GHOSTED, libMesh::System::have_vector(), libMesh::NumericVector< T >::init(), libMesh::System::n_dofs(), and libMesh::System::n_local_dofs().

Referenced by libMesh::System::add_adjoint_rhs(), libMesh::System::add_adjoint_solution(), libMesh::System::add_sensitivity_rhs(), libMesh::System::add_sensitivity_solution(), libMesh::ExplicitSystem::add_system_rhs(), libMesh::System::add_weighted_sensitivity_adjoint_solution(), libMesh::System::add_weighted_sensitivity_solution(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::SecondOrderUnsteadySolver::init(), libMesh::UnsteadySolver::init(), libMesh::OptimizationSystem::init_data(), libMesh::ContinuationSystem::init_data(), libMesh::NewmarkSystem::NewmarkSystem(), libMesh::System::read_header(), libMesh::FrequencySystem::set_frequencies(), libMesh::FrequencySystem::set_frequencies_by_range(), and libMesh::FrequencySystem::set_frequencies_by_steps().

664 {
665  // Return the vector if it is already there.
666  if (this->have_vector(vec_name))
667  return *(_vectors[vec_name]);
668 
669  // Otherwise build the vector
670  NumericVector<Number> * buf = NumericVector<Number>::build(this->comm()).release();
671  _vectors.insert (std::make_pair (vec_name, buf));
672  _vector_projections.insert (std::make_pair (vec_name, projections));
673 
674  _vector_types.insert (std::make_pair (vec_name, type));
675 
676  // Vectors are primal by default
677  _vector_is_adjoint.insert (std::make_pair (vec_name, -1));
678 
679  // Initialize it if necessary
680  if (_is_initialized)
681  {
682  if (type == GHOSTED)
683  {
684 #ifdef LIBMESH_ENABLE_GHOSTED
685  buf->init (this->n_dofs(), this->n_local_dofs(),
686  _dof_map->get_send_list(), false,
687  GHOSTED);
688 #else
689  libmesh_error_msg("Cannot initialize ghosted vectors when they are not enabled.");
690 #endif
691  }
692  else
693  buf->init (this->n_dofs(), this->n_local_dofs(), false, type);
694  }
695 
696  return *buf;
697 }
std::map< std::string, ParallelType > _vector_types
Definition: system.h:1952
bool _is_initialized
Definition: system.h:1971
std::unique_ptr< DofMap > _dof_map
Definition: system.h:1884
const Parallel::Communicator & comm() const
dof_id_type n_local_dofs() const
Definition: system.C:187
dof_id_type n_dofs() const
Definition: system.C:150
std::map< std::string, int > _vector_is_adjoint
Definition: system.h:1947
bool have_vector(const std::string &vec_name) const
Definition: system.h:2225
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
std::map< std::string, NumericVector< Number > *> _vectors
Definition: system.h:1935
std::map< std::string, bool > _vector_projections
Definition: system.h:1941

◆ add_weighted_sensitivity_adjoint_solution()

NumericVector< Number > & libMesh::System::add_weighted_sensitivity_adjoint_solution ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's weighted sensitivity adjoint solution vectors, by default the one corresponding to the first qoi. Creates the vector if it doesn't already exist.

Definition at line 989 of file system.C.

References libMesh::System::add_vector(), and libMesh::System::set_vector_as_adjoint().

Referenced by libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

990 {
991  std::ostringstream adjoint_name;
992  adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
993 
994  NumericVector<Number> & returnval = this->add_vector(adjoint_name.str());
995  this->set_vector_as_adjoint(adjoint_name.str(), i);
996  return returnval;
997 }
void set_vector_as_adjoint(const std::string &vec_name, int qoi_num)
Definition: system.C:885
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Definition: system.C:661

◆ add_weighted_sensitivity_solution()

NumericVector< Number > & libMesh::System::add_weighted_sensitivity_solution ( )
inherited
Returns
A reference to the solution of the last weighted sensitivity solve Creates the vector if it doesn't already exist.

Definition at line 936 of file system.C.

References libMesh::System::add_vector().

Referenced by libMesh::ImplicitSystem::weighted_sensitivity_solve().

937 {
938  return this->add_vector("weighted_sensitivity_solution");
939 }
NumericVector< Number > & add_vector(const std::string &vec_name, const bool projections=true, const ParallelType type=PARALLEL)
Definition: system.C:661

◆ adjoint_qoi_parameter_sensitivity()

void libMesh::ImplicitSystem::adjoint_qoi_parameter_sensitivity ( const QoISet qoi_indices,
const ParameterVector parameters,
SensitivityData sensitivities 
)
overridevirtualinherited

Solves for the derivative of each of the system's quantities of interest q in qoi[qoi_indices] with respect to each parameter in parameters, placing the result for qoi i and parameter j into sensitivities[i][j].

Uses adjoint_solve() and the adjoint sensitivity method.

Currently uses finite differenced derivatives (partial q / partial p) and (partial R / partial p).

Reimplemented from libMesh::System.

Definition at line 697 of file implicit_system.C.

References std::abs(), libMesh::ImplicitSystem::adjoint_solve(), libMesh::SensitivityData::allocate_data(), libMesh::ExplicitSystem::assemble_qoi(), libMesh::ImplicitSystem::assemble_residual_derivatives(), libMesh::NumericVector< T >::dot(), libMesh::System::get_sensitivity_rhs(), libMesh::QoISet::has_index(), libMesh::System::is_adjoint_already_solved(), std::max(), libMesh::System::n_qois(), libMesh::System::qoi, libMesh::Real, libMesh::ParameterVector::size(), and libMesh::TOLERANCE.

700 {
701  ParameterVector & parameters =
702  const_cast<ParameterVector &>(parameters_in);
703 
704  const unsigned int Np = cast_int<unsigned int>
705  (parameters.size());
706  const unsigned int Nq = this->n_qois();
707 
708  // An introduction to the problem:
709  //
710  // Residual R(u(p),p) = 0
711  // partial R / partial u = J = system matrix
712  //
713  // This implies that:
714  // d/dp(R) = 0
715  // (partial R / partial p) +
716  // (partial R / partial u) * (partial u / partial p) = 0
717 
718  // We first do an adjoint solve:
719  // J^T * z = (partial q / partial u)
720  // if we havent already or dont have an initial condition for the adjoint
721  if (!this->is_adjoint_already_solved())
722  {
723  this->adjoint_solve(qoi_indices);
724  }
725 
726  this->assemble_residual_derivatives(parameters_in);
727 
728  // Get ready to fill in sensitivities:
729  sensitivities.allocate_data(qoi_indices, *this, parameters);
730 
731  // We use the identities:
732  // dq/dp = (partial q / partial p) + (partial q / partial u) *
733  // (partial u / partial p)
734  // dq/dp = (partial q / partial p) + (J^T * z) *
735  // (partial u / partial p)
736  // dq/dp = (partial q / partial p) + z * J *
737  // (partial u / partial p)
738 
739  // Leading to our final formula:
740  // dq/dp = (partial q / partial p) - z * (partial R / partial p)
741 
742  // In the case of adjoints with heterogenous Dirichlet boundary
743  // function phi, where
744  // q := S(u) - R(u,phi)
745  // the final formula works out to:
746  // dq/dp = (partial S / partial p) - z * (partial R / partial p)
747  // Because we currently have no direct access to
748  // (partial S / partial p), we use the identity
749  // (partial S / partial p) = (partial q / partial p) +
750  // phi * (partial R / partial p)
751  // to derive an equivalent equation:
752  // dq/dp = (partial q / partial p) - (z-phi) * (partial R / partial p)
753 
754  // Since z-phi degrees of freedom are zero for constrained indices,
755  // we can use the same constrained -(partial R / partial p) that we
756  // use for forward sensitivity solves, taking into account the
757  // differing sign convention.
758  //
759  // Since that vector is constrained, its constrained indices are
760  // zero, so its product with phi is zero, so we can neglect the
761  // evaluation of phi terms.
762 
763  for (unsigned int j=0; j != Np; ++j)
764  {
765  // We currently get partial derivatives via central differencing
766 
767  // (partial q / partial p) ~= (q(p+dp)-q(p-dp))/(2*dp)
768  // (partial R / partial p) ~= (rhs(p+dp) - rhs(p-dp))/(2*dp)
769 
770  Number old_parameter = *parameters[j];
771 
772  const Real delta_p =
773  TOLERANCE * std::max(std::abs(old_parameter), 1e-3);
774 
775  *parameters[j] = old_parameter - delta_p;
776  this->assemble_qoi(qoi_indices);
777  std::vector<Number> qoi_minus = this->qoi;
778 
779  NumericVector<Number> & neg_partialR_partialp = this->get_sensitivity_rhs(j);
780 
781  *parameters[j] = old_parameter + delta_p;
782  this->assemble_qoi(qoi_indices);
783  std::vector<Number> & qoi_plus = this->qoi;
784 
785  std::vector<Number> partialq_partialp(Nq, 0);
786  for (unsigned int i=0; i != Nq; ++i)
787  if (qoi_indices.has_index(i))
788  partialq_partialp[i] = (qoi_plus[i] - qoi_minus[i]) / (2.*delta_p);
789 
790  // Don't leave the parameter changed
791  *parameters[j] = old_parameter;
792 
793  for (unsigned int i=0; i != Nq; ++i)
794  if (qoi_indices.has_index(i))
795  sensitivities[i][j] = partialq_partialp[i] +
796  neg_partialR_partialp.dot(this->get_adjoint_solution(i));
797  }
798 
799  // All parameters have been reset.
800  // Reset the original qoi.
801 
802  this->assemble_qoi(qoi_indices);
803 }
double abs(double a)
unsigned int n_qois() const
Definition: system.h:2278
NumericVector< Number > & get_sensitivity_rhs(unsigned int i=0)
Definition: system.C:1061
static const Real TOLERANCE
virtual std::pair< unsigned int, Real > adjoint_solve(const QoISet &qoi_indices=QoISet()) override
long double max(long double a, double b)
std::vector< Number > qoi
Definition: system.h:1558
bool is_adjoint_already_solved() const
Definition: system.h:388
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void assemble_qoi(const QoISet &qoi_indices=QoISet()) override
virtual void assemble_residual_derivatives(const ParameterVector &parameters) override

◆ adjoint_solve()

std::pair< unsigned int, Real > libMesh::ImplicitSystem::adjoint_solve ( const QoISet qoi_indices = QoISet())
overridevirtualinherited

Assembles & solves the linear system (dR/du)^T*z = dq/du, for those quantities of interest q specified by qoi_indices.

Leave qoi_indices empty to solve all adjoint problems.

Returns
A pair with the total number of linear iterations performed and the (sum of the) final residual norms

Reimplemented from libMesh::System.

Reimplemented in libMesh::DifferentiableSystem.

Definition at line 372 of file implicit_system.C.

References libMesh::System::add_adjoint_solution(), libMesh::LinearSolver< T >::adjoint_solve(), libMesh::System::assemble_before_solve, libMesh::ExplicitSystem::assemble_qoi_derivative(), libMesh::ImplicitSystem::assembly(), libMesh::DofMap::enforce_adjoint_constraints_exactly(), libMesh::System::get_adjoint_rhs(), libMesh::System::get_adjoint_solution(), libMesh::System::get_dof_map(), libMesh::ImplicitSystem::get_linear_solve_parameters(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::QoISet::has_index(), libMesh::ImplicitSystem::matrix, libMesh::System::n_qois(), and libMesh::ImplicitSystem::release_linear_solver().

Referenced by libMesh::ImplicitSystem::adjoint_qoi_parameter_sensitivity(), libMesh::DifferentiableSystem::adjoint_solve(), libMesh::ImplicitSystem::qoi_parameter_hessian(), and libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product().

373 {
374  // Log how long the linear solve takes.
375  LOG_SCOPE("adjoint_solve()", "ImplicitSystem");
376 
377  if (this->assemble_before_solve)
378  // Assemble the linear system
379  this->assembly (/* get_residual = */ false,
380  /* get_jacobian = */ true);
381 
382  // The adjoint problem is linear
383  LinearSolver<Number> * linear_solver = this->get_linear_solver();
384 
385  // Reset and build the RHS from the QOI derivative
386  this->assemble_qoi_derivative(qoi_indices,
387  /* include_liftfunc = */ false,
388  /* apply_constraints = */ true);
389 
390  // Our iteration counts and residuals will be sums of the individual
391  // results
392  std::pair<unsigned int, Real> solver_params =
394  std::pair<unsigned int, Real> totalrval = std::make_pair(0,0.0);
395 
396  for (unsigned int i=0; i != this->n_qois(); ++i)
397  if (qoi_indices.has_index(i))
398  {
399  const std::pair<unsigned int, Real> rval =
400  linear_solver->adjoint_solve (*matrix, this->add_adjoint_solution(i),
401  this->get_adjoint_rhs(i),
402  solver_params.second,
403  solver_params.first);
404 
405  totalrval.first += rval.first;
406  totalrval.second += rval.second;
407  }
408 
409  this->release_linear_solver(linear_solver);
410 
411  // The linear solver may not have fit our constraints exactly
412 #ifdef LIBMESH_ENABLE_CONSTRAINTS
413  for (unsigned int i=0; i != this->n_qois(); ++i)
414  if (qoi_indices.has_index(i))
416  (this->get_adjoint_solution(i), i);
417 #endif
418 
419  return totalrval;
420 }
NumericVector< Number > & add_adjoint_solution(unsigned int i=0)
Definition: system.C:957
virtual std::pair< unsigned int, Real > get_linear_solve_parameters() const
unsigned int n_qois() const
Definition: system.h:2278
virtual LinearSolver< Number > * get_linear_solver() const
virtual void release_linear_solver(LinearSolver< Number > *) const
void enforce_adjoint_constraints_exactly(NumericVector< Number > &v, unsigned int q) const
virtual void assembly(bool, bool, bool=false, bool=false)
SparseMatrix< Number > * matrix
virtual void assemble_qoi_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true) override
NumericVector< Number > & get_adjoint_solution(unsigned int i=0)
Definition: system.C:969
bool assemble_before_solve
Definition: system.h:1477
const DofMap & get_dof_map() const
Definition: system.h:2049
NumericVector< Number > & get_adjoint_rhs(unsigned int i=0)
Definition: system.C:1031

◆ allocate_data_structures()

virtual void libMesh::RBConstruction::allocate_data_structures ( )
protectedvirtual

Helper function that actually allocates all the data structures required by this class.

Reimplemented in libMesh::TransientRBConstruction.

◆ assemble()

virtual void libMesh::LinearImplicitSystem::assemble ( )
inlineoverridevirtualinherited

Prepares matrix and _dof_map for matrix assembly. Does not actually assemble anything. For matrix assembly, use the assemble() in derived classes. Should be overridden in derived classes.

Reimplemented from libMesh::ImplicitSystem.

Reimplemented in libMesh::FrequencySystem, and libMesh::NewmarkSystem.

Definition at line 110 of file linear_implicit_system.h.

References libMesh::ImplicitSystem::assemble().

Referenced by libMesh::NewmarkSystem::assemble(), libMesh::FrequencySystem::assemble(), libMesh::LinearImplicitSystem::assembly(), and libMesh::LinearImplicitSystem::solve().

virtual void assemble() override

◆ assemble_affine_expansion()

virtual void libMesh::RBConstruction::assemble_affine_expansion ( bool  skip_matrix_assembly,
bool  skip_vector_assembly 
)
virtual

Assemble the matrices and vectors for this system. Optionally skip matrix or vector assembly (e.g. we may want to read data in from disk instead).

Reimplemented in libMesh::TransientRBConstruction.

◆ assemble_all_affine_operators()

virtual void libMesh::RBConstruction::assemble_all_affine_operators ( )
protectedvirtual

Assemble and store all Q_a affine operators as well as the inner-product matrix.

Reimplemented in libMesh::TransientRBConstruction.

◆ assemble_all_affine_vectors()

virtual void libMesh::RBConstruction::assemble_all_affine_vectors ( )
protectedvirtual

Assemble and store the affine RHS vectors.

◆ assemble_all_output_vectors()

virtual void libMesh::RBConstruction::assemble_all_output_vectors ( )
protectedvirtual

Assemble and store the output vectors.

◆ assemble_Aq_matrix()

void libMesh::RBConstruction::assemble_Aq_matrix ( unsigned int  q,
SparseMatrix< Number > *  input_matrix,
bool  apply_dof_constraints = true 
)

Assemble the q^th affine matrix and store it in input_matrix.

◆ assemble_Fq_vector()

void libMesh::RBConstruction::assemble_Fq_vector ( unsigned int  q,
NumericVector< Number > *  input_vector,
bool  apply_dof_constraints = true 
)

Assemble the q^th affine vector and store it in input_matrix.

◆ assemble_inner_product_matrix()

void libMesh::RBConstruction::assemble_inner_product_matrix ( SparseMatrix< Number > *  input_matrix,
bool  apply_dof_constraints = true 
)

Assemble the inner product matrix and store it in input_matrix.

◆ assemble_misc_matrices()

virtual void libMesh::RBConstruction::assemble_misc_matrices ( )
protectedvirtual

Assemble and store all the inner-product matrix, the constraint matrix (for constrained problems) and the mass matrix (for time-dependent problems).

Reimplemented in libMesh::TransientRBConstruction.

◆ assemble_qoi()

void libMesh::ExplicitSystem::assemble_qoi ( const QoISet qoi_indices = QoISet())
overridevirtualinherited

Prepares qoi for quantity of interest assembly, then calls user qoi function. Can be overridden in derived classes.

Reimplemented from libMesh::System.

Reimplemented in libMesh::FEMSystem.

Definition at line 56 of file explicit_system.C.

References libMesh::System::assemble_qoi(), libMesh::QoISet::has_index(), libMesh::System::n_qois(), and libMesh::System::qoi.

Referenced by libMesh::ImplicitSystem::adjoint_qoi_parameter_sensitivity(), libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity(), libMesh::ImplicitSystem::qoi_parameter_hessian(), and libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product().

57 {
58  // The user quantity of interest assembly gets to expect to
59  // accumulate on initially zero values
60  for (unsigned int i=0; i != this->n_qois(); ++i)
61  if (qoi_indices.has_index(i))
62  qoi[i] = 0;
63 
64  Parent::assemble_qoi (qoi_indices);
65 }
unsigned int n_qois() const
Definition: system.h:2278
std::vector< Number > qoi
Definition: system.h:1558
virtual void assemble_qoi(const QoISet &qoi_indices=QoISet())
Definition: system.C:473

◆ assemble_qoi_derivative()

void libMesh::ExplicitSystem::assemble_qoi_derivative ( const QoISet qoi_indices = QoISet(),
bool  include_liftfunc = true,
bool  apply_constraints = true 
)
overridevirtualinherited

Prepares adjoint_rhs for quantity of interest derivative assembly, then calls user qoi derivative function. Can be overridden in derived classes.

Reimplemented from libMesh::System.

Reimplemented in libMesh::FEMSystem.

Definition at line 69 of file explicit_system.C.

References libMesh::System::add_adjoint_rhs(), libMesh::System::assemble_qoi_derivative(), libMesh::QoISet::has_index(), libMesh::System::n_qois(), and libMesh::NumericVector< T >::zero().

Referenced by libMesh::ImplicitSystem::adjoint_solve(), libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity(), libMesh::ImplicitSystem::qoi_parameter_hessian(), libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

72 {
73  // The user quantity of interest derivative assembly gets to expect
74  // to accumulate on initially zero vectors
75  for (unsigned int i=0; i != this->n_qois(); ++i)
76  if (qoi_indices.has_index(i))
77  this->add_adjoint_rhs(i).zero();
78 
79  Parent::assemble_qoi_derivative (qoi_indices, include_liftfunc,
80  apply_constraints);
81 }
unsigned int n_qois() const
Definition: system.h:2278
virtual void assemble_qoi_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true)
Definition: system.C:484
virtual void zero()=0
NumericVector< Number > & add_adjoint_rhs(unsigned int i=0)
Definition: system.C:1021

◆ assemble_residual_derivatives()

void libMesh::ImplicitSystem::assemble_residual_derivatives ( const ParameterVector parameters)
overridevirtualinherited

Residual parameter derivative function.

Uses finite differences by default.

This will assemble the sensitivity rhs vectors to hold -(partial R / partial p_i), making them ready to solve the forward sensitivity equation.

Can be overridden in derived classes.

Reimplemented from libMesh::System.

Definition at line 654 of file implicit_system.C.

References std::abs(), libMesh::System::add_sensitivity_rhs(), libMesh::ImplicitSystem::assembly(), libMesh::NumericVector< T >::close(), std::max(), libMesh::Real, libMesh::ExplicitSystem::rhs, libMesh::ParameterVector::size(), and libMesh::TOLERANCE.

Referenced by libMesh::ImplicitSystem::adjoint_qoi_parameter_sensitivity(), and libMesh::ImplicitSystem::sensitivity_solve().

655 {
656  ParameterVector & parameters =
657  const_cast<ParameterVector &>(parameters_in);
658 
659  const unsigned int Np = cast_int<unsigned int>
660  (parameters.size());
661 
662  for (unsigned int p=0; p != Np; ++p)
663  {
664  NumericVector<Number> & sensitivity_rhs = this->add_sensitivity_rhs(p);
665 
666  // Approximate -(partial R / partial p) by
667  // (R(p-dp) - R(p+dp)) / (2*dp)
668 
669  Number old_parameter = *parameters[p];
670 
671  const Real delta_p =
672  TOLERANCE * std::max(std::abs(old_parameter), 1e-3);
673 
674  *parameters[p] -= delta_p;
675 
676  // this->assembly(true, false, true);
677  this->assembly(true, false, false);
678  this->rhs->close();
679  sensitivity_rhs = *this->rhs;
680 
681  *parameters[p] = old_parameter + delta_p;
682 
683  // this->assembly(true, false, true);
684  this->assembly(true, false, false);
685  this->rhs->close();
686 
687  sensitivity_rhs -= *this->rhs;
688  sensitivity_rhs /= (2*delta_p);
689  sensitivity_rhs.close();
690 
691  *parameters[p] = old_parameter;
692  }
693 }
double abs(double a)
NumericVector< Number > * rhs
NumericVector< Number > & add_sensitivity_rhs(unsigned int i=0)
Definition: system.C:1051
static const Real TOLERANCE
long double max(long double a, double b)
virtual void assembly(bool, bool, bool=false, bool=false)
virtual void close()=0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ assembly()

void libMesh::LinearImplicitSystem::assembly ( bool  get_residual,
bool  get_jacobian,
bool  apply_heterogeneous_constraints = false,
bool  apply_no_constraints = false 
)
overridevirtualinherited

Assembles a residual in rhs and/or a jacobian in matrix, as requested.

Reimplemented from libMesh::ImplicitSystem.

Definition at line 366 of file linear_implicit_system.C.

References libMesh::NumericVector< T >::add_vector(), libMesh::LinearImplicitSystem::assemble(), libMesh::NumericVector< T >::close(), libMesh::SparseMatrix< T >::close(), libMesh::ImplicitSystem::matrix, libMesh::ExplicitSystem::rhs, and libMesh::System::solution.

370 {
371  // Residual R(u(p),p) := A(p)*u(p) - b(p)
372  // partial R / partial u = A
373 
374  this->assemble();
375  this->rhs->close();
376  this->matrix->close();
377 
378  *(this->rhs) *= -1.0;
379  this->rhs->add_vector(*this->solution, *this->matrix);
380 }
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
NumericVector< Number > * rhs
std::unique_ptr< NumericVector< Number > > solution
Definition: system.h:1523
virtual void close()=0
virtual void close()=0
SparseMatrix< Number > * matrix

◆ attach_assemble_function()

void libMesh::System::attach_assemble_function ( void   fptrEquationSystems &es, const std::string &name)
inherited

Register a user function to use in assembling the system matrix and RHS.

Definition at line 1777 of file system.C.

References libMesh::System::_assemble_system_function, libMesh::System::_assemble_system_object, and libMesh::out.

1779 {
1780  libmesh_assert(fptr);
1781 
1782  if (_assemble_system_object != nullptr)
1783  {
1784  libmesh_here();
1785  libMesh::out << "WARNING: Cannot specify both assembly function and object!"
1786  << std::endl;
1787 
1788  _assemble_system_object = nullptr;
1789  }
1790 
1792 }
Assembly * _assemble_system_object
Definition: system.h:1841
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
Definition: system.h:1835
OStreamProxy out(std::cout)

◆ attach_assemble_object()

void libMesh::System::attach_assemble_object ( System::Assembly assemble_in)
inherited

Register a user object to use in assembling the system matrix and RHS.

Definition at line 1796 of file system.C.

References libMesh::System::_assemble_system_function, libMesh::System::_assemble_system_object, and libMesh::out.

1797 {
1798  if (_assemble_system_function != nullptr)
1799  {
1800  libmesh_here();
1801  libMesh::out << "WARNING: Cannot specify both assembly object and function!"
1802  << std::endl;
1803 
1804  _assemble_system_function = nullptr;
1805  }
1806 
1807  _assemble_system_object = &assemble_in;
1808 }
Assembly * _assemble_system_object
Definition: system.h:1841
void(* _assemble_system_function)(EquationSystems &es, const std::string &name)
Definition: system.h:1835
OStreamProxy out(std::cout)

◆ attach_constraint_function()

void libMesh::System::attach_constraint_function ( void   fptrEquationSystems &es, const std::string &name)
inherited

Register a user function for imposing constraints.

Definition at line 1812 of file system.C.

References libMesh::System::_constrain_system_function, libMesh::System::_constrain_system_object, and libMesh::out.

1814 {
1815  libmesh_assert(fptr);
1816 
1817  if (_constrain_system_object != nullptr)
1818  {
1819  libmesh_here();
1820  libMesh::out << "WARNING: Cannot specify both constraint function and object!"
1821  << std::endl;
1822 
1823  _constrain_system_object = nullptr;
1824  }
1825 
1827 }
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
Definition: system.h:1846
Constraint * _constrain_system_object
Definition: system.h:1852
OStreamProxy out(std::cout)

◆ attach_constraint_object()

void libMesh::System::attach_constraint_object ( System::Constraint constrain)
inherited

Register a user object for imposing constraints.

Definition at line 1831 of file system.C.

References libMesh::System::_constrain_system_function, libMesh::System::_constrain_system_object, and libMesh::out.

1832 {
1833  if (_constrain_system_function != nullptr)
1834  {
1835  libmesh_here();
1836  libMesh::out << "WARNING: Cannot specify both constraint object and function!"
1837  << std::endl;
1838 
1839  _constrain_system_function = nullptr;
1840  }
1841 
1842  _constrain_system_object = &constrain;
1843 }
void(* _constrain_system_function)(EquationSystems &es, const std::string &name)
Definition: system.h:1846
Constraint * _constrain_system_object
Definition: system.h:1852
OStreamProxy out(std::cout)

◆ attach_init_function()

void libMesh::System::attach_init_function ( void   fptrEquationSystems &es, const std::string &name)
inherited

Register a user function to use in initializing the system.

Definition at line 1742 of file system.C.

References libMesh::System::_init_system_function, libMesh::System::_init_system_object, and libMesh::out.

1744 {
1745  libmesh_assert(fptr);
1746 
1747  if (_init_system_object != nullptr)
1748  {
1749  libmesh_here();
1750  libMesh::out << "WARNING: Cannot specify both initialization function and object!"
1751  << std::endl;
1752 
1753  _init_system_object = nullptr;
1754  }
1755 
1756  _init_system_function = fptr;
1757 }
Initialization * _init_system_object
Definition: system.h:1830
void(* _init_system_function)(EquationSystems &es, const std::string &name)
Definition: system.h:1824
OStreamProxy out(std::cout)

◆ attach_init_object()

void libMesh::System::attach_init_object ( System::Initialization init_in)
inherited

Register a user class to use to initialize the system.

Note
This is exclusive with the attach_init_function.

Definition at line 1761 of file system.C.

References libMesh::System::_init_system_function, libMesh::System::_init_system_object, and libMesh::out.

1762 {
1763  if (_init_system_function != nullptr)
1764  {
1765  libmesh_here();
1766  libMesh::out << "WARNING: Cannot specify both initialization object and function!"
1767  << std::endl;
1768 
1769  _init_system_function = nullptr;
1770  }
1771 
1772  _init_system_object = &init_in;
1773 }
Initialization * _init_system_object
Definition: system.h:1830
void(* _init_system_function)(EquationSystems &es, const std::string &name)
Definition: system.h:1824
OStreamProxy out(std::cout)

◆ attach_QOI_derivative()

void libMesh::System::attach_QOI_derivative ( void   fptrEquationSystems &es, const std::string &name, const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)
inherited

Register a user function for evaluating derivatives of a quantity of interest with respect to test functions, whose values should be placed in System::rhs

Definition at line 1883 of file system.C.

References libMesh::System::_qoi_evaluate_derivative_function, libMesh::System::_qoi_evaluate_derivative_object, and libMesh::out.

1885 {
1886  libmesh_assert(fptr);
1887 
1888  if (_qoi_evaluate_derivative_object != nullptr)
1889  {
1890  libmesh_here();
1891  libMesh::out << "WARNING: Cannot specify both QOI derivative function and object!"
1892  << std::endl;
1893 
1895  }
1896 
1898 }
QOIDerivative * _qoi_evaluate_derivative_object
Definition: system.h:1878
OStreamProxy out(std::cout)
void(* _qoi_evaluate_derivative_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)
Definition: system.h:1869

◆ attach_QOI_derivative_object()

void libMesh::System::attach_QOI_derivative_object ( QOIDerivative qoi_derivative)
inherited

Register a user object for evaluating derivatives of a quantity of interest with respect to test functions, whose values should be placed in System::rhs

Definition at line 1902 of file system.C.

References libMesh::System::_qoi_evaluate_derivative_function, libMesh::System::_qoi_evaluate_derivative_object, and libMesh::out.

1903 {
1904  if (_qoi_evaluate_derivative_function != nullptr)
1905  {
1906  libmesh_here();
1907  libMesh::out << "WARNING: Cannot specify both QOI derivative object and function!"
1908  << std::endl;
1909 
1911  }
1912 
1913  _qoi_evaluate_derivative_object = &qoi_derivative;
1914 }
QOIDerivative * _qoi_evaluate_derivative_object
Definition: system.h:1878
OStreamProxy out(std::cout)
void(* _qoi_evaluate_derivative_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices, bool include_liftfunc, bool apply_constraints)
Definition: system.h:1869

◆ attach_QOI_function()

void libMesh::System::attach_QOI_function ( void   fptrEquationSystems &es, const std::string &name, const QoISet &qoi_indices)
inherited

Register a user function for evaluating the quantities of interest, whose values should be placed in System::qoi

Definition at line 1847 of file system.C.

References libMesh::System::_qoi_evaluate_function, libMesh::System::_qoi_evaluate_object, and libMesh::out.

1850 {
1851  libmesh_assert(fptr);
1852 
1853  if (_qoi_evaluate_object != nullptr)
1854  {
1855  libmesh_here();
1856  libMesh::out << "WARNING: Cannot specify both QOI function and object!"
1857  << std::endl;
1858 
1859  _qoi_evaluate_object = nullptr;
1860  }
1861 
1862  _qoi_evaluate_function = fptr;
1863 }
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
Definition: system.h:1857
QOI * _qoi_evaluate_object
Definition: system.h:1864
OStreamProxy out(std::cout)

◆ attach_QOI_object()

void libMesh::System::attach_QOI_object ( QOI qoi)
inherited

Register a user object for evaluating the quantities of interest, whose values should be placed in System::qoi

Definition at line 1867 of file system.C.

References libMesh::System::_qoi_evaluate_function, libMesh::System::_qoi_evaluate_object, and libMesh::out.

1868 {
1869  if (_qoi_evaluate_function != nullptr)
1870  {
1871  libmesh_here();
1872  libMesh::out << "WARNING: Cannot specify both QOI object and function!"
1873  << std::endl;
1874 
1875  _qoi_evaluate_function = nullptr;
1876  }
1877 
1878  _qoi_evaluate_object = &qoi_in;
1879 }
void(* _qoi_evaluate_function)(EquationSystems &es, const std::string &name, const QoISet &qoi_indices)
Definition: system.h:1857
QOI * _qoi_evaluate_object
Definition: system.h:1864
OStreamProxy out(std::cout)

◆ attach_shell_matrix()

void libMesh::LinearImplicitSystem::attach_shell_matrix ( ShellMatrix< Number > *  shell_matrix)
inherited

This function enables the user to provide a shell matrix, i.e. a matrix that is not stored element-wise, but as a function. When you register your shell matrix using this function, calling solve() will no longer use the matrix member but the registered shell matrix instead. You can reset this behaviour to its original state by supplying a nullptr to this function.

Definition at line 158 of file linear_implicit_system.C.

References libMesh::LinearImplicitSystem::_shell_matrix.

Referenced by libMesh::LinearImplicitSystem::detach_shell_matrix().

159 {
160  _shell_matrix = shell_matrix;
161 }
ShellMatrix< Number > * _shell_matrix

◆ boundary_project_solution() [1/2]

void libMesh::System::boundary_project_solution ( const std::set< boundary_id_type > &  b,
const std::vector< unsigned int > &  variables,
FunctionBase< Number > *  f,
FunctionBase< Gradient > *  g = nullptr 
)
inherited

Projects arbitrary boundary functions onto a vector of degree of freedom values for the current system. Only degrees of freedom which affect the function's trace on a boundary in the set b are affected. Only degrees of freedom associated with the variables listed in the vector variables are projected. The function value f and its gradient g are user-provided cloneable functors. A gradient g is only required/used for projecting onto finite element spaces with continuous derivatives. If non-default Parameters are to be used, they can be provided in the parameters argument.

This method projects an arbitrary boundary function onto the solution via L2 projections and nodal interpolations on each element.

Definition at line 985 of file system_projection.C.

989 {
990  this->boundary_project_vector(b, variables, *solution, f, g);
991 
992  solution->localize(*current_local_solution);
993 }
void boundary_project_vector(const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const
std::unique_ptr< NumericVector< Number > > solution
Definition: system.h:1523
std::unique_ptr< NumericVector< Number > > current_local_solution
Definition: system.h:1535

◆ boundary_project_solution() [2/2]

void libMesh::System::boundary_project_solution ( const std::set< boundary_id_type > &  b,
const std::vector< unsigned int > &  variables,
ValueFunctionPointer  fptr,
GradientFunctionPointer  gptr,
const Parameters parameters 
)
inherited

Projects arbitrary boundary functions onto a vector of degree of freedom values for the current system. Only degrees of freedom which affect the function's trace on a boundary in the set b are affected. Only degrees of freedom associated with the variables listed in the vector variables are projected. The function value fptr and its gradient gptr are represented by function pointers. A gradient gptr is only required/used for projecting onto finite element spaces with continuous derivatives.

This method projects components of an arbitrary boundary function onto the solution via L2 projections and nodal interpolations on each element.

Definition at line 968 of file system_projection.C.

973 {
974  WrappedFunction<Number> f(*this, fptr, &parameters);
975  WrappedFunction<Gradient> g(*this, gptr, &parameters);
976  this->boundary_project_solution(b, variables, &f, &g);
977 }
void boundary_project_solution(const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr)

◆ boundary_project_vector() [1/2]

void libMesh::System::boundary_project_vector ( const std::set< boundary_id_type > &  b,
const std::vector< unsigned int > &  variables,
NumericVector< Number > &  new_vector,
FunctionBase< Number > *  f,
FunctionBase< Gradient > *  g = nullptr,
int  is_adjoint = -1 
) const
inherited

Projects arbitrary boundary functions onto a vector of degree of freedom values for the current system. Only degrees of freedom which affect the function's trace on a boundary in the set b are affected. Only degrees of freedom associated with the variables listed in the vector variables are projected. The function value f and its gradient g are user-provided cloneable functors. A gradient g is only required/used for projecting onto finite element spaces with continuous derivatives. If non-default Parameters are to be used, they can be provided in the parameters argument.

Constrain the new vector using the requested adjoint rather than primal constraints if is_adjoint is non-negative.

This method projects an arbitrary function via L2 projections and nodal interpolations on each element.

Definition at line 1021 of file system_projection.C.

References libMesh::NumericVector< T >::close(), and libMesh::Threads::parallel_for().

1027 {
1028  LOG_SCOPE ("boundary_project_vector()", "System");
1029 
1031  (ConstElemRange (this->get_mesh().active_local_elements_begin(),
1032  this->get_mesh().active_local_elements_end() ),
1033  BoundaryProjectSolution(b, variables, *this, f, g,
1034  this->get_equation_systems().parameters,
1035  new_vector)
1036  );
1037 
1038  // We don't do SCALAR dofs when just projecting the boundary, so
1039  // we're done here.
1040 
1041  new_vector.close();
1042 
1043 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1044  if (is_adjoint == -1)
1045  this->get_dof_map().enforce_constraints_exactly(*this, &new_vector);
1046  else if (is_adjoint >= 0)
1048  is_adjoint);
1049 #endif
1050 }
void parallel_for(const Range &range, const Body &body)
Definition: threads_none.h:73
const EquationSystems & get_equation_systems() const
Definition: system.h:712
const MeshBase & get_mesh() const
Definition: system.h:2033
StoredRange< MeshBase::const_element_iterator, const Elem * > ConstElemRange
Definition: elem_range.h:34
void enforce_adjoint_constraints_exactly(NumericVector< Number > &v, unsigned int q) const
virtual void close()=0
const DofMap & get_dof_map() const
Definition: system.h:2049
void enforce_constraints_exactly(const System &system, NumericVector< Number > *v=nullptr, bool homogeneous=false) const

◆ boundary_project_vector() [2/2]

void libMesh::System::boundary_project_vector ( const std::set< boundary_id_type > &  b,
const std::vector< unsigned int > &  variables,
ValueFunctionPointer  fptr,
GradientFunctionPointer  gptr,
const Parameters parameters,
NumericVector< Number > &  new_vector,
int  is_adjoint = -1 
) const
inherited

Projects arbitrary boundary functions onto a vector of degree of freedom values for the current system. Only degrees of freedom which affect the function's trace on a boundary in the set b are affected. Only degrees of freedom associated with the variables listed in the vector variables are projected. The function value fptr and its gradient gptr are represented by function pointers. A gradient gptr is only required/used for projecting onto finite element spaces with continuous derivatives.

Constrain the new vector using the requested adjoint rather than primal constraints if is_adjoint is non-negative.

This method projects an arbitrary boundary function via L2 projections and nodal interpolations on each element.

Definition at line 1003 of file system_projection.C.

1010 {
1011  WrappedFunction<Number> f(*this, fptr, &parameters);
1012  WrappedFunction<Gradient> g(*this, gptr, &parameters);
1013  this->boundary_project_vector(b, variables, new_vector, &f, &g,
1014  is_adjoint);
1015 }
void boundary_project_vector(const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr, int is_adjoint=-1) const

◆ broadcast_parameters()

void libMesh::RBConstructionBase< LinearImplicitSystem >::broadcast_parameters ( unsigned int  proc_id)
inherited

Broadcasts parameters on processor proc_id to all processors.

◆ build_context()

virtual std::unique_ptr<DGFEMContext> libMesh::RBConstruction::build_context ( )
protectedvirtual

Builds a DGFEMContext object with enough information to do evaluations on each element. We use DGFEMContext since it allows for both DG and continuous Galerkin formulations.

◆ build_zero_dirichlet_boundary_object()

static std::unique_ptr<DirichletBoundary> libMesh::RBConstruction::build_zero_dirichlet_boundary_object ( )
static

It's helpful to be able to generate a DirichletBoundary that stores a ZeroFunction in order to impose Dirichlet boundary conditions.

◆ calculate_norm() [1/2]

Real libMesh::System::calculate_norm ( const NumericVector< Number > &  v,
unsigned int  var,
FEMNormType  norm_type,
std::set< unsigned int > *  skip_dimensions = nullptr 
) const
inherited
Returns
A norm of variable var in the vector v, in the specified norm (e.g. L2, L_INF, H1)

Definition at line 1378 of file system.C.

References libMesh::DISCRETE_L1, libMesh::DISCRETE_L2, libMesh::DISCRETE_L_INF, libMesh::System::discrete_var_norm(), libMesh::L2, libMesh::System::n_vars(), and libMesh::Real.

Referenced by libMesh::AdaptiveTimeSolver::calculate_norm(), and libMesh::UnsteadySolver::du().

1382 {
1383  //short circuit to save time
1384  if (norm_type == DISCRETE_L1 ||
1385  norm_type == DISCRETE_L2 ||
1386  norm_type == DISCRETE_L_INF)
1387  return discrete_var_norm(v,var,norm_type);
1388 
1389  // Not a discrete norm
1390  std::vector<FEMNormType> norms(this->n_vars(), L2);
1391  std::vector<Real> weights(this->n_vars(), 0.0);
1392  norms[var] = norm_type;
1393  weights[var] = 1.0;
1394  Real val = this->calculate_norm(v, SystemNorm(norms, weights), skip_dimensions);
1395  return val;
1396 }
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
Definition: system.C:1378
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real discrete_var_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type) const
Definition: system.C:1359
unsigned int n_vars() const
Definition: system.h:2105

◆ calculate_norm() [2/2]

Real libMesh::System::calculate_norm ( const NumericVector< Number > &  v,
const SystemNorm norm,
std::set< unsigned int > *  skip_dimensions = nullptr 
) const
inherited
Returns
A norm of the vector v, using component_norm and component_scale to choose and weight the norms of each variable.

Definition at line 1400 of file system.C.

References libMesh::System::_dof_map, libMesh::System::_mesh, std::abs(), libMesh::TypeVector< T >::add_scaled(), libMesh::TypeTensor< T >::add_scaled(), libMesh::FEGenericBase< OutputType >::build(), libMesh::NumericVector< T >::build(), libMesh::ParallelObject::comm(), libMesh::FEType::default_quadrature_rule(), libMesh::DISCRETE_L1, libMesh::DISCRETE_L2, libMesh::DISCRETE_L_INF, libMesh::System::discrete_var_norm(), libMesh::DofMap::dof_indices(), libMesh::MeshBase::elem_dimensions(), libMesh::FEGenericBase< OutputType >::get_d2phi(), libMesh::System::get_dof_map(), libMesh::FEGenericBase< OutputType >::get_dphi(), libMesh::FEAbstract::get_JxW(), libMesh::System::get_mesh(), libMesh::FEGenericBase< OutputType >::get_phi(), libMesh::H1, libMesh::H1_SEMINORM, libMesh::H2, libMesh::H2_SEMINORM, libMesh::SystemNorm::is_discrete(), libMesh::L1, libMesh::NumericVector< T >::l1_norm(), libMesh::L2, libMesh::NumericVector< T >::l2_norm(), libMesh::L_INF, libMesh::NumericVector< T >::linfty_norm(), libMesh::NumericVector< T >::localize(), std::max(), libMesh::Parallel::Communicator::max(), libMesh::QBase::n_points(), libMesh::System::n_vars(), libMesh::TypeVector< T >::norm(), libMesh::TypeTensor< T >::norm(), libMesh::TensorTools::norm_sq(), libMesh::TypeVector< T >::norm_sq(), libMesh::TypeTensor< T >::norm_sq(), libMesh::Real, libMesh::FEAbstract::reinit(), libMesh::SERIAL, libMesh::NumericVector< T >::size(), libMesh::Parallel::Communicator::sum(), libMesh::SystemNorm::type(), libMesh::DofMap::variable_type(), libMesh::W1_INF_SEMINORM, libMesh::W2_INF_SEMINORM, libMesh::SystemNorm::weight(), and libMesh::SystemNorm::weight_sq().

1403 {
1404  // This function must be run on all processors at once
1405  parallel_object_only();
1406 
1407  LOG_SCOPE ("calculate_norm()", "System");
1408 
1409  // Zero the norm before summation
1410  Real v_norm = 0.;
1411 
1412  if (norm.is_discrete())
1413  {
1414  //Check to see if all weights are 1.0 and all types are equal
1415  FEMNormType norm_type0 = norm.type(0);
1416  unsigned int check_var = 0;
1417  for (; check_var != this->n_vars(); ++check_var)
1418  if ((norm.weight(check_var) != 1.0) || (norm.type(check_var) != norm_type0))
1419  break;
1420 
1421  //All weights were 1.0 so just do the full vector discrete norm
1422  if (check_var == this->n_vars())
1423  {
1424  if (norm_type0 == DISCRETE_L1)
1425  return v.l1_norm();
1426  if (norm_type0 == DISCRETE_L2)
1427  return v.l2_norm();
1428  if (norm_type0 == DISCRETE_L_INF)
1429  return v.linfty_norm();
1430  else
1431  libmesh_error_msg("Invalid norm_type0 = " << norm_type0);
1432  }
1433 
1434  for (unsigned int var=0; var != this->n_vars(); ++var)
1435  {
1436  // Skip any variables we don't need to integrate
1437  if (norm.weight(var) == 0.0)
1438  continue;
1439 
1440  v_norm += norm.weight(var) * discrete_var_norm(v, var, norm.type(var));
1441  }
1442 
1443  return v_norm;
1444  }
1445 
1446  // Localize the potentially parallel vector
1447  std::unique_ptr<NumericVector<Number>> local_v = NumericVector<Number>::build(this->comm());
1448  local_v->init(v.size(), true, SERIAL);
1449  v.localize (*local_v, _dof_map->get_send_list());
1450 
1451  // I'm not sure how best to mix Hilbert norms on some variables (for
1452  // which we'll want to square then sum then square root) with norms
1453  // like L_inf (for which we'll just want to take an absolute value
1454  // and then sum).
1455  bool using_hilbert_norm = true,
1456  using_nonhilbert_norm = true;
1457 
1458  // Loop over all variables
1459  for (unsigned int var=0; var != this->n_vars(); ++var)
1460  {
1461  // Skip any variables we don't need to integrate
1462  Real norm_weight_sq = norm.weight_sq(var);
1463  if (norm_weight_sq == 0.0)
1464  continue;
1465  Real norm_weight = norm.weight(var);
1466 
1467  // Check for unimplemented norms (rather than just returning 0).
1468  FEMNormType norm_type = norm.type(var);
1469  if ((norm_type==H1) ||
1470  (norm_type==H2) ||
1471  (norm_type==L2) ||
1472  (norm_type==H1_SEMINORM) ||
1473  (norm_type==H2_SEMINORM))
1474  {
1475  if (!using_hilbert_norm)
1476  libmesh_not_implemented();
1477  using_nonhilbert_norm = false;
1478  }
1479  else if ((norm_type==L1) ||
1480  (norm_type==L_INF) ||
1481  (norm_type==W1_INF_SEMINORM) ||
1482  (norm_type==W2_INF_SEMINORM))
1483  {
1484  if (!using_nonhilbert_norm)
1485  libmesh_not_implemented();
1486  using_hilbert_norm = false;
1487  }
1488  else
1489  libmesh_not_implemented();
1490 
1491  const FEType & fe_type = this->get_dof_map().variable_type(var);
1492 
1493  // Allow space for dims 0-3, even if we don't use them all
1494  std::vector<std::unique_ptr<FEBase>> fe_ptrs(4);
1495  std::vector<std::unique_ptr<QBase>> q_rules(4);
1496 
1497  const std::set<unsigned char> & elem_dims = _mesh.elem_dimensions();
1498 
1499  // Prepare finite elements for each dimension present in the mesh
1500  for (const auto & dim : elem_dims)
1501  {
1502  if (skip_dimensions && skip_dimensions->find(dim) != skip_dimensions->end())
1503  continue;
1504 
1505  // Construct quadrature and finite element objects
1506  q_rules[dim] = fe_type.default_quadrature_rule (dim);
1507  fe_ptrs[dim] = FEBase::build(dim, fe_type);
1508 
1509  // Attach quadrature rule to FE object
1510  fe_ptrs[dim]->attach_quadrature_rule (q_rules[dim].get());
1511  }
1512 
1513  std::vector<dof_id_type> dof_indices;
1514 
1515  // Begin the loop over the elements
1516  for (const auto & elem : this->get_mesh().active_local_element_ptr_range())
1517  {
1518  const unsigned int dim = elem->dim();
1519 
1520 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1521 
1522  // One way for implementing this would be to exchange the fe with the FEInterface- class.
1523  // However, it needs to be discussed whether integral-norms make sense for infinite elements.
1524  // or in which sense they could make sense.
1525  if (elem->infinite() )
1526  libmesh_not_implemented();
1527 
1528 #endif
1529 
1530  if (skip_dimensions && skip_dimensions->find(dim) != skip_dimensions->end())
1531  continue;
1532 
1533  FEBase * fe = fe_ptrs[dim].get();
1534  QBase * qrule = q_rules[dim].get();
1535  libmesh_assert(fe);
1536  libmesh_assert(qrule);
1537 
1538  const std::vector<Real> & JxW = fe->get_JxW();
1539  const std::vector<std::vector<Real>> * phi = nullptr;
1540  if (norm_type == H1 ||
1541  norm_type == H2 ||
1542  norm_type == L2 ||
1543  norm_type == L1 ||
1544  norm_type == L_INF)
1545  phi = &(fe->get_phi());
1546 
1547  const std::vector<std::vector<RealGradient>> * dphi = nullptr;
1548  if (norm_type == H1 ||
1549  norm_type == H2 ||
1550  norm_type == H1_SEMINORM ||
1551  norm_type == W1_INF_SEMINORM)
1552  dphi = &(fe->get_dphi());
1553 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1554  const std::vector<std::vector<RealTensor>> * d2phi = nullptr;
1555  if (norm_type == H2 ||
1556  norm_type == H2_SEMINORM ||
1557  norm_type == W2_INF_SEMINORM)
1558  d2phi = &(fe->get_d2phi());
1559 #endif
1560 
1561  fe->reinit (elem);
1562 
1563  this->get_dof_map().dof_indices (elem, dof_indices, var);
1564 
1565  const unsigned int n_qp = qrule->n_points();
1566 
1567  const unsigned int n_sf = cast_int<unsigned int>
1568  (dof_indices.size());
1569 
1570  // Begin the loop over the Quadrature points.
1571  for (unsigned int qp=0; qp<n_qp; qp++)
1572  {
1573  if (norm_type == L1)
1574  {
1575  Number u_h = 0.;
1576  for (unsigned int i=0; i != n_sf; ++i)
1577  u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1578  v_norm += norm_weight *
1579  JxW[qp] * std::abs(u_h);
1580  }
1581 
1582  if (norm_type == L_INF)
1583  {
1584  Number u_h = 0.;
1585  for (unsigned int i=0; i != n_sf; ++i)
1586  u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1587  v_norm = std::max(v_norm, norm_weight * std::abs(u_h));
1588  }
1589 
1590  if (norm_type == H1 ||
1591  norm_type == H2 ||
1592  norm_type == L2)
1593  {
1594  Number u_h = 0.;
1595  for (unsigned int i=0; i != n_sf; ++i)
1596  u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
1597  v_norm += norm_weight_sq *
1598  JxW[qp] * TensorTools::norm_sq(u_h);
1599  }
1600 
1601  if (norm_type == H1 ||
1602  norm_type == H2 ||
1603  norm_type == H1_SEMINORM)
1604  {
1605  Gradient grad_u_h;
1606  for (unsigned int i=0; i != n_sf; ++i)
1607  grad_u_h.add_scaled((*dphi)[i][qp], (*local_v)(dof_indices[i]));
1608  v_norm += norm_weight_sq *
1609  JxW[qp] * grad_u_h.norm_sq();
1610  }
1611 
1612  if (norm_type == W1_INF_SEMINORM)
1613  {
1614  Gradient grad_u_h;
1615  for (unsigned int i=0; i != n_sf; ++i)
1616  grad_u_h.add_scaled((*dphi)[i][qp], (*local_v)(dof_indices[i]));
1617  v_norm = std::max(v_norm, norm_weight * grad_u_h.norm());
1618  }
1619 
1620 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1621  if (norm_type == H2 ||
1622  norm_type == H2_SEMINORM)
1623  {
1624  Tensor hess_u_h;
1625  for (unsigned int i=0; i != n_sf; ++i)
1626  hess_u_h.add_scaled((*d2phi)[i][qp], (*local_v)(dof_indices[i]));
1627  v_norm += norm_weight_sq *
1628  JxW[qp] * hess_u_h.norm_sq();
1629  }
1630 
1631  if (norm_type == W2_INF_SEMINORM)
1632  {
1633  Tensor hess_u_h;
1634  for (unsigned int i=0; i != n_sf; ++i)
1635  hess_u_h.add_scaled((*d2phi)[i][qp], (*local_v)(dof_indices[i]));
1636  v_norm = std::max(v_norm, norm_weight * hess_u_h.norm());
1637  }
1638 #endif
1639  }
1640  }
1641  }
1642 
1643  if (using_hilbert_norm)
1644  {
1645  this->comm().sum(v_norm);
1646  v_norm = std::sqrt(v_norm);
1647  }
1648  else
1649  {
1650  this->comm().max(v_norm);
1651  }
1652 
1653  return v_norm;
1654 }
double abs(double a)
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Definition: dof_map.C:1930
void add_scaled(const TypeTensor< T2 > &, const T)
Definition: type_tensor.h:808
void add_scaled(const TypeVector< T2 > &, const T)
Definition: type_vector.h:627
virtual numeric_index_type size() const =0
const FEType & variable_type(const unsigned int c) const
Definition: dof_map.h:1792
std::unique_ptr< DofMap > _dof_map
Definition: system.h:1884
const Parallel::Communicator & comm() const
long double max(long double a, double b)
const MeshBase & get_mesh() const
Definition: system.h:2033
virtual Real l2_norm() const =0
NumberVectorValue Gradient
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
const std::set< unsigned char > & elem_dimensions() const
Definition: mesh_base.h:220
FEGenericBase< Real > FEBase
virtual Real l1_norm() const =0
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
NumberTensorValue Tensor
Real discrete_var_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type) const
Definition: system.C:1359
unsigned int n_vars() const
Definition: system.h:2105
const DofMap & get_dof_map() const
Definition: system.h:2049
MeshBase & _mesh
Definition: system.h:1896
virtual Real linfty_norm() const =0
virtual void localize(std::vector< T > &v_local) const =0

◆ check_convergence()

void libMesh::RBConstruction::check_convergence ( LinearSolver< Number > &  input_solver)
protected

Check if the linear solver reports convergence. Throw an error when that is not the case.

◆ clear()

virtual void libMesh::RBConstruction::clear ( )
overridevirtual

Clear all the data structures associated with the system.

Reimplemented from libMesh::RBConstructionBase< LinearImplicitSystem >.

Reimplemented in libMesh::TransientSystem< RBConstruction >, libMesh::RBEIMConstruction, and libMesh::TransientRBConstruction.

◆ comm()

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

Definition at line 89 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_tao_equality_constraints(), libMesh::__libmesh_tao_equality_constraints_jacobian(), libMesh::__libmesh_tao_gradient(), libMesh::__libmesh_tao_hessian(), libMesh::__libmesh_tao_inequality_constraints(), libMesh::__libmesh_tao_inequality_constraints_jacobian(), libMesh::__libmesh_tao_objective(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< 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(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::ImplicitSystem::add_matrix(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::PetscDMWrapper::build_sf(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::PetscDMWrapper::check_section_n_dofs(), 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::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::EpetraVector< T >::EpetraVector(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::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::FEMSystem::mesh_position_set(), 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(), 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::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::CheckpointIO::select_split_config(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::split_mesh(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::MeshRefinement::test_level_one(), libMesh::MeshRefinement::test_unflagged(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

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

◆ compare()

bool libMesh::System::compare ( const System other_system,
const Real  threshold,
const bool  verbose 
) const
virtualinherited
Returns
true when the other system contains identical data, up to the given threshold. Outputs some diagnostic info when verbose is set.

Definition at line 514 of file system.C.

References libMesh::System::_is_initialized, libMesh::System::_sys_name, libMesh::System::_vectors, libMesh::System::get_vector(), libMesh::System::n_vectors(), libMesh::System::name(), libMesh::out, and libMesh::System::solution.

Referenced by libMesh::EquationSystems::compare().

517 {
518  // we do not care for matrices, but for vectors
519  libmesh_assert (_is_initialized);
520  libmesh_assert (other_system._is_initialized);
521 
522  if (verbose)
523  {
524  libMesh::out << " Systems \"" << _sys_name << "\"" << std::endl;
525  libMesh::out << " comparing matrices not supported." << std::endl;
526  libMesh::out << " comparing names...";
527  }
528 
529  // compare the name: 0 means identical
530  const int name_result = _sys_name.compare(other_system.name());
531  if (verbose)
532  {
533  if (name_result == 0)
534  libMesh::out << " identical." << std::endl;
535  else
536  libMesh::out << " names not identical." << std::endl;
537  libMesh::out << " comparing solution vector...";
538  }
539 
540 
541  // compare the solution: -1 means identical
542  const int solu_result = solution->compare (*other_system.solution.get(),
543  threshold);
544 
545  if (verbose)
546  {
547  if (solu_result == -1)
548  libMesh::out << " identical up to threshold." << std::endl;
549  else
550  libMesh::out << " first difference occurred at index = "
551  << solu_result << "." << std::endl;
552  }
553 
554 
555  // safety check, whether we handle at least the same number
556  // of vectors
557  std::vector<int> ov_result;
558 
559  if (this->n_vectors() != other_system.n_vectors())
560  {
561  if (verbose)
562  {
563  libMesh::out << " Fatal difference. This system handles "
564  << this->n_vectors() << " add'l vectors," << std::endl
565  << " while the other system handles "
566  << other_system.n_vectors()
567  << " add'l vectors." << std::endl
568  << " Aborting comparison." << std::endl;
569  }
570  return false;
571  }
572  else if (this->n_vectors() == 0)
573  {
574  // there are no additional vectors...
575  ov_result.clear ();
576  }
577  else
578  {
579  // compare other vectors
580  for (auto & pr : _vectors)
581  {
582  if (verbose)
583  libMesh::out << " comparing vector \""
584  << pr.first << "\" ...";
585 
586  // assume they have the same name
587  const NumericVector<Number> & other_system_vector =
588  other_system.get_vector(pr.first);
589 
590  ov_result.push_back(pr.second->compare (other_system_vector,
591  threshold));
592 
593  if (verbose)
594  {
595  if (ov_result[ov_result.size()-1] == -1)
596  libMesh::out << " identical up to threshold." << std::endl;
597  else
598  libMesh::out << " first difference occurred at" << std::endl
599  << " index = " << ov_result[ov_result.size()-1] << "." << std::endl;
600  }
601  }
602  } // finished comparing additional vectors
603 
604 
605  bool overall_result;
606 
607  // sum up the results
608  if ((name_result==0) && (solu_result==-1))
609  {
610  if (ov_result.size()==0)
611  overall_result = true;
612  else
613  {
614  bool ov_identical;
615  unsigned int n = 0;
616  do
617  {
618  ov_identical = (ov_result[n]==-1);
619  n++;
620  }
621  while (ov_identical && n<ov_result.size());
622  overall_result = ov_identical;
623  }
624  }
625  else
626  overall_result = false;
627 
628  if (verbose)
629  {
630  libMesh::out << " finished comparisons, ";
631  if (overall_result)
632  libMesh::out << "found no differences." << std::endl << std::endl;
633  else
634  libMesh::out << "found differences." << std::endl << std::endl;
635  }
636 
637  return overall_result;
638 }
bool _is_initialized
Definition: system.h:1971
unsigned int n_vectors() const
Definition: system.h:2233
std::unique_ptr< NumericVector< Number > > solution
Definition: system.h:1523
std::map< std::string, NumericVector< Number > *> _vectors
Definition: system.h:1935
const std::string _sys_name
Definition: system.h:1901
OStreamProxy out(std::cout)

◆ compute_Fq_representor_innerprods()

virtual void libMesh::RBConstruction::compute_Fq_representor_innerprods ( bool  compute_inner_products = true)
protectedvirtual

Compute the terms that are combined ‘online’ to determine the dual norm of the residual. Here we compute the terms associated with the right-hand side. These terms are basis independent, hence we separate them from the rest of the calculations that are done in update_residual_terms. By default, inner product terms are also computed, but you can turn this feature off e.g. if you are already reading in that data from files.

◆ compute_max_error_bound()

virtual Real libMesh::RBConstruction::compute_max_error_bound ( )
virtual

(i) Compute the a posteriori error bound for each set of parameters in the training set, (ii) set current_parameters to the parameters that maximize the error bound, and (iii) return the maximum error bound.

◆ compute_output_dual_innerprods()

virtual void libMesh::RBConstruction::compute_output_dual_innerprods ( )
protectedvirtual

Compute and store the dual norm of each output functional.

◆ current_solution()

Number libMesh::System::current_solution ( const dof_id_type  global_dof_number) const
inherited

◆ deactivate()

void libMesh::System::deactivate ( )
inlineinherited

Deactivates the system. Only active systems are solved.

Definition at line 2081 of file system.h.

References libMesh::System::_active.

2082 {
2083  _active = false;
2084 }

◆ detach_shell_matrix()

void libMesh::LinearImplicitSystem::detach_shell_matrix ( )
inlineinherited

Detaches a shell matrix. Same as attach_shell_matrix(nullptr).

Definition at line 185 of file linear_implicit_system.h.

References libMesh::LinearImplicitSystem::attach_shell_matrix().

185 { attach_shell_matrix(nullptr); }
void attach_shell_matrix(ShellMatrix< Number > *shell_matrix)

◆ disable_cache()

void libMesh::ImplicitSystem::disable_cache ( )
overridevirtualinherited

Avoids use of any cached data that might affect any solve result. Should be overridden in derived systems.

Reimplemented from libMesh::System.

Definition at line 306 of file implicit_system.C.

References libMesh::System::assemble_before_solve, libMesh::ImplicitSystem::get_linear_solver(), and libMesh::LinearSolver< T >::reuse_preconditioner().

306  {
307  this->assemble_before_solve = true;
308  this->get_linear_solver()->reuse_preconditioner(false);
309 }
virtual LinearSolver< Number > * get_linear_solver() const
virtual void reuse_preconditioner(bool)
bool assemble_before_solve
Definition: system.h:1477

◆ disable_print_counter_info() [1/2]

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 106 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

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

107 {
108  _enable_print_counter = false;
109  return;
110 }

◆ disable_print_counter_info() [2/2]

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 106 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

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

107 {
108  _enable_print_counter = false;
109  return;
110 }

◆ enable_print_counter_info() [1/2]

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

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

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = true;
103  return;
104 }

◆ enable_print_counter_info() [2/2]

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

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

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = true;
103  return;
104 }

◆ enrich_basis_from_rhs_terms()

void libMesh::RBConstruction::enrich_basis_from_rhs_terms ( const bool  resize_rb_eval_data = true)

This function computes one basis function for each rhs term. This is useful in some cases since we can avoid doing a full greedy if we know that we do not have any "left-hand side" parameters, for example.

◆ enrich_RB_space()

virtual void libMesh::RBConstruction::enrich_RB_space ( )
protectedvirtual

Add a new basis function to the RB space. This is called during train_reduced_basis.

Reimplemented in libMesh::TransientRBConstruction, and libMesh::RBEIMConstruction.

◆ final_linear_residual()

Real libMesh::LinearImplicitSystem::final_linear_residual ( ) const
inlineinherited
Returns
The final residual for the linear system solve.

Definition at line 169 of file linear_implicit_system.h.

References libMesh::LinearImplicitSystem::_final_linear_residual.

◆ forward_qoi_parameter_sensitivity()

void libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity ( const QoISet qoi_indices,
const ParameterVector parameters,
SensitivityData sensitivities 
)
overridevirtualinherited

Solves for the derivative of each of the system's quantities of interest q in qoi[qoi_indices] with respect to each parameter in parameters, placing the result for qoi i and parameter j into sensitivities[i][j].

Uses the forward sensitivity method.

Currently uses finite differenced derivatives (partial q / partial p) and (partial R / partial p).

Reimplemented from libMesh::System.

Definition at line 807 of file implicit_system.C.

References std::abs(), libMesh::SensitivityData::allocate_data(), libMesh::ExplicitSystem::assemble_qoi(), libMesh::ExplicitSystem::assemble_qoi_derivative(), libMesh::ImplicitSystem::assembly(), libMesh::NumericVector< T >::close(), libMesh::SparseMatrix< T >::close(), libMesh::NumericVector< T >::dot(), libMesh::System::get_adjoint_rhs(), libMesh::System::get_sensitivity_solution(), libMesh::QoISet::has_index(), libMesh::ImplicitSystem::matrix, std::max(), libMesh::System::n_qois(), libMesh::System::qoi, libMesh::Real, libMesh::ExplicitSystem::rhs, libMesh::ImplicitSystem::sensitivity_solve(), libMesh::ParameterVector::size(), and libMesh::TOLERANCE.

810 {
811  ParameterVector & parameters =
812  const_cast<ParameterVector &>(parameters_in);
813 
814  const unsigned int Np = cast_int<unsigned int>
815  (parameters.size());
816  const unsigned int Nq = this->n_qois();
817 
818  // An introduction to the problem:
819  //
820  // Residual R(u(p),p) = 0
821  // partial R / partial u = J = system matrix
822  //
823  // This implies that:
824  // d/dp(R) = 0
825  // (partial R / partial p) +
826  // (partial R / partial u) * (partial u / partial p) = 0
827 
828  // We first solve for (partial u / partial p) for each parameter:
829  // J * (partial u / partial p) = - (partial R / partial p)
830 
831  this->sensitivity_solve(parameters);
832 
833  // Get ready to fill in sensitivities:
834  sensitivities.allocate_data(qoi_indices, *this, parameters);
835 
836  // We use the identity:
837  // dq/dp = (partial q / partial p) + (partial q / partial u) *
838  // (partial u / partial p)
839 
840  // We get (partial q / partial u) from the user
841  this->assemble_qoi_derivative(qoi_indices,
842  /* include_liftfunc = */ true,
843  /* apply_constraints = */ false);
844 
845  // We don't need these to be closed() in this function, but libMesh
846  // standard practice is to have them closed() by the time the
847  // function exits
848  for (unsigned int i=0; i != this->n_qois(); ++i)
849  if (qoi_indices.has_index(i))
850  this->get_adjoint_rhs(i).close();
851 
852  for (unsigned int j=0; j != Np; ++j)
853  {
854  // We currently get partial derivatives via central differencing
855 
856  // (partial q / partial p) ~= (q(p+dp)-q(p-dp))/(2*dp)
857 
858  Number old_parameter = *parameters[j];
859 
860  const Real delta_p =
861  TOLERANCE * std::max(std::abs(old_parameter), 1e-3);
862 
863  *parameters[j] = old_parameter - delta_p;
864  this->assemble_qoi(qoi_indices);
865  std::vector<Number> qoi_minus = this->qoi;
866 
867  *parameters[j] = old_parameter + delta_p;
868  this->assemble_qoi(qoi_indices);
869  std::vector<Number> & qoi_plus = this->qoi;
870 
871  std::vector<Number> partialq_partialp(Nq, 0);
872  for (unsigned int i=0; i != Nq; ++i)
873  if (qoi_indices.has_index(i))
874  partialq_partialp[i] = (qoi_plus[i] - qoi_minus[i]) / (2.*delta_p);
875 
876  // Don't leave the parameter changed
877  *parameters[j] = old_parameter;
878 
879  for (unsigned int i=0; i != Nq; ++i)
880  if (qoi_indices.has_index(i))
881  sensitivities[i][j] = partialq_partialp[i] +
882  this->get_adjoint_rhs(i).dot(this->get_sensitivity_solution(j));
883  }
884 
885  // All parameters have been reset.
886  // We didn't cache the original rhs or matrix for memory reasons,
887  // but we can restore them to a state consistent solution -
888  // principle of least surprise.
889  this->assembly(true, true);
890  this->rhs->close();
891  this->matrix->close();
892  this->assemble_qoi(qoi_indices);
893 }
double abs(double a)
unsigned int n_qois() const
Definition: system.h:2278
NumericVector< Number > & get_sensitivity_solution(unsigned int i=0)
Definition: system.C:916
NumericVector< Number > * rhs
virtual std::pair< unsigned int, Real > sensitivity_solve(const ParameterVector &parameters) override
static const Real TOLERANCE
virtual T dot(const NumericVector< T > &v) const =0
long double max(long double a, double b)
virtual void assembly(bool, bool, bool=false, bool=false)
std::vector< Number > qoi
Definition: system.h:1558
virtual void close()=0
virtual void close()=0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
SparseMatrix< Number > * matrix
virtual void assemble_qoi(const QoISet &qoi_indices=QoISet()) override
virtual void assemble_qoi_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true) override
NumericVector< Number > & get_adjoint_rhs(unsigned int i=0)
Definition: system.C:1031

◆ generate_training_parameters_deterministic()

static void libMesh::RBConstructionBase< LinearImplicitSystem >::generate_training_parameters_deterministic ( const Parallel::Communicator communicator,
std::map< std::string, bool >  log_param_scale,
std::map< std::string, std::unique_ptr< NumericVector< Number >>> &  training_parameters_in,
unsigned int  n_training_samples_in,
const RBParameters min_parameters,
const RBParameters max_parameters,
bool  serial_training_set = false 
)
staticprotectedinherited

Static helper function for generating a deterministic set of parameters. Only works with 1 or 2 parameters (as defined by the lengths of min/max parameters vectors), otherwise throws an error.

◆ generate_training_parameters_random()

static void libMesh::RBConstructionBase< LinearImplicitSystem >::generate_training_parameters_random ( const Parallel::Communicator communicator,
std::map< std::string, bool >  log_param_scale,
std::map< std::string, std::unique_ptr< NumericVector< Number >>> &  training_parameters_in,
unsigned int  n_training_samples_in,
const RBParameters min_parameters,
const RBParameters max_parameters,
int  training_parameters_random_seed = -1,
bool  serial_training_set = false 
)
staticprotectedinherited

Static helper function for generating a randomized set of parameters.

◆ get_abs_training_tolerance()

Real libMesh::RBConstruction::get_abs_training_tolerance ( )
inline

Definition at line 193 of file rb_construction.h.

References abs_training_tolerance.

◆ get_adjoint_rhs() [1/2]

NumericVector< Number > & libMesh::System::get_adjoint_rhs ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's adjoint rhs vectors, by default the one corresponding to the first qoi. This what the user's QoI derivative code should assemble when setting up an adjoint problem

Definition at line 1031 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::ImplicitSystem::adjoint_solve(), libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity(), libMesh::ImplicitSystem::qoi_parameter_hessian(), libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

1032 {
1033  std::ostringstream adjoint_rhs_name;
1034  adjoint_rhs_name << "adjoint_rhs" << i;
1035 
1036  return this->get_vector(adjoint_rhs_name.str());
1037 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ get_adjoint_rhs() [2/2]

const NumericVector< Number > & libMesh::System::get_adjoint_rhs ( unsigned int  i = 0) const
inherited
Returns
A reference to one of the system's adjoint rhs vectors, by default the one corresponding to the first qoi.

Definition at line 1041 of file system.C.

References libMesh::System::get_vector().

1042 {
1043  std::ostringstream adjoint_rhs_name;
1044  adjoint_rhs_name << "adjoint_rhs" << i;
1045 
1046  return this->get_vector(adjoint_rhs_name.str());
1047 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ get_adjoint_solution() [1/2]

NumericVector< Number > & libMesh::System::get_adjoint_solution ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's adjoint solution vectors, by default the one corresponding to the first qoi.

Definition at line 969 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::ImplicitSystem::adjoint_solve(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ImplicitSystem::qoi_parameter_hessian(), libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

970 {
971  std::ostringstream adjoint_name;
972  adjoint_name << "adjoint_solution" << i;
973 
974  return this->get_vector(adjoint_name.str());
975 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ get_adjoint_solution() [2/2]

const NumericVector< Number > & libMesh::System::get_adjoint_solution ( unsigned int  i = 0) const
inherited
Returns
A reference to one of the system's adjoint solution vectors, by default the one corresponding to the first qoi.

Definition at line 979 of file system.C.

References libMesh::System::get_vector().

980 {
981  std::ostringstream adjoint_name;
982  adjoint_name << "adjoint_solution" << i;
983 
984  return this->get_vector(adjoint_name.str());
985 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ get_all_matrices()

virtual void libMesh::RBConstruction::get_all_matrices ( std::map< std::string, SparseMatrix< Number > *> &  all_matrices)
virtual

Get a map that stores pointers to all of the matrices.

Reimplemented in libMesh::TransientRBConstruction.

◆ get_all_variable_numbers()

void libMesh::System::get_all_variable_numbers ( std::vector< unsigned int > &  all_variable_numbers) const
inherited

Fills all_variable_numbers with all the variable numbers for the variables that have been added to this system.

Definition at line 1258 of file system.C.

References libMesh::System::_variable_numbers, and libMesh::System::n_vars().

1259 {
1260  all_variable_numbers.resize(n_vars());
1261 
1262  // Make sure the variable exists
1263  std::map<std::string, unsigned short int>::const_iterator
1264  it = _variable_numbers.begin();
1265  std::map<std::string, unsigned short int>::const_iterator
1266  it_end = _variable_numbers.end();
1267 
1268  unsigned int count = 0;
1269  for ( ; it != it_end; ++it)
1270  {
1271  all_variable_numbers[count] = it->second;
1272  count++;
1273  }
1274 }
std::map< std::string, unsigned short int > _variable_numbers
Definition: system.h:1922
unsigned int n_vars() const
Definition: system.h:2105

◆ get_all_vectors()

virtual void libMesh::RBConstruction::get_all_vectors ( std::map< std::string, NumericVector< Number > *> &  all_vectors)
virtual

Get a map that stores pointers to all of the vectors.

◆ get_Aq()

SparseMatrix<Number>* libMesh::RBConstruction::get_Aq ( unsigned int  q)

Get a pointer to Aq.

◆ get_closest_value()

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

◆ get_convergence_assertion_flag()

bool libMesh::RBConstruction::get_convergence_assertion_flag ( ) const
protected

Getter for the flag determining if convergence should be checked after each solve.

◆ get_delta_N()

unsigned int libMesh::RBConstruction::get_delta_N ( ) const
inline

Get delta_N, the number of basis functions we add to the RB space per iteration of the greedy algorithm. For steady-state systems, this should be 1, but can be more than 1 for time-dependent systems.

Definition at line 411 of file rb_construction.h.

References delta_N.

411 { return delta_N; }

◆ get_deterministic_training_parameter_name()

const std::string& libMesh::RBConstructionBase< LinearImplicitSystem >::get_deterministic_training_parameter_name ( ) const
inherited

Get the name of the parameter that we will generate deterministic training parameters for.

◆ get_deterministic_training_parameter_repeats()

unsigned int libMesh::RBConstructionBase< LinearImplicitSystem >::get_deterministic_training_parameter_repeats ( ) const
inherited

Get the number of times each sample of the deterministic training parameter is repeated.

◆ get_discrete_parameter_values()

const std::map<std::string, std::vector<Real> >& libMesh::RBParametrized::get_discrete_parameter_values ( ) const
inherited

Get a const reference to the discrete parameter values.

◆ get_dof_map() [1/2]

const DofMap & libMesh::System::get_dof_map ( ) const
inlineinherited
Returns
A constant reference to this system's _dof_map.

Definition at line 2049 of file system.h.

References libMesh::System::_dof_map.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::DifferentiableSystem::add_dot_var_dirichlet_bcs(), libMesh::HPCoarsenTest::add_projection(), libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::ImplicitSystem::adjoint_solve(), libMesh::NewmarkSolver::advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), libMesh::EquationSystems::allgather(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_sf(), libMesh::System::calculate_norm(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), DMCreateDomainDecomposition_libMesh(), DMCreateFieldDecomposition_libMesh(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::System::get_info(), libMesh::SystemSubsetBySubdomain::init(), libMesh::SecondOrderUnsteadySolver::init_data(), libMesh::UnsteadySolver::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ImplicitSystem::init_matrices(), libMesh::CondensedEigenSystem::initialize_condensed_dofs(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::System::local_dof_indices(), libMesh::DofMap::max_constraint_error(), libMesh::DGFEMContext::neighbor_side_fe_reinit(), libMesh::UnsteadySolver::old_nonlinear_solution(), libMesh::SecondOrderUnsteadySolver::old_solution_accel(), libMesh::SecondOrderUnsteadySolver::old_solution_rate(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::petsc_auto_fieldsplit(), libMesh::ErrorVector::plot_error(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::FEMContext::pre_fe_reinit(), libMesh::System::re_update(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::SecondOrderUnsteadySolver::reinit(), libMesh::UnsteadySolver::reinit(), libMesh::EigenSystem::reinit(), libMesh::ImplicitSystem::reinit(), libMesh::System::reinit_constraints(), libMesh::EquationSystems::reinit_solutions(), libMesh::UnsteadySolver::retrieve_timestep(), libMesh::HPCoarsenTest::select_refinement(), libMesh::ImplicitSystem::sensitivity_solve(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::NewtonSolver::solve(), libMesh::PetscDiffSolver::solve(), libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve(), libMesh::ImplicitSystem::weighted_sensitivity_solve(), libMesh::System::write_parallel_data(), libMesh::EnsightIO::write_scalar_ascii(), libMesh::System::write_SCALAR_dofs(), and libMesh::EnsightIO::write_vector_ascii().

2050 {
2051  return *_dof_map;
2052 }
std::unique_ptr< DofMap > _dof_map
Definition: system.h:1884

◆ get_dof_map() [2/2]

DofMap & libMesh::System::get_dof_map ( )
inlineinherited
Returns
A writable reference to this system's _dof_map.

Definition at line 2057 of file system.h.

References libMesh::System::_dof_map.

2058 {
2059  return *_dof_map;
2060 }
std::unique_ptr< DofMap > _dof_map
Definition: system.h:1884

◆ get_equation_systems() [1/2]

◆ get_equation_systems() [2/2]

EquationSystems& libMesh::System::get_equation_systems ( )
inlineinherited
Returns
A reference to this system's parent EquationSystems object.

Definition at line 717 of file system.h.

References libMesh::System::_equation_systems.

717 { return _equation_systems; }
EquationSystems & _equation_systems
Definition: system.h:1890

◆ get_first_local_training_index()

numeric_index_type libMesh::RBConstructionBase< LinearImplicitSystem >::get_first_local_training_index ( ) const
inherited

Get the first local index of the training parameters.

◆ get_Fq()

NumericVector<Number>* libMesh::RBConstruction::get_Fq ( unsigned int  q)

Get a pointer to Fq.

◆ get_global_max_error_pair()

static void libMesh::RBConstructionBase< LinearImplicitSystem >::get_global_max_error_pair ( const Parallel::Communicator communicator,
std::pair< numeric_index_type, Real > &  error_pair 
)
staticprotectedinherited

Static function to return the error pair (index,error) that is corresponds to the largest error on all processors.

◆ get_greedy_parameter()

const RBParameters& libMesh::RBConstruction::get_greedy_parameter ( unsigned int  i)

Return the parameters chosen during the i^th step of the Greedy algorithm.

◆ get_info() [1/3]

std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

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

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

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (const auto & pr : _counts)
59  {
60  const std::string name(pr.first);
61  const unsigned int creations = pr.second.first;
62  const unsigned int destructions = pr.second.second;
63 
64  oss << "| " << name << " reference count information:\n"
65  << "| Creations: " << creations << '\n'
66  << "| Destructions: " << destructions << '\n';
67  }
68 
69  oss << " ---------------------------------------------------------------------------- \n";
70 
71  return oss.str();
72 
73 #else
74 
75  return "";
76 
77 #endif
78 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42

◆ get_info() [2/3]

std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

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

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

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (const auto & pr : _counts)
59  {
60  const std::string name(pr.first);
61  const unsigned int creations = pr.second.first;
62  const unsigned int destructions = pr.second.second;
63 
64  oss << "| " << name << " reference count information:\n"
65  << "| Creations: " << creations << '\n'
66  << "| Destructions: " << destructions << '\n';
67  }
68 
69  oss << " ---------------------------------------------------------------------------- \n";
70 
71  return oss.str();
72 
73 #else
74 
75  return "";
76 
77 #endif
78 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42

◆ get_info() [3/3]

std::string libMesh::System::get_info ( ) const
inherited
Returns
A string containing information about the system.

Definition at line 1658 of file system.C.

References libMesh::FEType::family, libMesh::System::get_dof_map(), libMesh::DofMap::get_info(), libMesh::FEType::inf_map, libMesh::System::n_constrained_dofs(), libMesh::System::n_dofs(), libMesh::System::n_local_constrained_dofs(), libMesh::System::n_local_dofs(), libMesh::System::n_matrices(), libMesh::System::n_variable_groups(), libMesh::VariableGroup::n_variables(), libMesh::System::n_vectors(), libMesh::VariableGroup::name(), libMesh::System::name(), libMesh::System::number(), libMesh::FEType::order, libMesh::FEType::radial_family, libMesh::FEType::radial_order, libMesh::System::system_type(), libMesh::Variable::type(), libMesh::DofMap::variable_group(), and libMesh::System::variable_group().

1659 {
1660  std::ostringstream oss;
1661 
1662 
1663  const std::string & sys_name = this->name();
1664 
1665  oss << " System #" << this->number() << ", \"" << sys_name << "\"\n"
1666  << " Type \"" << this->system_type() << "\"\n"
1667  << " Variables=";
1668 
1669  for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
1670  {
1671  const VariableGroup & vg_description (this->variable_group(vg));
1672 
1673  if (vg_description.n_variables() > 1) oss << "{ ";
1674  for (unsigned int vn=0; vn<vg_description.n_variables(); vn++)
1675  oss << "\"" << vg_description.name(vn) << "\" ";
1676  if (vg_description.n_variables() > 1) oss << "} ";
1677  }
1678 
1679  oss << '\n';
1680 
1681  oss << " Finite Element Types=";
1682 #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
1683  for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
1684  oss << "\""
1685  << Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().family)
1686  << "\" ";
1687 #else
1688  for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
1689  {
1690  oss << "\""
1691  << Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().family)
1692  << "\", \""
1693  << Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().radial_family)
1694  << "\" ";
1695  }
1696 
1697  oss << '\n' << " Infinite Element Mapping=";
1698  for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
1699  oss << "\""
1700  << Utility::enum_to_string<InfMapType>(this->get_dof_map().variable_group(vg).type().inf_map)
1701  << "\" ";
1702 #endif
1703 
1704  oss << '\n';
1705 
1706  oss << " Approximation Orders=";
1707  for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
1708  {
1709 #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
1710  oss << "\""
1711  << Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().order)
1712  << "\" ";
1713 #else
1714  oss << "\""
1715  << Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().order)
1716  << "\", \""
1717  << Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().radial_order)
1718  << "\" ";
1719 #endif
1720  }
1721 
1722  oss << '\n';
1723 
1724  oss << " n_dofs()=" << this->n_dofs() << '\n';
1725  oss << " n_local_dofs()=" << this->n_local_dofs() << '\n';
1726 #ifdef LIBMESH_ENABLE_CONSTRAINTS
1727  oss << " n_constrained_dofs()=" << this->n_constrained_dofs() << '\n';
1728  oss << " n_local_constrained_dofs()=" << this->n_local_constrained_dofs() << '\n';
1729 #endif
1730 
1731  oss << " " << "n_vectors()=" << this->n_vectors() << '\n';
1732  oss << " " << "n_matrices()=" << this->n_matrices() << '\n';
1733  // oss << " " << "n_additional_matrices()=" << this->n_additional_matrices() << '\n';
1734 
1735  oss << this->get_dof_map().get_info();
1736 
1737  return oss.str();
1738 }
FEFamily family
Definition: fe_type.h:204
OrderWrapper radial_order
Definition: fe_type.h:237
unsigned int n_variable_groups() const
Definition: system.h:2113
OrderWrapper order
Definition: fe_type.h:198
dof_id_type n_local_dofs() const
Definition: system.C:187
std::string get_info() const
Definition: dof_map.C:2703
dof_id_type n_dofs() const
Definition: system.C:150
unsigned int number() const
Definition: system.h:2025
unsigned int n_vectors() const
Definition: system.h:2233
const VariableGroup & variable_group(const unsigned int c) const
Definition: dof_map.h:1752
InfMapType inf_map
Definition: fe_type.h:258
virtual unsigned int n_matrices() const
Definition: system.h:2239
FEFamily radial_family
Definition: fe_type.h:250
virtual std::string system_type() const
Definition: system.h:487
dof_id_type n_local_constrained_dofs() const
Definition: system.C:172
const std::string & name() const
Definition: system.h:2017
const DofMap & get_dof_map() const
Definition: system.h:2049
const VariableGroup & variable_group(unsigned int vg) const
Definition: system.h:2143
dof_id_type n_constrained_dofs() const
Definition: system.C:157
const FEType & type() const
Definition: variable.h:119

◆ get_inner_product_assembly()

ElemAssembly& libMesh::RBConstruction::get_inner_product_assembly ( )
Returns
A reference to the inner product assembly object

◆ get_inner_product_matrix()

SparseMatrix<Number>* libMesh::RBConstruction::get_inner_product_matrix ( )

Get a pointer to inner_product_matrix. Accessing via this function, rather than directly through the class member allows us to do error checking (e.g. inner_product_matrix is not defined in low-memory mode).

◆ get_last_local_training_index()

numeric_index_type libMesh::RBConstructionBase< LinearImplicitSystem >::get_last_local_training_index ( ) const
inherited

Get the last local index of the training parameters.

◆ get_linear_solve_parameters()

std::pair< unsigned int, Real > libMesh::ImplicitSystem::get_linear_solve_parameters ( ) const
virtualinherited
Returns
An integer corresponding to the upper iteration count limit and a Real corresponding to the convergence tolerance to be used in linear adjoint and/or sensitivity solves

Reimplemented in libMesh::NonlinearImplicitSystem, and libMesh::DifferentiableSystem.

Definition at line 1421 of file implicit_system.C.

References libMesh::Parameters::get(), libMesh::System::get_equation_systems(), libMesh::EquationSystems::parameters, and libMesh::Real.

Referenced by libMesh::ImplicitSystem::adjoint_solve(), libMesh::ImplicitSystem::sensitivity_solve(), libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve(), and libMesh::ImplicitSystem::weighted_sensitivity_solve().

1422 {
1423  return std::make_pair(this->get_equation_systems().parameters.get<unsigned int>("linear solver maximum iterations"),
1424  this->get_equation_systems().parameters.get<Real>("linear solver tolerance"));
1425 }
const EquationSystems & get_equation_systems() const
Definition: system.h:712
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const T & get(const std::string &) const
Definition: parameters.h:425

◆ get_linear_solver()

LinearSolver< Number > * libMesh::LinearImplicitSystem::get_linear_solver ( ) const
overridevirtualinherited
Returns
A pointer to a linear solver appropriate for use in adjoint and/or sensitivity solves

Reimplemented from libMesh::ImplicitSystem.

Definition at line 353 of file linear_implicit_system.C.

References libMesh::LinearImplicitSystem::linear_solver.

354 {
355  return linear_solver.get();
356 }
std::unique_ptr< LinearSolver< Number > > linear_solver

◆ get_local_n_training_samples()

numeric_index_type libMesh::RBConstructionBase< LinearImplicitSystem >::get_local_n_training_samples ( ) const
inherited

Get the total number of training samples local to this processor.

◆ get_matrix() [1/2]

const SparseMatrix< Number > & libMesh::ImplicitSystem::get_matrix ( const std::string &  mat_name) const
inherited
Returns
A const reference to this system's additional matrix named mat_name.

None of these matrices is involved in the solution process. Access is only granted when the matrix is already properly initialized.

Definition at line 263 of file implicit_system.C.

References libMesh::ImplicitSystem::_matrices.

Referenced by libMesh::NewmarkSystem::compute_matrix(), libMesh::EigenTimeSolver::solve(), and libMesh::NewmarkSystem::update_rhs().

264 {
265  // Make sure the matrix exists
266  const_matrices_iterator pos = _matrices.find (mat_name);
267 
268  if (pos == _matrices.end())
269  libmesh_error_msg("ERROR: matrix " << mat_name << " does not exist in this system!");
270 
271  return *(pos->second);
272 }
std::map< std::string, SparseMatrix< Number > * > _matrices
std::map< std::string, SparseMatrix< Number > * >::const_iterator const_matrices_iterator

◆ get_matrix() [2/2]

SparseMatrix< Number > & libMesh::ImplicitSystem::get_matrix ( const std::string &  mat_name)
inherited
Returns
A writable reference to this system's additional matrix named mat_name.

None of these matrices is involved in the solution process. Access is only granted when the matrix is already properly initialized.

Definition at line 276 of file implicit_system.C.

References libMesh::ImplicitSystem::_matrices.

277 {
278  // Make sure the matrix exists
279  matrices_iterator pos = _matrices.find (mat_name);
280 
281  if (pos == _matrices.end())
282  libmesh_error_msg("ERROR: matrix " << mat_name << " does not exist in this system!");
283 
284  return *(pos->second);
285 }
std::map< std::string, SparseMatrix< Number > * > _matrices
std::map< std::string, SparseMatrix< Number > * >::iterator matrices_iterator

◆ get_matrix_for_output_dual_solves()

virtual SparseMatrix<Number>& libMesh::RBConstruction::get_matrix_for_output_dual_solves ( )
protectedvirtual

Return the matrix for the output residual dual norm solves. By default we use the inner product matrix for steady state problems.

Reimplemented in libMesh::TransientRBConstruction.

◆ get_mesh() [1/2]

const MeshBase & libMesh::System::get_mesh ( ) const
inlineinherited
Returns
A constant reference to this systems's _mesh.

Definition at line 2033 of file system.h.

References libMesh::System::_mesh.

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::HPCoarsenTest::add_projection(), libMesh::FEMSystem::assemble_qoi(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::FEMSystem::assembly(), libMesh::System::calculate_norm(), DMCreateDomainDecomposition_libMesh(), DMCreateFieldDecomposition_libMesh(), DMlibMeshSetSystem_libMesh(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::SystemSubsetBySubdomain::init(), libMesh::System::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ImplicitSystem::init_matrices(), libMesh::System::local_dof_indices(), libMesh::DofMap::max_constraint_error(), libMesh::FEMSystem::mesh_position_get(), libMesh::FEMSystem::mesh_position_set(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::FEMSystem::postprocess(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::System::read_parallel_data(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::EigenSystem::reinit(), libMesh::ImplicitSystem::reinit(), libMesh::HPSingularity::select_refinement(), libMesh::HPCoarsenTest::select_refinement(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::System::write_header(), libMesh::System::write_parallel_data(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), and libMesh::System::zero_variable().

2034 {
2035  return _mesh;
2036 }
MeshBase & _mesh
Definition: system.h:1896

◆ get_mesh() [2/2]

MeshBase & libMesh::System::get_mesh ( )
inlineinherited
Returns
A reference to this systems's _mesh.

Definition at line 2041 of file system.h.

References libMesh::System::_mesh.

2042 {
2043  return _mesh;
2044 }
MeshBase & _mesh
Definition: system.h:1896

◆ get_n_continuous_params()

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

Get the number of continuous parameters.

◆ get_n_discrete_params()

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

Get the number of discrete parameters.

◆ get_n_params()

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

Get the number of parameters.

◆ get_n_training_samples()

numeric_index_type libMesh::RBConstructionBase< LinearImplicitSystem >::get_n_training_samples ( ) const
inherited

Get the total number of training samples.

◆ get_Nmax()

unsigned int libMesh::RBConstruction::get_Nmax ( ) const
inline

Get/set Nmax, the maximum number of RB functions we are willing to compute.

Definition at line 206 of file rb_construction.h.

References Nmax.

206 { return Nmax; }

◆ get_non_dirichlet_Aq()

SparseMatrix<Number>* libMesh::RBConstruction::get_non_dirichlet_Aq ( unsigned int  q)

Get a pointer to non_dirichlet_Aq.

◆ get_non_dirichlet_Aq_if_avail()

SparseMatrix<Number>* libMesh::RBConstruction::get_non_dirichlet_Aq_if_avail ( unsigned int  q)

Get a pointer to non_dirichlet_Aq if it's available, otherwise get Aq.

◆ get_non_dirichlet_Fq()

NumericVector<Number>* libMesh::RBConstruction::get_non_dirichlet_Fq ( unsigned int  q)

Get a pointer to non-Dirichlet Fq.

◆ get_non_dirichlet_Fq_if_avail()

NumericVector<Number>* libMesh::RBConstruction::get_non_dirichlet_Fq_if_avail ( unsigned int  q)

Get a pointer to non_dirichlet_Fq if it's available, otherwise get Fq.

◆ get_non_dirichlet_inner_product_matrix()

SparseMatrix<Number>* libMesh::RBConstruction::get_non_dirichlet_inner_product_matrix ( )

Get the non-Dirichlet (or more generally no-constraints) version of the inner-product matrix. This is useful for performing multiplications on vectors that already have constraints enforced.

◆ get_non_dirichlet_inner_product_matrix_if_avail()

SparseMatrix<Number>* libMesh::RBConstruction::get_non_dirichlet_inner_product_matrix_if_avail ( )

Get the non-Dirichlet inner-product matrix if it's available, otherwise get the inner-product matrix with constraints.

◆ get_non_dirichlet_output_vector()

NumericVector<Number>* libMesh::RBConstruction::get_non_dirichlet_output_vector ( unsigned int  n,
unsigned int  q_l 
)

Get a pointer to non-Dirichlet output vector.

◆ get_normalize_rb_bound_in_greedy()

bool libMesh::RBConstruction::get_normalize_rb_bound_in_greedy ( )
inline

Definition at line 200 of file rb_construction.h.

References normalize_rb_bound_in_greedy.

◆ get_output_vector()

NumericVector<Number>* libMesh::RBConstruction::get_output_vector ( unsigned int  n,
unsigned int  q_l 
)

Get a pointer to the n^th output.

◆ get_output_vectors()

virtual void libMesh::RBConstruction::get_output_vectors ( std::map< std::string, NumericVector< Number > *> &  all_vectors)
virtual

Get a map that stores pointers to all of the vectors.

◆ get_parameter_max()

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

Get maximum allowable value of parameter param_name.

◆ get_parameter_min()

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

Get minimum allowable value of parameter param_name.

◆ get_parameter_names()

std::set<std::string> libMesh::RBParametrized::get_parameter_names ( ) const
inherited

Get a set that stores the parameter names.

◆ get_parameters()

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

Get the current parameters.

◆ get_parameters_max()

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

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

◆ get_parameters_min()

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

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

◆ get_params_from_training_set()

RBParameters libMesh::RBConstructionBase< LinearImplicitSystem >::get_params_from_training_set ( unsigned int  index)
protectedinherited

Return the RBParameters in index index of training set.

◆ get_rb_assembly_expansion()

RBAssemblyExpansion& libMesh::RBConstruction::get_rb_assembly_expansion ( )
Returns
A reference to the rb_assembly_expansion object

◆ get_RB_error_bound()

virtual Real libMesh::RBConstruction::get_RB_error_bound ( )
protectedvirtual
Returns
The RB error bound for the current parameters.

Used in the Greedy algorithm to select the next parameter.

Reimplemented in libMesh::RBEIMConstruction.

◆ get_rb_evaluation()

RBEvaluation& libMesh::RBConstruction::get_rb_evaluation ( )

Get a reference to the RBEvaluation object.

◆ get_rb_theta_expansion()

RBThetaExpansion& libMesh::RBConstruction::get_rb_theta_expansion ( )

Get a reference to the RBThetaExpansion object that that belongs to rb_eval.

◆ get_rel_training_tolerance()

Real libMesh::RBConstruction::get_rel_training_tolerance ( )
inline

Definition at line 186 of file rb_construction.h.

References rel_training_tolerance.

◆ get_sensitivity_rhs() [1/2]

NumericVector< Number > & libMesh::System::get_sensitivity_rhs ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's sensitivity rhs vectors, by default the one corresponding to the first parameter. By default these vectors are built by the library, using finite differences, when assemble_residual_derivatives() is called.

When assembled, this vector should hold -(partial R / partial p_i)

Definition at line 1061 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::ImplicitSystem::adjoint_qoi_parameter_sensitivity(), and libMesh::ImplicitSystem::sensitivity_solve().

1062 {
1063  std::ostringstream sensitivity_rhs_name;
1064  sensitivity_rhs_name << "sensitivity_rhs" << i;
1065 
1066  return this->get_vector(sensitivity_rhs_name.str());
1067 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ get_sensitivity_rhs() [2/2]

const NumericVector< Number > & libMesh::System::get_sensitivity_rhs ( unsigned int  i = 0) const
inherited
Returns
A reference to one of the system's sensitivity rhs vectors, by default the one corresponding to the first parameter.

Definition at line 1071 of file system.C.

References libMesh::System::get_vector().

1072 {
1073  std::ostringstream sensitivity_rhs_name;
1074  sensitivity_rhs_name << "sensitivity_rhs" << i;
1075 
1076  return this->get_vector(sensitivity_rhs_name.str());
1077 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ get_sensitivity_solution() [1/2]

NumericVector< Number > & libMesh::System::get_sensitivity_solution ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's solution sensitivity vectors, by default the one corresponding to the first parameter.

Definition at line 916 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity(), libMesh::ImplicitSystem::qoi_parameter_hessian(), and libMesh::ImplicitSystem::sensitivity_solve().

917 {
918  std::ostringstream sensitivity_name;
919  sensitivity_name << "sensitivity_solution" << i;
920 
921  return this->get_vector(sensitivity_name.str());
922 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ get_sensitivity_solution() [2/2]

const NumericVector< Number > & libMesh::System::get_sensitivity_solution ( unsigned int  i = 0) const
inherited
Returns
A reference to one of the system's solution sensitivity vectors, by default the one corresponding to the first parameter.

Definition at line 926 of file system.C.

References libMesh::System::get_vector().

927 {
928  std::ostringstream sensitivity_name;
929  sensitivity_name << "sensitivity_solution" << i;
930 
931  return this->get_vector(sensitivity_name.str());
932 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ get_shell_matrix()

ShellMatrix<Number>* libMesh::LinearImplicitSystem::get_shell_matrix ( )
inlineinherited
Returns
A pointer to the currently attached shell matrix, if any, otherwise nullptr.

Definition at line 191 of file linear_implicit_system.h.

References libMesh::LinearImplicitSystem::_shell_matrix.

191 { return _shell_matrix; }
ShellMatrix< Number > * _shell_matrix

◆ get_vector() [1/4]

const NumericVector< Number > & libMesh::System::get_vector ( const std::string &  vec_name) const
inherited
Returns
A const reference to this system's additional vector named vec_name. Access is only granted when the vector is already properly initialized.

Definition at line 774 of file system.C.

References libMesh::System::_vectors.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::NewmarkSolver::advance_timestep(), libMesh::AdaptiveTimeSolver::advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), libMesh::System::compare(), libMesh::NewmarkSolver::compute_initial_accel(), libMesh::UnsteadySolver::du(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::get_adjoint_rhs(), libMesh::System::get_adjoint_solution(), libMesh::System::get_sensitivity_rhs(), libMesh::System::get_sensitivity_solution(), libMesh::System::get_weighted_sensitivity_adjoint_solution(), libMesh::System::get_weighted_sensitivity_solution(), libMesh::NewmarkSystem::initial_conditions(), libMesh::NewmarkSolver::project_initial_accel(), libMesh::SecondOrderUnsteadySolver::project_initial_rate(), libMesh::SecondOrderUnsteadySolver::reinit(), libMesh::UnsteadySolver::reinit(), libMesh::MemorySolutionHistory::retrieve(), libMesh::UnsteadySolver::retrieve_timestep(), libMesh::TwostepTimeSolver::solve(), libMesh::FrequencySystem::solve(), libMesh::NewmarkSystem::update_rhs(), and libMesh::NewmarkSystem::update_u_v_a().

775 {
776  // Make sure the vector exists
777  const_vectors_iterator pos = _vectors.find(vec_name);
778 
779  if (pos == _vectors.end())
780  libmesh_error_msg("ERROR: vector " << vec_name << " does not exist in this system!");
781 
782  return *(pos->second);
783 }
std::map< std::string, NumericVector< Number > * >::const_iterator const_vectors_iterator
Definition: system.h:749
std::map< std::string, NumericVector< Number > *> _vectors
Definition: system.h:1935

◆ get_vector() [2/4]

NumericVector< Number > & libMesh::System::get_vector ( const std::string &  vec_name)
inherited
Returns
A writable reference to this system's additional vector named vec_name. Access is only granted when the vector is already properly initialized.

Definition at line 787 of file system.C.

References libMesh::System::_vectors.

788 {
789  // Make sure the vector exists
790  vectors_iterator pos = _vectors.find(vec_name);
791 
792  if (pos == _vectors.end())
793  libmesh_error_msg("ERROR: vector " << vec_name << " does not exist in this system!");
794 
795  return *(pos->second);
796 }
std::map< std::string, NumericVector< Number > * >::iterator vectors_iterator
Definition: system.h:748
std::map< std::string, NumericVector< Number > *> _vectors
Definition: system.h:1935

◆ get_vector() [3/4]

const NumericVector< Number > & libMesh::System::get_vector ( const unsigned int  vec_num) const
inherited
Returns
A const reference to this system's additional vector number vec_num (where the vectors are counted starting with 0).

Definition at line 800 of file system.C.

References libMesh::System::vectors_begin(), and libMesh::System::vectors_end().

801 {
804  unsigned int num = 0;
805  while ((num<vec_num) && (v!=v_end))
806  {
807  num++;
808  ++v;
809  }
810  libmesh_assert (v != v_end);
811  return *(v->second);
812 }
vectors_iterator vectors_end()
Definition: system.h:2257
std::map< std::string, NumericVector< Number > * >::const_iterator const_vectors_iterator
Definition: system.h:749
vectors_iterator vectors_begin()
Definition: system.h:2245

◆ get_vector() [4/4]

NumericVector< Number > & libMesh::System::get_vector ( const unsigned int  vec_num)
inherited
Returns
A writable reference to this system's additional vector number vec_num (where the vectors are counted starting with 0).

Definition at line 816 of file system.C.

References libMesh::System::vectors_begin(), and libMesh::System::vectors_end().

817 {
819  vectors_iterator v_end = vectors_end();
820  unsigned int num = 0;
821  while ((num<vec_num) && (v!=v_end))
822  {
823  num++;
824  ++v;
825  }
826  libmesh_assert (v != v_end);
827  return *(v->second);
828 }
vectors_iterator vectors_end()
Definition: system.h:2257
vectors_iterator vectors_begin()
Definition: system.h:2245
std::map< std::string, NumericVector< Number > * >::iterator vectors_iterator
Definition: system.h:748

◆ get_weighted_sensitivity_adjoint_solution() [1/2]

NumericVector< Number > & libMesh::System::get_weighted_sensitivity_adjoint_solution ( unsigned int  i = 0)
inherited
Returns
A reference to one of the system's weighted sensitivity adjoint solution vectors, by default the one corresponding to the first qoi.

Definition at line 1001 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().

1002 {
1003  std::ostringstream adjoint_name;
1004  adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
1005 
1006  return this->get_vector(adjoint_name.str());
1007 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ get_weighted_sensitivity_adjoint_solution() [2/2]

const NumericVector< Number > & libMesh::System::get_weighted_sensitivity_adjoint_solution ( unsigned int  i = 0) const
inherited
Returns
A reference to one of the system's weighted sensitivity adjoint solution vectors, by default the one corresponding to the first qoi.

Definition at line 1011 of file system.C.

References libMesh::System::get_vector().

1012 {
1013  std::ostringstream adjoint_name;
1014  adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
1015 
1016  return this->get_vector(adjoint_name.str());
1017 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ get_weighted_sensitivity_solution() [1/2]

NumericVector< Number > & libMesh::System::get_weighted_sensitivity_solution ( )
inherited
Returns
A reference to the solution of the last weighted sensitivity solve

Definition at line 943 of file system.C.

References libMesh::System::get_vector().

Referenced by libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product(), and libMesh::ImplicitSystem::weighted_sensitivity_solve().

944 {
945  return this->get_vector("weighted_sensitivity_solution");
946 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ get_weighted_sensitivity_solution() [2/2]

const NumericVector< Number > & libMesh::System::get_weighted_sensitivity_solution ( ) const
inherited
Returns
A reference to the solution of the last weighted sensitivity solve

Definition at line 950 of file system.C.

References libMesh::System::get_vector().

951 {
952  return this->get_vector("weighted_sensitivity_solution");
953 }
const NumericVector< Number > & get_vector(const std::string &vec_name) const
Definition: system.C:774

◆ greedy_termination_test()

virtual bool libMesh::RBConstruction::greedy_termination_test ( Real  abs_greedy_error,
Real  initial_greedy_error,
int  count 
)
protectedvirtual

Function that indicates when to terminate the Greedy basis training. Override in subclasses to specialize.

Reimplemented in libMesh::TransientRBConstruction.

◆ has_variable()

bool libMesh::System::has_variable ( const std::string &  var) const
inherited
Returns
true if a variable named var exists in this System

Definition at line 1236 of file system.C.

References libMesh::System::_variable_numbers.

Referenced by libMesh::GMVIO::copy_nodal_solution().

1237 {
1238  return _variable_numbers.count(var);
1239 }
std::map< std::string, unsigned short int > _variable_numbers
Definition: system.h:1922

◆ have_matrix()

bool libMesh::ImplicitSystem::have_matrix ( const std::string &  mat_name) const
inlineinherited
Returns
true if this System has a matrix associated with the given name, false otherwise.

Definition at line 419 of file implicit_system.h.

References libMesh::ImplicitSystem::_matrices.

Referenced by libMesh::ImplicitSystem::add_matrix(), and libMesh::EigenTimeSolver::init().

420 {
421  return (_matrices.count(mat_name));
422 }
std::map< std::string, SparseMatrix< Number > * > _matrices

◆ have_vector()

bool libMesh::System::have_vector ( const std::string &  vec_name) const
inlineinherited
Returns
true if this System has a vector associated with the given name, false otherwise.

Definition at line 2225 of file system.h.

References libMesh::System::_vectors.

Referenced by libMesh::System::add_vector().

2226 {
2227  return (_vectors.count(vec_name));
2228 }
std::map< std::string, NumericVector< Number > *> _vectors
Definition: system.h:1935

◆ hide_output()

bool& libMesh::System::hide_output ( )
inlineinherited
Returns
A writable reference to a boolean that determines if this system can be written to file or not. If set to true, then EquationSystems::write will ignore this system.

Definition at line 1662 of file system.h.

References libMesh::System::_hide_output.

1662 { return _hide_output; }
bool _hide_output
Definition: system.h:2009

◆ identify_variable_groups() [1/2]

bool libMesh::System::identify_variable_groups ( ) const
inlineinherited
Returns
true when VariableGroup structures should be automatically identified, false otherwise.

Definition at line 2201 of file system.h.

References libMesh::System::_identify_variable_groups.

Referenced by libMesh::System::add_variable().

2202 {
2204 }
bool _identify_variable_groups
Definition: system.h:1977

◆ identify_variable_groups() [2/2]

void libMesh::System::identify_variable_groups ( const bool  ivg)
inlineinherited

Toggle automatic VariableGroup identification.

Definition at line 2209 of file system.h.

References libMesh::System::_identify_variable_groups.

2210 {
2212 }
bool _identify_variable_groups
Definition: system.h:1977

◆ increment_constructor_count() [1/2]

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

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

Definition at line 181 of file reference_counter.h.

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

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

182 {
183  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
184  std::pair<unsigned int, unsigned int> & p = _counts[name];
185 
186  p.first++;
187 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
spin_mutex spin_mtx
Definition: threads.C:29

◆ increment_constructor_count() [2/2]

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

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

Definition at line 181 of file reference_counter.h.

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

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

182 {
183  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
184  std::pair<unsigned int, unsigned int> & p = _counts[name];
185 
186  p.first++;
187 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
spin_mutex spin_mtx
Definition: threads.C:29

◆ increment_destructor_count() [1/2]

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

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

Definition at line 194 of file reference_counter.h.

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

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

195 {
196  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
197  std::pair<unsigned int, unsigned int> & p = _counts[name];
198 
199  p.second++;
200 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
spin_mutex spin_mtx
Definition: threads.C:29

◆ increment_destructor_count() [2/2]

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

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

Definition at line 194 of file reference_counter.h.

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

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

195 {
196  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
197  std::pair<unsigned int, unsigned int> & p = _counts[name];
198 
199  p.second++;
200 }
std::string name(const ElemQuality q)
Definition: elem_quality.C:42
spin_mutex spin_mtx
Definition: threads.C:29

◆ init()

void libMesh::System::init ( )
inherited

Initializes degrees of freedom on the current mesh. Sets the

Definition at line 237 of file system.C.

References libMesh::System::_basic_system_only, libMesh::System::init_data(), libMesh::System::is_initialized(), libMesh::System::n_vars(), and libMesh::System::user_initialization().

238 {
239  // Calling init() twice on the same system currently works evil
240  // magic, whether done directly or via EquationSystems::read()
241  libmesh_assert(!this->is_initialized());
242 
243  // First initialize any required data:
244  // either only the basic System data
245  if (_basic_system_only)
247  // or all the derived class' data too
248  else
249  this->init_data();
250 
251  // If no variables have been added to this system
252  // don't do anything
253  if (!this->n_vars())
254  return;
255 
256  // Then call the user-provided initialization function
257  this->user_initialization();
258 }
bool _basic_system_only
Definition: system.h:1965
virtual void init_data()
Definition: system.C:262
virtual void user_initialization()
Definition: system.C:1918
bool is_initialized()
Definition: system.h:2089
unsigned int n_vars() const
Definition: system.h:2105

◆ init_context()

virtual void libMesh::RBConstruction::init_context ( FEMContext )
inlineprotectedvirtual

Initialize the FEMContext prior to performing an element loop. Reimplement this in derived classes in order to call FE::get_*() as the particular physics requires.

Definition at line 707 of file rb_construction.h.

707 {}

◆ init_data()

virtual void libMesh::RBConstructionBase< LinearImplicitSystem >::init_data ( )
protectedvirtualinherited

Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.

Reimplemented from libMesh::LinearImplicitSystem.

Reimplemented in libMesh::RBEIMConstruction.

◆ init_matrices()

void libMesh::ImplicitSystem::init_matrices ( )
protectedvirtualinherited

Initializes the matrices associated with this system.

Definition at line 106 of file implicit_system.C.

References libMesh::ImplicitSystem::_can_add_matrices, libMesh::ImplicitSystem::_matrices, libMesh::DofMap::attach_matrix(), libMesh::DofMap::compute_sparsity(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::SparseMatrix< T >::initialized(), libMesh::DofMap::is_attached(), and libMesh::ImplicitSystem::matrix.

Referenced by libMesh::ImplicitSystem::init_data().

107 {
108  libmesh_assert(matrix);
109 
110  // Check for quick return in case the system matrix
111  // (and by extension all the matrices) has already
112  // been initialized
113  if (matrix->initialized())
114  return;
115 
116  // Get a reference to the DofMap
117  DofMap & dof_map = this->get_dof_map();
118 
119  // no chance to add other matrices
120  _can_add_matrices = false;
121 
122  // Tell the matrices about the dof map, and vice versa
123  for (auto & pr : _matrices)
124  {
125  SparseMatrix<Number> & m = *(pr.second);
126  libmesh_assert (!m.initialized());
127 
128  // We want to allow repeated init() on systems, but we don't
129  // want to attach the same matrix to the DofMap twice
130  if (!dof_map.is_attached(m))
131  dof_map.attach_matrix (m);
132  }
133 
134  // Compute the sparsity pattern for the current
135  // mesh and DOF distribution. This also updates
136  // additional matrices, \p DofMap now knows them
137  dof_map.compute_sparsity (this->get_mesh());
138 
139  // Initialize matrices
140  for (auto & pr : _matrices)
141  pr.second->init ();
142 
143  // Set the additional matrices to 0.
144  for (auto & pr : _matrices)
145  pr.second->zero ();
146 }
virtual bool initialized() const
std::map< std::string, SparseMatrix< Number > * > _matrices
const MeshBase & get_mesh() const
Definition: system.h:2033
SparseMatrix< Number > * matrix
const DofMap & get_dof_map() const
Definition: system.h:2049

◆ initialize_parameters() [1/2]

void libMesh::RBParametrized::initialize_parameters ( const RBParameters mu_min_in,
const RBParameters mu_max_in,
const std::map< std::string, std::vector< Real >> &  discrete_parameter_values 
)
inherited

Initialize the parameter ranges and set current_parameters.

◆ initialize_parameters() [2/2]

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

Initialize the parameter ranges and set current_parameters.

◆ initialize_rb_construction()

virtual void libMesh::RBConstruction::initialize_rb_construction ( bool  skip_matrix_assembly = false,
bool  skip_vector_assembly = false 
)
virtual

Allocate all the data structures necessary for the construction stage of the RB method. This function also performs matrix and vector assembly of the "truth" affine expansion.

We can optionally skip the matrix or vector assembly steps by setting skip_matrix_assembly = true, or skip_vector_assembly = true, respectively.

Reimplemented in libMesh::RBEIMConstruction, and libMesh::TransientRBConstruction.

◆ initialize_training_parameters()

virtual void libMesh::RBConstructionBase< LinearImplicitSystem >::initialize_training_parameters ( const RBParameters mu_min,
const RBParameters mu_max,
unsigned int  n_training_parameters,
std::map< std::string, bool >  log_param_scale,
bool  deterministic = true 
)
virtualinherited

Initialize the parameter ranges and indicate whether deterministic or random training parameters should be used and whether or not we want the parameters to be scaled logarithmically.

◆ is_adjoint_already_solved()

◆ is_discrete_parameter()

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

Is parameter mu_name discrete?

◆ is_initialized()

bool libMesh::System::is_initialized ( )
inlineinherited
Returns
true iff this system has been initialized.

Definition at line 2089 of file system.h.

References libMesh::System::_is_initialized.

Referenced by libMesh::System::add_variable(), libMesh::System::add_variables(), and libMesh::System::init().

2090 {
2091  return _is_initialized;
2092 }
bool _is_initialized
Definition: system.h:1971

◆ is_quiet()

bool libMesh::RBConstructionBase< LinearImplicitSystem >::is_quiet ( ) const
inlineinherited

Is the system in quiet mode?

Definition at line 98 of file rb_construction_base.h.

◆ is_rb_eval_initialized()

bool libMesh::RBConstruction::is_rb_eval_initialized ( ) const
Returns
true if rb_eval is initialized. False, otherwise.

◆ load_basis_function()

virtual void libMesh::RBConstruction::load_basis_function ( unsigned int  i)
virtual

Load the i^th RB function into the RBConstruction solution vector.

Reimplemented in libMesh::RBEIMConstruction.

◆ load_rb_solution()

virtual void libMesh::RBConstruction::load_rb_solution ( )
virtual

Load the RB solution from the most recent solve with rb_eval into this system's solution vector.

Reimplemented in libMesh::TransientRBConstruction, and libMesh::RBEIMConstruction.

◆ load_training_set()

virtual void libMesh::RBConstructionBase< LinearImplicitSystem >::load_training_set ( std::map< std::string, std::vector< Number >> &  new_training_set)
virtualinherited

Overwrite the training parameters with new_training_set.

◆ local_dof_indices()

void libMesh::System::local_dof_indices ( const unsigned int  var,
std::set< dof_id_type > &  var_indices 
) const
inherited

Fills the std::set with the degrees of freedom on the local processor corresponding the the variable number passed in.

Definition at line 1277 of file system.C.

References libMesh::DofMap::dof_indices(), libMesh::DofMap::end_dof(), libMesh::DofMap::first_dof(), libMesh::System::get_dof_map(), and libMesh::System::get_mesh().

Referenced by libMesh::System::discrete_var_norm().

1279 {
1280  // Make sure the set is clear
1281  var_indices.clear();
1282 
1283  std::vector<dof_id_type> dof_indices;
1284 
1285  const dof_id_type
1286  first_local = this->get_dof_map().first_dof(),
1287  end_local = this->get_dof_map().end_dof();
1288 
1289  // Begin the loop over the elements
1290  for (const auto & elem : this->get_mesh().active_local_element_ptr_range())
1291  {
1292  this->get_dof_map().dof_indices (elem, dof_indices, var);
1293 
1294  for (std::size_t i=0; i<dof_indices.size(); i++)
1295  {
1296  dof_id_type dof = dof_indices[i];
1297 
1298  //If the dof is owned by the local processor
1299  if (first_local <= dof && dof < end_local)
1300  var_indices.insert(dof_indices[i]);
1301  }
1302  }
1303 
1304  // we may have missed assigning DOFs to nodes that we own
1305  // but to which we have no connected elements matching our
1306  // variable restriction criterion. this will happen, for example,
1307  // if variable V is restricted to subdomain S. We may not own
1308  // any elements which live in S, but we may own nodes which are
1309  // *connected* to elements which do.
1310  for (const auto & node : this->get_mesh().local_node_ptr_range())
1311  {
1312  libmesh_assert(node);
1313  this->get_dof_map().dof_indices (node, dof_indices, var);
1314  for (auto dof : dof_indices)
1315  if (first_local <= dof && dof < end_local)
1316  var_indices.insert(dof);
1317  }
1318 }
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Definition: dof_map.C:1930
const MeshBase & get_mesh() const
Definition: system.h:2033
dof_id_type first_dof(const processor_id_type proc) const
Definition: dof_map.h:599
dof_id_type end_dof(const processor_id_type proc) const
Definition: dof_map.h:641
const DofMap & get_dof_map() const
Definition: system.h:2049
uint8_t dof_id_type
Definition: id_types.h:64

◆ n_active_dofs()

dof_id_type libMesh::System::n_active_dofs ( ) const
inlineinherited
Returns
The number of active degrees of freedom for this System.

Definition at line 2217 of file system.h.

References libMesh::System::n_constrained_dofs(), and libMesh::System::n_dofs().

2218 {
2219  return this->n_dofs() - this->n_constrained_dofs();
2220 }
dof_id_type n_dofs() const
Definition: system.C:150
dof_id_type n_constrained_dofs() const
Definition: system.C:157

◆ n_components()

unsigned int libMesh::System::n_components ( ) const
inlineinherited
Returns
The total number of scalar components in the system's variables. This will equal n_vars() in the case of all scalar-valued variables.

Definition at line 2121 of file system.h.

References libMesh::System::_variables, libMesh::Variable::first_scalar_number(), and libMesh::Variable::n_components().

Referenced by libMesh::System::add_variables().

2122 {
2123  if (_variables.empty())
2124  return 0;
2125 
2126  const Variable & last = _variables.back();
2127  return last.first_scalar_number() + last.n_components();
2128 }
std::vector< Variable > _variables
Definition: system.h:1911

◆ n_constrained_dofs()

dof_id_type libMesh::System::n_constrained_dofs ( ) const
inherited
Returns
The total number of constrained degrees of freedom in the system.

Definition at line 157 of file system.C.

References libMesh::System::_dof_map.

Referenced by libMesh::System::get_info(), and libMesh::System::n_active_dofs().

158 {
159 #ifdef LIBMESH_ENABLE_CONSTRAINTS
160 
161  return _dof_map->n_constrained_dofs();
162 
163 #else
164 
165  return 0;
166 
167 #endif
168 }
std::unique_ptr< DofMap > _dof_map
Definition: system.h:1884

◆ n_dofs()

◆ n_linear_iterations()

unsigned int libMesh::LinearImplicitSystem::n_linear_iterations ( ) const
inlineinherited
Returns
The number of iterations taken for the most recent linear solve.

Definition at line 164 of file linear_implicit_system.h.

References libMesh::LinearImplicitSystem::_n_linear_iterations.

◆ n_local_constrained_dofs()

dof_id_type libMesh::System::n_local_constrained_dofs ( ) const
inherited
Returns
The number of constrained degrees of freedom on this processor.

Definition at line 172 of file system.C.

References libMesh::System::_dof_map.

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

173 {
174 #ifdef LIBMESH_ENABLE_CONSTRAINTS
175 
176  return _dof_map->n_local_constrained_dofs();
177 
178 #else
179 
180  return 0;
181 
182 #endif
183 }
std::unique_ptr< DofMap > _dof_map
Definition: system.h:1884

◆ n_local_dofs()

◆ n_matrices()

unsigned int libMesh::ImplicitSystem::n_matrices ( ) const
inlineoverridevirtualinherited
Returns
The number of matrices handled by this system

Reimplemented from libMesh::System.

Definition at line 426 of file implicit_system.h.

References libMesh::ImplicitSystem::_matrices.

427 {
428  return cast_int<unsigned int>(_matrices.size());
429 }
std::map< std::string, SparseMatrix< Number > * > _matrices

◆ n_objects() [1/2]

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

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

Definition at line 83 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

84  { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects

◆ n_objects() [2/2]

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

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

Definition at line 83 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

84  { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects

◆ n_processors()

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

Definition at line 95 of file parallel_object.h.

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

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::DistributedMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), 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::EnsightIO::EnsightIO(), libMesh::MeshBase::get_info(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::MeshBase::partition(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

96  { return cast_int<processor_id_type>(_communicator.size()); }
processor_id_type size() const
Definition: communicator.h:175
const Parallel::Communicator & _communicator

◆ n_qois()

◆ n_variable_groups()

unsigned int libMesh::System::n_variable_groups ( ) const
inlineinherited
Returns
The number of VariableGroup variable groups in the system

Definition at line 2113 of file system.h.

References libMesh::System::_variable_groups.

Referenced by libMesh::System::add_variable(), libMesh::FEMSystem::assembly(), libMesh::System::get_info(), and libMesh::System::init_data().

2114 {
2115  return cast_int<unsigned int>(_variable_groups.size());
2116 }
std::vector< VariableGroup > _variable_groups
Definition: system.h:1916

◆ n_vars()

unsigned int libMesh::System::n_vars ( ) const
inlineinherited
Returns
The number of variables in the system

Definition at line 2105 of file system.h.

References libMesh::System::_variables.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::DiffContext::add_localized_vector(), libMesh::System::add_variable(), libMesh::System::add_variables(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::System::calculate_norm(), libMesh::DGFEMContext::DGFEMContext(), libMesh::DiffContext::DiffContext(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::ErrorEstimator::estimate_errors(), libMesh::ExactSolution::ExactSolution(), libMesh::System::get_all_variable_numbers(), libMesh::System::init(), libMesh::FEMSystem::init_context(), libMesh::FEMContext::init_internal_data(), libMesh::DGFEMContext::neighbor_side_fe_reinit(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::petsc_auto_fieldsplit(), libMesh::FEMContext::pre_fe_reinit(), libMesh::System::re_update(), libMesh::System::read_legacy_data(), libMesh::System::read_parallel_data(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::HPCoarsenTest::select_refinement(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::SystemSubsetBySubdomain::set_var_nums(), libMesh::System::write_header(), libMesh::System::write_parallel_data(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), and libMesh::System::zero_variable().

2106 {
2107  return cast_int<unsigned int>(_variables.size());
2108 }
std::vector< Variable > _variables
Definition: system.h:1911

◆ n_vectors()

unsigned int libMesh::System::n_vectors ( ) const
inlineinherited
Returns
The number of vectors (in addition to the solution) handled by this system This is the size of the _vectors map

Definition at line 2233 of file system.h.

References libMesh::System::_vectors.

Referenced by libMesh::ExplicitSystem::add_system_rhs(), libMesh::System::compare(), libMesh::System::get_info(), and libMesh::System::write_header().

2234 {
2235  return cast_int<unsigned int>(_vectors.size());
2236 }
std::map< std::string, NumericVector< Number > *> _vectors
Definition: system.h:1935

◆ name()

◆ number()

◆ point_gradient() [1/3]

Gradient libMesh::System::point_gradient ( unsigned int  var,
const Point p,
const bool  insist_on_success = true 
) const
inherited
Returns
The gradient of the solution variable var at the physical point p in the mesh, similarly to point_value.

Definition at line 2100 of file system.C.

References libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), mesh, libMesh::Parallel::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), and libMesh::DofObject::processor_id().

Referenced by libMesh::System::point_gradient().

2101 {
2102  // This function must be called on every processor; there's no
2103  // telling where in the partition p falls.
2104  parallel_object_only();
2105 
2106  // And every processor had better agree about which point we're
2107  // looking for
2108 #ifndef NDEBUG
2109  libmesh_assert(this->comm().verify(p(0)));
2110 #if LIBMESH_DIM > 1
2111  libmesh_assert(this->comm().verify(p(1)));
2112 #endif
2113 #if LIBMESH_DIM > 2
2114  libmesh_assert(this->comm().verify(p(2)));
2115 #endif
2116 #endif // NDEBUG
2117 
2118  // Get a reference to the mesh object associated with the system object that calls this function
2119  const MeshBase & mesh = this->get_mesh();
2120 
2121  // Use an existing PointLocator or create a new one
2122  std::unique_ptr<PointLocatorBase> locator_ptr = mesh.sub_point_locator();
2123  PointLocatorBase & locator = *locator_ptr;
2124 
2125  if (!insist_on_success || !mesh.is_serial())
2126  locator.enable_out_of_mesh_mode();
2127 
2128  // Get a pointer to the element that contains P
2129  const Elem * e = locator(p);
2130 
2131  Gradient grad_u;
2132 
2133  if (e && this->get_dof_map().is_evaluable(*e, var))
2134  grad_u = point_gradient(var, p, *e);
2135 
2136  // If I have an element containing p, then let's let everyone know
2137  processor_id_type lowest_owner =
2138  (e && (e->processor_id() == this->processor_id())) ?
2139  this->processor_id() : this->n_processors();
2140  this->comm().min(lowest_owner);
2141 
2142  // Everybody should get their value from a processor that was able
2143  // to compute it.
2144  // If nobody admits owning the point, we may have a problem.
2145  if (lowest_owner != this->n_processors())
2146  this->comm().broadcast(grad_u, lowest_owner);
2147  else
2148  libmesh_assert(!insist_on_success);
2149 
2150  return grad_u;
2151 }
Gradient point_gradient(unsigned int var, const Point &p, const bool insist_on_success=true) const
Definition: system.C:2100
MeshBase & mesh
uint8_t processor_id_type
Definition: id_types.h:99
const Parallel::Communicator & comm() const
const MeshBase & get_mesh() const
Definition: system.h:2033
processor_id_type n_processors() const
NumberVectorValue Gradient
processor_id_type processor_id() const
const DofMap & get_dof_map() const
Definition: system.h:2049
void broadcast(T &data, const unsigned int root_id=0) const

◆ point_gradient() [2/3]

Gradient libMesh::System::point_gradient ( unsigned int  var,
const Point p,
const Elem e 
) const
inherited
Returns
The gradient of the solution variable var at the physical point p in local Elem e in the mesh, similarly to point_value.

Definition at line 2154 of file system.C.

References libMesh::TypeVector< T >::add_scaled(), libMesh::FEGenericBase< OutputType >::build(), libMesh::Elem::contains_point(), libMesh::System::current_solution(), libMesh::Elem::dim(), libMesh::DofMap::dof_indices(), libMesh::System::get_dof_map(), libMesh::Elem::infinite(), libMesh::FEInterface::inverse_map(), libMesh::DofMap::is_evaluable(), and libMesh::DofMap::variable_type().

2155 {
2156  // Ensuring that the given point is really in the element is an
2157  // expensive assert, but as long as debugging is turned on we might
2158  // as well try to catch a particularly nasty potential error
2159  libmesh_assert (e.contains_point(p));
2160 
2161 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
2162  if (e.infinite())
2163  libmesh_not_implemented();
2164 #endif
2165 
2166  // Get the dof map to get the proper indices for our computation
2167  const DofMap & dof_map = this->get_dof_map();
2168 
2169  // Make sure we can evaluate on this element.
2170  libmesh_assert (dof_map.is_evaluable(e, var));
2171 
2172  // Need dof_indices for phi[i][j]
2173  std::vector<dof_id_type> dof_indices;
2174 
2175  // Fill in the dof_indices for our element
2176  dof_map.dof_indices (&e, dof_indices, var);
2177 
2178  // Get the no of dofs associated with this point
2179  const unsigned int num_dofs = cast_int<unsigned int>
2180  (dof_indices.size());
2181 
2182  FEType fe_type = dof_map.variable_type(var);
2183 
2184  // Build a FE again so we can calculate u(p)
2185  std::unique_ptr<FEBase> fe (FEBase::build(e.dim(), fe_type));
2186 
2187  // Map the physical co-ordinates to the master co-ordinates using the inverse_map from fe_interface.h
2188  // Build a vector of point co-ordinates to send to reinit
2189  std::vector<Point> coor(1, FEInterface::inverse_map(e.dim(), fe_type, &e, p));
2190 
2191  // Get the values of the shape function derivatives
2192  const std::vector<std::vector<RealGradient>> & dphi = fe->get_dphi();
2193 
2194  // Reinitialize the element and compute the shape function values at coor
2195  fe->reinit (&e, &coor);
2196 
2197  // Get ready to accumulate a gradient
2198  Gradient grad_u;
2199 
2200  for (unsigned int l=0; l<num_dofs; l++)
2201  {
2202  grad_u.add_scaled (dphi[l][0], this->current_solution (dof_indices[l]));
2203  }
2204 
2205  return grad_u;
2206 }
void add_scaled(const TypeVector< T2 > &, const T)
Definition: type_vector.h:627
Number current_solution(const dof_id_type global_dof_number) const
Definition: system.C:194
NumberVectorValue Gradient
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
static Point inverse_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
Definition: fe_interface.C:590
const DofMap & get_dof_map() const
Definition: system.h:2049

◆ point_gradient() [3/3]

Gradient libMesh::System::point_gradient ( unsigned int  var,
const Point p,
const Elem e 
)