$extrastylesheet
#include <rb_construction.h>

Public Types | |
| typedef RBConstruction | sys_type |
| typedef RBConstructionBase < LinearImplicitSystem > | Parent |
| typedef std::map< std::string, SparseMatrix< Number > * >::iterator | matrices_iterator |
| typedef std::map< std::string, SparseMatrix< Number > * >::const_iterator | const_matrices_iterator |
| 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 () |
| void | set_rb_evaluation (RBEvaluation &rb_eval_in) |
| RBEvaluation & | get_rb_evaluation () |
| bool | is_rb_eval_initialized () const |
| RBThetaExpansion & | get_rb_theta_expansion () |
| void | set_rb_assembly_expansion (RBAssemblyExpansion &rb_assembly_expansion_in) |
| RBAssemblyExpansion & | get_rb_assembly_expansion () |
| sys_type & | system () |
| virtual void | clear () |
| virtual std::string | system_type () const |
| virtual Real | truth_solve (int plot_solution) |
| virtual Real | train_reduced_basis (const std::string &directory_name="offline_data", const bool resize_rb_eval_data=true) |
| virtual Real | compute_max_error_bound () |
| const RBParameters & | get_greedy_parameter (unsigned int i) |
| void | set_training_tolerance (Real new_training_tolerance) |
| Real | get_training_tolerance () |
| unsigned int | get_Nmax () const |
| virtual void | set_Nmax (unsigned int Nmax) |
| void | set_quiet_mode (bool quiet_mode_in) |
| bool | is_quiet () const |
| 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_Aq (unsigned int q) |
| SparseMatrix< Number > * | get_non_dirichlet_Aq (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_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_constraint_matrix (SparseMatrix< Number > *input_matrix) |
| void | assemble_and_add_constraint_matrix (SparseMatrix< Number > *input_matrix) |
| 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 ¶meters_filename) |
| void | set_rb_construction_parameters (unsigned int n_training_samples_in, bool deterministic_training_in, std::string alternative_solver_in, bool reuse_preconditioner_in, bool use_relative_bound_in_greedy_in, bool write_data_during_training_in, unsigned int training_parameters_random_seed_in, bool quiet_mode_in, unsigned int Nmax_in, Real training_tolerance_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) |
| ElemAssembly & | get_inner_product_assembly () |
| void | set_constraint_assembly (ElemAssembly &constraint_assembly_in) |
| ElemAssembly & | get_constraint_assembly () |
| void | zero_constrained_dofs_on_vector (NumericVector< Number > &vector) |
| void | set_convergence_assertion_flag (bool flag) |
| 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) |
| std::pair< std::string, std::string > | set_alternative_solver (UniquePtr< LinearSolver< Number > > &ls) |
| void | reset_alternative_solver (UniquePtr< LinearSolver< Number > > &ls, const std::pair< std::string, std::string > &orig) |
| 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 () |
| virtual void | assemble () |
| virtual void | restrict_solve_to (const SystemSubset *subset, const SubsetSolveMode subset_solve_mode=SUBSET_ZERO) |
| virtual void | solve () |
| virtual LinearSolver< Number > * | get_linear_solver () const |
| virtual void | release_linear_solver (LinearSolver< Number > *) const |
| virtual void | assembly (bool get_residual, bool get_jacobian, bool apply_heterogeneous_constraints=false) |
| unsigned int | n_linear_iterations () const |
| Real | final_linear_residual () const |
| void | attach_shell_matrix (ShellMatrix< Number > *shell_matrix) |
| void | detach_shell_matrix (void) |
| ShellMatrix< Number > * | get_shell_matrix (void) |
| virtual void | disable_cache () |
| virtual std::pair< unsigned int, Real > | get_linear_solve_parameters () const |
| virtual void | assemble_residual_derivatives (const ParameterVector ¶meters) |
| virtual std::pair< unsigned int, Real > | sensitivity_solve (const ParameterVector ¶meters) |
| virtual std::pair< unsigned int, Real > | weighted_sensitivity_solve (const ParameterVector ¶meters, const ParameterVector &weights) |
| virtual std::pair< unsigned int, Real > | adjoint_solve (const QoISet &qoi_indices=QoISet()) |
| virtual std::pair< unsigned int, Real > | weighted_sensitivity_adjoint_solve (const ParameterVector ¶meters, const ParameterVector &weights, const QoISet &qoi_indices=QoISet()) |
| virtual void | adjoint_qoi_parameter_sensitivity (const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &sensitivities) |
| virtual void | forward_qoi_parameter_sensitivity (const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &sensitivities) |
| virtual void | qoi_parameter_hessian (const QoISet &qoi_indices, const ParameterVector ¶meters, SensitivityData &hessian) |
| virtual void | qoi_parameter_hessian_vector_product (const QoISet &qoi_indices, const ParameterVector ¶meters, const ParameterVector &vector, SensitivityData &product) |
| SparseMatrix< Number > & | add_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 |
| virtual void | assemble_qoi (const QoISet &qoi_indices=QoISet()) |
| virtual void | assemble_qoi_derivative (const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true) |
| 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 ¶meters, 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=NULL) const |
| void | project_solution (FEMFunctionBase< Number > *f, FEMFunctionBase< Gradient > *g=NULL) const |
| void | project_solution (Number fptr(const Point &p, const Parameters ¶meters, const std::string &sys_name, const std::string &unknown_name), Gradient gptr(const Point &p, const Parameters ¶meters, const std::string &sys_name, const std::string &unknown_name), const Parameters ¶meters) const |
| void | project_vector (NumericVector< Number > &new_vector, FunctionBase< Number > *f, FunctionBase< Gradient > *g=NULL, int is_adjoint=-1) const |
| void | project_vector (NumericVector< Number > &new_vector, FEMFunctionBase< Number > *f, FEMFunctionBase< Gradient > *g=NULL, int is_adjoint=-1) const |
| void | project_vector (Number fptr(const Point &p, const Parameters ¶meters, const std::string &sys_name, const std::string &unknown_name), Gradient gptr(const Point &p, const Parameters ¶meters, const std::string &sys_name, const std::string &unknown_name), const Parameters ¶meters, 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=NULL) |
| void | boundary_project_solution (const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, Number fptr(const Point &p, const Parameters ¶meters, const std::string &sys_name, const std::string &unknown_name), Gradient gptr(const Point &p, const Parameters ¶meters, const std::string &sys_name, const std::string &unknown_name), const Parameters ¶meters) |
| 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=NULL, int is_adjoint=-1) const |
| void | boundary_project_vector (const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, Number fptr(const Point &p, const Parameters ¶meters, const std::string &sys_name, const std::string &unknown_name), Gradient gptr(const Point &p, const Parameters ¶meters, const std::string &sys_name, const std::string &unknown_name), const Parameters ¶meters, 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 MeshBase & | get_mesh () const |
| MeshBase & | get_mesh () |
| const DofMap & | get_dof_map () const |
| DofMap & | get_dof_map () |
| const EquationSystems & | get_equation_systems () const |
| EquationSystems & | get_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=NULL) |
| unsigned int | add_variable (const std::string &var, const Order order=FIRST, const FEFamily=LAGRANGE, const std::set< subdomain_id_type > *const active_subdomains=NULL) |
| unsigned int | add_variables (const std::vector< std::string > &vars, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=NULL) |
| 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=NULL) |
| const Variable & | variable (unsigned int var) const |
| const VariableGroup & | variable_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 FEType & | variable_type (const unsigned int i) const |
| const FEType & | variable_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) const |
| Real | calculate_norm (const NumericVector< Number > &v, const SystemNorm &norm) 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| const Parallel::Communicator & | comm () 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 RBParameters & | get_parameters () const |
| void | set_parameters (const RBParameters ¶ms) |
| const RBParameters & | get_parameters_min () const |
| const RBParameters & | get_parameters_max () const |
| Real | get_parameter_min (const std::string ¶m_name) const |
| Real | get_parameter_max (const std::string ¶m_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 UniquePtr < DirichletBoundary > | build_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< Real > | training_error_bounds |
| UniquePtr< LinearSolver< Number > > | inner_product_solver |
| LinearSolver< Number > * | original_linear_solver |
| bool | use_inner_product_solver |
| UniquePtr< SparseMatrix< Number > > | inner_product_matrix |
| UniquePtr< SparseMatrix< Number > > | non_dirichlet_inner_product_matrix |
| UniquePtr< SparseMatrix< Number > > | constraint_matrix |
| std::vector< Number > | truth_outputs |
| std::vector< std::vector < Number > > | output_dual_innerprods |
| std::vector< NumericVector < Number > * > | Fq_representor |
| std::vector< Number > | Fq_representor_innerprods |
| bool | constrained_problem |
| bool | reuse_preconditioner |
| bool | use_relative_bound_in_greedy |
| bool | exit_on_repeated_greedy_parameters |
| bool | write_data_during_training |
| bool | impose_internal_dirichlet_BCs |
| bool | impose_internal_fluxes |
| bool | compute_RB_inner_product |
| bool | store_non_dirichlet_operators |
| bool | enforce_constraints_exactly |
| bool | use_empty_rb_solve_in_greedy |
| bool | Fq_representor_innerprods_computed |
| UniquePtr< LinearSolver< Number > > | linear_solver |
| SparseMatrix< Number > * | matrix |
| NumericVector< Number > * | rhs |
| bool | assemble_before_solve |
| bool | use_fixed_solution |
| int | extra_quadrature_order |
| UniquePtr< NumericVector < Number > > | solution |
| UniquePtr< NumericVector < Number > > | current_local_solution |
| Real | time |
| std::vector< Number > | qoi |
| 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 UniquePtr< DGFEMContext > | build_context () |
| virtual void | assemble_matrix_for_output_dual_solves () |
| virtual bool | greedy_termination_test (Real training_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 () |
| 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< unsigned int, 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, 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, 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 | quiet_mode |
| bool | output_dual_innerprods_computed |
| bool | assert_convergence |
| bool | serial_training_set |
| UniquePtr< NumericVector < Number > > | inner_product_storage_vector |
| std::string | alternative_solver |
| 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 | |
| RBEvaluation * | rb_eval |
| RBAssemblyExpansion * | rb_assembly_expansion |
| ElemAssembly * | inner_product_assembly |
| ElemAssembly * | constraint_assembly |
| std::vector< SparseMatrix < Number > * > | Aq_vector |
| std::vector< NumericVector < Number > * > | Fq_vector |
| std::vector< std::vector < NumericVector< Number > * > > | outputs_vector |
| std::vector< SparseMatrix < Number > * > | non_dirichlet_Aq_vector |
| std::vector< NumericVector < Number > * > | non_dirichlet_Fq_vector |
| std::vector< std::vector < NumericVector< Number > * > > | non_dirichlet_outputs_vector |
| Real | training_tolerance |
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.
Definition at line 57 of file rb_construction.h.
typedef std::map<std::string, SparseMatrix<Number>* >::const_iterator libMesh::ImplicitSystem::const_matrices_iterator [inherited] |
Definition at line 280 of file implicit_system.h.
typedef std::map<std::string, NumericVector<Number>* >::const_iterator libMesh::System::const_vectors_iterator [inherited] |
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts [protected, inherited] |
Data structure to log the information. The log is identified by the class name.
Definition at line 113 of file reference_counter.h.
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts [protected, inherited] |
Data structure to log the information. The log is identified by the class name.
Definition at line 113 of file reference_counter.h.
typedef std::map<std::string, SparseMatrix<Number>* >::iterator libMesh::ImplicitSystem::matrices_iterator [inherited] |
Matrix iterator typedefs.
Definition at line 279 of file implicit_system.h.
The type of the parent.
Reimplemented from libMesh::LinearImplicitSystem.
Reimplemented in libMesh::RBEIMConstruction, and libMesh::TransientRBConstruction.
Definition at line 118 of file rb_construction.h.
The type of system.
Reimplemented from libMesh::RBConstructionBase< LinearImplicitSystem >.
Reimplemented in libMesh::RBEIMConstruction, libMesh::TransientRBConstruction, and libMesh::TransientSystem< RBConstruction >.
Definition at line 77 of file rb_construction.h.
typedef std::map<std::string, NumericVector<Number>* >::iterator libMesh::System::vectors_iterator [inherited] |
| libMesh::RBConstruction::RBConstruction | ( | EquationSystems & | es, |
| const std::string & | name, | ||
| const unsigned int | number | ||
| ) |
Constructor. Optionally initializes required data structures.
| virtual libMesh::RBConstruction::~RBConstruction | ( | ) | [virtual] |
Destructor.
| void libMesh::System::activate | ( | ) | [inline, inherited] |
Activates the system. Only active systems are solved.
Definition at line 2001 of file system.h.
References libMesh::System::_active.
{
_active = true;
}
| bool libMesh::System::active | ( | ) | const [inline, inherited] |
true if the system is active, false otherwise. An active system will be solved. Definition at line 1993 of file system.h.
References libMesh::System::_active.
{
return _active;
}
| NumericVector< Number > & libMesh::System::add_adjoint_rhs | ( | unsigned int | i = 0 | ) | [inherited] |
Definition at line 1048 of file system.C.
References libMesh::System::add_vector().
Referenced by libMesh::ExplicitSystem::assemble_qoi_derivative(), and libMesh::FEMSystem::assemble_qoi_derivative().
{
std::ostringstream adjoint_rhs_name;
adjoint_rhs_name << "adjoint_rhs" << i;
return this->add_vector(adjoint_rhs_name.str(), false);
}
| NumericVector< Number > & libMesh::System::add_adjoint_solution | ( | unsigned int | i = 0 | ) | [inherited] |
Definition at line 984 of file system.C.
References libMesh::System::add_vector(), and libMesh::System::set_vector_as_adjoint().
Referenced by libMesh::ImplicitSystem::adjoint_solve().
{
std::ostringstream adjoint_name;
adjoint_name << "adjoint_solution" << i;
NumericVector<Number> &returnval = this->add_vector(adjoint_name.str());
this->set_vector_as_adjoint(adjoint_name.str(), i);
return returnval;
}
| 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 207 of file implicit_system.C.
References libMesh::ImplicitSystem::_can_add_matrices, libMesh::ImplicitSystem::_matrices, libMesh::ParallelObject::comm(), and libMesh::ImplicitSystem::have_matrix().
Referenced by libMesh::ImplicitSystem::add_system_matrix(), libMesh::EigenTimeSolver::init(), and libMesh::NewmarkSystem::NewmarkSystem().
{
// only add matrices before initializing...
if (!_can_add_matrices)
libmesh_error_msg("ERROR: Too late. Cannot add matrices to the system after initialization"
<< "\n any more. You should have done this earlier.");
// Return the matrix if it is already there.
if (this->have_matrix(mat_name))
return *(_matrices[mat_name]);
// Otherwise build the matrix and return it.
SparseMatrix<Number>* buf = SparseMatrix<Number>::build(this->comm()).release();
_matrices.insert (std::make_pair (mat_name, buf));
return *buf;
}
| 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.
| 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)
| NumericVector< Number > & libMesh::System::add_sensitivity_rhs | ( | unsigned int | i = 0 | ) | [inherited] |
Definition at line 1078 of file system.C.
References libMesh::System::add_vector().
Referenced by libMesh::ImplicitSystem::assemble_residual_derivatives().
{
std::ostringstream sensitivity_rhs_name;
sensitivity_rhs_name << "sensitivity_rhs" << i;
return this->add_vector(sensitivity_rhs_name.str(), false);
}
| NumericVector< Number > & libMesh::System::add_sensitivity_solution | ( | unsigned int | i = 0 | ) | [inherited] |
Definition at line 933 of file system.C.
References libMesh::System::add_vector().
Referenced by libMesh::ImplicitSystem::sensitivity_solve().
{
std::ostringstream sensitivity_name;
sensitivity_name << "sensitivity_solution" << i;
return this->add_vector(sensitivity_name.str());
}
| unsigned int libMesh::System::add_variable | ( | const std::string & | var, |
| const FEType & | type, | ||
| const std::set< subdomain_id_type > *const | active_subdomains = NULL |
||
| ) | [inherited] |
Adds the variable var to the list of variables for this system. Returns the index number for the new variable.
Definition at line 1108 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::libmesh_assert(), libMesh::System::n_variable_groups(), libMesh::System::n_vars(), libMesh::System::number(), libMesh::System::variable_name(), and libMesh::System::variable_type().
Referenced by libMesh::System::add_variable(), libMesh::ErrorVector::plot_error(), and libMesh::System::read_header().
{
libmesh_assert(!this->is_initialized());
// Make sure the variable isn't there already
// or if it is, that it's the type we want
for (unsigned int v=0; v<this->n_vars(); v++)
if (this->variable_name(v) == var)
{
if (this->variable_type(v) == type)
return _variables[v].number();
libmesh_error_msg("ERROR: incompatible variable " << var << " has already been added for this system!");
}
// Optimize for VariableGroups here - if the user is adding multiple
// variables of the same FEType and subdomain restriction, catch
// that here and add them as members of the same VariableGroup.
//
// start by setting this flag to whatever the user has requested
// and then consider the conditions which should negate it.
bool should_be_in_vg = this->identify_variable_groups();
// No variable groups, nothing to add to
if (!this->n_variable_groups())
should_be_in_vg = false;
else
{
VariableGroup &vg(_variable_groups.back());
// get a pointer to their subdomain restriction, if any.
const std::set<subdomain_id_type> * const
their_active_subdomains (vg.implicitly_active() ?
NULL : &vg.active_subdomains());
// Different types?
if (vg.type() != type)
should_be_in_vg = false;
// they are restricted, we aren't?
if (their_active_subdomains && !active_subdomains)
should_be_in_vg = false;
// they aren't restriced, we are?
if (!their_active_subdomains && active_subdomains)
should_be_in_vg = false;
if (their_active_subdomains && active_subdomains)
// restricted to different sets?
if (*their_active_subdomains != *active_subdomains)
should_be_in_vg = false;
// OK, after all that, append the variable to the vg if none of the conditions
// were violated
if (should_be_in_vg)
{
const unsigned short curr_n_vars = cast_int<unsigned short>
(this->n_vars());
vg.append (var);
_variables.push_back(vg(vg.n_variables()-1));
_variable_numbers[var] = curr_n_vars;
return curr_n_vars;
}
}
// otherwise, fall back to adding a single variable group
return this->add_variables (std::vector<std::string>(1, var),
type,
active_subdomains);
}
| 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 = NULL |
||
| ) | [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 1186 of file system.C.
References libMesh::System::add_variable().
{
return this->add_variable(var,
FEType(order, family),
active_subdomains);
}
| unsigned int libMesh::System::add_variables | ( | const std::vector< std::string > & | vars, |
| const FEType & | type, | ||
| const std::set< subdomain_id_type > *const | active_subdomains = NULL |
||
| ) | [inherited] |
Adds the variable var to the list of variables for this system. Returns the index number for the new variable.
Definition at line 1198 of file system.C.
References libMesh::System::_variable_groups, libMesh::System::_variable_numbers, libMesh::System::_variables, libMesh::System::is_initialized(), libMesh::libmesh_assert(), 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().
{
libmesh_assert(!this->is_initialized());
// Make sure the variable isn't there already
// or if it is, that it's the type we want
for (unsigned int ov=0; ov<vars.size(); ov++)
for (unsigned int v=0; v<this->n_vars(); v++)
if (this->variable_name(v) == vars[ov])
{
if (this->variable_type(v) == type)
return _variables[v].number();
libmesh_error_msg("ERROR: incompatible variable " << vars[ov] << " has already been added for this system!");
}
const unsigned short curr_n_vars = cast_int<unsigned short>
(this->n_vars());
const unsigned int next_first_component = this->n_components();
// Add the variable group to the list
_variable_groups.push_back((active_subdomains == NULL) ?
VariableGroup(this, vars, curr_n_vars,
next_first_component, type) :
VariableGroup(this, vars, curr_n_vars,
next_first_component, type, *active_subdomains));
const VariableGroup &vg (_variable_groups.back());
// Add each component of the group individually
for (unsigned short v=0; v<vars.size(); v++)
{
_variables.push_back (vg(v));
_variable_numbers[vars[v]] = cast_int<unsigned short>
(curr_n_vars+v);
}
libmesh_assert_equal_to ((curr_n_vars+vars.size()), this->n_vars());
// BSK - Defer this now to System::init_data() so we can detect
// VariableGroups 12/28/2012
// // Add the variable group to the _dof_map
// _dof_map->add_variable_group (vg);
// Return the number of the new variable
return cast_int<unsigned int>(curr_n_vars+vars.size()-1);
}
| 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 = NULL |
||
| ) | [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 1251 of file system.C.
References libMesh::System::add_variables().
{
return this->add_variables(vars,
FEType(order, family),
active_subdomains);
}
| 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 inititialized 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 689 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::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::UnsteadySolver::init(), 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().
{
// Return the vector if it is already there.
if (this->have_vector(vec_name))
return *(_vectors[vec_name]);
// Otherwise build the vector
NumericVector<Number>* buf = NumericVector<Number>::build(this->comm()).release();
_vectors.insert (std::make_pair (vec_name, buf));
_vector_projections.insert (std::make_pair (vec_name, projections));
_vector_types.insert (std::make_pair (vec_name, type));
// Vectors are primal by default
_vector_is_adjoint.insert (std::make_pair (vec_name, -1));
// Initialize it if necessary
if (_is_initialized)
{
if(type == GHOSTED)
{
#ifdef LIBMESH_ENABLE_GHOSTED
buf->init (this->n_dofs(), this->n_local_dofs(),
_dof_map->get_send_list(), false,
GHOSTED);
#else
libmesh_error_msg("Cannot initialize ghosted vectors when they are not enabled.");
#endif
}
else
buf->init (this->n_dofs(), this->n_local_dofs(), false, type);
}
return *buf;
}
| NumericVector< Number > & libMesh::System::add_weighted_sensitivity_adjoint_solution | ( | unsigned int | i = 0 | ) | [inherited] |
Definition at line 1016 of file system.C.
References libMesh::System::add_vector(), and libMesh::System::set_vector_as_adjoint().
Referenced by libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().
{
std::ostringstream adjoint_name;
adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
NumericVector<Number> &returnval = this->add_vector(adjoint_name.str());
this->set_vector_as_adjoint(adjoint_name.str(), i);
return returnval;
}
| NumericVector< Number > & libMesh::System::add_weighted_sensitivity_solution | ( | ) | [inherited] |
Definition at line 963 of file system.C.
References libMesh::System::add_vector().
Referenced by libMesh::ImplicitSystem::weighted_sensitivity_solve().
{
return this->add_vector("weighted_sensitivity_solution");
}
| void libMesh::ImplicitSystem::adjoint_qoi_parameter_sensitivity | ( | const QoISet & | qoi_indices, |
| const ParameterVector & | parameters, | ||
| SensitivityData & | sensitivities | ||
| ) | [virtual, inherited] |
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 700 of file implicit_system.C.
References libMesh::SensitivityData::allocate_data(), libMesh::get_dof_map(), libMesh::QoISet::has_index(), libMesh::Real, libMesh::ParameterVector::size(), and libMesh::TOLERANCE.
{
// We currently get partial derivatives via central differencing
const Real delta_p = TOLERANCE;
ParameterVector& parameters =
const_cast<ParameterVector&>(parameters_in);
const unsigned int Np = cast_int<unsigned int>
(parameters.size());
const unsigned int Nq = cast_int<unsigned int>
(qoi.size());
// An introduction to the problem:
//
// Residual R(u(p),p) = 0
// partial R / partial u = J = system matrix
//
// This implies that:
// d/dp(R) = 0
// (partial R / partial p) +
// (partial R / partial u) * (partial u / partial p) = 0
// We first do an adjoint solve:
// J^T * z = (partial q / partial u)
// if we havent already or dont have an initial condition for the adjoint
if (!this->is_adjoint_already_solved())
{
this->adjoint_solve(qoi_indices);
}
// Get ready to fill in senstivities:
sensitivities.allocate_data(qoi_indices, *this, parameters);
// We use the identities:
// dq/dp = (partial q / partial p) + (partial q / partial u) *
// (partial u / partial p)
// dq/dp = (partial q / partial p) + (J^T * z) *
// (partial u / partial p)
// dq/dp = (partial q / partial p) + z * J *
// (partial u / partial p)
// Leading to our final formula:
// dq/dp = (partial q / partial p) - z * (partial R / partial p)
// In the case of adjoints with heterogenous Dirichlet boundary
// function phi, where
// q := R(u,phi) + S(u)
// the final formula works out to:
// dq/dp = (partial S / partial p) - z * (partial R / partial p)
// Because we currently have no direct access to
// (partial S / partial p), we use the identity
// (partial S / partial p) = (partial q / partial p) -
// phi * (partial R / partial p)
// to derive an equivalent equation:
// dq/dp = (partial q / partial p) - (z+phi) * (partial R / partial p)
// If we have non-zero adjoint dofs on Dirichlet constrained
// boundary dofs, then we need the residual components
// corresponding to those dofs when using r*z to compute R(u,z), so
// we can't apply constraints.
//
// If we aren't in that situation we could apply constraints but
// it will be faster not to.
this->get_dof_map().stash_dof_constraints();
for (unsigned int j=0; j != Np; ++j)
{
// (partial q / partial p) ~= (q(p+dp)-q(p-dp))/(2*dp)
// (partial R / partial p) ~= (rhs(p+dp) - rhs(p-dp))/(2*dp)
Number old_parameter = *parameters[j];
// Number old_qoi = this->qoi;
*parameters[j] = old_parameter - delta_p;
this->assemble_qoi(qoi_indices);
std::vector<Number> qoi_minus = this->qoi;
this->assembly(true, false, true);
this->rhs->close();
// FIXME - this can and should be optimized to avoid the clone()
UniquePtr<NumericVector<Number> > partialR_partialp = this->rhs->clone();
*partialR_partialp *= -1;
*parameters[j] = old_parameter + delta_p;
this->assemble_qoi(qoi_indices);
std::vector<Number>& qoi_plus = this->qoi;
std::vector<Number> partialq_partialp(Nq, 0);
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
partialq_partialp[i] = (qoi_plus[i] - qoi_minus[i]) / (2.*delta_p);
this->assembly(true, false, true);
this->rhs->close();
*partialR_partialp += *this->rhs;
*partialR_partialp /= (2.*delta_p);
// Don't leave the parameter changed
*parameters[j] = old_parameter;
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
sensitivities[i][j] = partialq_partialp[i] -
partialR_partialp->dot(this->get_adjoint_solution(i));
if (this->get_dof_map().has_adjoint_dirichlet_boundaries(i))
{
UniquePtr<NumericVector<Number> > lift_func =
this->get_adjoint_solution(i).zero_clone();
this->get_dof_map().enforce_adjoint_constraints_exactly
(*lift_func.get(), i);
sensitivities[i][j] += partialR_partialp->dot(*lift_func);
}
}
}
// All parameters have been reset.
// We didn't cache the original rhs or matrix for memory reasons,
// but we can restore them to a state consistent solution -
// principle of least surprise.
this->get_dof_map().unstash_dof_constraints();
this->assembly(true, true);
this->rhs->close();
this->matrix->close();
this->assemble_qoi(qoi_indices);
}
| std::pair< unsigned int, Real > libMesh::ImplicitSystem::adjoint_solve | ( | const QoISet & | qoi_indices = QoISet() | ) | [virtual, inherited] |
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 365 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::qoi, libMesh::ImplicitSystem::release_linear_solver(), and libMesh::START_LOG().
{
// Log how long the linear solve takes.
START_LOG("adjoint_solve()", "ImplicitSystem");
if (this->assemble_before_solve)
// Assemble the linear system
this->assembly (/* get_residual = */ false,
/* get_jacobian = */ true);
// The adjoint problem is linear
LinearSolver<Number> *linear_solver = this->get_linear_solver();
// Reset and build the RHS from the QOI derivative
this->assemble_qoi_derivative(qoi_indices,
/* include_liftfunc = */ false,
/* apply_constraints = */ true);
// Our iteration counts and residuals will be sums of the individual
// results
std::pair<unsigned int, Real> solver_params =
this->get_linear_solve_parameters();
std::pair<unsigned int, Real> totalrval = std::make_pair(0,0.0);
for (unsigned int i=0; i != this->qoi.size(); ++i)
if (qoi_indices.has_index(i))
{
const std::pair<unsigned int, Real> rval =
linear_solver->adjoint_solve (*matrix, this->add_adjoint_solution(i),
this->get_adjoint_rhs(i),
solver_params.second,
solver_params.first);
totalrval.first += rval.first;
totalrval.second += rval.second;
}
this->release_linear_solver(linear_solver);
// The linear solver may not have fit our constraints exactly
#ifdef LIBMESH_ENABLE_CONSTRAINTS
for (unsigned int i=0; i != this->qoi.size(); ++i)
if (qoi_indices.has_index(i))
this->get_dof_map().enforce_adjoint_constraints_exactly
(this->get_adjoint_solution(i), i);
#endif
// Stop logging the nonlinear solve
STOP_LOG("adjoint_solve()", "ImplicitSystem");
return totalrval;
}
| virtual void libMesh::RBConstruction::allocate_data_structures | ( | ) | [protected, virtual] |
Helper function that actually allocates all the data structures required by this class.
Reimplemented in libMesh::TransientRBConstruction.
| virtual void libMesh::LinearImplicitSystem::assemble | ( | ) | [inline, virtual, inherited] |
Prepares matrix and _dof_map for matrix assembly. Does not actually assemble anything. For matrix assembly, use the assemble() in derived classes. Should be overloaded in derived classes.
Reimplemented from libMesh::ImplicitSystem.
Reimplemented in libMesh::FrequencySystem, and libMesh::NewmarkSystem.
Definition at line 104 of file linear_implicit_system.h.
Referenced by libMesh::LinearImplicitSystem::assembly(), and libMesh::LinearImplicitSystem::solve().
{ ImplicitSystem::assemble(); }
| 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.
| virtual void libMesh::RBConstruction::assemble_all_affine_operators | ( | ) | [protected, virtual] |
Assemble and store all Q_a affine operators as well as the inner-product matrix.
Reimplemented in libMesh::TransientRBConstruction.
| virtual void libMesh::RBConstruction::assemble_all_affine_vectors | ( | ) | [protected, virtual] |
Assemble and store the affine RHS vectors.
| virtual void libMesh::RBConstruction::assemble_all_output_vectors | ( | ) | [protected, virtual] |
Assemble and store the output vectors.
| void libMesh::RBConstruction::assemble_and_add_constraint_matrix | ( | SparseMatrix< Number > * | input_matrix | ) |
Assemble the constraint matrix and add it to input_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.
| void libMesh::RBConstruction::assemble_constraint_matrix | ( | SparseMatrix< Number > * | input_matrix | ) |
Assemble the constraint matrix and store it in input_matrix.
| 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.
| 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.
| virtual void libMesh::RBConstruction::assemble_matrix_for_output_dual_solves | ( | ) | [protected, virtual] |
Define the matrix assembly for the output residual dual norm solves. By default we use the inner product matrix for steady state problems.
Reimplemented in libMesh::TransientRBConstruction.
| virtual void libMesh::RBConstruction::assemble_misc_matrices | ( | ) | [protected, virtual] |
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.
| void libMesh::ExplicitSystem::assemble_qoi | ( | const QoISet & | qoi_indices = QoISet() | ) | [virtual, inherited] |
Prepares qoi for quantity of interest assembly, then calls user qoi function. Can be overloaded in derived classes.
Reimplemented from libMesh::System.
Reimplemented in libMesh::FEMSystem.
Definition at line 89 of file explicit_system.C.
References libMesh::System::assemble_qoi(), libMesh::QoISet::has_index(), and libMesh::System::qoi.
{
// The user quantity of interest assembly gets to expect to
// accumulate on initially zero values
for (unsigned int i=0; i != qoi.size(); ++i)
if (qoi_indices.has_index(i))
qoi[i] = 0;
Parent::assemble_qoi (qoi_indices);
}
| void libMesh::ExplicitSystem::assemble_qoi_derivative | ( | const QoISet & | qoi_indices = QoISet(), |
| bool | include_liftfunc = true, |
||
| bool | apply_constraints = true |
||
| ) | [virtual, inherited] |
Prepares adjoint_rhs for quantity of interest derivative assembly, then calls user qoi derivative function. Can be overloaded in derived classes.
Reimplemented from libMesh::System.
Reimplemented in libMesh::FEMSystem.
Definition at line 102 of file explicit_system.C.
References libMesh::System::add_adjoint_rhs(), libMesh::System::assemble_qoi_derivative(), libMesh::QoISet::has_index(), libMesh::System::qoi, and libMesh::NumericVector< T >::zero().
Referenced by libMesh::ImplicitSystem::adjoint_solve(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().
{
// The user quantity of interest derivative assembly gets to expect
// to accumulate on initially zero vectors
for (unsigned int i=0; i != qoi.size(); ++i)
if (qoi_indices.has_index(i))
this->add_adjoint_rhs(i).zero();
Parent::assemble_qoi_derivative (qoi_indices, include_liftfunc,
apply_constraints);
}
| void libMesh::ImplicitSystem::assemble_residual_derivatives | ( | const ParameterVector & | parameters | ) | [virtual, inherited] |
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 overloaded in derived classes.
Reimplemented from libMesh::System.
Definition at line 660 of file implicit_system.C.
References libMesh::System::add_sensitivity_rhs(), libMesh::ImplicitSystem::assembly(), libMesh::NumericVector< T >::close(), libMesh::Real, libMesh::ExplicitSystem::rhs, libMesh::ParameterVector::size(), and libMesh::TOLERANCE.
Referenced by libMesh::ImplicitSystem::sensitivity_solve().
{
Real deltap = TOLERANCE;
ParameterVector& parameters =
const_cast<ParameterVector&>(parameters_in);
const unsigned int Np = cast_int<unsigned int>
(parameters.size());
for (unsigned int p=0; p != Np; ++p)
{
NumericVector<Number> &sensitivity_rhs = this->add_sensitivity_rhs(p);
// Approximate -(partial R / partial p) by
// (R(p-dp) - R(p+dp)) / (2*dp)
Number old_parameter = *parameters[p];
*parameters[p] -= deltap;
this->assembly(true, false, true);
this->rhs->close();
sensitivity_rhs = *this->rhs;
*parameters[p] = old_parameter + deltap;
this->assembly(true, false, true);
this->rhs->close();
sensitivity_rhs -= *this->rhs;
sensitivity_rhs /= (2*deltap);
sensitivity_rhs.close();
*parameters[p] = old_parameter;
}
}
| void libMesh::LinearImplicitSystem::assembly | ( | bool | get_residual, |
| bool | get_jacobian, | ||
| bool | apply_heterogeneous_constraints = false |
||
| ) | [virtual, inherited] |
Assembles a residual in rhs and/or a jacobian in matrix, as requested.
Reimplemented from libMesh::ImplicitSystem.
Definition at line 379 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.
| 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 1779 of file system.C.
References libMesh::System::_assemble_system_function, libMesh::System::_assemble_system_object, libMesh::libmesh_assert(), and libMesh::out.
{
libmesh_assert(fptr);
if (_assemble_system_object != NULL)
{
libmesh_here();
libMesh::out << "WARNING: Cannot specify both assembly function and object!"
<< std::endl;
_assemble_system_object = NULL;
}
_assemble_system_function = fptr;
}
| 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 1798 of file system.C.
References libMesh::System::_assemble_system_function, libMesh::System::_assemble_system_object, and libMesh::out.
{
if (_assemble_system_function != NULL)
{
libmesh_here();
libMesh::out << "WARNING: Cannot specify both assembly object and function!"
<< std::endl;
_assemble_system_function = NULL;
}
_assemble_system_object = &assemble_in;
}
| void libMesh::System::attach_constraint_function | ( | void | fptrEquationSystems &es,const std::string &name | ) | [inherited] |
Register a user function for imposing constraints.
Definition at line 1814 of file system.C.
References libMesh::System::_constrain_system_function, libMesh::System::_constrain_system_object, libMesh::libmesh_assert(), and libMesh::out.
{
libmesh_assert(fptr);
if (_constrain_system_object != NULL)
{
libmesh_here();
libMesh::out << "WARNING: Cannot specify both constraint function and object!"
<< std::endl;
_constrain_system_object = NULL;
}
_constrain_system_function = fptr;
}
| void libMesh::System::attach_constraint_object | ( | System::Constraint & | constrain | ) | [inherited] |
Register a user object for imposing constraints.
Definition at line 1833 of file system.C.
References libMesh::System::_constrain_system_function, libMesh::System::_constrain_system_object, and libMesh::out.
{
if (_constrain_system_function != NULL)
{
libmesh_here();
libMesh::out << "WARNING: Cannot specify both constraint object and function!"
<< std::endl;
_constrain_system_function = NULL;
}
_constrain_system_object = &constrain;
}
| 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 1744 of file system.C.
References libMesh::System::_init_system_function, libMesh::System::_init_system_object, libMesh::libmesh_assert(), and libMesh::out.
{
libmesh_assert(fptr);
if (_init_system_object != NULL)
{
libmesh_here();
libMesh::out << "WARNING: Cannot specify both initialization function and object!"
<< std::endl;
_init_system_object = NULL;
}
_init_system_function = fptr;
}
| 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 1763 of file system.C.
References libMesh::System::_init_system_function, libMesh::System::_init_system_object, and libMesh::out.
{
if (_init_system_function != NULL)
{
libmesh_here();
libMesh::out << "WARNING: Cannot specify both initialization object and function!"
<< std::endl;
_init_system_function = NULL;
}
_init_system_object = &init_in;
}
| 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 1885 of file system.C.
References libMesh::System::_qoi_evaluate_derivative_function, libMesh::System::_qoi_evaluate_derivative_object, libMesh::libmesh_assert(), and libMesh::out.
{
libmesh_assert(fptr);
if (_qoi_evaluate_derivative_object != NULL)
{
libmesh_here();
libMesh::out << "WARNING: Cannot specify both QOI derivative function and object!"
<< std::endl;
_qoi_evaluate_derivative_object = NULL;
}
_qoi_evaluate_derivative_function = fptr;
}
| 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 1904 of file system.C.
References libMesh::System::_qoi_evaluate_derivative_function, libMesh::System::_qoi_evaluate_derivative_object, and libMesh::out.
{
if (_qoi_evaluate_derivative_function != NULL)
{
libmesh_here();
libMesh::out << "WARNING: Cannot specify both QOI derivative object and function!"
<< std::endl;
_qoi_evaluate_derivative_function = NULL;
}
_qoi_evaluate_derivative_object = &qoi_derivative;
}
| 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 1849 of file system.C.
References libMesh::System::_qoi_evaluate_function, libMesh::System::_qoi_evaluate_object, libMesh::libmesh_assert(), and libMesh::out.
{
libmesh_assert(fptr);
if (_qoi_evaluate_object != NULL)
{
libmesh_here();
libMesh::out << "WARNING: Cannot specify both QOI function and object!"
<< std::endl;
_qoi_evaluate_object = NULL;
}
_qoi_evaluate_function = fptr;
}
| 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 1869 of file system.C.
References libMesh::System::_qoi_evaluate_function, libMesh::System::_qoi_evaluate_object, and libMesh::out.
{
if (_qoi_evaluate_function != NULL)
{
libmesh_here();
libMesh::out << "WARNING: Cannot specify both QOI object and function!"
<< std::endl;
_qoi_evaluate_function = NULL;
}
_qoi_evaluate_object = &qoi_in;
}
| 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 NULL pointer to this function.
Definition at line 171 of file linear_implicit_system.C.
References libMesh::LinearImplicitSystem::_shell_matrix.
Referenced by libMesh::LinearImplicitSystem::detach_shell_matrix().
{
_shell_matrix = shell_matrix;
}
| 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 = NULL |
||
| ) | [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 arbitary boundary function onto the solution via L2 projections and nodal interpolations on each element.
Definition at line 678 of file system_projection.C.
{
this->boundary_project_vector(b, variables, *solution, f, g);
solution->localize(*current_local_solution);
}
| void libMesh::System::boundary_project_solution | ( | const std::set< boundary_id_type > & | b, |
| const std::vector< unsigned int > & | variables, | ||
| Number | fptrconst Point &p,const Parameters ¶meters,const std::string &sys_name,const std::string &unknown_name, | ||
| Gradient | gptrconst Point &p,const Parameters ¶meters,const std::string &sys_name,const std::string &unknown_name, | ||
| 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 654 of file system_projection.C.
{
WrappedFunction<Number> f(*this, fptr, ¶meters);
WrappedFunction<Gradient> g(*this, gptr, ¶meters);
this->boundary_project_solution(b, variables, &f, &g);
}
| 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 = NULL, |
||
| 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 722 of file system_projection.C.
References libMesh::NumericVector< T >::close(), libMesh::get_dof_map(), libMesh::Threads::parallel_for(), and libMesh::START_LOG().
{
START_LOG ("boundary_project_vector()", "System");
Threads::parallel_for
(ConstElemRange (this->get_mesh().active_local_elements_begin(),
this->get_mesh().active_local_elements_end() ),
BoundaryProjectSolution(b, variables, *this, f, g,
this->get_equation_systems().parameters,
new_vector)
);
// We don't do SCALAR dofs when just projecting the boundary, so
// we're done here.
new_vector.close();
#ifdef LIBMESH_ENABLE_CONSTRAINTS
if (is_adjoint == -1)
this->get_dof_map().enforce_constraints_exactly(*this, &new_vector);
else if (is_adjoint >= 0)
this->get_dof_map().enforce_adjoint_constraints_exactly(new_vector,
is_adjoint);
#endif
STOP_LOG("boundary_project_vector()", "System");
}
| void libMesh::System::boundary_project_vector | ( | const std::set< boundary_id_type > & | b, |
| const std::vector< unsigned int > & | variables, | ||
| Number | fptrconst Point &p,const Parameters ¶meters,const std::string &sys_name,const std::string &unknown_name, | ||
| Gradient | gptrconst Point &p,const Parameters ¶meters,const std::string &sys_name,const std::string &unknown_name, | ||
| 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 697 of file system_projection.C.
{
WrappedFunction<Number> f(*this, fptr, ¶meters);
WrappedFunction<Gradient> g(*this, gptr, ¶meters);
this->boundary_project_vector(b, variables, new_vector, &f, &g,
is_adjoint);
}
| void libMesh::RBConstructionBase< LinearImplicitSystem >::broadcast_parameters | ( | unsigned int | proc_id | ) | [inherited] |
Broadcasts parameters on processor proc_id to all processors.
| virtual UniquePtr<DGFEMContext> libMesh::RBConstruction::build_context | ( | ) | [protected, virtual] |
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.
| static UniquePtr<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.
| Real libMesh::System::calculate_norm | ( | const NumericVector< Number > & | v, |
| unsigned int | var, | ||
| FEMNormType | norm_type | ||
| ) | const [inherited] |
var in the vector v, in the specified norm (e.g. L2, L_INF, H1) Definition at line 1405 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().
{
//short circuit to save time
if(norm_type == DISCRETE_L1 ||
norm_type == DISCRETE_L2 ||
norm_type == DISCRETE_L_INF)
return discrete_var_norm(v,var,norm_type);
// Not a discrete norm
std::vector<FEMNormType> norms(this->n_vars(), L2);
std::vector<Real> weights(this->n_vars(), 0.0);
norms[var] = norm_type;
weights[var] = 1.0;
Real val = this->calculate_norm(v, SystemNorm(norms, weights));
return val;
}
| Real libMesh::System::calculate_norm | ( | const NumericVector< Number > & | v, |
| const SystemNorm & | norm | ||
| ) | const [inherited] |
v, using component_norm and component_scale to choose and weight the norms of each variable. Definition at line 1426 of file system.C.
References libMesh::System::_dof_map, std::abs(), libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), libMesh::TypeVector< T >::add_scaled(), libMesh::TypeTensor< T >::add_scaled(), libMesh::FEGenericBase< OutputType >::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::System::get_dof_map(), libMesh::System::get_mesh(), 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::MeshBase::mesh_dimension(), libMesh::System::n_vars(), libMesh::TensorTools::norm_sq(), libMesh::Real, libMesh::SERIAL, libMesh::TypeVector< T >::size(), libMesh::TypeTensor< T >::size(), libMesh::NumericVector< T >::size(), libMesh::TypeVector< T >::size_sq(), libMesh::TypeTensor< T >::size_sq(), libMesh::START_LOG(), 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().
{
// This function must be run on all processors at once
parallel_object_only();
START_LOG ("calculate_norm()", "System");
// Zero the norm before summation
Real v_norm = 0.;
if (norm.is_discrete())
{
STOP_LOG ("calculate_norm()", "System");
//Check to see if all weights are 1.0 and all types are equal
FEMNormType norm_type0 = norm.type(0);
unsigned int check_var = 0;
for (; check_var != this->n_vars(); ++check_var)
if((norm.weight(check_var) != 1.0) || (norm.type(check_var) != norm_type0))
break;
//All weights were 1.0 so just do the full vector discrete norm
if(check_var == this->n_vars())
{
if(norm_type0 == DISCRETE_L1)
return v.l1_norm();
if(norm_type0 == DISCRETE_L2)
return v.l2_norm();
if(norm_type0 == DISCRETE_L_INF)
return v.linfty_norm();
else
libmesh_error_msg("Invalid norm_type0 = " << norm_type0);
}
for (unsigned int var=0; var != this->n_vars(); ++var)
{
// Skip any variables we don't need to integrate
if (norm.weight(var) == 0.0)
continue;
v_norm += norm.weight(var) * discrete_var_norm(v, var, norm.type(var));
}
return v_norm;
}
// Localize the potentially parallel vector
UniquePtr<NumericVector<Number> > local_v = NumericVector<Number>::build(this->comm());
local_v->init(v.size(), true, SERIAL);
v.localize (*local_v, _dof_map->get_send_list());
unsigned int dim = this->get_mesh().mesh_dimension();
// I'm not sure how best to mix Hilbert norms on some variables (for
// which we'll want to square then sum then square root) with norms
// like L_inf (for which we'll just want to take an absolute value
// and then sum).
bool using_hilbert_norm = true,
using_nonhilbert_norm = true;
// Loop over all variables
for (unsigned int var=0; var != this->n_vars(); ++var)
{
// Skip any variables we don't need to integrate
Real norm_weight_sq = norm.weight_sq(var);
if (norm_weight_sq == 0.0)
continue;
Real norm_weight = norm.weight(var);
// Check for unimplemented norms (rather than just returning 0).
FEMNormType norm_type = norm.type(var);
if((norm_type==H1) ||
(norm_type==H2) ||
(norm_type==L2) ||
(norm_type==H1_SEMINORM) ||
(norm_type==H2_SEMINORM))
{
if (!using_hilbert_norm)
libmesh_not_implemented();
using_nonhilbert_norm = false;
}
else if ((norm_type==L1) ||
(norm_type==L_INF) ||
(norm_type==W1_INF_SEMINORM) ||
(norm_type==W2_INF_SEMINORM))
{
if (!using_nonhilbert_norm)
libmesh_not_implemented();
using_hilbert_norm = false;
}
else
libmesh_not_implemented();
const FEType& fe_type = this->get_dof_map().variable_type(var);
UniquePtr<QBase> qrule =
fe_type.default_quadrature_rule (dim);
UniquePtr<FEBase> fe
(FEBase::build(dim, fe_type));
fe->attach_quadrature_rule (qrule.get());
const std::vector<Real>& JxW = fe->get_JxW();
const std::vector<std::vector<Real> >* phi = NULL;
if (norm_type == H1 ||
norm_type == H2 ||
norm_type == L2 ||
norm_type == L1 ||
norm_type == L_INF)
phi = &(fe->get_phi());
const std::vector<std::vector<RealGradient> >* dphi = NULL;
if (norm_type == H1 ||
norm_type == H2 ||
norm_type == H1_SEMINORM ||
norm_type == W1_INF_SEMINORM)
dphi = &(fe->get_dphi());
#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
const std::vector<std::vector<RealTensor> >* d2phi = NULL;
if (norm_type == H2 ||
norm_type == H2_SEMINORM ||
norm_type == W2_INF_SEMINORM)
d2phi = &(fe->get_d2phi());
#endif
std::vector<dof_id_type> dof_indices;
// Begin the loop over the elements
MeshBase::const_element_iterator el =
this->get_mesh().active_local_elements_begin();
const MeshBase::const_element_iterator end_el =
this->get_mesh().active_local_elements_end();
for ( ; el != end_el; ++el)
{
const Elem* elem = *el;
fe->reinit (elem);
this->get_dof_map().dof_indices (elem, dof_indices, var);
const unsigned int n_qp = qrule->n_points();
const unsigned int n_sf = cast_int<unsigned int>
(dof_indices.size());
// Begin the loop over the Quadrature points.
for (unsigned int qp=0; qp<n_qp; qp++)
{
if (norm_type == L1)
{
Number u_h = 0.;
for (unsigned int i=0; i != n_sf; ++i)
u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
v_norm += norm_weight *
JxW[qp] * std::abs(u_h);
}
if (norm_type == L_INF)
{
Number u_h = 0.;
for (unsigned int i=0; i != n_sf; ++i)
u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
v_norm = std::max(v_norm, norm_weight * std::abs(u_h));
}
if (norm_type == H1 ||
norm_type == H2 ||
norm_type == L2)
{
Number u_h = 0.;
for (unsigned int i=0; i != n_sf; ++i)
u_h += (*phi)[i][qp] * (*local_v)(dof_indices[i]);
v_norm += norm_weight_sq *
JxW[qp] * TensorTools::norm_sq(u_h);
}
if (norm_type == H1 ||
norm_type == H2 ||
norm_type == H1_SEMINORM)
{
Gradient grad_u_h;
for (unsigned int i=0; i != n_sf; ++i)
grad_u_h.add_scaled((*dphi)[i][qp], (*local_v)(dof_indices[i]));
v_norm += norm_weight_sq *
JxW[qp] * grad_u_h.size_sq();
}
if (norm_type == W1_INF_SEMINORM)
{
Gradient grad_u_h;
for (unsigned int i=0; i != n_sf; ++i)
grad_u_h.add_scaled((*dphi)[i][qp], (*local_v)(dof_indices[i]));
v_norm = std::max(v_norm, norm_weight * grad_u_h.size());
}
#ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
if (norm_type == H2 ||
norm_type == H2_SEMINORM)
{
Tensor hess_u_h;
for (unsigned int i=0; i != n_sf; ++i)
hess_u_h.add_scaled((*d2phi)[i][qp], (*local_v)(dof_indices[i]));
v_norm += norm_weight_sq *
JxW[qp] * hess_u_h.size_sq();
}
if (norm_type == W2_INF_SEMINORM)
{
Tensor hess_u_h;
for (unsigned int i=0; i != n_sf; ++i)
hess_u_h.add_scaled((*d2phi)[i][qp], (*local_v)(dof_indices[i]));
v_norm = std::max(v_norm, norm_weight * hess_u_h.size());
}
#endif
}
}
}
if (using_hilbert_norm)
{
this->comm().sum(v_norm);
v_norm = std::sqrt(v_norm);
}
else
{
this->comm().max(v_norm);
}
STOP_LOG ("calculate_norm()", "System");
return v_norm;
}
| void libMesh::RBConstruction::check_convergence | ( | ) | [protected] |
Check if the linear solver reports convergence. Throw an error when that is not the case.
| virtual void libMesh::RBConstruction::clear | ( | ) | [virtual] |
Clear all the data structures associated with the system.
Reimplemented from libMesh::RBConstructionBase< LinearImplicitSystem >.
Reimplemented in libMesh::RBEIMConstruction, libMesh::TransientRBConstruction, and libMesh::TransientSystem< RBConstruction >.
| const Parallel::Communicator& libMesh::ParallelObject::comm | ( | ) | const [inline, inherited] |
Parallel::Communicator object used by this mesh. Definition at line 86 of file parallel_object.h.
References libMesh::ParallelObject::_communicator.
Referenced by libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_residual(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::MetisPartitioner::_do_partition(), libMesh::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), 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::ImplicitSystem::add_matrix(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::bounding_box(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::MeshRefinement::coarsen_elements(), 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::MeshTools::correct_node_proc_ids(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshSetSystem_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), 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::ImplicitSystem::get_linear_solver(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::ParallelMesh::libmesh_assert_valid_parallel_flags(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::FEMSystem::mesh_position_set(), libMesh::MeshSerializer::MeshSerializer(), libMesh::ParallelMesh::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::ParallelMesh::parallel_max_elem_id(), libMesh::ParallelMesh::parallel_max_node_id(), libMesh::ParallelMesh::parallel_n_elem(), libMesh::ParallelMesh::parallel_n_nodes(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::System::project_vector(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), 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(), 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::MeshRefinement::refine_elements(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id(), libMesh::MeshRefinement::test_level_one(), libMesh::MeshRefinement::test_unflagged(), libMesh::MeshTools::total_weight(), libMesh::NameBasedIO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::write(), libMesh::LegacyXdrIO::write_mesh(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), and libMesh::DivaIO::write_stream().
{ return _communicator; }
| bool libMesh::System::compare | ( | const System & | other_system, |
| const Real | threshold, | ||
| const bool | verbose | ||
| ) | const [virtual, inherited] |
true when the other system contains identical data, up to the given threshold. Outputs some diagnostic info when verbose is set. Definition at line 539 of file system.C.
References libMesh::System::_is_initialized, libMesh::System::_sys_name, libMesh::System::_vectors, libMesh::System::get_vector(), libMesh::libmesh_assert(), libMesh::System::n_vectors(), libMesh::System::name(), libMesh::out, and libMesh::System::solution.
Referenced by libMesh::EquationSystems::compare().
{
// we do not care for matrices, but for vectors
libmesh_assert (_is_initialized);
libmesh_assert (other_system._is_initialized);
if (verbose)
{
libMesh::out << " Systems \"" << _sys_name << "\"" << std::endl;
libMesh::out << " comparing matrices not supported." << std::endl;
libMesh::out << " comparing names...";
}
// compare the name: 0 means identical
const int name_result = _sys_name.compare(other_system.name());
if (verbose)
{
if (name_result == 0)
libMesh::out << " identical." << std::endl;
else
libMesh::out << " names not identical." << std::endl;
libMesh::out << " comparing solution vector...";
}
// compare the solution: -1 means identical
const int solu_result = solution->compare (*other_system.solution.get(),
threshold);
if (verbose)
{
if (solu_result == -1)
libMesh::out << " identical up to threshold." << std::endl;
else
libMesh::out << " first difference occured at index = "
<< solu_result << "." << std::endl;
}
// safety check, whether we handle at least the same number
// of vectors
std::vector<int> ov_result;
if (this->n_vectors() != other_system.n_vectors())
{
if (verbose)
{
libMesh::out << " Fatal difference. This system handles "
<< this->n_vectors() << " add'l vectors," << std::endl
<< " while the other system handles "
<< other_system.n_vectors()
<< " add'l vectors." << std::endl
<< " Aborting comparison." << std::endl;
}
return false;
}
else if (this->n_vectors() == 0)
{
// there are no additional vectors...
ov_result.clear ();
}
else
{
// compare other vectors
for (const_vectors_iterator pos = _vectors.begin();
pos != _vectors.end(); ++pos)
{
if (verbose)
libMesh::out << " comparing vector \""
<< pos->first << "\" ...";
// assume they have the same name
const NumericVector<Number>& other_system_vector =
other_system.get_vector(pos->first);
ov_result.push_back(pos->second->compare (other_system_vector,
threshold));
if (verbose)
{
if (ov_result[ov_result.size()-1] == -1)
libMesh::out << " identical up to threshold." << std::endl;
else
libMesh::out << " first difference occured at" << std::endl
<< " index = " << ov_result[ov_result.size()-1] << "." << std::endl;
}
}
} // finished comparing additional vectors
bool overall_result;
// sum up the results
if ((name_result==0) && (solu_result==-1))
{
if (ov_result.size()==0)
overall_result = true;
else
{
bool ov_identical;
unsigned int n = 0;
do
{
ov_identical = (ov_result[n]==-1);
n++;
}
while (ov_identical && n<ov_result.size());
overall_result = ov_identical;
}
}
else
overall_result = false;
if (verbose)
{
libMesh::out << " finished comparisons, ";
if (overall_result)
libMesh::out << "found no differences." << std::endl << std::endl;
else
libMesh::out << "found differences." << std::endl << std::endl;
}
return overall_result;
}
| virtual void libMesh::RBConstruction::compute_Fq_representor_innerprods | ( | bool | compute_inner_products = true | ) | [protected, virtual] |
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.
| 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.
| virtual void libMesh::RBConstruction::compute_output_dual_innerprods | ( | ) | [protected, virtual] |
Compute and store the dual norm of each output functional.
| Number libMesh::System::current_solution | ( | const dof_id_type | global_dof_number | ) | const [inherited] |
Definition at line 184 of file system.C.
References libMesh::System::_dof_map, and libMesh::System::current_local_solution.
Referenced by libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::HPCoarsenTest::add_projection(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::HPCoarsenTest::select_refinement(), libMesh::EnsightIO::write_scalar_ascii(), and libMesh::EnsightIO::write_vector_ascii().
{
// Check the sizes
libmesh_assert_less (global_dof_number, _dof_map->n_dofs());
libmesh_assert_less (global_dof_number, current_local_solution->size());
return (*current_local_solution)(global_dof_number);
}
| void libMesh::System::deactivate | ( | ) | [inline, inherited] |
Deactivates the system. Only active systems are solved.
Definition at line 2009 of file system.h.
References libMesh::System::_active.
{
_active = false;
}
| void libMesh::LinearImplicitSystem::detach_shell_matrix | ( | void | ) | [inline, inherited] |
Detaches a shell matrix. Same as attach_shell_matrix(NULL).
Definition at line 177 of file linear_implicit_system.h.
References libMesh::LinearImplicitSystem::attach_shell_matrix().
{ attach_shell_matrix(NULL); }
| void libMesh::ImplicitSystem::disable_cache | ( | ) | [virtual, inherited] |
Assembles & solves the linear system Ax=b. Avoids use of any cached data that might affect any solve result. Should be overloaded in derived systems.
Reimplemented from libMesh::System.
Definition at line 296 of file implicit_system.C.
References libMesh::System::assemble_before_solve, libMesh::ImplicitSystem::get_linear_solver(), and libMesh::LinearSolver< T >::reuse_preconditioner().
{
this->assemble_before_solve = true;
this->get_linear_solver()->reuse_preconditioner(false);
}
| void libMesh::ReferenceCounter::disable_print_counter_info | ( | ) | [static, inherited] |
Definition at line 106 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
Referenced by libMesh::LibMeshInit::LibMeshInit().
{
_enable_print_counter = false;
return;
}
| void libMesh::ReferenceCounter::disable_print_counter_info | ( | ) | [static, inherited] |
Definition at line 106 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
Referenced by libMesh::LibMeshInit::LibMeshInit().
{
_enable_print_counter = false;
return;
}
| void libMesh::ReferenceCounter::enable_print_counter_info | ( | ) | [static, inherited] |
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.
{
_enable_print_counter = true;
return;
}
| void libMesh::ReferenceCounter::enable_print_counter_info | ( | ) | [static, inherited] |
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.
{
_enable_print_counter = true;
return;
}
| virtual void libMesh::RBConstruction::enrich_RB_space | ( | ) | [protected, virtual] |
Add a new basis function to the RB space. This is called during train_reduced_basis.
Reimplemented in libMesh::TransientRBConstruction, and libMesh::RBEIMConstruction.
| Real libMesh::LinearImplicitSystem::final_linear_residual | ( | ) | const [inline, inherited] |
Returns the final residual for the linear system solve.
Definition at line 161 of file linear_implicit_system.h.
References libMesh::LinearImplicitSystem::_final_linear_residual.
{ return _final_linear_residual; }
| void libMesh::ImplicitSystem::forward_qoi_parameter_sensitivity | ( | const QoISet & | qoi_indices, |
| const ParameterVector & | parameters, | ||
| SensitivityData & | sensitivities | ||
| ) | [virtual, inherited] |
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 838 of file implicit_system.C.
References libMesh::SensitivityData::allocate_data(), libMesh::QoISet::has_index(), libMesh::Real, libMesh::ParameterVector::size(), and libMesh::TOLERANCE.
{
// We currently get partial derivatives via central differencing
const Real delta_p = TOLERANCE;
ParameterVector& parameters =
const_cast<ParameterVector&>(parameters_in);
const unsigned int Np = cast_int<unsigned int>
(parameters.size());
const unsigned int Nq = cast_int<unsigned int>
(qoi.size());
// An introduction to the problem:
//
// Residual R(u(p),p) = 0
// partial R / partial u = J = system matrix
//
// This implies that:
// d/dp(R) = 0
// (partial R / partial p) +
// (partial R / partial u) * (partial u / partial p) = 0
// We first solve for (partial u / partial p) for each parameter:
// J * (partial u / partial p) = - (partial R / partial p)
this->sensitivity_solve(parameters);
// Get ready to fill in senstivities:
sensitivities.allocate_data(qoi_indices, *this, parameters);
// We use the identity:
// dq/dp = (partial q / partial p) + (partial q / partial u) *
// (partial u / partial p)
// We get (partial q / partial u) from the user
this->assemble_qoi_derivative(qoi_indices,
/* include_liftfunc = */ true,
/* apply_constraints = */ false);
// FIXME: what do we do with adjoint boundary conditions here?
// We don't need these to be closed() in this function, but libMesh
// standard practice is to have them closed() by the time the
// function exits
for (unsigned int i=0; i != this->qoi.size(); ++i)
if (qoi_indices.has_index(i))
this->get_adjoint_rhs(i).close();
for (unsigned int j=0; j != Np; ++j)
{
// (partial q / partial p) ~= (q(p+dp)-q(p-dp))/(2*dp)
Number old_parameter = *parameters[j];
*parameters[j] = old_parameter - delta_p;
this->assemble_qoi();
std::vector<Number> qoi_minus = this->qoi;
*parameters[j] = old_parameter + delta_p;
this->assemble_qoi();
std::vector<Number>& qoi_plus = this->qoi;
std::vector<Number> partialq_partialp(Nq, 0);
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
partialq_partialp[i] = (qoi_plus[i] - qoi_minus[i]) / (2.*delta_p);
// Don't leave the parameter changed
*parameters[j] = old_parameter;
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
sensitivities[i][j] = partialq_partialp[i] +
this->get_adjoint_rhs(i).dot(this->get_sensitivity_solution(j));
}
// All parameters have been reset.
// We didn't cache the original rhs or matrix for memory reasons,
// but we can restore them to a state consistent solution -
// principle of least surprise.
this->assembly(true, true);
this->rhs->close();
this->matrix->close();
this->assemble_qoi(qoi_indices);
}
| 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, NumericVector< Number > * > & | training_parameters_in, | ||
| unsigned int | n_training_samples_in, | ||
| const RBParameters & | min_parameters, | ||
| const RBParameters & | max_parameters, | ||
| bool | serial_training_set = false |
||
| ) | [static, protected, inherited] |
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.
| 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, 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, protected, inherited] |
Static helper function for generating a randomized set of parameters.
| NumericVector< Number > & libMesh::System::get_adjoint_rhs | ( | unsigned int | i = 0 | ) | [inherited] |
Definition at line 1058 of file system.C.
References libMesh::System::get_vector().
Referenced by libMesh::ImplicitSystem::adjoint_solve(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().
{
std::ostringstream adjoint_rhs_name;
adjoint_rhs_name << "adjoint_rhs" << i;
return this->get_vector(adjoint_rhs_name.str());
}
| const NumericVector< Number > & libMesh::System::get_adjoint_rhs | ( | unsigned int | i = 0 | ) | const [inherited] |
Definition at line 1068 of file system.C.
References libMesh::System::get_vector().
{
std::ostringstream adjoint_rhs_name;
adjoint_rhs_name << "adjoint_rhs" << i;
return this->get_vector(adjoint_rhs_name.str());
}
| NumericVector< Number > & libMesh::System::get_adjoint_solution | ( | unsigned int | i = 0 | ) | [inherited] |
Definition at line 996 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(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().
{
std::ostringstream adjoint_name;
adjoint_name << "adjoint_solution" << i;
return this->get_vector(adjoint_name.str());
}
| const NumericVector< Number > & libMesh::System::get_adjoint_solution | ( | unsigned int | i = 0 | ) | const [inherited] |
Definition at line 1006 of file system.C.
References libMesh::System::get_vector().
{
std::ostringstream adjoint_name;
adjoint_name << "adjoint_solution" << i;
return this->get_vector(adjoint_name.str());
}
| 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.
| 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 1285 of file system.C.
References libMesh::System::_variable_numbers, and libMesh::System::n_vars().
{
all_variable_numbers.resize(n_vars());
// Make sure the variable exists
std::map<std::string, unsigned short int>::const_iterator
it = _variable_numbers.begin();
std::map<std::string, unsigned short int>::const_iterator
it_end = _variable_numbers.end();
unsigned int count = 0;
for( ; it != it_end; ++it)
{
all_variable_numbers[count] = it->second;
count++;
}
}
| 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.
| SparseMatrix<Number>* libMesh::RBConstruction::get_Aq | ( | unsigned int | q | ) |
Get a pointer to Aq.
| static Real libMesh::RBParametrized::get_closest_value | ( | Real | value, |
| const std::vector< Real > & | list_of_values | ||
| ) | [static, inherited] |
Helper function that returns the closest entry to value from list_of_values.
| bool libMesh::RBConstruction::get_convergence_assertion_flag | ( | ) | const [protected] |
Getter for the flag determining if convergence should be checked after each solve.
| 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 399 of file rb_construction.h.
References delta_N.
{ return delta_N; }
| 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.
| 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.
| 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.
| const DofMap & libMesh::System::get_dof_map | ( | ) | const [inline, inherited] |
_dof_map. Definition at line 1977 of file system.h.
References libMesh::System::_dof_map.
Referenced by libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_residual(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::HPCoarsenTest::add_projection(), libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::ImplicitSystem::adjoint_solve(), libMesh::UnsteadySolver::advance_timestep(), libMesh::EquationSystems::allgather(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_solution_vector(), libMesh::System::calculate_norm(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), DMCreateDomainDecomposition_libMesh(), DMCreateFieldDecomposition_libMesh(), DMlibMeshFunction(), DMlibMeshSetSystem_libMesh(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::System::get_info(), libMesh::EquationSystems::get_solution(), libMesh::SystemSubsetBySubdomain::init(), libMesh::UnsteadySolver::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ImplicitSystem::init_matrices(), libMesh::CondensedEigenSystem::initialize_condensed_dofs(), libMesh::System::local_dof_indices(), libMesh::DofMap::max_constraint_error(), libMesh::DGFEMContext::neighbor_side_fe_reinit(), libMesh::UnsteadySolver::old_nonlinear_solution(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::ProjectSolution::operator()(), libMesh::ProjectFEMSolution::operator()(), libMesh::BoundaryProjectSolution::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::project_vector(), libMesh::System::re_update(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::UnsteadySolver::reinit(), libMesh::ImplicitSystem::reinit(), libMesh::EigenSystem::reinit(), libMesh::EquationSystems::reinit(), libMesh::System::reinit_constraints(), libMesh::UnsteadySolver::retrieve_timestep(), libMesh::HPCoarsenTest::select_refinement(), libMesh::ImplicitSystem::sensitivity_solve(), libMesh::NewtonSolver::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().
{
return *_dof_map;
}
| DofMap & libMesh::System::get_dof_map | ( | ) | [inline, inherited] |
_dof_map. Definition at line 1985 of file system.h.
References libMesh::System::_dof_map.
{
return *_dof_map;
}
| const EquationSystems& libMesh::System::get_equation_systems | ( | ) | const [inline, inherited] |
Definition at line 715 of file system.h.
References libMesh::System::_equation_systems.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::NewmarkSystem::clear(), libMesh::FrequencySystem::clear_all(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::ImplicitSystem::get_linear_solve_parameters(), libMesh::FrequencySystem::init_data(), libMesh::FrequencySystem::n_frequencies(), libMesh::System::project_vector(), libMesh::FrequencySystem::set_current_frequency(), libMesh::FrequencySystem::set_frequencies(), libMesh::FrequencySystem::set_frequencies_by_range(), libMesh::FrequencySystem::set_frequencies_by_steps(), libMesh::NewmarkSystem::set_newmark_parameters(), libMesh::NonlinearImplicitSystem::set_solver_parameters(), libMesh::CondensedEigenSystem::solve(), libMesh::EigenSystem::solve(), libMesh::LinearImplicitSystem::solve(), libMesh::FrequencySystem::solve(), and libMesh::WrappedFunction< Output >::WrappedFunction().
{ return _equation_systems; }
| EquationSystems& libMesh::System::get_equation_systems | ( | ) | [inline, inherited] |
Definition at line 720 of file system.h.
References libMesh::System::_equation_systems.
{ return _equation_systems; }
| numeric_index_type libMesh::RBConstructionBase< LinearImplicitSystem >::get_first_local_training_index | ( | ) | const [inherited] |
Get the first local index of the training parameters.
| NumericVector<Number>* libMesh::RBConstruction::get_Fq | ( | unsigned int | q | ) |
Get a pointer to Fq.
| static void libMesh::RBConstructionBase< LinearImplicitSystem >::get_global_max_error_pair | ( | const Parallel::Communicator & | communicator, |
| std::pair< unsigned int, Real > & | error_pair | ||
| ) | [static, protected, inherited] |
Static function to return the error pair (index,error) that is corresponds to the largest error on all processors.
| const RBParameters& libMesh::RBConstruction::get_greedy_parameter | ( | unsigned int | i | ) |
Return the parameters chosen during the i^th step of the Greedy algorithm.
| std::string libMesh::ReferenceCounter::get_info | ( | ) | [static, inherited] |
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().
{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
std::ostringstream oss;
oss << '\n'
<< " ---------------------------------------------------------------------------- \n"
<< "| Reference count information |\n"
<< " ---------------------------------------------------------------------------- \n";
for (Counts::iterator it = _counts.begin();
it != _counts.end(); ++it)
{
const std::string name(it->first);
const unsigned int creations = it->second.first;
const unsigned int destructions = it->second.second;
oss << "| " << name << " reference count information:\n"
<< "| Creations: " << creations << '\n'
<< "| Destructions: " << destructions << '\n';
}
oss << " ---------------------------------------------------------------------------- \n";
return oss.str();
#else
return "";
#endif
}
| std::string libMesh::ReferenceCounter::get_info | ( | ) | [static, inherited] |
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().
{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
std::ostringstream oss;
oss << '\n'
<< " ---------------------------------------------------------------------------- \n"
<< "| Reference count information |\n"
<< " ---------------------------------------------------------------------------- \n";
for (Counts::iterator it = _counts.begin();
it != _counts.end(); ++it)
{
const std::string name(it->first);
const unsigned int creations = it->second.first;
const unsigned int destructions = it->second.second;
oss << "| " << name << " reference count information:\n"
<< "| Creations: " << creations << '\n'
<< "| Destructions: " << destructions << '\n';
}
oss << " ---------------------------------------------------------------------------- \n";
return oss.str();
#else
return "";
#endif
}
| std::string libMesh::System::get_info | ( | ) | const [inherited] |
Definition at line 1660 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().
{
std::ostringstream oss;
const std::string& sys_name = this->name();
oss << " System #" << this->number() << ", \"" << sys_name << "\"\n"
<< " Type \"" << this->system_type() << "\"\n"
<< " Variables=";
for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
{
const VariableGroup &vg_description (this->variable_group(vg));
if (vg_description.n_variables() > 1) oss << "{ ";
for (unsigned int vn=0; vn<vg_description.n_variables(); vn++)
oss << "\"" << vg_description.name(vn) << "\" ";
if (vg_description.n_variables() > 1) oss << "} ";
}
oss << '\n';
oss << " Finite Element Types=";
#ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
oss << "\""
<< Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().family)
<< "\" ";
#else
for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
{
oss << "\""
<< Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().family)
<< "\", \""
<< Utility::enum_to_string<FEFamily>(this->get_dof_map().variable_group(vg).type().radial_family)
<< "\" ";
}
oss << '\n' << " Infinite Element Mapping=";
for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
oss << "\""
<< Utility::enum_to_string<InfMapType>(this->get_dof_map().variable_group(vg).type().inf_map)
<< "\" ";
#endif
oss << '\n';
oss << " Approximation Orders=";
for (unsigned int vg=0; vg<this->n_variable_groups(); vg++)
{
#ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
oss << "\""
<< Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().order)
<< "\" ";
#else
oss << "\""
<< Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().order)
<< "\", \""
<< Utility::enum_to_string<Order>(this->get_dof_map().variable_group(vg).type().radial_order)
<< "\" ";
#endif
}
oss << '\n';
oss << " n_dofs()=" << this->n_dofs() << '\n';
oss << " n_local_dofs()=" << this->n_local_dofs() << '\n';
#ifdef LIBMESH_ENABLE_CONSTRAINTS
oss << " n_constrained_dofs()=" << this->n_constrained_dofs() << '\n';
oss << " n_local_constrained_dofs()=" << this->n_local_constrained_dofs() << '\n';
#endif
oss << " " << "n_vectors()=" << this->n_vectors() << '\n';
oss << " " << "n_matrices()=" << this->n_matrices() << '\n';
// oss << " " << "n_additional_matrices()=" << this->n_additional_matrices() << '\n';
oss << this->get_dof_map().get_info();
return oss.str();
}
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).
| numeric_index_type libMesh::RBConstructionBase< LinearImplicitSystem >::get_last_local_training_index | ( | ) | const [inherited] |
Get the last local index of the training parameters.
| std::pair< unsigned int, Real > libMesh::ImplicitSystem::get_linear_solve_parameters | ( | ) | const [virtual, inherited] |
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 1435 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().
{
return std::make_pair(this->get_equation_systems().parameters.get<unsigned int>("linear solver maximum iterations"),
this->get_equation_systems().parameters.get<Real>("linear solver tolerance"));
}
| LinearSolver< Number > * libMesh::LinearImplicitSystem::get_linear_solver | ( | ) | const [virtual, inherited] |
Returns a pointer to a linear solver appropriate for use in adjoint and/or sensitivity solves
Reimplemented from libMesh::ImplicitSystem.
Definition at line 366 of file linear_implicit_system.C.
References libMesh::LinearImplicitSystem::linear_solver.
{
return linear_solver.get();
}
| numeric_index_type libMesh::RBConstructionBase< LinearImplicitSystem >::get_local_n_training_samples | ( | ) | const [inherited] |
Get the total number of training samples local to this processor.
| const SparseMatrix< Number > & libMesh::ImplicitSystem::get_matrix | ( | const std::string & | mat_name | ) | const [inherited] |
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 253 of file implicit_system.C.
References libMesh::ImplicitSystem::_matrices.
Referenced by libMesh::NewmarkSystem::compute_matrix(), libMesh::EigenTimeSolver::solve(), and libMesh::NewmarkSystem::update_rhs().
{
// Make sure the matrix exists
const_matrices_iterator pos = _matrices.find (mat_name);
if (pos == _matrices.end())
libmesh_error_msg("ERROR: matrix " << mat_name << " does not exist in this system!");
return *(pos->second);
}
| SparseMatrix< Number > & libMesh::ImplicitSystem::get_matrix | ( | const std::string & | mat_name | ) | [inherited] |
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 266 of file implicit_system.C.
References libMesh::ImplicitSystem::_matrices.
{
// Make sure the matrix exists
matrices_iterator pos = _matrices.find (mat_name);
if (pos == _matrices.end())
libmesh_error_msg("ERROR: matrix " << mat_name << " does not exist in this system!");
return *(pos->second);
}
| const MeshBase & libMesh::System::get_mesh | ( | ) | const [inline, inherited] |
_mesh. Definition at line 1961 of file system.h.
References libMesh::System::_mesh.
Referenced by libMesh::ExactSolution::_compute_error(), 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::FEMContext::FEMContext(), 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::ProjectSolution::operator()(), libMesh::BoundaryProjectSolution::operator()(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::FEMSystem::postprocess(), libMesh::System::project_vector(), 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::ImplicitSystem::reinit(), libMesh::EigenSystem::reinit(), libMesh::HPSingularity::select_refinement(), libMesh::HPCoarsenTest::select_refinement(), libMesh::System::write_header(), libMesh::System::write_parallel_data(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), and libMesh::System::zero_variable().
{
return _mesh;
}
| MeshBase & libMesh::System::get_mesh | ( | ) | [inline, inherited] |
_mesh. Definition at line 1969 of file system.h.
References libMesh::System::_mesh.
{
return _mesh;
}
| unsigned int libMesh::RBParametrized::get_n_continuous_params | ( | ) | const [inherited] |
Get the number of continuous parameters.
| unsigned int libMesh::RBParametrized::get_n_discrete_params | ( | ) | const [inherited] |
Get the number of discrete parameters.
| unsigned int libMesh::RBParametrized::get_n_params | ( | ) | const [inherited] |
Get the number of parameters.
| numeric_index_type libMesh::RBConstructionBase< LinearImplicitSystem >::get_n_training_samples | ( | ) | const [inherited] |
Get the total number of training samples.
| 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 182 of file rb_construction.h.
References Nmax.
{ return Nmax; }
| SparseMatrix<Number>* libMesh::RBConstruction::get_non_dirichlet_Aq | ( | unsigned int | q | ) |
Get a pointer to non_dirichlet_Aq.
| NumericVector<Number>* libMesh::RBConstruction::get_non_dirichlet_Fq | ( | unsigned int | q | ) |
Get a pointer to non-Dirichlet Fq.
Get a pointer to non_dirichlet_inner_product_matrix. Accessing via this function, rather than directly through the class member allows us to do error checking (e.g. non_dirichlet_inner_product_matrix is not defined in low-memory mode, and we need store_non_dirichlet_operators==true).
| NumericVector<Number>* libMesh::RBConstruction::get_non_dirichlet_output_vector | ( | unsigned int | n, |
| unsigned int | q_l | ||
| ) |
Get a pointer to non-Dirichlet output vector.
| NumericVector<Number>* libMesh::RBConstruction::get_output_vector | ( | unsigned int | n, |
| unsigned int | q_l | ||
| ) |
Get a pointer to the n^th output.
| 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.
| Real libMesh::RBParametrized::get_parameter_max | ( | const std::string & | param_name | ) | const [inherited] |
Get maximum allowable value of parameter param_name.
| Real libMesh::RBParametrized::get_parameter_min | ( | const std::string & | param_name | ) | const [inherited] |
Get minimum allowable value of parameter param_name.
| std::set<std::string> libMesh::RBParametrized::get_parameter_names | ( | ) | const [inherited] |
Get a set that stores the parameter names.
| const RBParameters& libMesh::RBParametrized::get_parameters | ( | ) | const [inherited] |
Get the current parameters.
| const RBParameters& libMesh::RBParametrized::get_parameters_max | ( | ) | const [inherited] |
Get an RBParameters object that specifies the maximum allowable value for each parameter.
| const RBParameters& libMesh::RBParametrized::get_parameters_min | ( | ) | const [inherited] |
Get an RBParameters object that specifies the minimum allowable value for each parameter.
| RBParameters libMesh::RBConstructionBase< LinearImplicitSystem >::get_params_from_training_set | ( | unsigned int | index | ) | [protected, inherited] |
Return the RBParameters in index index of training set.
| virtual Real libMesh::RBConstruction::get_RB_error_bound | ( | ) | [protected, virtual] |
This function returns the RB error bound for the current parameters and is used in the Greedy algorithm to select the next parameter.
Reimplemented in libMesh::RBEIMConstruction.
Get a reference to the RBEvaluation object.
Get a reference to the RBThetaExpansion object that that belongs to rb_eval.
| NumericVector< Number > & libMesh::System::get_sensitivity_rhs | ( | unsigned int | i = 0 | ) | [inherited] |
assemble_residual_derivatives() is called.When assembled, this vector should hold -(partial R / partial p_i)
Definition at line 1088 of file system.C.
References libMesh::System::get_vector().
Referenced by libMesh::ImplicitSystem::sensitivity_solve().
{
std::ostringstream sensitivity_rhs_name;
sensitivity_rhs_name << "sensitivity_rhs" << i;
return this->get_vector(sensitivity_rhs_name.str());
}
| const NumericVector< Number > & libMesh::System::get_sensitivity_rhs | ( | unsigned int | i = 0 | ) | const [inherited] |
Definition at line 1098 of file system.C.
References libMesh::System::get_vector().
{
std::ostringstream sensitivity_rhs_name;
sensitivity_rhs_name << "sensitivity_rhs" << i;
return this->get_vector(sensitivity_rhs_name.str());
}
| NumericVector< Number > & libMesh::System::get_sensitivity_solution | ( | unsigned int | i = 0 | ) | [inherited] |
Definition at line 943 of file system.C.
References libMesh::System::get_vector().
Referenced by libMesh::ImplicitSystem::sensitivity_solve().
{
std::ostringstream sensitivity_name;
sensitivity_name << "sensitivity_solution" << i;
return this->get_vector(sensitivity_name.str());
}
| const NumericVector< Number > & libMesh::System::get_sensitivity_solution | ( | unsigned int | i = 0 | ) | const [inherited] |
Definition at line 953 of file system.C.
References libMesh::System::get_vector().
{
std::ostringstream sensitivity_name;
sensitivity_name << "sensitivity_solution" << i;
return this->get_vector(sensitivity_name.str());
}
| ShellMatrix<Number>* libMesh::LinearImplicitSystem::get_shell_matrix | ( | void | ) | [inline, inherited] |
Returns a pointer to the currently attached shell matrix, if any, or NULL else.
Definition at line 183 of file linear_implicit_system.h.
References libMesh::LinearImplicitSystem::_shell_matrix.
{ return _shell_matrix; }
| Real libMesh::RBConstruction::get_training_tolerance | ( | ) | [inline] |
Definition at line 176 of file rb_construction.h.
References training_tolerance.
{ return training_tolerance; }
| const NumericVector< Number > & libMesh::System::get_vector | ( | const std::string & | vec_name | ) | const [inherited] |
vec_name. Access is only granted when the vector is already properly initialized. Definition at line 801 of file system.C.
References libMesh::System::_vectors.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::AdaptiveTimeSolver::advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), libMesh::System::compare(), 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::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().
{
// Make sure the vector exists
const_vectors_iterator pos = _vectors.find(vec_name);
if (pos == _vectors.end())
libmesh_error_msg("ERROR: vector " << vec_name << " does not exist in this system!");
return *(pos->second);
}
| NumericVector< Number > & libMesh::System::get_vector | ( | const std::string & | vec_name | ) | [inherited] |
vec_name. Access is only granted when the vector is already properly initialized. Definition at line 814 of file system.C.
References libMesh::System::_vectors.
{
// Make sure the vector exists
vectors_iterator pos = _vectors.find(vec_name);
if (pos == _vectors.end())
libmesh_error_msg("ERROR: vector " << vec_name << " does not exist in this system!");
return *(pos->second);
}
| const NumericVector< Number > & libMesh::System::get_vector | ( | const unsigned int | vec_num | ) | const [inherited] |
vec_num (where the vectors are counted starting with 0). Definition at line 827 of file system.C.
References libMesh::libmesh_assert(), libMesh::System::vectors_begin(), and libMesh::System::vectors_end().
{
const_vectors_iterator v = vectors_begin();
const_vectors_iterator v_end = vectors_end();
unsigned int num = 0;
while((num<vec_num) && (v!=v_end))
{
num++;
++v;
}
libmesh_assert (v != v_end);
return *(v->second);
}
| NumericVector< Number > & libMesh::System::get_vector | ( | const unsigned int | vec_num | ) | [inherited] |
vec_num (where the vectors are counted starting with 0). Definition at line 843 of file system.C.
References libMesh::libmesh_assert(), libMesh::System::vectors_begin(), and libMesh::System::vectors_end().
{
vectors_iterator v = vectors_begin();
vectors_iterator v_end = vectors_end();
unsigned int num = 0;
while((num<vec_num) && (v!=v_end))
{
num++;
++v;
}
libmesh_assert (v != v_end);
return *(v->second);
}
| NumericVector< Number > & libMesh::System::get_weighted_sensitivity_adjoint_solution | ( | unsigned int | i = 0 | ) | [inherited] |
Definition at line 1028 of file system.C.
References libMesh::System::get_vector().
Referenced by libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().
{
std::ostringstream adjoint_name;
adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
return this->get_vector(adjoint_name.str());
}
| const NumericVector< Number > & libMesh::System::get_weighted_sensitivity_adjoint_solution | ( | unsigned int | i = 0 | ) | const [inherited] |
Definition at line 1038 of file system.C.
References libMesh::System::get_vector().
{
std::ostringstream adjoint_name;
adjoint_name << "weighted_sensitivity_adjoint_solution" << i;
return this->get_vector(adjoint_name.str());
}
| NumericVector< Number > & libMesh::System::get_weighted_sensitivity_solution | ( | ) | [inherited] |
Definition at line 970 of file system.C.
References libMesh::System::get_vector().
Referenced by libMesh::ImplicitSystem::weighted_sensitivity_solve().
{
return this->get_vector("weighted_sensitivity_solution");
}
| const NumericVector< Number > & libMesh::System::get_weighted_sensitivity_solution | ( | ) | const [inherited] |
Definition at line 977 of file system.C.
References libMesh::System::get_vector().
{
return this->get_vector("weighted_sensitivity_solution");
}
| virtual bool libMesh::RBConstruction::greedy_termination_test | ( | Real | training_greedy_error, |
| int | count | ||
| ) | [protected, virtual] |
Function that indicates when to terminate the Greedy basis training. Overload in subclasses to specialize.
Reimplemented in libMesh::RBEIMConstruction, and libMesh::TransientRBConstruction.
| bool libMesh::System::has_variable | ( | const std::string & | var | ) | const [inherited] |
var exists in this System Definition at line 1263 of file system.C.
References libMesh::System::_variable_numbers.
Referenced by libMesh::GMVIO::copy_nodal_solution().
{
return _variable_numbers.count(var);
}
| bool libMesh::ImplicitSystem::have_matrix | ( | const std::string & | mat_name | ) | const [inline, inherited] |
true if this System has a matrix associated with the given name, false otherwise. Definition at line 381 of file implicit_system.h.
References libMesh::ImplicitSystem::_matrices.
Referenced by libMesh::ImplicitSystem::add_matrix(), and libMesh::EigenTimeSolver::init().
{
return (_matrices.count(mat_name));
}
| bool libMesh::System::have_vector | ( | const std::string & | vec_name | ) | const [inline, inherited] |
true if this System has a vector associated with the given name, false otherwise. Definition at line 2153 of file system.h.
References libMesh::System::_vectors.
Referenced by libMesh::System::add_vector(), and libMesh::System::remove_vector().
{
return (_vectors.count(vec_name));
}
| bool libMesh::System::identify_variable_groups | ( | ) | const [inline, inherited] |
true when VariableGroup structures should be automatically identified, false otherwise. Definition at line 2129 of file system.h.
References libMesh::System::_identify_variable_groups.
Referenced by libMesh::System::add_variable().
{
return _identify_variable_groups;
}
| void libMesh::System::identify_variable_groups | ( | const bool | ivg | ) | [inline, inherited] |
Toggle automatic VariableGroup identification.
Definition at line 2137 of file system.h.
References libMesh::System::_identify_variable_groups.
{
_identify_variable_groups = ivg;
}
| void libMesh::ReferenceCounter::increment_constructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
Definition at line 163 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().
{
Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
std::pair<unsigned int, unsigned int>& p = _counts[name];
p.first++;
}
| void libMesh::ReferenceCounter::increment_constructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
Definition at line 163 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().
{
Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
std::pair<unsigned int, unsigned int>& p = _counts[name];
p.first++;
}
| void libMesh::ReferenceCounter::increment_destructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
Definition at line 176 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().
{
Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
std::pair<unsigned int, unsigned int>& p = _counts[name];
p.second++;
}
| void libMesh::ReferenceCounter::increment_destructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
Definition at line 176 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().
{
Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
std::pair<unsigned int, unsigned int>& p = _counts[name];
p.second++;
}
| void libMesh::System::init | ( | ) | [inherited] |
Initializes degrees of freedom on the current mesh. Sets the
Definition at line 227 of file system.C.
References libMesh::System::_basic_system_only, libMesh::System::init_data(), libMesh::System::n_vars(), and libMesh::System::user_initialization().
{
// First initialize any required data:
// either only the basic System data
if (_basic_system_only)
System::init_data();
// or all the derived class' data too
else
this->init_data();
// If no variables have been added to this system
// don't do anything
if(!this->n_vars())
return;
// Then call the user-provided intialization function
this->user_initialization();
}
| virtual void libMesh::RBConstruction::init_context | ( | FEMContext & | ) | [inline, protected, virtual] |
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.
Reimplemented in libMesh::RBEIMConstruction.
Definition at line 742 of file rb_construction.h.
{}
| virtual void libMesh::RBConstructionBase< LinearImplicitSystem >::init_data | ( | ) | [protected, virtual, inherited] |
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, and libMesh::TransientSystem< RBConstruction >.
| void libMesh::ImplicitSystem::init_matrices | ( | ) | [protected, virtual, inherited] |
Initializes the matrices associated with this system.
Definition at line 105 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(), libMesh::libmesh_assert(), and libMesh::ImplicitSystem::matrix.
Referenced by libMesh::ImplicitSystem::init_data().
{
libmesh_assert(matrix);
// Check for quick return in case the system matrix
// (and by extension all the matrices) has already
// been initialized
if (matrix->initialized())
return;
// Get a reference to the DofMap
DofMap& dof_map = this->get_dof_map();
// no chance to add other matrices
_can_add_matrices = false;
// Tell the matrices about the dof map, and vice versa
for (matrices_iterator pos = _matrices.begin();
pos != _matrices.end(); ++pos)
{
SparseMatrix<Number> &m = *(pos->second);
libmesh_assert (!m.initialized());
// We want to allow repeated init() on systems, but we don't
// want to attach the same matrix to the DofMap twice
if (!dof_map.is_attached(m))
dof_map.attach_matrix (m);
}
// Compute the sparsity pattern for the current
// mesh and DOF distribution. This also updates
// additional matrices, \p DofMap now knows them
dof_map.compute_sparsity (this->get_mesh());
// Initialize matrices
for (matrices_iterator pos = _matrices.begin();
pos != _matrices.end(); ++pos)
pos->second->init ();
// Set the additional matrices to 0.
for (matrices_iterator pos = _matrices.begin();
pos != _matrices.end(); ++pos)
pos->second->zero ();
}
| 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.
| void libMesh::RBParametrized::initialize_parameters | ( | const RBParametrized & | rb_parametrized | ) | [inherited] |
Initialize the parameter ranges and set current_parameters.
| 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.
| 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 |
||
| ) | [virtual, inherited] |
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.
| bool libMesh::System::is_adjoint_already_solved | ( | ) | const [inline, inherited] |
Accessor for the adjoint_already_solved boolean
Definition at line 375 of file system.h.
References libMesh::System::adjoint_already_solved.
Referenced by libMesh::AdjointResidualErrorEstimator::estimate_error().
{ return adjoint_already_solved;}
| bool libMesh::RBParametrized::is_discrete_parameter | ( | const std::string & | mu_name | ) | const [inherited] |
Is parameter mu_name discrete?
| bool libMesh::System::is_initialized | ( | ) | [inline, inherited] |
Returns true iff this system has been initialized.
Definition at line 2017 of file system.h.
References libMesh::System::_is_initialized.
Referenced by libMesh::System::add_variable(), and libMesh::System::add_variables().
{
return _is_initialized;
}
| bool libMesh::RBConstruction::is_quiet | ( | ) | const [inline] |
Is the system in quiet mode?
Definition at line 196 of file rb_construction.h.
References quiet_mode.
{ return this->quiet_mode; }
| bool libMesh::RBConstruction::is_rb_eval_initialized | ( | ) | const |
| virtual void libMesh::RBConstruction::load_basis_function | ( | unsigned int | i | ) | [virtual] |
Load the i^th RB function into the RBConstruction solution vector.
| 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.
| virtual void libMesh::RBConstructionBase< LinearImplicitSystem >::load_training_set | ( | std::map< std::string, std::vector< Number > > & | new_training_set | ) | [virtual, inherited] |
Overwrite the training parameters with new_training_set.
| 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 1304 of file system.C.
References libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), 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().
{
// Make sure the set is clear
var_indices.clear();
std::vector<dof_id_type> dof_indices;
// Begin the loop over the elements
MeshBase::const_element_iterator el =
this->get_mesh().active_local_elements_begin();
const MeshBase::const_element_iterator end_el =
this->get_mesh().active_local_elements_end();
const dof_id_type
first_local = this->get_dof_map().first_dof(),
end_local = this->get_dof_map().end_dof();
for ( ; el != end_el; ++el)
{
const Elem* elem = *el;
this->get_dof_map().dof_indices (elem, dof_indices, var);
for(unsigned int i=0; i<dof_indices.size(); i++)
{
dof_id_type dof = dof_indices[i];
//If the dof is owned by the local processor
if(first_local <= dof && dof < end_local)
var_indices.insert(dof_indices[i]);
}
}
}
| dof_id_type libMesh::System::n_active_dofs | ( | ) | const [inline, inherited] |
Returns the number of active degrees of freedom for this System.
Definition at line 2145 of file system.h.
References libMesh::System::n_constrained_dofs(), and libMesh::System::n_dofs().
{
return this->n_dofs() - this->n_constrained_dofs();
}
| unsigned int libMesh::System::n_components | ( | ) | const [inline, inherited] |
n_vars() in the case of all scalar-valued variables. Definition at line 2049 of file system.h.
References libMesh::System::_variables, libMesh::Variable::first_scalar_number(), and libMesh::Variable::n_components().
Referenced by libMesh::System::add_variables(), and libMesh::System::project_vector().
{
if (_variables.empty())
return 0;
const Variable& last = _variables.back();
return last.first_scalar_number() + last.n_components();
}
| dof_id_type libMesh::System::n_constrained_dofs | ( | ) | const [inherited] |
Definition at line 147 of file system.C.
References libMesh::System::_dof_map.
Referenced by libMesh::System::get_info(), and libMesh::System::n_active_dofs().
{
#ifdef LIBMESH_ENABLE_CONSTRAINTS
return _dof_map->n_constrained_dofs();
#else
return 0;
#endif
}
| dof_id_type libMesh::System::n_dofs | ( | ) | const [inherited] |
Definition at line 140 of file system.C.
References libMesh::System::_dof_map.
Referenced by libMesh::System::add_vector(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::get_info(), libMesh::UnsteadySolver::init_data(), libMesh::System::init_data(), libMesh::System::n_active_dofs(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::System::project_vector(), libMesh::System::read_legacy_data(), libMesh::UnsteadySolver::reinit(), libMesh::System::reinit(), and libMesh::System::restrict_vectors().
{
return _dof_map->n_dofs();
}
| unsigned int libMesh::LinearImplicitSystem::n_linear_iterations | ( | ) | const [inline, inherited] |
Returns the number of iterations taken for the most recent linear solve.
Definition at line 156 of file linear_implicit_system.h.
References libMesh::LinearImplicitSystem::_n_linear_iterations.
{ return _n_linear_iterations; }
| dof_id_type libMesh::System::n_local_constrained_dofs | ( | ) | const [inherited] |
Definition at line 162 of file system.C.
References libMesh::System::_dof_map.
Referenced by libMesh::System::get_info().
{
#ifdef LIBMESH_ENABLE_CONSTRAINTS
return _dof_map->n_local_constrained_dofs();
#else
return 0;
#endif
}
| dof_id_type libMesh::System::n_local_dofs | ( | ) | const [inherited] |
Definition at line 177 of file system.C.
References libMesh::System::_dof_map, and libMesh::ParallelObject::processor_id().
Referenced by libMesh::System::add_vector(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::get_info(), libMesh::UnsteadySolver::init_data(), libMesh::System::init_data(), libMesh::System::project_vector(), libMesh::UnsteadySolver::reinit(), libMesh::System::reinit(), and libMesh::System::restrict_vectors().
{
return _dof_map->n_dofs_on_processor (this->processor_id());
}
| unsigned int libMesh::ImplicitSystem::n_matrices | ( | ) | const [inline, virtual, inherited] |
Reimplemented from libMesh::System.
Definition at line 388 of file implicit_system.h.
References libMesh::ImplicitSystem::_matrices.
{
return cast_int<unsigned int>(_matrices.size());
}
| static unsigned int libMesh::ReferenceCounter::n_objects | ( | ) | [inline, static, inherited] |
Prints the number of outstanding (created, but not yet destroyed) objects.
Definition at line 79 of file reference_counter.h.
References libMesh::ReferenceCounter::_n_objects.
Referenced by libMesh::LibMeshInit::~LibMeshInit().
{ return _n_objects; }
| static unsigned int libMesh::ReferenceCounter::n_objects | ( | ) | [inline, static, inherited] |
Prints the number of outstanding (created, but not yet destroyed) objects.
Definition at line 79 of file reference_counter.h.
References libMesh::ReferenceCounter::_n_objects.
Referenced by libMesh::LibMeshInit::~LibMeshInit().
{ return _n_objects; }
| processor_id_type libMesh::ParallelObject::n_processors | ( | ) | const [inline, inherited] |
Definition at line 92 of file parallel_object.h.
References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::size().
Referenced by libMesh::ParmetisPartitioner::_do_repartition(), libMesh::ParallelMesh::add_elem(), libMesh::ParallelMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::ParallelMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::UnstructuredMesh::create_pid_mesh(), 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::EquationSystems::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshTools::processor_bounding_box(), libMesh::System::project_vector(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::Partitioner::repartition(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::BoundaryInfo::sync(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::CheckpointIO::write(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().
{ return cast_int<processor_id_type>(_communicator.size()); }
| unsigned int libMesh::System::n_variable_groups | ( | ) | const [inline, inherited] |
VariableGroup variable groups in the system Definition at line 2041 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().
{
return cast_int<unsigned int>(_variable_groups.size());
}
| unsigned int libMesh::System::n_vars | ( | ) | const [inline, inherited] |
Definition at line 2033 of file system.h.
References libMesh::System::_variables.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::DiffContext::add_localized_vector(), libMesh::System::add_variable(), libMesh::System::add_variables(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_solution_vector(), 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::FEMContext::FEMContext(), libMesh::System::get_all_variable_numbers(), libMesh::EquationSystems::get_solution(), libMesh::System::init(), libMesh::FEMSystem::init_context(), libMesh::DGFEMContext::neighbor_side_fe_reinit(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::ProjectSolution::operator()(), libMesh::petsc_auto_fieldsplit(), libMesh::FEMContext::pre_fe_reinit(), libMesh::System::project_vector(), 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::System::reinit(), libMesh::HPCoarsenTest::select_refinement(), 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().
{
return cast_int<unsigned int>(_variables.size());
}
| unsigned int libMesh::System::n_vectors | ( | ) | const [inline, inherited] |
_vectors map Definition at line 2161 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().
{
return cast_int<unsigned int>(_vectors.size());
}
| const std::string & libMesh::System::name | ( | ) | const [inline, inherited] |
Definition at line 1945 of file system.h.
References libMesh::System::_sys_name.
Referenced by libMesh::System::compare(), libMesh::ContinuationSystem::ContinuationSystem(), DMlibMeshSetUpName_Private(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::ExactSolution::ExactSolution(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::System::get_info(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::NewtonSolver::init(), libMesh::TimeSolver::init_data(), libMesh::petsc_auto_fieldsplit(), libMesh::TimeSolver::reinit(), libMesh::LinearImplicitSystem::solve(), libMesh::FrequencySystem::solve(), libMesh::NonlinearImplicitSystem::solve(), libMesh::System::user_assembly(), libMesh::System::user_constrain(), libMesh::System::user_initialization(), libMesh::System::user_QOI(), libMesh::System::user_QOI_derivative(), libMesh::System::write_header(), libMesh::System::write_parallel_data(), and libMesh::System::write_serialized_data().
{
return _sys_name;
}
| unsigned int libMesh::System::number | ( | ) | const [inline, inherited] |
Definition at line 1953 of file system.h.
References libMesh::System::_sys_number.
Referenced by libMesh::ExactSolution::_compute_error(), libMesh::System::add_variable(), libMesh::System::add_variables(), libMesh::EquationSystems::build_solution_vector(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::System::get_info(), libMesh::System::read_legacy_data(), libMesh::System::read_parallel_data(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::HPCoarsenTest::select_refinement(), libMesh::System::write_parallel_data(), libMesh::System::write_serialized_blocked_dof_objects(), and libMesh::System::zero_variable().
{
return _sys_number;
}
| 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 2092 of file system.C.
References libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::System::get_mesh(), libMesh::libmesh_assert(), mesh, libMesh::Parallel::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::MeshBase::sub_point_locator(), and libMesh::Parallel::Communicator::verify().
{
// This function must be called on every processor; there's no
// telling where in the partition p falls.
parallel_object_only();
// And every processor had better agree about which point we're
// looking for
#ifndef NDEBUG
this->comm().verify(p);
#endif // NDEBUG
// Get a reference to the mesh object associated with the system object that calls this function
const MeshBase &mesh = this->get_mesh();
// Use an existing PointLocator or create a new one
UniquePtr<PointLocatorBase> locator_ptr = mesh.sub_point_locator();
PointLocatorBase& locator = *locator_ptr;
if (!insist_on_success)
locator.enable_out_of_mesh_mode();
// Get a pointer to the element that contains P
const Elem *e = locator(p);
Gradient grad_u;
if (e && e->processor_id() == this->processor_id())
grad_u = point_gradient(var, p, *e);
// If I have an element containing p, then let's let everyone know
processor_id_type lowest_owner =
(e && (e->processor_id() == this->processor_id())) ?
this->processor_id() : this->n_processors();
this->comm().min(lowest_owner);
// Everybody should get their value from a processor that was able
// to compute it.
// If nobody admits owning the point, we may have a problem.
if (lowest_owner != this->n_processors())
this->comm().broadcast(grad_u, lowest_owner);
else
libmesh_assert(!insist_on_success);
return grad_u;
}
| 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 2140 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::System::get_dof_map(), libMesh::FEInterface::inverse_map(), libMesh::libmesh_assert(), libMesh::ParallelObject::processor_id(), and libMesh::DofObject::processor_id().
{
libmesh_assert_equal_to (e.processor_id(), this->processor_id());
// Ensuring that the given point is really in the element is an
// expensive assert, but as long as debugging is turned on we might
// as well try to catch a particularly nasty potential error
libmesh_assert (e.contains_point(p));
// Get the dof map to get the proper indices for our computation
const DofMap& dof_map = this->get_dof_map();
// Need dof_indices for phi[i][j]
std::vector<dof_id_type> dof_indices;
// Fill in the dof_indices for our element
dof_map.dof_indices (&e, dof_indices, var);
// Get the no of dofs assciated with this point
const unsigned int num_dofs = cast_int<unsigned int>
(dof_indices.size());
FEType fe_type = dof_map.variable_type(var);
// Build a FE again so we can calculate u(p)
UniquePtr<FEBase> fe (FEBase::build(e.dim(), fe_type));
// Map the physical co-ordinates to the master co-ordinates using the inverse_map from fe_interface.h
// Build a vector of point co-ordinates to send to reinit
std::vector<Point> coor(1, FEInterface::inverse_map(e.dim(), fe_type, &e, p));
// Get the values of the shape function derivatives
const std::vector<std::vector<RealGradient> >& dphi = fe->get_dphi();
// Reinitialize the element and compute the shape function values at coor
fe->reinit (&e, &coor);
// Get ready to accumulate a gradient
Gradient grad_u;
for (unsigned int l=0; l<num_dofs; l++)
{
grad_u.add_scaled (dphi[l][0], this->current_solution (dof_indices[l]));
}
return grad_u;
}
| Tensor libMesh::System::point_hessian | ( | unsigned int | var, |
| const Point & | p, | ||
| const bool | insist_on_success = true |
||
| ) | const [inherited] |
Returns the second derivative tensor of the solution variable var at the physical point p in the mesh, similarly to point_value.
Definition at line 2191 of file system.C.
References libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::System::get_mesh(), libMesh::libmesh_assert(), mesh, libMesh::Parallel::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::MeshBase::sub_point_locator(), and libMesh::Parallel::Communicator::verify().
{
// This function must be called on every processor; there's no
// telling where in the partition p falls.
parallel_object_only();
// And every processor had better agree about which point we're
// looking for
#ifndef NDEBUG
this->comm().verify(p);
#endif // NDEBUG
// Get a reference to the mesh object associated with the system object that calls this function
const MeshBase &mesh = this->get_mesh();
// Use an existing PointLocator or create a new one
UniquePtr<PointLocatorBase> locator_ptr = mesh.sub_point_locator();
PointLocatorBase& locator = *locator_ptr;
if (!insist_on_success)
locator.enable_out_of_mesh_mode();
// Get a pointer to the element that contains P
const Elem *e = locator(p);
Tensor hess_u;
if (e && e->processor_id() == this->processor_id())
hess_u = point_hessian(var, p, *e);
// If I have an element containing p, then let's let everyone know
processor_id_type lowest_owner =
(e && (e->processor_id() == this->processor_id())) ?
this->processor_id() : this->n_processors();
this->comm().min(lowest_owner);
// Everybody should get their value from a processor that was able
// to compute it.
// If nobody admits owning the point, we may have a problem.
if (lowest_owner != this->n_processors())
this->comm().broadcast(hess_u, lowest_owner);
else
libmesh_assert(!insist_on_success);
return hess_u;
}
| Tensor libMesh::System::point_hessian | ( | unsigned int | var, |
| const Point & | p, | ||
| const Elem & | e | ||
| ) | const [inherited] |
Returns the second derivative tensor of the solution variable var at the physical point p in local Elem e in the mesh, similarly to point_value.
Definition at line 2238 of file system.C.
References libMesh::TypeTensor< T >::add_scaled(), libMesh::FEGenericBase< OutputType >::build(), libMesh::Elem::contains_point(), libMesh::System::current_solution(), libMesh::Elem::dim(), libMesh::System::get_dof_map(), libMesh::FEInterface::inverse_map(), libMesh::libmesh_assert(), libMesh::ParallelObject::processor_id(), and libMesh::DofObject::processor_id().
{
libmesh_assert_equal_to (e.processor_id(), this->processor_id());
// Ensuring that the given point is really in the element is an
// expensive assert, but as long as debugging is turned on we might
// as well try to catch a particularly nasty potential error
libmesh_assert (e.contains_point(p));
// Get the dof map to get the proper indices for our computation
const DofMap& dof_map = this->get_dof_map();
// Need dof_indices for phi[i][j]
std::vector<dof_id_type> dof_indices;
// Fill in the dof_indices for our element
dof_map.dof_indices (&e, dof_indices, var);
// Get the no of dofs assciated with this point
const unsigned int num_dofs = cast_int<unsigned int>
(dof_indices.size());
FEType fe_type = dof_map.variable_type(var);
// Build a FE again so we can calculate u(p)
UniquePtr<FEBase> fe (FEBase::build(e.dim(), fe_type));
// Map the physical co-ordinates to the master co-ordinates using the inverse_map from fe_interface.h
// Build a vector of point co-ordinates to send to reinit
std::vector<Point> coor(1, FEInterface::inverse_map(e.dim(), fe_type, &e, p));
// Get the values of the shape function derivatives
const std::vector<std::vector<RealTensor> >& d2phi = fe->get_d2phi();
// Reinitialize the element and compute the shape function values at coor
fe->reinit (&e, &coor);
// Get ready to accumulate a hessian
Tensor hess_u;
for (unsigned int l=0; l<num_dofs; l++)
{
hess_u.add_scaled (d2phi[l][0], this->current_solution (dof_indices[l]));
}
return hess_u;
}
| Number libMesh::System::point_value | ( | unsigned int | var, |
| const Point & | p, | ||
| const bool | insist_on_success = true |
||
| ) | const [inherited] |
Returns the value of the solution variable var at the physical point p in the mesh, without knowing a priori which element contains p.
Note that this function uses MeshBase::sub_point_locator(); users may or may not want to call MeshBase::clear_point_locator() afterward. Also, point_locator() is expensive (N log N for initial construction, log N for evaluations). Avoid using this function in any context where you are already looping over elements.
Because the element containing p may lie on any processor, this function is parallel-only.
By default this method expects the point to reside inside the domain and will abort if no element can be found which contains . The optional parameter insist_on_success can be set to false to allow the method to return 0 when the point is not located.
Definition at line 1995 of file system.C.
References libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::PointLocatorBase::enable_out_of_mesh_mode(), libMesh::System::get_mesh(), libMesh::libmesh_assert(), mesh, libMesh::Parallel::Communicator::min(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::MeshBase::sub_point_locator(), and libMesh::Parallel::Communicator::verify().
{
// This function must be called on every processor; there's no
// telling where in the partition p falls.
parallel_object_only();
// And every processor had better agree about which point we're
// looking for
#ifndef NDEBUG
this->comm().verify(p);
#endif // NDEBUG
// Get a reference to the mesh object associated with the system object that calls this function
const MeshBase &mesh = this->get_mesh();
// Use an existing PointLocator or create a new one
UniquePtr<PointLocatorBase> locator_ptr = mesh.sub_point_locator();
PointLocatorBase& locator = *locator_ptr;
if (!insist_on_success)
locator.enable_out_of_mesh_mode();
// Get a pointer to the element that contains P
const Elem *e = locator(p);
Number u = 0;
if (e && e->processor_id() == this->processor_id())
u = point_value(var, p, *e);
// If I have an element containing p, then let's let everyone know
processor_id_type lowest_owner =
(e && (e->processor_id() == this->processor_id())) ?
this->processor_id() : this->n_processors();
this->comm().min(lowest_owner);
// Everybody should get their value from a processor that was able
// to compute it.
// If nobody admits owning the point, we have a problem.
if (lowest_owner != this->n_processors())
this->comm().broadcast(u, lowest_owner);
else
libmesh_assert(!insist_on_success);
return u;
}
| Number libMesh::System::point_value | ( | unsigned int | var, |
| const Point & | p, | ||
| const Elem & | e | ||
| ) | const [inherited] |
Returns the value of the solution variable var at the physical point p contained in local Elem e
This version of point_value can be run in serial, but assumes e is in the local mesh partition.
Definition at line 2042 of file system.C.
References libMesh::FEGenericBase< OutputType >::build(), libMesh::Elem::contains_point(), libMesh::System::current_solution(), libMesh::Elem::dim(), libMesh::System::get_dof_map(), libMesh::FEInterface::inverse_map(), libMesh::libmesh_assert(), libMesh::ParallelObject::processor_id(), and libMesh::DofObject::processor_id().
{
libmesh_assert_equal_to (e.processor_id(), this->processor_id());
// Ensuring that the given point is really in the element is an
// expensive assert, but as long as debugging is turned on we might
// as well try to catch a particularly nasty potential error
libmesh_assert (e.contains_point(p));
// Get the dof map to get the proper indices for our computation
const DofMap& dof_map = this->get_dof_map();
// Need dof_indices for phi[i][j]
std::vector<dof_id_type> dof_indices;
// Fill in the dof_indices for our element
dof_map.dof_indices (&e, dof_indices, var);
// Get the no of dofs assciated with this point
const unsigned int num_dofs = cast_int<unsigned int>
(dof_indices.size());
FEType fe_type = dof_map.variable_type(var);
// Build a FE so we can calculate u(p)
UniquePtr<FEBase> fe (FEBase::build(e.dim(), fe_type));
// Map the physical co-ordinates to the master co-ordinates using the inverse_map from fe_interface.h
// Build a vector of point co-ordinates to send to reinit
std::vector<Point> coor(1, FEInterface::inverse_map(e.dim(), fe_type, &e, p));
// Get the shape function values
const std::vector<std::vector<Real> >& phi = fe->get_phi();
// Reinitialize the element and compute the shape function values at coor
fe->reinit (&e, &coor);
// Get ready to accumulate a value
Number u = 0;
for (unsigned int l=0; l<num_dofs; l++)
{
u += phi[l][0]*this->current_solution (dof_indices[l]);
}
return u;
}
Print out a matrix that shows the orthogonality of the RB basis functions. This is a helpful debugging tool, e.g. orthogonality can be degraded due to finite precision arithmetic.
| void libMesh::RBParametrized::print_discrete_parameter_values | ( | ) | const [inherited] |
Print out all the discrete parameter values.
| void libMesh::ReferenceCounter::print_info | ( | std::ostream & | out = libMesh::out | ) | [static, inherited] |
Prints the reference information, by default to libMesh::out.
Definition at line 88 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().
Referenced by libMesh::LibMeshInit::~LibMeshInit().
{
if( _enable_print_counter ) out_stream << ReferenceCounter::get_info();
}
| void libMesh::ReferenceCounter::print_info | ( | std::ostream & | out = libMesh::out | ) | [static, inherited] |
Prints the reference information, by default to libMesh::out.
Definition at line 88 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().
Referenced by libMesh::LibMeshInit::~LibMeshInit().
{
if( _enable_print_counter ) out_stream << ReferenceCounter::get_info();
}
| virtual void libMesh::RBConstruction::print_info | ( | ) | [virtual] |
Print out info that describes the current setup of this RBConstruction.
Reimplemented in libMesh::TransientRBConstruction, and libMesh::RBEIMConstruction.
| void libMesh::RBParametrized::print_parameters | ( | ) | const [inherited] |
Print the current parameters.
| virtual void libMesh::RBConstruction::process_parameters_file | ( | const std::string & | parameters_filename | ) | [virtual] |
Read in from the file specified by parameters_filename and set the this system's member variables accordingly.
Reimplemented in libMesh::TransientRBConstruction, and libMesh::RBEIMConstruction.
| processor_id_type libMesh::ParallelObject::processor_id | ( | ) | const [inline, inherited] |
Definition at line 98 of file parallel_object.h.
References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::rank().
Referenced by libMesh::MetisPartitioner::_do_partition(), libMesh::EquationSystems::_read_impl(), libMesh::SerialMesh::active_local_elements_begin(), libMesh::ParallelMesh::active_local_elements_begin(), libMesh::SerialMesh::active_local_elements_end(), libMesh::ParallelMesh::active_local_elements_end(), libMesh::SerialMesh::active_local_subdomain_elements_begin(), libMesh::ParallelMesh::active_local_subdomain_elements_begin(), libMesh::SerialMesh::active_local_subdomain_elements_end(), libMesh::ParallelMesh::active_local_subdomain_elements_end(), libMesh::SerialMesh::active_not_local_elements_begin(), libMesh::ParallelMesh::active_not_local_elements_begin(), libMesh::SerialMesh::active_not_local_elements_end(), libMesh::ParallelMesh::active_not_local_elements_end(), libMesh::ParallelMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::ParallelMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::ParallelMesh::assign_unique_ids(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::DofMap::build_sparsity(), libMesh::ParallelMesh::clear(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO_Helper::create(), libMesh::ParallelMesh::delete_elem(), libMesh::ParallelMesh::delete_node(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::SerialMesh::facelocal_elements_begin(), libMesh::ParallelMesh::facelocal_elements_begin(), libMesh::SerialMesh::facelocal_elements_end(), libMesh::ParallelMesh::facelocal_elements_end(), libMesh::MeshFunction::find_element(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMap::first_dof(), libMesh::DofMap::first_old_dof(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::MeshBase::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::ParallelMesh::insert_elem(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::MeshTools::libmesh_assert_valid_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_procids< Node >(), libMesh::SerialMesh::local_elements_begin(), libMesh::ParallelMesh::local_elements_begin(), libMesh::SerialMesh::local_elements_end(), libMesh::ParallelMesh::local_elements_end(), libMesh::SerialMesh::local_level_elements_begin(), libMesh::ParallelMesh::local_level_elements_begin(), libMesh::SerialMesh::local_level_elements_end(), libMesh::ParallelMesh::local_level_elements_end(), libMesh::SerialMesh::local_nodes_begin(), libMesh::ParallelMesh::local_nodes_begin(), libMesh::SerialMesh::local_nodes_end(), libMesh::ParallelMesh::local_nodes_end(), libMesh::SerialMesh::local_not_level_elements_begin(), libMesh::ParallelMesh::local_not_level_elements_begin(), libMesh::SerialMesh::local_not_level_elements_end(), libMesh::ParallelMesh::local_not_level_elements_end(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMap::n_local_dofs(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::SerialMesh::not_local_elements_begin(), libMesh::ParallelMesh::not_local_elements_begin(), libMesh::SerialMesh::not_local_elements_end(), libMesh::ParallelMesh::not_local_elements_end(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::ParallelMesh::ParallelMesh(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::System::project_vector(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::MeshData::read_xdr(), libMesh::SerialMesh::semilocal_elements_begin(), libMesh::ParallelMesh::semilocal_elements_begin(), libMesh::SerialMesh::semilocal_elements_end(), libMesh::ParallelMesh::semilocal_elements_end(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::BoundaryInfo::sync(), libMesh::MeshTools::total_weight(), libMesh::ParallelMesh::update_parallel_id_counts(), libMesh::MeshTools::weight(), libMesh::NameBasedIO::write(), libMesh::ExodusII_IO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().
{ return cast_int<processor_id_type>(_communicator.rank()); }
| void libMesh::System::project_solution | ( | FunctionBase< Number > * | f, |
| FunctionBase< Gradient > * | g = NULL |
||
| ) | const [inherited] |
Projects arbitrary functions onto the current solution. 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 function onto the solution via L2 projections and nodal interpolations on each element.
Definition at line 472 of file system_projection.C.
References libMesh::System::_dof_map, libMesh::System::current_local_solution, libMesh::System::project_vector(), and libMesh::System::solution.
Referenced by libMesh::System::project_solution().
{
this->project_vector(*solution, f, g);
solution->localize(*current_local_solution, _dof_map->get_send_list());
}
| void libMesh::System::project_solution | ( | FEMFunctionBase< Number > * | f, |
| FEMFunctionBase< Gradient > * | g = NULL |
||
| ) | const [inherited] |
Projects arbitrary functions onto the current solution. 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 function onto the solution via L2 projections and nodal interpolations on each element.
Definition at line 485 of file system_projection.C.
References libMesh::System::_dof_map, libMesh::System::current_local_solution, libMesh::System::project_vector(), and libMesh::System::solution.
{
this->project_vector(*solution, f, g);
solution->localize(*current_local_solution, _dof_map->get_send_list());
}
| void libMesh::System::project_solution | ( | Number | fptrconst Point &p,const Parameters ¶meters,const std::string &sys_name,const std::string &unknown_name, |
| Gradient | gptrconst Point &p,const Parameters ¶meters,const std::string &sys_name,const std::string &unknown_name, | ||
| const Parameters & | parameters | ||
| ) | const [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.
This method projects an arbitrary function onto the solution via L2 projections and nodal interpolations on each element.
Definition at line 452 of file system_projection.C.
References libMesh::System::project_solution().
{
WrappedFunction<Number> f(*this, fptr, ¶meters);
WrappedFunction<Gradient> g(*this, gptr, ¶meters);
this->project_solution(&f, &g);
}
| bool& libMesh::System::project_solution_on_reinit | ( | void | ) | [inline, inherited] |
Tells the System whether or not to project the solution vector onto new grids when the system is reinitialized. The solution will be projected unless project_solution_on_reinit() = false is called.
Definition at line 797 of file system.h.
References libMesh::System::_solution_projection.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), and libMesh::MemorySolutionHistory::store().
{ return _solution_projection; }
| void libMesh::System::project_vector | ( | NumericVector< Number > & | new_vector, |
| FunctionBase< Number > * | f, | ||
| FunctionBase< Gradient > * | g = NULL, |
||
| int | is_adjoint = -1 |
||
| ) | const [inherited] |
Projects arbitrary functions onto a vector of degree of freedom values for the current system. 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 519 of file system_projection.C.
References libMesh::NumericVector< T >::close(), libMesh::DofMap::enforce_adjoint_constraints_exactly(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::FEType::family, libMesh::System::get_dof_map(), libMesh::System::get_equation_systems(), libMesh::System::get_mesh(), libMesh::System::n_components(), libMesh::ParallelObject::n_processors(), libMesh::System::n_vars(), libMesh::Threads::parallel_for(), libMesh::ParallelObject::processor_id(), libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), libMesh::NumericVector< T >::set(), libMesh::START_LOG(), libMesh::System::time, libMesh::Variable::type(), libMesh::System::variable(), and libMesh::System::variable_scalar_number().
Referenced by libMesh::System::project_solution(), libMesh::System::project_vector(), and libMesh::System::restrict_vectors().
{
START_LOG ("project_vector()", "System");
Threads::parallel_for
(ConstElemRange (this->get_mesh().active_local_elements_begin(),
this->get_mesh().active_local_elements_end() ),
ProjectSolution(*this, f, g,
this->get_equation_systems().parameters,
new_vector)
);
// Also, load values into the SCALAR dofs
// Note: We assume that all SCALAR dofs are on the
// processor with highest ID
if(this->processor_id() == (this->n_processors()-1))
{
// We get different scalars as different
// components from a new-style f functor.
DenseVector<Number> fout(this->n_components());
bool filled_fout = false;
const DofMap& dof_map = this->get_dof_map();
for (unsigned int var=0; var<this->n_vars(); var++)
if(this->variable(var).type().family == SCALAR)
{
if (!filled_fout)
{
(*f) (Point(), this->time, fout);
filled_fout = true;
}
std::vector<dof_id_type> SCALAR_indices;
dof_map.SCALAR_dof_indices (SCALAR_indices, var);
const unsigned int n_SCALAR_dofs =
cast_int<unsigned int>(SCALAR_indices.size());
for (unsigned int i=0; i<n_SCALAR_dofs; i++)
{
const dof_id_type global_index = SCALAR_indices[i];
const unsigned int component_index =
this->variable_scalar_number(var,i);
new_vector.set(global_index, fout(component_index));
}
}
}
new_vector.close();
#ifdef LIBMESH_ENABLE_CONSTRAINTS
if (is_adjoint == -1)
this->get_dof_map().enforce_constraints_exactly(*this, &new_vector);
else if (is_adjoint >= 0)
this->get_dof_map().enforce_adjoint_constraints_exactly(new_vector,
is_adjoint);
#endif
STOP_LOG("project_vector()", "System");
}
| void libMesh::System::project_vector | ( | NumericVector< Number > & | new_vector, |
| FEMFunctionBase< Number > * | f, | ||
| FEMFunctionBase< Gradient > * | g = NULL, |
||
| int | is_adjoint = -1 |
||
| ) | const [inherited] |
Projects arbitrary functions onto a vector of degree of freedom values for the current system. 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 587 of file system_projection.C.
References libMesh::MeshBase::active_local_elements_begin(), libMesh::NumericVector< T >::close(), libMesh::FEMFunctionBase< Output >::component(), libMesh::DofMap::enforce_adjoint_constraints_exactly(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::FEType::family, libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::ParallelObject::n_processors(), libMesh::System::n_vars(), libMesh::Threads::parallel_for(), libMesh::FEMContext::pre_fe_reinit(), libMesh::ParallelObject::processor_id(), libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), libMesh::NumericVector< T >::set(), libMesh::START_LOG(), libMesh::System::time, libMesh::Variable::type(), libMesh::System::variable(), and libMesh::System::variable_scalar_number().
{
START_LOG ("project_fem_vector()", "System");
Threads::parallel_for
(ConstElemRange (this->get_mesh().active_local_elements_begin(),
this->get_mesh().active_local_elements_end() ),
ProjectFEMSolution(*this, f, g, new_vector)
);
// Also, load values into the SCALAR dofs
// Note: We assume that all SCALAR dofs are on the
// processor with highest ID
if(this->processor_id() == (this->n_processors()-1))
{
// FIXME: Do we want to first check for SCALAR vars before building this? [PB]
FEMContext context( *this );
const DofMap& dof_map = this->get_dof_map();
for (unsigned int var=0; var<this->n_vars(); var++)
if(this->variable(var).type().family == SCALAR)
{
// FIXME: We reinit with an arbitrary element in case the user
// doesn't override FEMFunctionBase::component. Is there
// any use case we're missing? [PB]
Elem *el = const_cast<Elem *>(*(this->get_mesh().active_local_elements_begin()));
context.pre_fe_reinit( *this, el );
std::vector<dof_id_type> SCALAR_indices;
dof_map.SCALAR_dof_indices (SCALAR_indices, var);
const unsigned int n_SCALAR_dofs =
cast_int<unsigned int>(SCALAR_indices.size());
for (unsigned int i=0; i<n_SCALAR_dofs; i++)
{
const dof_id_type global_index = SCALAR_indices[i];
const unsigned int component_index =
this->variable_scalar_number(var,i);
new_vector.set(global_index, f->component(context, component_index, Point(), this->time));
}
}
}
new_vector.close();
#ifdef LIBMESH_ENABLE_CONSTRAINTS
if (is_adjoint == -1)
this->get_dof_map().enforce_constraints_exactly(*this, &new_vector);
else if (is_adjoint >= 0)
this->get_dof_map().enforce_adjoint_constraints_exactly(new_vector,
is_adjoint);
#endif
STOP_LOG("project_fem_vector()", "System");
}
| void libMesh::System::project_vector | ( | Number | fptrconst Point &p,const Parameters ¶meters,const std::string &sys_name,const std::string &unknown_name, |
| Gradient | gptrconst Point &p,const Parameters ¶meters,const std::string &sys_name,const std::string &unknown_name, | ||
| const Parameters & | parameters, | ||
| NumericVector< Number > & | new_vector, | ||
| int | is_adjoint = -1 |
||
| ) | const [inherited] |
Projects arbitrary functions onto a vector of degree of freedom values for the current system. 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 function via L2 projections and nodal interpolations on each element.
Definition at line 498 of file system_projection.C.
References libMesh::System::project_vector().
{
WrappedFunction<Number> f(*this, fptr, ¶meters);
WrappedFunction<Gradient> g(*this, gptr, ¶meters);
this->project_vector(new_vector, &f, &g, is_adjoint);
}
| void libMesh::System::project_vector | ( | NumericVector< Number > & | vector, |
| int | is_adjoint = -1 |
||
| ) | const [protected, inherited] |
Projects the vector defined on the old mesh onto the new mesh.
Constrain the new vector using the requested adjoint rather than primal constraints if is_adjoint is non-negative.
Definition at line 255 of file system_projection.C.
References libMesh::NumericVector< T >::clone(), and libMesh::System::project_vector().
{
// Create a copy of the vector, which currently
// contains the old data.
UniquePtr<NumericVector<Number> >
old_vector (vector.clone());
// Project the old vector to the new vector
this->project_vector (*old_vector, vector, is_adjoint);
}
| void libMesh::System::project_vector | ( | const NumericVector< Number > & | old_v, |
| NumericVector< Number > & | new_v, | ||
| int | is_adjoint = -1 |
||
| ) | const [protected, inherited] |
Projects the vector defined on the old mesh onto the new mesh. The original vector is unchanged and the new vector is passed through the second argument.
Constrain the new vector using the requested adjoint rather than primal constraints if is_adjoint is non-negative.
This method projects the vector via L2 projections or nodal interpolations on each element.
This method projects a solution from an old mesh to a current, refined mesh. The input vector old_v gives the solution on the old mesh, while the new_v gives the solution (to be computed) on the new mesh.
Definition at line 273 of file system_projection.C.
References libMesh::NumericVector< T >::clear(), libMesh::NumericVector< T >::close(), libMesh::ParallelObject::comm(), libMesh::DofMap::enforce_adjoint_constraints_exactly(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::FEType::family, libMesh::NumericVector< T >::get(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::GHOSTED, libMesh::NumericVector< T >::init(), libMesh::libmesh_assert(), libMesh::NumericVector< T >::local_size(), libMesh::NumericVector< T >::localize(), libMesh::System::n_dofs(), libMesh::System::n_local_dofs(), libMesh::ParallelObject::n_processors(), libMesh::System::n_vars(), libMesh::PARALLEL, libMesh::Threads::parallel_for(), libMesh::Threads::parallel_reduce(), libMesh::ParallelObject::processor_id(), libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), libMesh::BuildProjectionList::send_list, libMesh::SERIAL, libMesh::NumericVector< T >::set(), libMesh::NumericVector< T >::size(), libMesh::START_LOG(), libMesh::Variable::type(), libMesh::NumericVector< T >::type(), libMesh::BuildProjectionList::unique(), and libMesh::System::variable().
{
START_LOG ("project_vector()", "System");
new_v.clear();
#ifdef LIBMESH_ENABLE_AMR
// Resize the new vector and get a serial version.
NumericVector<Number> *new_vector_ptr = NULL;
UniquePtr<NumericVector<Number> > new_vector_built;
NumericVector<Number> *local_old_vector;
UniquePtr<NumericVector<Number> > local_old_vector_built;
const NumericVector<Number> *old_vector_ptr = NULL;
ConstElemRange active_local_elem_range
(this->get_mesh().active_local_elements_begin(),
this->get_mesh().active_local_elements_end());
// If the old vector was uniprocessor, make the new
// vector uniprocessor
if (old_v.type() == SERIAL)
{
new_v.init (this->n_dofs(), false, SERIAL);
new_vector_ptr = &new_v;
old_vector_ptr = &old_v;
}
// Otherwise it is a parallel, distributed vector, which
// we need to localize.
else if (old_v.type() == PARALLEL)
{
// Build a send list for efficient localization
BuildProjectionList projection_list(*this);
Threads::parallel_reduce (active_local_elem_range,
projection_list);
// Create a sorted, unique send_list
projection_list.unique();
new_v.init (this->n_dofs(), this->n_local_dofs(), false, PARALLEL);
new_vector_built = NumericVector<Number>::build(this->comm());
local_old_vector_built = NumericVector<Number>::build(this->comm());
new_vector_ptr = new_vector_built.get();
local_old_vector = local_old_vector_built.get();
new_vector_ptr->init(this->n_dofs(), false, SERIAL);
local_old_vector->init(old_v.size(), false, SERIAL);
old_v.localize(*local_old_vector, projection_list.send_list);
local_old_vector->close();
old_vector_ptr = local_old_vector;
}
else if (old_v.type() == GHOSTED)
{
// Build a send list for efficient localization
BuildProjectionList projection_list(*this);
Threads::parallel_reduce (active_local_elem_range,
projection_list);
// Create a sorted, unique send_list
projection_list.unique();
new_v.init (this->n_dofs(), this->n_local_dofs(),
this->get_dof_map().get_send_list(), false, GHOSTED);
local_old_vector_built = NumericVector<Number>::build(this->comm());
new_vector_ptr = &new_v;
local_old_vector = local_old_vector_built.get();
local_old_vector->init(old_v.size(), old_v.local_size(),
projection_list.send_list, false, GHOSTED);
old_v.localize(*local_old_vector, projection_list.send_list);
local_old_vector->close();
old_vector_ptr = local_old_vector;
}
else // unknown old_v.type()
libmesh_error_msg("ERROR: Unknown old_v.type() == " << old_v.type());
// Note that the above will have zeroed the new_vector.
// Just to be sure, assert that new_vector_ptr and old_vector_ptr
// were successfully set before trying to deref them.
libmesh_assert(new_vector_ptr);
libmesh_assert(old_vector_ptr);
NumericVector<Number> &new_vector = *new_vector_ptr;
const NumericVector<Number> &old_vector = *old_vector_ptr;
Threads::parallel_for (active_local_elem_range,
ProjectVector(*this,
old_vector,
new_vector)
);
// Copy the SCALAR dofs from old_vector to new_vector
// Note: We assume that all SCALAR dofs are on the
// processor with highest ID
if(this->processor_id() == (this->n_processors()-1))
{
const DofMap& dof_map = this->get_dof_map();
for (unsigned int var=0; var<this->n_vars(); var++)
if(this->variable(var).type().family == SCALAR)
{
// We can just map SCALAR dofs directly across
std::vector<dof_id_type> new_SCALAR_indices, old_SCALAR_indices;
dof_map.SCALAR_dof_indices (new_SCALAR_indices, var, false);
dof_map.SCALAR_dof_indices (old_SCALAR_indices, var, true);
const unsigned int new_n_dofs =
cast_int<unsigned int>(new_SCALAR_indices.size());
for (unsigned int i=0; i<new_n_dofs; i++)
{
new_vector.set( new_SCALAR_indices[i], old_vector(old_SCALAR_indices[i]) );
}
}
}
new_vector.close();
// If the old vector was serial, we probably need to send our values
// to other processors
//
// FIXME: I'm not sure how to make a NumericVector do that without
// creating a temporary parallel vector to use localize! - RHS
if (old_v.type() == SERIAL)
{
UniquePtr<NumericVector<Number> > dist_v = NumericVector<Number>::build(this->comm());
dist_v->init(this->n_dofs(), this->n_local_dofs(), false, PARALLEL);
dist_v->close();
for (dof_id_type i=0; i!=dist_v->size(); i++)
if (new_vector(i) != 0.0)
dist_v->set(i, new_vector(i));
dist_v->close();
dist_v->localize (new_v, this->get_dof_map().get_send_list());
new_v.close();
}
// If the old vector was parallel, we need to update it
// and free the localized copies
else if (old_v.type() == PARALLEL)
{
// We may have to set dof values that this processor doesn't
// own in certain special cases, like LAGRANGE FIRST or
// HERMITE THIRD elements on second-order meshes
for (dof_id_type i=0; i!=new_v.size(); i++)
if (new_vector(i) != 0.0)
new_v.set(i, new_vector(i));
new_v.close();
}
if (is_adjoint == -1)
this->get_dof_map().enforce_constraints_exactly(*this, &new_v);
else if (is_adjoint >= 0)
this->get_dof_map().enforce_adjoint_constraints_exactly(new_v,
is_adjoint);
#else
// AMR is disabled: simply copy the vector
new_v = old_v;
#endif // #ifdef LIBMESH_ENABLE_AMR
STOP_LOG("project_vector()", "System");
}
| void libMesh::System::prolong_vectors | ( | ) | [virtual, inherited] |
Prolong vectors after the mesh has refined
Definition at line 373 of file system.C.
References libMesh::System::restrict_vectors().
Referenced by libMesh::EquationSystems::reinit().
{
#ifdef LIBMESH_ENABLE_AMR
// Currently project_vector handles both restriction and prolongation
this->restrict_vectors();
#endif
}
| void libMesh::ImplicitSystem::qoi_parameter_hessian | ( | const QoISet & | qoi_indices, |
| const ParameterVector & | parameters, | ||
| SensitivityData & | hessian | ||
| ) | [virtual, inherited] |
For each of the system's quantities of interest q in qoi[qoi_indices], and for a vector of parameters p, the parameter sensitivity Hessian H_ij is defined as H_ij = (d^2 q)/(d p_i d p_j) This Hessian is the output of this method, where for each q_i, H_jk is stored in hessian.second_derivative(i,j,k).
Reimplemented from libMesh::System.
Definition at line 1137 of file implicit_system.C.
References libMesh::SensitivityData::allocate_hessian_data(), libMesh::QoISet::has_index(), libMesh::Real, libMesh::SensitivityData::second_derivative(), libMesh::ParameterVector::size(), and libMesh::TOLERANCE.
{
// We currently get partial derivatives via finite differencing
const Real delta_p = TOLERANCE;
ParameterVector& parameters =
const_cast<ParameterVector&>(parameters_in);
// We'll use one temporary vector for matrix-vector-vector products
UniquePtr<NumericVector<Number> > tempvec = this->solution->zero_clone();
// And another temporary vector to hold a copy of the true solution
// so we can safely perturb this->solution.
UniquePtr<NumericVector<Number> > oldsolution = this->solution->clone();
const unsigned int Np = cast_int<unsigned int>
(parameters.size());
const unsigned int Nq = cast_int<unsigned int>
(qoi.size());
// For each quantity of interest q, the parameter sensitivity
// Hessian is defined as q''_{kl} = {d^2 q}/{d p_k d p_l}.
//
// We calculate it from values and partial derivatives of the
// quantity of interest function Q, solution u, adjoint solution z,
// and residual R, as:
//
// q''_{kl} =
// Q''_{kl} + Q''_{uk}(u)*u'_l + Q''_{ul}(u) * u'_k +
// Q''_{uu}(u)*u'_k*u'_l -
// R''_{kl}(u,z) -
// R''_{uk}(u,z)*u'_l - R''_{ul}(u,z)*u'_k -
// R''_{uu}(u,z)*u'_k*u'_l
//
// See the adjoints model document for more details.
// We first do an adjoint solve to get z for each quantity of
// interest
// if we havent already or dont have an initial condition for the adjoint
if (!this->is_adjoint_already_solved())
{
this->adjoint_solve(qoi_indices);
}
// And a sensitivity solve to get u_k for each parameter
this->sensitivity_solve(parameters);
// Get ready to fill in second derivatives:
sensitivities.allocate_hessian_data(qoi_indices, *this, parameters);
for (unsigned int k=0; k != Np; ++k)
{
Number old_parameterk = *parameters[k];
// The Hessian is symmetric, so we just calculate the lower
// triangle and the diagonal, and we get the upper triangle from
// the transpose of the lower
for (unsigned int l=0; l != k+1; ++l)
{
// The second partial derivatives with respect to parameters
// are all calculated via a central finite difference
// stencil:
// F''_{kl} ~= (F(p+dp*e_k+dp*e_l) - F(p+dp*e_k-dp*e_l) -
// F(p-dp*e_k+dp*e_l) + F(p-dp*e_k-dp*e_l))/(4*dp^2)
// We will add Q''_{kl}(u) and subtract R''_{kl}(u,z) at the
// same time.
//
// We have to be careful with the perturbations to handle
// the k=l case
Number old_parameterl = *parameters[l];
*parameters[k] += delta_p;
*parameters[l] += delta_p;
this->assemble_qoi(qoi_indices);
this->assembly(true, false, true);
this->rhs->close();
std::vector<Number> partial2q_term = this->qoi;
std::vector<Number> partial2R_term(this->qoi.size());
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
partial2R_term[i] = this->rhs->dot(this->get_adjoint_solution(i));
*parameters[l] -= 2.*delta_p;
this->assemble_qoi(qoi_indices);
this->assembly(true, false, true);
this->rhs->close();
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
partial2q_term[i] -= this->qoi[i];
partial2R_term[i] -= this->rhs->dot(this->get_adjoint_solution(i));
}
*parameters[k] -= 2.*delta_p;
this->assemble_qoi(qoi_indices);
this->assembly(true, false, true);
this->rhs->close();
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
partial2q_term[i] += this->qoi[i];
partial2R_term[i] += this->rhs->dot(this->get_adjoint_solution(i));
}
*parameters[l] += 2.*delta_p;
this->assemble_qoi(qoi_indices);
this->assembly(true, false, true);
this->rhs->close();
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
partial2q_term[i] -= this->qoi[i];
partial2R_term[i] -= this->rhs->dot(this->get_adjoint_solution(i));
partial2q_term[i] /= (4. * delta_p * delta_p);
partial2R_term[i] /= (4. * delta_p * delta_p);
}
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
Number current_terms = partial2q_term[i] - partial2R_term[i];
sensitivities.second_derivative(i,k,l) += current_terms;
if (k != l)
sensitivities.second_derivative(i,l,k) += current_terms;
}
// Don't leave the parameters perturbed
*parameters[l] = old_parameterl;
*parameters[k] = old_parameterk;
}
// We get (partial q / partial u) and
// (partial R / partial u) from the user, but centrally
// difference to get q_uk and R_uk terms:
// (partial^2 q / partial u partial k)
// q_uk*u'_l = (q_u(p+dp*e_k)*u'_l - q_u(p-dp*e_k)*u'_l)/(2*dp)
// R_uk*z*u'_l = (R_u(p+dp*e_k)*z*u'_l - R_u(p-dp*e_k)*z*u'_l)/(2*dp)
//
// To avoid creating Nq temporary vectors, we add these
// subterms to the sensitivities output one by one.
//
// FIXME: this is probably a bad order of operations for
// controlling floating point error.
*parameters[k] = old_parameterk + delta_p;
this->assembly(false, true);
this->matrix->close();
this->assemble_qoi_derivative(qoi_indices,
/* include_liftfunc = */ true,
/* apply_constraints = */ false);
for (unsigned int l=0; l != Np; ++l)
{
this->matrix->vector_mult(*tempvec, this->get_sensitivity_solution(l));
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
this->get_adjoint_rhs(i).close();
Number current_terms =
(this->get_adjoint_rhs(i).dot(this->get_sensitivity_solution(l)) -
tempvec->dot(this->get_adjoint_solution(i))) / (2.*delta_p);
sensitivities.second_derivative(i,k,l) += current_terms;
// We use the _uk terms twice; symmetry lets us reuse
// these calculations for the _ul terms.
sensitivities.second_derivative(i,l,k) += current_terms;
}
}
*parameters[k] = old_parameterk - delta_p;
this->assembly(false, true);
this->matrix->close();
this->assemble_qoi_derivative(qoi_indices,
/* include_liftfunc = */ true,
/* apply_constraints = */ false);
for (unsigned int l=0; l != Np; ++l)
{
this->matrix->vector_mult(*tempvec, this->get_sensitivity_solution(l));
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
this->get_adjoint_rhs(i).close();
Number current_terms =
(-this->get_adjoint_rhs(i).dot(this->get_sensitivity_solution(l)) +
tempvec->dot(this->get_adjoint_solution(i))) / (2.*delta_p);
sensitivities.second_derivative(i,k,l) += current_terms;
// We use the _uk terms twice; symmetry lets us reuse
// these calculations for the _ul terms.
sensitivities.second_derivative(i,l,k) += current_terms;
}
}
// Don't leave the parameter perturbed
*parameters[k] = old_parameterk;
// Our last remaining terms are -R_uu(u,z)*u_k*u_l and
// Q_uu(u)*u_k*u_l
//
// We take directional central finite differences of R_u and Q_u
// to approximate these terms, e.g.:
//
// Q_uu(u)*u_k ~= (Q_u(u+dp*u_k) - Q_u(u-dp*u_k))/(2*dp)
*this->solution = this->get_sensitivity_solution(k);
*this->solution *= delta_p;
*this->solution += *oldsolution;
this->assembly(false, true);
this->matrix->close();
this->assemble_qoi_derivative(qoi_indices,
/* include_liftfunc = */ true,
/* apply_constraints = */ false);
// The Hessian is symmetric, so we just calculate the lower
// triangle and the diagonal, and we get the upper triangle from
// the transpose of the lower
//
// Note that, because we took the directional finite difference
// with respect to k and not l, we've added an O(delta_p^2)
// error to any permutational symmetry in the Hessian...
for (unsigned int l=0; l != k+1; ++l)
{
this->matrix->vector_mult(*tempvec, this->get_sensitivity_solution(l));
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
this->get_adjoint_rhs(i).close();
Number current_terms =
(this->get_adjoint_rhs(i).dot(this->get_sensitivity_solution(l)) -
tempvec->dot(this->get_adjoint_solution(i))) / (2.*delta_p);
sensitivities.second_derivative(i,k,l) += current_terms;
if (k != l)
sensitivities.second_derivative(i,l,k) += current_terms;
}
}
*this->solution = this->get_sensitivity_solution(k);
*this->solution *= -delta_p;
*this->solution += *oldsolution;
this->assembly(false, true);
this->matrix->close();
this->assemble_qoi_derivative(qoi_indices,
/* include_liftfunc = */ true,
/* apply_constraints = */ false);
for (unsigned int l=0; l != k+1; ++l)
{
this->matrix->vector_mult(*tempvec, this->get_sensitivity_solution(l));
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
this->get_adjoint_rhs(i).close();
Number current_terms =
(-this->get_adjoint_rhs(i).dot(this->get_sensitivity_solution(l)) +
tempvec->dot(this->get_adjoint_solution(i))) / (2.*delta_p);
sensitivities.second_derivative(i,k,l) += current_terms;
if (k != l)
sensitivities.second_derivative(i,l,k) += current_terms;
}
}
// Don't leave the solution perturbed
*this->solution = *oldsolution;
}
// All parameters have been reset.
// Don't leave the qoi or system changed - principle of least
// surprise.
this->assembly(true, true);
this->rhs->close();
this->matrix->close();
this->assemble_qoi(qoi_indices);
}
| void libMesh::ImplicitSystem::qoi_parameter_hessian_vector_product | ( | const QoISet & | qoi_indices, |
| const ParameterVector & | parameters, | ||
| const ParameterVector & | vector, | ||
| SensitivityData & | product | ||
| ) | [virtual, inherited] |
For each of the system's quantities of interest q in qoi[qoi_indices], and for a vector of parameters p, the parameter sensitivity Hessian H_ij is defined as H_ij = (d^2 q)/(d p_i d p_j) The Hessian-vector product, for a vector v_k in parameter space, is S_j = H_jk v_k This product is the output of this method, where for each q_i, S_j is stored in sensitivities[i][j].
Reimplemented from libMesh::System.
Definition at line 930 of file implicit_system.C.
References libMesh::SensitivityData::allocate_data(), libMesh::ParameterVector::deep_copy(), libMesh::QoISet::has_index(), libMesh::Real, libMesh::ParameterVector::size(), libMesh::TOLERANCE, and libMesh::ParameterVector::value_copy().
{
// We currently get partial derivatives via finite differencing
const Real delta_p = TOLERANCE;
ParameterVector& parameters =
const_cast<ParameterVector&>(parameters_in);
// We'll use a single temporary vector for matrix-vector-vector products
UniquePtr<NumericVector<Number> > tempvec = this->solution->zero_clone();
const unsigned int Np = cast_int<unsigned int>
(parameters.size());
const unsigned int Nq = cast_int<unsigned int>
(qoi.size());
// For each quantity of interest q, the parameter sensitivity
// Hessian is defined as q''_{kl} = {d^2 q}/{d p_k d p_l}.
// Given a vector of parameter perturbation weights w_l, this
// function evaluates the hessian-vector product sum_l(q''_{kl}*w_l)
//
// We calculate it from values and partial derivatives of the
// quantity of interest function Q, solution u, adjoint solution z,
// parameter sensitivity adjoint solutions z^l, and residual R, as:
//
// sum_l(q''_{kl}*w_l) =
// sum_l(w_l * Q''_{kl}) + Q''_{uk}(u)*(sum_l(w_l u'_l)) -
// R'_k(u, sum_l(w_l*z^l)) - R'_{uk}(u,z)*(sum_l(w_l u'_l) -
// sum_l(w_l*R''_{kl}(u,z))
//
// See the adjoints model document for more details.
// We first do an adjoint solve to get z for each quantity of
// interest
// if we havent already or dont have an initial condition for the adjoint
if (!this->is_adjoint_already_solved())
{
this->adjoint_solve(qoi_indices);
}
// Get ready to fill in senstivities:
sensitivities.allocate_data(qoi_indices, *this, parameters);
// We can't solve for all the solution sensitivities u'_l or for all
// of the parameter sensitivity adjoint solutions z^l without
// requiring O(Nq*Np) linear solves. So we'll solve directly for their
// weighted sum - this is just O(Nq) solves.
// First solve for sum_l(w_l u'_l).
this->weighted_sensitivity_solve(parameters, vector);
// Then solve for sum_l(w_l z^l).
this->weighted_sensitivity_adjoint_solve(parameters, vector, qoi_indices);
for (unsigned int k=0; k != Np; ++k)
{
// We approximate sum_l(w_l * Q''_{kl}) with a central
// differencing pertubation:
// sum_l(w_l * Q''_{kl}) ~=
// (Q(p + dp*w_l*e_l + dp*e_k) - Q(p - dp*w_l*e_l + dp*e_k) -
// Q(p + dp*w_l*e_l - dp*e_k) + Q(p - dp*w_l*e_l - dp*e_k))/(4*dp^2)
// The sum(w_l*R''_kl) term requires the same sort of pertubation,
// and so we subtract it in at the same time:
// sum_l(w_l * R''_{kl}) ~=
// (R(p + dp*w_l*e_l + dp*e_k) - R(p - dp*w_l*e_l + dp*e_k) -
// R(p + dp*w_l*e_l - dp*e_k) + R(p - dp*w_l*e_l - dp*e_k))/(4*dp^2)
ParameterVector oldparameters, parameterperturbation;
parameters.deep_copy(oldparameters);
vector.deep_copy(parameterperturbation);
parameterperturbation *= delta_p;
parameters += parameterperturbation;
Number old_parameter = *parameters[k];
*parameters[k] = old_parameter + delta_p;
this->assemble_qoi(qoi_indices);
this->assembly(true, false, true);
this->rhs->close();
std::vector<Number> partial2q_term = this->qoi;
std::vector<Number> partial2R_term(this->qoi.size());
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
partial2R_term[i] = this->rhs->dot(this->get_adjoint_solution(i));
*parameters[k] = old_parameter - delta_p;
this->assemble_qoi(qoi_indices);
this->assembly(true, false, true);
this->rhs->close();
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
partial2q_term[i] -= this->qoi[i];
partial2R_term[i] -= this->rhs->dot(this->get_adjoint_solution(i));
}
oldparameters.value_copy(parameters);
parameterperturbation *= -1.0;
parameters += parameterperturbation;
// Re-center old_parameter, which may be affected by vector
old_parameter = *parameters[k];
*parameters[k] = old_parameter + delta_p;
this->assemble_qoi(qoi_indices);
this->assembly(true, false, true);
this->rhs->close();
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
partial2q_term[i] -= this->qoi[i];
partial2R_term[i] -= this->rhs->dot(this->get_adjoint_solution(i));
}
*parameters[k] = old_parameter - delta_p;
this->assemble_qoi(qoi_indices);
this->assembly(true, false, true);
this->rhs->close();
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
partial2q_term[i] += this->qoi[i];
partial2R_term[i] += this->rhs->dot(this->get_adjoint_solution(i));
}
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
partial2q_term[i] /= (4. * delta_p * delta_p);
partial2R_term[i] /= (4. * delta_p * delta_p);
}
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
sensitivities[i][k] = partial2q_term[i] - partial2R_term[i];
// We get (partial q / partial u), R, and
// (partial R / partial u) from the user, but centrally
// difference to get q_uk, R_k, and R_uk terms:
// (partial R / partial k)
// R_k*sum(w_l*z^l) = (R(p+dp*e_k)*sum(w_l*z^l) - R(p-dp*e_k)*sum(w_l*z^l))/(2*dp)
// (partial^2 q / partial u partial k)
// q_uk = (q_u(p+dp*e_k) - q_u(p-dp*e_k))/(2*dp)
// (partial^2 R / partial u partial k)
// R_uk*z*sum(w_l*u'_l) = (R_u(p+dp*e_k)*z*sum(w_l*u'_l) - R_u(p-dp*e_k)*z*sum(w_l*u'_l))/(2*dp)
// To avoid creating Nq temporary vectors for q_uk or R_uk, we add
// subterms to the sensitivities output one by one.
//
// FIXME: this is probably a bad order of operations for
// controlling floating point error.
*parameters[k] = old_parameter + delta_p;
this->assembly(true, true);
this->rhs->close();
this->matrix->close();
this->assemble_qoi_derivative(qoi_indices,
/* include_liftfunc = */ true,
/* apply_constraints = */ false);
this->matrix->vector_mult(*tempvec, this->get_weighted_sensitivity_solution());
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
this->get_adjoint_rhs(i).close();
sensitivities[i][k] += (this->get_adjoint_rhs(i).dot(this->get_weighted_sensitivity_solution()) -
this->rhs->dot(this->get_weighted_sensitivity_adjoint_solution(i)) -
this->get_adjoint_solution(i).dot(*tempvec)) / (2.*delta_p);
}
*parameters[k] = old_parameter - delta_p;
this->assembly(true, true);
this->rhs->close();
this->matrix->close();
this->assemble_qoi_derivative(qoi_indices,
/* include_liftfunc = */ true,
/* apply_constraints = */ false);
this->matrix->vector_mult(*tempvec, this->get_weighted_sensitivity_solution());
for (unsigned int i=0; i != Nq; ++i)
if (qoi_indices.has_index(i))
{
this->get_adjoint_rhs(i).close();
sensitivities[i][k] += (-this->get_adjoint_rhs(i).dot(this->get_weighted_sensitivity_solution()) +
this->rhs->dot(this->get_weighted_sensitivity_adjoint_solution(i)) +
this->get_adjoint_solution(i).dot(*tempvec)) / (2.*delta_p);
}
}
// All parameters have been reset.
// Don't leave the qoi or system changed - principle of least
// surprise.
this->assembly(true, true);
this->rhs->close();
this->matrix->close();
this->assemble_qoi(qoi_indices);
}
| void libMesh::System::qoi_parameter_sensitivity | ( | const QoISet & | qoi_indices, |
| const ParameterVector & | parameters, | ||
| SensitivityData & | sensitivities | ||
| ) | [virtual, inherited] |
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].
Note that parameters is a const vector, not a vector-of-const; parameter values in this vector need to be mutable for finite differencing to work.
Automatically chooses the forward method for problems with more quantities of interest than parameters, or the adjoint method otherwise.
This method is only usable in derived classes which overload an implementation.
Definition at line 523 of file system.C.
References libMesh::ParameterVector::size(), and libMesh::QoISet::size().
{
// Forward sensitivities are more efficient for Nq > Np
if (qoi_indices.size(*this) > parameters.size())
forward_qoi_parameter_sensitivity(qoi_indices, parameters, sensitivities);
// Adjoint sensitivities are more efficient for Np > Nq,
// and an adjoint may be more reusable than a forward
// solution sensitivity in the Np == Nq case.
else
adjoint_qoi_parameter_sensitivity(qoi_indices, parameters, sensitivities);
}
| void libMesh::System::re_update | ( | ) | [virtual, inherited] |
Re-update the local values when the mesh has changed. This method takes the data updated by update() and makes it up-to-date on the current mesh.
Reimplemented in libMesh::TransientSystem< RBConstruction >.
Definition at line 442 of file system.C.
References libMesh::System::current_local_solution, libMesh::System::get_dof_map(), libMesh::DofMap::get_send_list(), libMesh::System::n_vars(), and libMesh::System::solution.
{
parallel_object_only();
// If this system is empty... don't do anything!
if(!this->n_vars())
return;
const std::vector<dof_id_type>& send_list = this->get_dof_map().get_send_list ();
// Check sizes
libmesh_assert_equal_to (current_local_solution->size(), solution->size());
// Not true with ghosted vectors
// libmesh_assert_equal_to (current_local_solution->local_size(), solution->size());
// libmesh_assert (!send_list.empty());
libmesh_assert_less_equal (send_list.size(), solution->size());
// Create current_local_solution from solution. This will
// put a local copy of solution into current_local_solution.
solution->localize (*current_local_solution, send_list);
}
| void libMesh::System::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 |
||
| ) | [inherited] |
Reads the basic data header for this System.
Definition at line 115 of file system_io.C.
References libMesh::System::_additional_data_written, libMesh::System::_written_var_indices, libMesh::System::add_variable(), libMesh::System::add_vector(), libMesh::Parallel::Communicator::broadcast(), libMesh::System::clear(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::FEType::family, libMesh::System::get_mesh(), libMesh::FEType::inf_map, libMesh::libmesh_assert(), libMesh::MeshBase::mesh_dimension(), libMesh::MONOMIAL, libMesh::on_command_line(), libMesh::FEType::order, libMesh::out, libMesh::ParallelObject::processor_id(), libMesh::FEType::radial_family, libMesh::FEType::radial_order, libMesh::Xdr::reading(), libMesh::System::variable_number(), libMesh::Xdr::version(), and libMesh::XYZ.
Referenced by libMesh::EquationSystems::_read_impl().
{
// This method implements the input of a
// System object, embedded in the output of
// an EquationSystems<T_sys>. This warrants some
// documentation. The output file essentially
// consists of 5 sections:
//
// for this system
//
// 5.) The number of variables in the system (unsigned int)
//
// for each variable in the system
//
// 6.) The name of the variable (string)
//
// 6.1.) Variable subdmains
//
// 7.) Combined in an FEType:
// - The approximation order(s) of the variable
// (Order Enum, cast to int/s)
// - The finite element family/ies of the variable
// (FEFamily Enum, cast to int/s)
//
// end variable loop
//
// 8.) The number of additional vectors (unsigned int),
//
// for each additional vector in the system object
//
// 9.) the name of the additional vector (string)
//
// end system
libmesh_assert (io.reading());
// Possibly clear data structures and start from scratch.
if (read_header_in)
this->clear ();
// Figure out if we need to read infinite element information.
// This will be true if the version string contains " with infinite elements"
const bool read_ifem_info =
(version.rfind(" with infinite elements") < version.size()) ||
libMesh::on_command_line ("--read_ifem_systems");
{
// 5.)
// Read the number of variables in the system
unsigned int nv=0;
if (this->processor_id() == 0)
io.data (nv);
this->comm().broadcast(nv);
_written_var_indices.clear();
_written_var_indices.resize(nv, 0);
for (unsigned int var=0; var<nv; var++)
{
// 6.)
// Read the name of the var-th variable
std::string var_name;
if (this->processor_id() == 0)
io.data (var_name);
this->comm().broadcast(var_name);
// 6.1.)
std::set<subdomain_id_type> domains;
if (io.version() >= LIBMESH_VERSION_ID(0,7,2))
{
std::vector<subdomain_id_type> domain_array;
if (this->processor_id() == 0)
io.data (domain_array);
for (std::vector<subdomain_id_type>::iterator it = domain_array.begin(); it != domain_array.end(); ++it)
domains.insert(*it);
}
this->comm().broadcast(domains);
// 7.)
// Read the approximation order(s) of the var-th variable
int order=0;
if (this->processor_id() == 0)
io.data (order);
this->comm().broadcast(order);
// do the same for infinite element radial_order
int rad_order=0;
if (read_ifem_info)
{
if (this->processor_id() == 0)
io.data(rad_order);
this->comm().broadcast(rad_order);
}
// Read the finite element type of the var-th variable
int fam=0;
if (this->processor_id() == 0)
io.data (fam);
this->comm().broadcast(fam);
FEType type;
type.order = static_cast<Order>(order);
type.family = static_cast<FEFamily>(fam);
// Check for incompatibilities. The shape function indexing was
// changed for the monomial and xyz finite element families to
// simplify extension to arbitrary p. The consequence is that
// old restart files will not be read correctly. This is expected
// to be an unlikely occurance, but catch it anyway.
if (read_legacy_format)
if ((type.family == MONOMIAL || type.family == XYZ) &&
((type.order > 2 && this->get_mesh().mesh_dimension() == 2) ||
(type.order > 1 && this->get_mesh().mesh_dimension() == 3)))
{
libmesh_here();
libMesh::out << "*****************************************************************\n"
<< "* WARNING: reading a potentially incompatible restart file!!! *\n"
<< "* contact libmesh-users@lists.sourceforge.net for more details *\n"
<< "*****************************************************************"
<< std::endl;
}
// Read additional information for infinite elements
int radial_fam=0;
int i_map=0;
if (read_ifem_info)
{
if (this->processor_id() == 0)
io.data (radial_fam);
this->comm().broadcast(radial_fam);
if (this->processor_id() == 0)
io.data (i_map);
this->comm().broadcast(i_map);
}
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
type.radial_order = static_cast<Order>(rad_order);
type.radial_family = static_cast<FEFamily>(radial_fam);
type.inf_map = static_cast<InfMapType>(i_map);
#endif
if (read_header_in)
{
if (domains.empty())
_written_var_indices[var] = this->add_variable (var_name, type);
else
_written_var_indices[var] = this->add_variable (var_name, type, &domains);
}
else
_written_var_indices[var] = this->variable_number(var_name);
}
}
// 8.)
// Read the number of additional vectors.
unsigned int nvecs=0;
if (this->processor_id() == 0)
io.data (nvecs);
this->comm().broadcast(nvecs);
// If nvecs > 0, this means that write_additional_data
// was true when this file was written. We will need to
// make use of this fact later.
if (nvecs > 0)
this->_additional_data_written = true;
for (unsigned int vec=0; vec<nvecs; vec++)
{
// 9.)
// Read the name of the vec-th additional vector
std::string vec_name;
if (this->processor_id() == 0)
io.data (vec_name);
this->comm().broadcast(vec_name);
if (read_additional_data)
{
// Systems now can handle adding post-initialization vectors
// libmesh_assert(this->_can_add_vectors);
// Some systems may have added their own vectors already
// libmesh_assert_equal_to (this->_vectors.count(vec_name), 0);
this->add_vector(vec_name);
}
}
}
| void libMesh::System::read_legacy_data | ( | Xdr & | io, |
| const bool | read_additional_data = true |
||
| ) | [inherited] |
Reads additional data, namely vectors, for this System.
Definition at line 310 of file system_io.C.
References libMesh::System::_additional_data_written, libMesh::System::_vectors, libMesh::System::_written_var_indices, libMesh::MeshBase::active_elements_begin(), libMesh::MeshBase::active_elements_end(), libMesh::Parallel::Communicator::broadcast(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), end, libMesh::System::get_mesh(), libMesh::DofObject::invalid_id, libMesh::libmesh_assert(), libMesh::System::n_dofs(), libMesh::System::n_vars(), libMesh::MeshBase::nodes_begin(), libMesh::MeshBase::nodes_end(), libMesh::System::number(), libMesh::ParallelObject::processor_id(), libMesh::Xdr::reading(), libMesh::System::solution, libMesh::sys, and libMesh::zero.
{
libmesh_deprecated();
// This method implements the output of the vectors
// contained in this System object, embedded in the
// output of an EquationSystems<T_sys>.
//
// 10.) The global solution vector, re-ordered to be node-major
// (More on this later.)
//
// for each additional vector in the object
//
// 11.) The global additional vector, re-ordered to be
// node-major (More on this later.)
libmesh_assert (io.reading());
// read and reordering buffers
std::vector<Number> global_vector;
std::vector<Number> reordered_vector;
// 10.)
// Read and set the solution vector
{
if (this->processor_id() == 0)
io.data (global_vector);
this->comm().broadcast(global_vector);
// Remember that the stored vector is node-major.
// We need to put it into whatever application-specific
// ordering we may have using the dof_map.
reordered_vector.resize(global_vector.size());
//libMesh::out << "global_vector.size()=" << global_vector.size() << std::endl;
//libMesh::out << "this->n_dofs()=" << this->n_dofs() << std::endl;
libmesh_assert_equal_to (global_vector.size(), this->n_dofs());
dof_id_type cnt=0;
const unsigned int sys = this->number();
const unsigned int nv = cast_int<unsigned int>
(this->_written_var_indices.size());
libmesh_assert_less_equal (nv, this->n_vars());
for (unsigned int data_var=0; data_var<nv; data_var++)
{
const unsigned int var = _written_var_indices[data_var];
// First reorder the nodal DOF values
{
MeshBase::node_iterator
it = this->get_mesh().nodes_begin(),
end = this->get_mesh().nodes_end();
for (; it != end; ++it)
for (unsigned int index=0; index<(*it)->n_comp(sys,var); index++)
{
libmesh_assert_not_equal_to ((*it)->dof_number(sys, var, index),
DofObject::invalid_id);
libmesh_assert_less (cnt, global_vector.size());
reordered_vector[(*it)->dof_number(sys, var, index)] =
global_vector[cnt++];
}
}
// Then reorder the element DOF values
{
MeshBase::element_iterator
it = this->get_mesh().active_elements_begin(),
end = this->get_mesh().active_elements_end();
for (; it != end; ++it)
for (unsigned int index=0; index<(*it)->n_comp(sys,var); index++)
{
libmesh_assert_not_equal_to ((*it)->dof_number(sys, var, index),
DofObject::invalid_id);
libmesh_assert_less (cnt, global_vector.size());
reordered_vector[(*it)->dof_number(sys, var, index)] =
global_vector[cnt++];
}
}
}
*(this->solution) = reordered_vector;
}
// For each additional vector, simply go through the list.
// ONLY attempt to do this IF additional data was actually
// written to the file for this system (controlled by the
// _additional_data_written flag).
if (this->_additional_data_written)
{
std::map<std::string, NumericVector<Number>* >::iterator
pos = this->_vectors.begin();
for (; pos != this->_vectors.end(); ++pos)
{
// 11.)
// Read the values of the vec-th additional vector.
// Prior do _not_ clear, but fill with zero, since the
// additional vectors _have_ to have the same size
// as the solution vector
std::fill (global_vector.begin(), global_vector.end(), libMesh::zero);
if (this->processor_id() == 0)
io.data (global_vector);
this->comm().broadcast(global_vector);
// If read_additional_data==true, then we will keep this vector, otherwise
// we are going to throw it away.
if (read_additional_data)
{
// Remember that the stored vector is node-major.
// We need to put it into whatever application-specific
// ordering we may have using the dof_map.
std::fill (reordered_vector.begin(),
reordered_vector.end(),
libMesh::zero);
reordered_vector.resize(global_vector.size());
libmesh_assert_equal_to (global_vector.size(), this->n_dofs());
dof_id_type cnt=0;
const unsigned int sys = this->number();
const unsigned int nv = cast_int<unsigned int>
(this->_written_var_indices.size());
libmesh_assert_less_equal (nv, this->n_vars());
for (unsigned int data_var=0; data_var<nv; data_var++)
{
const unsigned int var = _written_var_indices[data_var];
// First reorder the nodal DOF values
{
MeshBase::node_iterator
it = this->get_mesh().nodes_begin(),
end = this->get_mesh().nodes_end();
for (; it!=end; ++it)
for (unsigned int index=0; index<(*it)->n_comp(sys,var); index++)
{
libmesh_assert_not_equal_to ((*it)->dof_number(sys, var, index),
DofObject::invalid_id);
libmesh_assert_less (cnt, global_vector.size());
reordered_vector[(*it)->dof_number(sys, var, index)] =
global_vector[cnt++];
}
}
// Then reorder the element DOF values
{
MeshBase::element_iterator
it = this->get_mesh().active_elements_begin(),
end = this->get_mesh().active_elements_end();
for (; it!=end; ++it)
for (unsigned int index=0; index<(*it)->n_comp(sys,var); index++)
{
libmesh_assert_not_equal_to ((*it)->dof_number(sys, var, index),
DofObject::invalid_id);
libmesh_assert_less (cnt, global_vector.size());
reordered_vector[(*it)->dof_number(sys, var, index)] =
global_vector[cnt++];
}
}
}
// use the overloaded operator=(std::vector) to assign the values
*(pos->second) = reordered_vector;
}
}
} // end if (_additional_data_written)
}
| template void libMesh::System::read_parallel_data< Real > | ( | Xdr & | io, |
| const bool | read_additional_data | ||
| ) | [inherited] |
Reads additional data, namely vectors, for this System. This method may safely be called on a distributed-memory mesh. This method will read an individual file for each processor in the simulation where the local solution components for that processor are stored.
This method implements the output of the vectors contained in this System object, embedded in the output of an EquationSystems<T_sys>.
9.) The global solution vector, re-ordered to be node-major (More on this later.)
for each additional vector in the object
10.) The global additional vector, re-ordered to be node-major (More on this later.)
Note that the actual IO is handled through the Xdr class (to be renamed later?) which provides a uniform interface to both the XDR (eXternal Data Representation) interface and standard ASCII output. Thus this one section of code will read XDR or ASCII files with no changes.
Definition at line 498 of file system_io.C.
References libMesh::System::_vectors, libMesh::System::_written_var_indices, libMesh::Xdr::data(), libMesh::FEType::family, libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::DofObject::invalid_id, libMesh::Xdr::is_open(), libMesh::libmesh_assert(), libMesh::ParallelObject::n_processors(), libMesh::System::n_vars(), libMesh::System::number(), libMesh::ParallelObject::processor_id(), libMesh::Xdr::reading(), libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), libMesh::System::solution, libMesh::Variable::type(), and libMesh::System::variable().
{
// PerfLog pl("IO Performance",false);
// pl.push("read_parallel_data");
dof_id_type total_read_size = 0;
libmesh_assert (io.reading());
libmesh_assert (io.is_open());
// build the ordered nodes and element maps.
// when writing/reading parallel files we need to iterate
// over our nodes/elements in order of increasing global id().
// however, this is not guaranteed to be ordering we obtain
// by using the node_iterators/element_iterators directly.
// so build a set, sorted by id(), that provides the ordering.
// further, for memory economy build the set but then transfer
// its contents to vectors, which will be sorted.
std::vector<const DofObject*> ordered_nodes, ordered_elements;
{
std::set<const DofObject*, CompareDofObjectsByID>
ordered_nodes_set (this->get_mesh().local_nodes_begin(),
this->get_mesh().local_nodes_end());
ordered_nodes.insert(ordered_nodes.end(),
ordered_nodes_set.begin(),
ordered_nodes_set.end());
}
{
std::set<const DofObject*, CompareDofObjectsByID>
ordered_elements_set (this->get_mesh().local_elements_begin(),
this->get_mesh().local_elements_end());
ordered_elements.insert(ordered_elements.end(),
ordered_elements_set.begin(),
ordered_elements_set.end());
}
// std::vector<Number> io_buffer;
std::vector<InValType> io_buffer;
// 9.)
//
// Actually read the solution components
// for the ith system to disk
io.data(io_buffer);
total_read_size += cast_int<dof_id_type>(io_buffer.size());
const unsigned int sys_num = this->number();
const unsigned int nv = cast_int<unsigned int>
(this->_written_var_indices.size());
libmesh_assert_less_equal (nv, this->n_vars());
dof_id_type cnt=0;
// Loop over each non-SCALAR variable and each node, and read out the value.
for (unsigned int data_var=0; data_var<nv; data_var++)
{
const unsigned int var = _written_var_indices[data_var];
if(this->variable(var).type().family != SCALAR)
{
// First read the node DOF values
for (std::vector<const DofObject*>::const_iterator
it = ordered_nodes.begin(); it != ordered_nodes.end(); ++it)
for (unsigned int comp=0; comp<(*it)->n_comp(sys_num, var); comp++)
{
libmesh_assert_not_equal_to ((*it)->dof_number(sys_num, var, comp),
DofObject::invalid_id);
libmesh_assert_less (cnt, io_buffer.size());
this->solution->set((*it)->dof_number(sys_num, var, comp), io_buffer[cnt++]);
}
// Then read the element DOF values
for (std::vector<const DofObject*>::const_iterator
it = ordered_elements.begin(); it != ordered_elements.end(); ++it)
for (unsigned int comp=0; comp<(*it)->n_comp(sys_num, var); comp++)
{
libmesh_assert_not_equal_to ((*it)->dof_number(sys_num, var, comp),
DofObject::invalid_id);
libmesh_assert_less (cnt, io_buffer.size());
this->solution->set((*it)->dof_number(sys_num, var, comp), io_buffer[cnt++]);
}
}
}
// Finally, read the SCALAR variables on the last processor
for (unsigned int data_var=0; data_var<nv; data_var++)
{
const unsigned int var = _written_var_indices[data_var];
if(this->variable(var).type().family == SCALAR)
{
if (this->processor_id() == (this->n_processors()-1))
{
const DofMap& dof_map = this->get_dof_map();
std::vector<dof_id_type> SCALAR_dofs;
dof_map.SCALAR_dof_indices(SCALAR_dofs, var);
for(unsigned int i=0; i<SCALAR_dofs.size(); i++)
{
this->solution->set( SCALAR_dofs[i], io_buffer[cnt++] );
}
}
}
}
// And we're done setting solution entries
this->solution->close();
// Only read additional vectors if wanted
if (read_additional_data)
{
std::map<std::string, NumericVector<Number>* >::const_iterator
pos = _vectors.begin();
for(; pos != this->_vectors.end(); ++pos)
{
cnt=0;
io_buffer.clear();
// 10.)
//
// Actually read the additional vector components
// for the ith system to disk
io.data(io_buffer);
total_read_size += cast_int<dof_id_type>(io_buffer.size());
// Loop over each non-SCALAR variable and each node, and read out the value.
for (unsigned int data_var=0; data_var<nv; data_var++)
{
const unsigned int var = _written_var_indices[data_var];
if(this->variable(var).type().family != SCALAR)
{
// First read the node DOF values
for (std::vector<const DofObject*>::const_iterator
it = ordered_nodes.begin(); it != ordered_nodes.end(); ++it)
for (unsigned int comp=0; comp<(*it)->n_comp(sys_num, var); comp++)
{
libmesh_assert_not_equal_to ((*it)->dof_number(sys_num, var, comp),
DofObject::invalid_id);
libmesh_assert_less (cnt, io_buffer.size());
pos->second->set((*it)->dof_number(sys_num, var, comp), io_buffer[cnt++]);
}
// Then read the element DOF values
for (std::vector<const DofObject*>::const_iterator
it = ordered_elements.begin(); it != ordered_elements.end(); ++it)
for (unsigned int comp=0; comp<(*it)->n_comp(sys_num, var); comp++)
{
libmesh_assert_not_equal_to ((*it)->dof_number(sys_num, var, comp),
DofObject::invalid_id);
libmesh_assert_less (cnt, io_buffer.size());
pos->second->set((*it)->dof_number(sys_num, var, comp), io_buffer[cnt++]);
}
}
}
// Finally, read the SCALAR variables on the last processor
for (unsigned int data_var=0; data_var<nv; data_var++)
{
const unsigned int var = _written_var_indices[data_var];
if(this->variable(var).type().family == SCALAR)
{
if (this->processor_id() == (this->n_processors()-1))
{
const DofMap& dof_map = this->get_dof_map();
std::vector<dof_id_type> SCALAR_dofs;
dof_map.SCALAR_dof_indices(SCALAR_dofs, var);
for(unsigned int i=0; i<SCALAR_dofs.size(); i++)
{
pos->second->set( SCALAR_dofs[i], io_buffer[cnt++] );
}
}
}
}
// And we're done setting entries for this variable
pos->second->close();
}
}
// const Real
// dt = pl.get_elapsed_time(),
// rate = total_read_size*sizeof(Number)/dt;
// libMesh::err << "Read " << total_read_size << " \"Number\" values\n"
// << " Elapsed time = " << dt << '\n'
// << " Rate = " << rate/1.e6 << "(MB/sec)\n\n";
// pl.pop("read_parallel_data");
}
| void libMesh::System::read_parallel_data | ( | Xdr & | io, |
| const bool | read_additional_data | ||
| ) | [inline, inherited] |
Non-templated version for backward compatibility.
Reads additional data, namely vectors, for this System. This method may safely be called on a distributed-memory mesh. This method will read an individual file for each processor in the simulation where the local solution components for that processor are stored.
Definition at line 1290 of file system.h.
{ read_parallel_data<Number>(io, read_additional_data); }
| void libMesh::RBParametrized::read_parameter_data_from_files | ( | const std::string & | continuous_param_file_name, |
| const std::string & | discrete_param_file_name, | ||
| const bool | read_binary_data | ||
| ) | [inherited] |
Read in the parameter ranges from files.
| virtual void libMesh::RBConstruction::read_riesz_representors_from_files | ( | const std::string & | riesz_representors_dir, |
| const bool | write_binary_residual_representors | ||
| ) | [virtual] |
Read in all the Riesz representor data from files. directory_name specifies which directory to read from. io_flag specifies whether we read in all data, or only a basis (in)dependent subset.
Reimplemented in libMesh::TransientRBConstruction.
| template void libMesh::System::read_serialized_data< Real > | ( | Xdr & | io, |
| const bool | read_additional_data = true |
||
| ) | [inherited] |
Reads additional data, namely vectors, for this System. This method may safely be called on a distributed-memory mesh.
Definition at line 713 of file system_io.C.
References libMesh::System::_vectors, libMesh::ParallelObject::processor_id(), and libMesh::System::solution.
{
// This method implements the input of the vectors
// contained in this System object, embedded in the
// output of an EquationSystems<T_sys>.
//
// 10.) The global solution vector, re-ordered to be node-major
// (More on this later.)
//
// for each additional vector in the object
//
// 11.) The global additional vector, re-ordered to be
// node-major (More on this later.)
parallel_object_only();
std::string comment;
// PerfLog pl("IO Performance",false);
// pl.push("read_serialized_data");
// std::size_t total_read_size = 0;
// 10.)
// Read the global solution vector
{
// total_read_size +=
this->read_serialized_vector<InValType>(io, *this->solution);
// get the comment
if (this->processor_id() == 0)
io.comment (comment);
}
// 11.)
// Only read additional vectors if wanted
if (read_additional_data)
{
std::map<std::string, NumericVector<Number>* >::const_iterator
pos = _vectors.begin();
for(; pos != this->_vectors.end(); ++pos)
{
// total_read_size +=
this->read_serialized_vector<InValType>(io, *pos->second);
// get the comment
if (this->processor_id() == 0)
io.comment (comment);
}
}
// const Real
// dt = pl.get_elapsed_time(),
// rate = total_read_size*sizeof(Number)/dt;
// libMesh::out << "Read " << total_read_size << " \"Number\" values\n"
// << " Elapsed time = " << dt << '\n'
// << " Rate = " << rate/1.e6 << "(MB/sec)\n\n";
// pl.pop("read_serialized_data");
}
| void libMesh::System::read_serialized_data | ( | Xdr & | io, |
| const bool | read_additional_data = true |
||
| ) | [inline, inherited] |
| template std::size_t libMesh::System::read_serialized_vectors< Real > | ( | Xdr & | io, |
| const std::vector< NumericVector< Number > * > & | vectors | ||
| ) | const [inherited] |
Read a number of identically distributed vectors. This method allows for optimization for the multiple vector case by only communicating the metadata once.
Definition at line 2193 of file system_io.C.
References libMesh::Xdr::data(), libMesh::FEType::family, libMesh::System::get_mesh(), libMesh::libmesh_assert(), libMesh::MeshBase::n_elem(), libMesh::MeshTools::n_elem(), n_nodes, libMesh::MeshBase::n_nodes(), libMesh::System::n_vars(), libMesh::ParallelObject::processor_id(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::Xdr::reading(), libMesh::SCALAR, libMesh::Variable::type(), and libMesh::System::variable().
{
parallel_object_only();
// Error checking
// #ifndef NDEBUG
// // In parallel we better be reading a parallel vector -- if not
// // we will not set all of its components below!!
// if (this->n_processors() > 1)
// {
// libmesh_assert (vec.type() == PARALLEL ||
// vec.type() == GHOSTED);
// }
// #endif
libmesh_assert (io.reading());
if (this->processor_id() == 0)
{
// sizes
unsigned int num_vecs=0;
dof_id_type vector_length=0;
// Get the number of vectors
io.data(num_vecs);
// Get the buffer size
io.data(vector_length);
libmesh_assert_equal_to (num_vecs, vectors.size());
if (num_vecs != 0)
{
libmesh_assert_not_equal_to (vectors[0], 0);
libmesh_assert_equal_to (vectors[0]->size(), vector_length);
}
}
// no need to actually communicate these.
// this->comm().broadcast(num_vecs);
// this->comm().broadcast(vector_length);
// Cache these - they are not free!
const dof_id_type
n_nodes = this->get_mesh().n_nodes(),
n_elem = this->get_mesh().n_elem();
std::size_t read_length = 0.;
//---------------------------------
// Collect the values for all nodes
read_length +=
this->read_serialized_blocked_dof_objects (n_nodes,
this->get_mesh().local_nodes_begin(),
this->get_mesh().local_nodes_end(),
InValType(),
io,
vectors);
//------------------------------------
// Collect the values for all elements
read_length +=
this->read_serialized_blocked_dof_objects (n_elem,
this->get_mesh().local_elements_begin(),
this->get_mesh().local_elements_end(),
InValType(),
io,
vectors);
//-------------------------------------------
// Finally loop over all the SCALAR variables
for (unsigned int vec=0; vec<vectors.size(); vec++)
for (unsigned int var=0; var<this->n_vars(); var++)
if(this->variable(var).type().family == SCALAR)
{
libmesh_assert_not_equal_to (vectors[vec], 0);
read_length +=
this->read_SCALAR_dofs (var, io, *vectors[vec]);
}
//---------------------------------------
// last step - must close all the vectors
for (unsigned int vec=0; vec<vectors.size(); vec++)
{
libmesh_assert_not_equal_to (vectors[vec], 0);
vectors[vec]->close();
}
return read_length;
}
| std::size_t libMesh::System::read_serialized_vectors | ( | Xdr & | io, |
| const std::vector< NumericVector< Number > * > & | vectors | ||
| ) | const [inline, inherited] |
Non-templated version for backward compatibility.
Read a number of identically distributed vectors. This method allows for optimization for the multiple vector case by only communicating the metadata once.
Definition at line 1268 of file system.h.
{ return read_serialized_vectors<Number>(io, vectors); }
| virtual void libMesh::RBConstruction::recompute_all_residual_terms | ( | const bool | compute_inner_products = true | ) | [virtual] |
This function computes all of the residual representors, can be useful when restarting a basis training computation. If compute_inner_products is false, we just compute the residual Riesz representors, whereas if true, we also compute all the corresponding inner product terms.
| void libMesh::LinearImplicitSystem::reinit | ( | ) | [virtual, inherited] |
Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be used.
Reimplemented from libMesh::ImplicitSystem.
Reimplemented in libMesh::NewmarkSystem, and libMesh::TransientSystem< RBConstruction >.
Definition at line 85 of file linear_implicit_system.C.
References libMesh::LinearImplicitSystem::linear_solver, and libMesh::ImplicitSystem::reinit().
{
// re-initialize the linear solver interface
linear_solver->clear();
// initialize parent data
Parent::reinit();
}
| void libMesh::System::reinit_constraints | ( | ) | [virtual, inherited] |
Reinitializes the constraints for this system.
Definition at line 412 of file system.C.
References libMesh::System::_mesh, libMesh::DofMap::create_dof_constraints(), libMesh::System::get_dof_map(), libMesh::DofMap::prepare_send_list(), libMesh::DofMap::process_constraints(), libMesh::System::time, and libMesh::System::user_constrain().
{
get_dof_map().create_dof_constraints(_mesh, this->time);
user_constrain();
get_dof_map().process_constraints(_mesh);
get_dof_map().prepare_send_list();
}
| void libMesh::LinearImplicitSystem::release_linear_solver | ( | LinearSolver< Number > * | ) | const [virtual, inherited] |
Releases a pointer to a linear solver acquired by this->get_linear_solver()
Reimplemented from libMesh::ImplicitSystem.
Definition at line 373 of file linear_implicit_system.C.
{
}
| void libMesh::System::remove_vector | ( | const std::string & | vec_name | ) | [inherited] |
Removes the additional vector vec_name from this system
Definition at line 727 of file system.C.
References libMesh::System::_vector_is_adjoint, libMesh::System::_vector_projections, libMesh::System::_vector_types, libMesh::System::_vectors, and libMesh::System::have_vector().
{
//Return if the vector does not exist
if ( !(this->have_vector(vec_name)) )
return;
_vectors[vec_name]->clear();
delete _vectors[vec_name];
_vectors[vec_name] = NULL;
_vectors.erase(vec_name);
_vector_projections.erase(vec_name);
_vector_is_adjoint.erase(vec_name);
_vector_types.erase(vec_name);
}
| const SparseMatrix< Number > * libMesh::ImplicitSystem::request_matrix | ( | const std::string & | mat_name | ) | const [inherited] |
mat_name, or returns NULL if no matrix by that name exists. Definition at line 227 of file implicit_system.C.
References libMesh::ImplicitSystem::_matrices.
Referenced by libMesh::ImplicitSystem::sensitivity_solve(), libMesh::NewtonSolver::solve(), and libMesh::LinearImplicitSystem::solve().
{
// Make sure the matrix exists
const_matrices_iterator pos = _matrices.find (mat_name);
if (pos == _matrices.end())
return NULL;
return pos->second;
}
| SparseMatrix< Number > * libMesh::ImplicitSystem::request_matrix | ( | const std::string & | mat_name | ) | [inherited] |
mat_name, or returns NULL if no matrix by that name exists. Definition at line 240 of file implicit_system.C.
References libMesh::ImplicitSystem::_matrices.
{
// Make sure the matrix exists
matrices_iterator pos = _matrices.find (mat_name);
if (pos == _matrices.end())
return NULL;
return pos->second;
}
| const NumericVector< Number > * libMesh::System::request_vector | ( | const std::string & | vec_name | ) | const [inherited] |
System has a vector associated with the given name, NULL otherwise. Definition at line 743 of file system.C.
References libMesh::System::_vectors.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error().
{
const_vectors_iterator pos = _vectors.find(vec_name);
if (pos == _vectors.end())
return NULL;
return pos->second;
}
| NumericVector< Number > * libMesh::System::request_vector | ( | const std::string & | vec_name | ) | [inherited] |
System has a vector associated with the given name, NULL otherwise. Definition at line 755 of file system.C.
References libMesh::System::_vectors.
{
vectors_iterator pos = _vectors.find(vec_name);
if (pos == _vectors.end())
return NULL;
return pos->second;
}
| const NumericVector< Number > * libMesh::System::request_vector | ( | const unsigned int | vec_num | ) | const [inherited] |
vec_num (where the vectors are counted starting with 0), or returns NULL if the system has no such vector. Definition at line 767 of file system.C.
References libMesh::System::vectors_begin(), and libMesh::System::vectors_end().
{
const_vectors_iterator v = vectors_begin();
const_vectors_iterator v_end = vectors_end();
unsigned int num = 0;
while((num<vec_num) && (v!=v_end))
{
num++;
++v;
}
if (v==v_end)
return NULL;
return v->second;
}
| NumericVector< Number > * libMesh::System::request_vector | ( | const unsigned int | vec_num | ) | [inherited] |
vec_num (where the vectors are counted starting with 0), or returns NULL if the system has no such vector. Definition at line 784 of file system.C.
References libMesh::System::vectors_begin(), and libMesh::System::vectors_end().
{
vectors_iterator v = vectors_begin();
vectors_iterator v_end = vectors_end();
unsigned int num = 0;
while((num<vec_num) && (v!=v_end))
{
num++;
++v;
}
if (v==v_end)
return NULL;
return v->second;
}
| void libMesh::RBConstructionBase< LinearImplicitSystem >::reset_alternative_solver | ( | UniquePtr< LinearSolver< Number > > & | ls, |
| const std::pair< std::string, std::string > & | orig | ||
| ) | [inherited] |
Resets the PC (and iterative solver, if desired) in the passed-in LinearSolver object to the values specified in the pair of strings passed as the second argument. If the "alternative_solver" string, defined below, is "unchanged", this function does nothing.
| void libMesh::LinearImplicitSystem::restrict_solve_to | ( | const SystemSubset * | subset, |
| const SubsetSolveMode | subset_solve_mode = SUBSET_ZERO |
||
| ) | [virtual, inherited] |
After calling this method, any solve will be limited to the given subset. To disable this mode, call this method with subset being a NULL pointer.
Reimplemented from libMesh::System.
Definition at line 96 of file linear_implicit_system.C.
References libMesh::LinearImplicitSystem::_subset, libMesh::LinearImplicitSystem::_subset_solve_mode, and libMesh::SystemSubset::get_system().
Referenced by libMesh::LinearImplicitSystem::clear().
{
_subset = subset;
_subset_solve_mode = subset_solve_mode;
if(subset!=NULL)
{
libmesh_assert_equal_to (&subset->get_system(), this);
}
}
| void libMesh::System::restrict_vectors | ( | ) | [virtual, inherited] |
Restrict vectors after the mesh has coarsened
Definition at line 320 of file system.C.
References libMesh::System::_dof_map, libMesh::System::_solution_projection, libMesh::System::_vector_projections, libMesh::System::_vector_types, libMesh::System::_vectors, libMesh::System::current_local_solution, libMesh::GHOSTED, libMesh::System::n_dofs(), libMesh::System::n_local_dofs(), libMesh::System::project_vector(), libMesh::System::solution, and libMesh::System::vector_is_adjoint().
Referenced by libMesh::System::prolong_vectors(), and libMesh::EquationSystems::reinit().
{
#ifdef LIBMESH_ENABLE_AMR
// Restrict the _vectors on the coarsened cells
for (vectors_iterator pos = _vectors.begin(); pos != _vectors.end(); ++pos)
{
NumericVector<Number>* v = pos->second;
if (_vector_projections[pos->first])
{
this->project_vector (*v, this->vector_is_adjoint(pos->first));
}
else
{
ParallelType type = _vector_types[pos->first];
if(type == GHOSTED)
{
#ifdef LIBMESH_ENABLE_GHOSTED
pos->second->init (this->n_dofs(), this->n_local_dofs(),
_dof_map->get_send_list(), false,
GHOSTED);
#else
libmesh_error_msg("Cannot initialize ghosted vectors when they are not enabled.");
#endif
}
else
pos->second->init (this->n_dofs(), this->n_local_dofs(), false, type);
}
}
const std::vector<dof_id_type>& send_list = _dof_map->get_send_list ();
// Restrict the solution on the coarsened cells
if (_solution_projection)
this->project_vector (*solution);
#ifdef LIBMESH_ENABLE_GHOSTED
current_local_solution->init(this->n_dofs(),
this->n_local_dofs(), send_list,
false, GHOSTED);
#else
current_local_solution->init(this->n_dofs());
#endif
if (_solution_projection)
solution->localize (*current_local_solution, send_list);
#endif // LIBMESH_ENABLE_AMR
}
| std::pair< unsigned int, Real > libMesh::ImplicitSystem::sensitivity_solve | ( | const ParameterVector & | parameters | ) | [virtual, inherited] |
Assembles & solves the linear system(s) (dR/du)*u_p = -dR/dp, for those parameters contained within parameters.
Returns a pair with the total number of linear iterations performed and the (sum of the) final residual norms
Reimplemented from libMesh::System.
Definition at line 304 of file implicit_system.C.
References libMesh::System::add_sensitivity_solution(), libMesh::System::assemble_before_solve, libMesh::ImplicitSystem::assemble_residual_derivatives(), libMesh::ImplicitSystem::assembly(), libMesh::SparseMatrix< T >::close(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::System::get_dof_map(), libMesh::ImplicitSystem::get_linear_solve_parameters(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::System::get_sensitivity_rhs(), libMesh::System::get_sensitivity_solution(), libMesh::ImplicitSystem::matrix, libMesh::pc, libMesh::ImplicitSystem::release_linear_solver(), libMesh::ImplicitSystem::request_matrix(), libMesh::ParameterVector::size(), libMesh::LinearSolver< T >::solve(), and libMesh::START_LOG().
{
// Log how long the linear solve takes.
START_LOG("sensitivity_solve()", "ImplicitSystem");
// The forward system should now already be solved.
// Now assemble the corresponding sensitivity system.
if (this->assemble_before_solve)
{
// Build the Jacobian
this->assembly(false, true);
this->matrix->close();
// Reset and build the RHS from the residual derivatives
this->assemble_residual_derivatives(parameters);
}
// The sensitivity problem is linear
LinearSolver<Number> *linear_solver = this->get_linear_solver();
// Our iteration counts and residuals will be sums of the individual
// results
std::pair<unsigned int, Real> solver_params =
this->get_linear_solve_parameters();
std::pair<unsigned int, Real> totalrval = std::make_pair(0,0.0);
// Solve the linear system.
SparseMatrix<Number> *pc = this->request_matrix("Preconditioner");
for (unsigned int p=0; p != parameters.size(); ++p)
{
std::pair<unsigned int, Real> rval =
linear_solver->solve (*matrix, pc,
this->add_sensitivity_solution(p),
this->get_sensitivity_rhs(p),
solver_params.second,
solver_params.first);
totalrval.first += rval.first;
totalrval.second += rval.second;
}
// The linear solver may not have fit our constraints exactly
#ifdef LIBMESH_ENABLE_CONSTRAINTS
for (unsigned int p=0; p != parameters.size(); ++p)
this->get_dof_map().enforce_constraints_exactly
(*this, &this->get_sensitivity_solution(p),
/* homogeneous = */ true);
#endif
this->release_linear_solver(linear_solver);
// Stop logging the nonlinear solve
STOP_LOG("sensitivity_solve()", "ImplicitSystem");
return totalrval;
}
| void libMesh::System::set_adjoint_already_solved | ( | bool | setting | ) | [inline, inherited] |
Setter for the adjoint_already_solved boolean
Definition at line 381 of file system.h.
References libMesh::System::adjoint_already_solved.
{ adjoint_already_solved = setting;}
| std::pair<std::string,std::string> libMesh::RBConstructionBase< LinearImplicitSystem >::set_alternative_solver | ( | UniquePtr< LinearSolver< Number > > & | ls | ) | [inherited] |
Changes the current PC (and iterative solver, if desired) in the passed-in LinearSolver object to an alternative solver specified by the alternative_solver string stored in this class. You might use this to e.g. switch to a sparse direct solver for the multiple RHS solves executed during the update_residual_terms function. The return strings are names of the original PC and KSP objects, you can reset these using the reset_alternative_solver() function below.
| void libMesh::System::set_basic_system_only | ( | ) | [inline, inherited] |
Sets the system to be "basic only": i.e. advanced system components such as ImplicitSystem matrices may not be initialized. This is useful for efficiency in certain utility programs that never use System::solve(). This method must be called after the System or derived class is created but before it is initialized; e.g. from within EquationSystems::read()
Definition at line 2025 of file system.h.
References libMesh::System::_basic_system_only.
Referenced by libMesh::EquationSystems::_read_impl().
{
_basic_system_only = true;
}
| void libMesh::RBConstruction::set_constraint_assembly | ( | ElemAssembly & | constraint_assembly_in | ) |
Set the rb_assembly_expansion object.
| virtual void libMesh::RBConstruction::set_context_solution_vec | ( | NumericVector< Number > & | vec | ) | [protected, virtual] |
Set current_local_solution = vec so that we can access vec from FEMContext during assembly. Override in subclasses if different behavior is required.
| void libMesh::RBConstruction::set_convergence_assertion_flag | ( | bool | flag | ) |
Setter for the flag determining if convergence should be checked after each solve.
| void libMesh::RBConstructionBase< LinearImplicitSystem >::set_deterministic_training_parameter_name | ( | const std::string & | name | ) | [inherited] |
In some cases we only want to allow discrete parameter values, instead of parameters that may take any value in a specified interval. Here we provide a method to set the d Set the discrete values for parameter mu that are allowed in the training set. This must be called before the training set is generated. Set the name of the parameter that we will generate deterministic training parameters for. Defaults to "NONE".
| void libMesh::RBConstructionBase< LinearImplicitSystem >::set_deterministic_training_parameter_repeats | ( | unsigned int | repeats | ) | [inherited] |
Set the number of times each sample of the deterministic training parameter is repeated.
| void libMesh::RBConstruction::set_inner_product_assembly | ( | ElemAssembly & | inner_product_assembly_in | ) |
Set the rb_assembly_expansion object.
| virtual void libMesh::RBConstruction::set_Nmax | ( | unsigned int | Nmax | ) | [virtual] |
| void libMesh::RBParametrized::set_parameters | ( | const RBParameters & | params | ) | [inherited] |
Set the current parameters to params
| void libMesh::RBConstructionBase< LinearImplicitSystem >::set_params_from_training_set | ( | unsigned int | index | ) | [protected, inherited] |
Set parameters to the RBParameters stored in index index of the training set.
| virtual void libMesh::RBConstructionBase< LinearImplicitSystem >::set_params_from_training_set_and_broadcast | ( | unsigned int | index | ) | [protected, virtual, inherited] |
Load the specified training parameter and then broadcast to all processors.
| void libMesh::RBConstruction::set_quiet_mode | ( | bool | quiet_mode_in | ) | [inline] |
Set the quiet_mode flag. If quiet == false then we print out a lot of extra information during the Offline stage.
Definition at line 190 of file rb_construction.h.
References quiet_mode.
{ this->quiet_mode = quiet_mode_in; }
| void libMesh::RBConstruction::set_rb_assembly_expansion | ( | RBAssemblyExpansion & | rb_assembly_expansion_in | ) |
Set the rb_assembly_expansion object.
| void libMesh::RBConstruction::set_rb_construction_parameters | ( | unsigned int | n_training_samples_in, |
| bool | deterministic_training_in, | ||
| std::string | alternative_solver_in, | ||
| bool | reuse_preconditioner_in, | ||
| bool | use_relative_bound_in_greedy_in, | ||
| bool | write_data_during_training_in, | ||
| unsigned int | training_parameters_random_seed_in, | ||
| bool | quiet_mode_in, | ||
| unsigned int | Nmax_in, | ||
| Real | training_tolerance_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 | ||
| ) |
Set the state of this RBConstruction object based on the arguments to this function.
| void libMesh::RBConstruction::set_rb_evaluation | ( | RBEvaluation & | rb_eval_in | ) |
Set the RBEvaluation object.
| void libMesh::RBConstructionBase< LinearImplicitSystem >::set_training_random_seed | ( | unsigned int | seed | ) | [inherited] |
Set the seed that is used to randomly generate training parameters.
| void libMesh::RBConstruction::set_training_tolerance | ( | Real | new_training_tolerance | ) | [inline] |
Get/set the tolerance for the basis training.
Definition at line 174 of file rb_construction.h.
References training_tolerance.
{this->training_tolerance = new_training_tolerance; }
| void libMesh::System::set_vector_as_adjoint | ( | const std::string & | vec_name, |
| int | qoi_num | ||
| ) | [inherited] |
Allows one to set the QoI index controlling whether the vector identified by vec_name represents a solution from the adjoint (qoi_num >= 0) or primal (qoi_num == -1) space. This becomes significant if those spaces have differing heterogeneous Dirichlet constraints.
qoi_num == -2 can be used to indicate a vector which should not be affected by constraints during projection operations.
Definition at line 912 of file system.C.
References libMesh::System::_vector_is_adjoint.
Referenced by libMesh::System::add_adjoint_solution(), and libMesh::System::add_weighted_sensitivity_adjoint_solution().
{
// We reserve -1 for vectors which get primal constraints, -2 for
// vectors which get no constraints
libmesh_assert_greater_equal(qoi_num, -2);
_vector_is_adjoint[vec_name] = qoi_num;
}
| void libMesh::System::set_vector_preservation | ( | const std::string & | vec_name, |
| bool | preserve | ||
| ) | [inherited] |
Allows one to set the boolean controlling whether the vector identified by vec_name should be "preserved": projected to new meshes, saved, etc.
Definition at line 894 of file system.C.
References libMesh::System::_vector_projections.
{
_vector_projections[vec_name] = preserve;
}
| void libMesh::LinearImplicitSystem::solve | ( | ) | [virtual, inherited] |
Assembles & solves the linear system A*x=b.
Reimplemented from libMesh::ExplicitSystem.
Reimplemented in libMesh::FrequencySystem.
Definition at line 109 of file linear_implicit_system.C.
References libMesh::LinearImplicitSystem::_final_linear_residual, libMesh::LinearImplicitSystem::_n_linear_iterations, libMesh::LinearImplicitSystem::_shell_matrix, libMesh::LinearImplicitSystem::_subset, libMesh::LinearImplicitSystem::_subset_solve_mode, libMesh::LinearImplicitSystem::assemble(), libMesh::System::assemble_before_solve, libMesh::SystemSubset::dof_ids(), libMesh::Parameters::get(), libMesh::System::get_equation_systems(), libMesh::LinearImplicitSystem::linear_solver, libMesh::ImplicitSystem::matrix, libMesh::System::name(), libMesh::on_command_line(), libMesh::EquationSystems::parameters, libMesh::Real, libMesh::ImplicitSystem::request_matrix(), libMesh::ExplicitSystem::rhs, libMesh::System::solution, and libMesh::System::update().
{
if (this->assemble_before_solve)
// Assemble the linear system
this->assemble ();
// Log how long the linear solve takes.
// This gets done by the LinearSolver classes now [RHS]
// START_LOG("solve()", "System");
// Get a reference to the EquationSystems
const EquationSystems& es =
this->get_equation_systems();
// If the linear solver hasn't been initialized, we do so here.
if (libMesh::on_command_line("--solver_system_names"))
linear_solver->init((this->name()+"_").c_str());
else
linear_solver->init();
// Get the user-specifiied linear solver tolerance
const Real tol =
es.parameters.get<Real>("linear solver tolerance");
// Get the user-specified maximum # of linear solver iterations
const unsigned int maxits =
es.parameters.get<unsigned int>("linear solver maximum iterations");
if(_subset!=NULL)
{
linear_solver->restrict_solve_to(&_subset->dof_ids(),_subset_solve_mode);
}
// Solve the linear system. Several cases:
std::pair<unsigned int, Real> rval = std::make_pair(0,0.0);
if(_shell_matrix)
// 1.) Shell matrix with or without user-supplied preconditioner.
rval = linear_solver->solve(*_shell_matrix, this->request_matrix("Preconditioner"), *solution, *rhs, tol, maxits);
else
// 2.) No shell matrix, with or without user-supplied preconditioner
rval = linear_solver->solve (*matrix, this->request_matrix("Preconditioner"), *solution, *rhs, tol, maxits);
if(_subset!=NULL)
{
linear_solver->restrict_solve_to(NULL);
}
// Store the number of linear iterations required to
// solve and the final residual.
_n_linear_iterations = rval.first;
_final_linear_residual = rval.second;
// Stop logging the linear solve
// This gets done by the LinearSolver classes now [RHS]
// STOP_LOG("solve()", "System");
// Update the system after the solve
this->update();
}
| sys_type& libMesh::RBConstruction::system | ( | ) | [inline] |
Reimplemented from libMesh::RBConstructionBase< LinearImplicitSystem >.
Reimplemented in libMesh::TransientSystem< RBConstruction >.
Definition at line 113 of file rb_construction.h.
{ return *this; }
| virtual std::string libMesh::RBConstruction::system_type | ( | ) | const [virtual] |
Reimplemented from libMesh::LinearImplicitSystem.
Reimplemented in libMesh::TransientSystem< RBConstruction >.
| virtual Real libMesh::RBConstruction::train_reduced_basis | ( | const std::string & | directory_name = "offline_data", |
| const bool | resize_rb_eval_data = true |
||
| ) | [virtual] |
Train the reduced basis. This is the crucial function in the Offline stage: it generates the reduced basis using the "Greedy algorithm." Each stage of the Greedy algorithm involves solving the reduced basis over a large training set and selecting the parameter at which the reduced basis error bound is largest, then performing a truth_solve at that parameter and enriching the reduced basis with the corresponding snapshot.
resize_rb_eval_data is a boolean flag to indicate whether or not we call rb_eval->resize_data_structures(Nmax). True by default, by we may set it to false if, for example, we are continuing from a previous training run and don't want to clobber the existing rb_eval data.
Reimplemented in libMesh::RBEIMConstruction, and libMesh::TransientRBConstruction.
| virtual void libMesh::RBConstruction::truth_assembly | ( | ) | [protected, virtual] |
Assemble the truth matrix and right-hand side for current_parameters.
Reimplemented in libMesh::TransientRBConstruction.
| virtual Real libMesh::RBConstruction::truth_solve | ( | int | plot_solution | ) | [virtual] |
Perform a "truth" solve, i.e. solve the finite element system at at the parameters currently set in the system. This is used extensively in training the reduced basis, since "truth snapshots" are employed as basis functions.
Reimplemented in libMesh::RBEIMConstruction, and libMesh::TransientRBConstruction.
| void libMesh::System::update | ( | ) | [virtual, inherited] |
Update the local values to reflect the solution on neighboring processors.
Definition at line 421 of file system.C.
References libMesh::System::_dof_map, libMesh::System::current_local_solution, libMesh::libmesh_assert(), and libMesh::System::solution.
Referenced by libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_residual(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::FEMSystem::assemble_qoi(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::FEMSystem::assembly(), libMesh::NonlinearImplicitSystem::assembly(), libMesh::EquationSystems::build_solution_vector(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::GMVIO::copy_nodal_solution(), DMlibMeshFunction(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::EquationSystems::get_solution(), libMesh::FEMSystem::mesh_position_get(), libMesh::FEMSystem::postprocess(), libMesh::NewtonSolver::solve(), libMesh::ExplicitSystem::solve(), libMesh::LinearImplicitSystem::solve(), and libMesh::NonlinearImplicitSystem::solve().
{
libmesh_assert(solution->closed());
const std::vector<dof_id_type>& send_list = _dof_map->get_send_list ();
// Check sizes
libmesh_assert_equal_to (current_local_solution->size(), solution->size());
// More processors than elements => empty send_list
// libmesh_assert (!send_list.empty());
libmesh_assert_less_equal (send_list.size(), solution->size());
// Create current_local_solution from solution. This will
// put a local copy of solution into current_local_solution.
// Only the necessary values (specified by the send_list)
// are copied to minimize communication
solution->localize (*current_local_solution, send_list);
}
| void libMesh::System::update_global_solution | ( | std::vector< Number > & | global_soln | ) | const [inherited] |
Fill the input vector global_soln so that it contains the global solution on all processors. Requires communication with all other processors.
Definition at line 670 of file system.C.
References libMesh::System::solution.
Referenced by libMesh::ExactSolution::_compute_error(), libMesh::EquationSystems::build_discontinuous_solution_vector(), and libMesh::ExactErrorEstimator::estimate_error().
| void libMesh::System::update_global_solution | ( | std::vector< Number > & | global_soln, |
| const processor_id_type | dest_proc | ||
| ) | const [inherited] |
Fill the input vector global_soln so that it contains the global solution on processor dest_proc. Requires communication with all other processors.
Definition at line 679 of file system.C.
References libMesh::System::solution.
| void libMesh::RBConstruction::update_greedy_param_list | ( | ) | [protected] |
Update the list of Greedily chosen parameters with current_parameters.
| virtual void libMesh::RBConstruction::update_RB_system_matrices | ( | ) | [protected, virtual] |
Compute the reduced basis matrices for the current basis.
Reimplemented in libMesh::TransientRBConstruction, and libMesh::RBEIMConstruction.
| virtual void libMesh::RBConstruction::update_residual_terms | ( | bool | compute_inner_products = true | ) | [protected, virtual] |
Compute the terms that are combined `online' to determine the dual norm of the residual. 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.
Reimplemented in libMesh::TransientRBConstruction.
| virtual void libMesh::RBConstruction::update_system | ( | ) | [protected, virtual] |
Update the system after enriching the RB space; this calls a series of functions to update the system properly.
Reimplemented in libMesh::TransientRBConstruction, and libMesh::RBEIMConstruction.
| void libMesh::System::user_assembly | ( | ) | [virtual, inherited] |
Calls user's attached assembly function, or is overloaded by the user in derived classes.
Definition at line 1934 of file system.C.
References libMesh::System::_assemble_system_function, libMesh::System::_assemble_system_object, libMesh::System::_equation_systems, libMesh::System::Assembly::assemble(), and libMesh::System::name().
Referenced by libMesh::System::assemble().
{
// Call the user-provided assembly function,
// if it was provided
if (_assemble_system_function != NULL)
this->_assemble_system_function (_equation_systems, this->name());
// ...or the user-provided assembly object.
else if (_assemble_system_object != NULL)
this->_assemble_system_object->assemble();
}
| void libMesh::System::user_constrain | ( | ) | [virtual, inherited] |
Calls user's attached constraint function, or is overloaded by the user in derived classes.
Definition at line 1948 of file system.C.
References libMesh::System::_constrain_system_function, libMesh::System::_constrain_system_object, libMesh::System::_equation_systems, libMesh::System::Constraint::constrain(), and libMesh::System::name().
Referenced by libMesh::EquationSystems::allgather(), libMesh::System::init_data(), libMesh::EquationSystems::reinit(), and libMesh::System::reinit_constraints().
{
// Call the user-provided constraint function,
// if it was provided
if (_constrain_system_function!= NULL)
this->_constrain_system_function(_equation_systems, this->name());
// ...or the user-provided constraint object.
else if (_constrain_system_object != NULL)
this->_constrain_system_object->constrain();
}
| void libMesh::System::user_initialization | ( | ) | [virtual, inherited] |
Calls user's attached initialization function, or is overloaded by the user in derived classes.
Definition at line 1920 of file system.C.
References libMesh::System::_equation_systems, libMesh::System::_init_system_function, libMesh::System::_init_system_object, libMesh::System::Initialization::initialize(), and libMesh::System::name().
Referenced by libMesh::System::init(), and libMesh::NewmarkSystem::initial_conditions().
{
// Call the user-provided intialization function,
// if it was provided
if (_init_system_function != NULL)
this->_init_system_function (_equation_systems, this->name());
// ...or the user-provided initialization object.
else if (_init_system_object != NULL)
this->_init_system_object->initialize();
}
| void libMesh::System::user_QOI | ( | const QoISet & | qoi_indices | ) | [virtual, inherited] |
Calls user's attached quantity of interest function, or is overloaded by the user in derived classes.
Definition at line 1962 of file system.C.
References libMesh::System::_equation_systems, libMesh::System::_qoi_evaluate_function, libMesh::System::_qoi_evaluate_object, libMesh::System::name(), and libMesh::System::QOI::qoi().
Referenced by libMesh::System::assemble_qoi().
{
// Call the user-provided quantity of interest function,
// if it was provided
if (_qoi_evaluate_function != NULL)
this->_qoi_evaluate_function(_equation_systems, this->name(), qoi_indices);
// ...or the user-provided QOI function object.
else if (_qoi_evaluate_object != NULL)
this->_qoi_evaluate_object->qoi(qoi_indices);
}
| void libMesh::System::user_QOI_derivative | ( | const QoISet & | qoi_indices = QoISet(), |
| bool | include_liftfunc = true, |
||
| bool | apply_constraints = true |
||
| ) | [virtual, inherited] |
Calls user's attached quantity of interest derivative function, or is overloaded by the user in derived classes.
Definition at line 1976 of file system.C.
References libMesh::System::_equation_systems, libMesh::System::_qoi_evaluate_derivative_function, libMesh::System::_qoi_evaluate_derivative_object, libMesh::System::name(), and libMesh::System::QOIDerivative::qoi_derivative().
Referenced by libMesh::System::assemble_qoi_derivative().
{
// Call the user-provided quantity of interest derivative,
// if it was provided
if (_qoi_evaluate_derivative_function != NULL)
this->_qoi_evaluate_derivative_function
(_equation_systems, this->name(), qoi_indices, include_liftfunc,
apply_constraints);
// ...or the user-provided QOI derivative function object.
else if (_qoi_evaluate_derivative_object != NULL)
this->_qoi_evaluate_derivative_object->qoi_derivative
(qoi_indices, include_liftfunc, apply_constraints);
}
| const Variable & libMesh::System::variable | ( | unsigned int | var | ) | const [inline, inherited] |
Return a constant reference to Variable var.
Definition at line 2061 of file system.h.
References libMesh::System::_variables.
Referenced by libMesh::ExactSolution::_compute_error(), libMesh::EquationSystems::build_solution_vector(), libMesh::EquationSystems::get_solution(), libMesh::System::project_vector(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::System::write_header(), libMesh::System::write_parallel_data(), libMesh::System::write_serialized_vector(), and libMesh::System::write_serialized_vectors().
{
libmesh_assert_less (i, _variables.size());
return _variables[i];
}
| const VariableGroup & libMesh::System::variable_group | ( | unsigned int | vg | ) | const [inline, inherited] |
Return a constant reference to VariableGroup vg.
Definition at line 2071 of file system.h.
References libMesh::System::_variable_groups.
Referenced by libMesh::FEMSystem::assembly(), and libMesh::System::get_info().
{
libmesh_assert_less (vg, _variable_groups.size());
return _variable_groups[vg];
}
| const std::string & libMesh::System::variable_name | ( | const unsigned int | i | ) | const [inline, inherited] |
i. Definition at line 2081 of file system.h.
References libMesh::System::_variables.
Referenced by libMesh::System::add_variable(), libMesh::System::add_variables(), libMesh::DiscontinuityMeasure::boundary_side_integration(), libMesh::KellyErrorEstimator::boundary_side_integration(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::ExactSolution::ExactSolution(), libMesh::EquationSystems::get_solution(), libMesh::ParsedFEMFunction< Output >::ParsedFEMFunction(), libMesh::petsc_auto_fieldsplit(), and libMesh::System::write_header().
{
libmesh_assert_less (i, _variables.size());
return _variables[i].name();
}
| unsigned short int libMesh::System::variable_number | ( | const std::string & | var | ) | const [inherited] |
var. Definition at line 1270 of file system.C.
References libMesh::System::_variable_numbers, and libMesh::System::_variables.
Referenced by libMesh::ExactSolution::_compute_error(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::GMVIO::copy_nodal_solution(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::System::read_header(), libMesh::System::variable_scalar_number(), libMesh::System::variable_type(), libMesh::EnsightIO::write_scalar_ascii(), and libMesh::EnsightIO::write_vector_ascii().
{
// Make sure the variable exists
std::map<std::string, unsigned short int>::const_iterator
pos = _variable_numbers.find(var);
if (pos == _variable_numbers.end())
libmesh_error_msg("ERROR: variable " << var << " does not exist in this system!");
libmesh_assert_equal_to (_variables[pos->second].name(), var);
return pos->second;
}
| unsigned int libMesh::System::variable_scalar_number | ( | const std::string & | var, |
| unsigned int | component | ||
| ) | const [inline, inherited] |
variable_number(var) Irony: currently our only non-scalar-valued variable type is SCALAR.
Definition at line 2092 of file system.h.
References libMesh::System::variable_number().
Referenced by libMesh::ExactSolution::_compute_error(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::ProjectSolution::operator()(), libMesh::ProjectFEMSolution::operator()(), libMesh::BoundaryProjectSolution::operator()(), and libMesh::System::project_vector().
{
return variable_scalar_number(this->variable_number(var), component);
}
| unsigned int libMesh::System::variable_scalar_number | ( | unsigned int | var_num, |
| unsigned int | component | ||
| ) | const [inline, inherited] |
var_num Irony: currently our only non-scalar-valued variable type is SCALAR.
Definition at line 2102 of file system.h.
References libMesh::System::_variables.
{
return _variables[var_num].first_scalar_number() + component;
}
| const FEType & libMesh::System::variable_type | ( | const unsigned int | i | ) | const [inline, inherited] |
i. Definition at line 2111 of file system.h.
References libMesh::System::_variables.
Referenced by libMesh::System::add_variable(), libMesh::System::add_variables(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::EquationSystems::build_solution_vector(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::GMVIO::copy_nodal_solution(), libMesh::DGFEMContext::DGFEMContext(), libMesh::FEMContext::FEMContext(), libMesh::EquationSystems::get_solution(), libMesh::FEMSystem::init_context(), libMesh::System::write_header(), libMesh::EnsightIO::write_scalar_ascii(), and libMesh::EnsightIO::write_vector_ascii().
{
libmesh_assert_less (i, _variables.size());
return _variables[i].type();
}
| const FEType & libMesh::System::variable_type | ( | const std::string & | var | ) | const [inline, inherited] |
var. Definition at line 2121 of file system.h.
References libMesh::System::_variables, and libMesh::System::variable_number().
{
return _variables[this->variable_number(var)].type();
}
| int libMesh::System::vector_is_adjoint | ( | const std::string & | vec_name | ) | const [inherited] |
Definition at line 923 of file system.C.
References libMesh::System::_vector_is_adjoint, and libMesh::libmesh_assert().
Referenced by libMesh::System::restrict_vectors().
{
libmesh_assert(_vector_is_adjoint.find(vec_name) !=
_vector_is_adjoint.end());
return _vector_is_adjoint.find(vec_name)->second;
}
| const std::string & libMesh::System::vector_name | ( | const unsigned int | vec_num | ) | const [inherited] |
vec_num (where the vectors are counted starting with 0). Definition at line 859 of file system.C.
References libMesh::libmesh_assert(), libMesh::System::vectors_begin(), and libMesh::System::vectors_end().
{
const_vectors_iterator v = vectors_begin();
const_vectors_iterator v_end = vectors_end();
unsigned int num = 0;
while((num<vec_num) && (v!=v_end))
{
num++;
++v;
}
libmesh_assert (v != v_end);
return v->first;
}
| const std::string & libMesh::System::vector_name | ( | const NumericVector< Number > & | vec_reference | ) | const [inherited] |
Definition at line 873 of file system.C.
References libMesh::libmesh_assert(), libMesh::System::vectors_begin(), and libMesh::System::vectors_end().
{
const_vectors_iterator v = vectors_begin();
const_vectors_iterator v_end = vectors_end();
for(; v != v_end; ++v)
{
// Check if the current vector is the one whose name we want
if(&vec_reference == v->second)
break; // exit loop if it is
}
// Before returning, make sure we didnt loop till the end and not find any match
libmesh_assert (v != v_end);
// Return the string associated with the current vector
return v->first;
}
| bool libMesh::System::vector_preservation | ( | const std::string & | vec_name | ) | const [inherited] |
Definition at line 902 of file system.C.
References libMesh::System::_vector_projections.
Referenced by libMesh::MemorySolutionHistory::store().
{
if (_vector_projections.find(vec_name) == _vector_projections.end())
return false;
return _vector_projections.find(vec_name)->second;
}
| System::vectors_iterator libMesh::System::vectors_begin | ( | ) | [inline, inherited] |
Beginning of vectors container
Definition at line 2173 of file system.h.
References libMesh::System::_vectors.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::get_vector(), libMesh::System::request_vector(), libMesh::MemorySolutionHistory::store(), libMesh::VTKIO::system_vectors_to_vtk(), and libMesh::System::vector_name().
{
return _vectors.begin();
}
| System::const_vectors_iterator libMesh::System::vectors_begin | ( | ) | const [inline, inherited] |
Beginning of vectors container
Definition at line 2179 of file system.h.
References libMesh::System::_vectors.
{
return _vectors.begin();
}
| System::vectors_iterator libMesh::System::vectors_end | ( | ) | [inline, inherited] |
End of vectors container
Definition at line 2185 of file system.h.
References libMesh::System::_vectors.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::System::get_vector(), libMesh::System::request_vector(), libMesh::MemorySolutionHistory::store(), libMesh::VTKIO::system_vectors_to_vtk(), and libMesh::System::vector_name().
{
return _vectors.end();
}
| System::const_vectors_iterator libMesh::System::vectors_end | ( | ) | const [inline, inherited] |
End of vectors container
Definition at line 2191 of file system.h.
References libMesh::System::_vectors.
{
return _vectors.end();
}
| std::pair< unsigned int, Real > libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve | ( | const ParameterVector & | parameters, |
| const ParameterVector & | weights, | ||
| const QoISet & | qoi_indices = QoISet() |
||
| ) | [virtual, inherited] |
Assembles & solves the linear system(s) (dR/du)^T*z_w = sum(w_p*(d^2q/dudp - d^2R/dudp*z)), for those parameters p contained within parameters, weighted by the values w_p found within weights.
Assumes that adjoint_solve has already calculated z for each qoi in qoi_indices.
Returns a pair with the total number of linear iterations performed and the (sum of the) final residual norms
Reimplemented from libMesh::System.
Definition at line 421 of file implicit_system.C.
References libMesh::System::add_weighted_sensitivity_adjoint_solution(), libMesh::ExplicitSystem::assemble_qoi_derivative(), libMesh::ImplicitSystem::assembly(), libMesh::NumericVector< T >::close(), libMesh::SparseMatrix< T >::close(), libMesh::ParameterVector::deep_copy(), libMesh::DofMap::enforce_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::SparseMatrix< T >::get_transpose(), libMesh::System::get_weighted_sensitivity_adjoint_solution(), libMesh::DofMap::has_adjoint_dirichlet_boundaries(), libMesh::QoISet::has_index(), libMesh::libmesh_assert(), libMesh::ImplicitSystem::matrix, libMesh::System::qoi, libMesh::Real, libMesh::ImplicitSystem::release_linear_solver(), libMesh::ExplicitSystem::rhs, libMesh::LinearSolver< T >::solve(), libMesh::START_LOG(), libMesh::TOLERANCE, libMesh::ParameterVector::value_copy(), libMesh::SparseMatrix< T >::vector_mult_add(), and libMesh::NumericVector< T >::zero_clone().
{
// Log how long the linear solve takes.
START_LOG("weighted_sensitivity_adjoint_solve()", "ImplicitSystem");
// We currently get partial derivatives via central differencing
const Real delta_p = TOLERANCE;
ParameterVector& parameters =
const_cast<ParameterVector&>(parameters_in);
// The forward system should now already be solved.
// The adjoint system should now already be solved.
// Now we're assembling a weighted sum of adjoint-adjoint systems:
//
// dR/du (u, sum_l(w_l*z^l)) = sum_l(w_l*(Q''_ul - R''_ul (u, z)))
// FIXME: The derivation here does not yet take adjoint boundary
// conditions into account.
for (unsigned int i=0; i != this->qoi.size(); ++i)
if (qoi_indices.has_index(i))
libmesh_assert(!this->get_dof_map().has_adjoint_dirichlet_boundaries(i));
// We'll assemble the rhs first, because the R'' term will require
// perturbing the jacobian
// We'll use temporary rhs vectors, because we haven't (yet) found
// any good reasons why users might want to save these:
std::vector<NumericVector<Number> *> temprhs(this->qoi.size());
for (unsigned int i=0; i != this->qoi.size(); ++i)
if (qoi_indices.has_index(i))
temprhs[i] = this->rhs->zero_clone().release();
// We approximate the _l partial derivatives via a central
// differencing perturbation in the w_l direction:
//
// sum_l(w_l*v_l) ~= (v(p + dp*w_l*e_l) - v(p - dp*w_l*e_l))/(2*dp)
// PETSc doesn't implement SGEMX, so neither does NumericVector,
// so we want to avoid calculating f -= R'*z. We'll thus evaluate
// the above equation by first adding -v(p+dp...), then multiplying
// the intermediate result vectors by -1, then adding -v(p-dp...),
// then finally dividing by 2*dp.
ParameterVector oldparameters, parameterperturbation;
parameters.deep_copy(oldparameters);
weights.deep_copy(parameterperturbation);
parameterperturbation *= delta_p;
parameters += parameterperturbation;
this->assembly(false, true);
this->matrix->close();
// Take the discrete adjoint, so that we can calculate R_u(u,z) with
// a matrix-vector product of R_u and z.
matrix->get_transpose(*matrix);
this->assemble_qoi_derivative(qoi_indices,
/* include_liftfunc = */ false,
/* apply_constraints = */ true);
for (unsigned int i=0; i != this->qoi.size(); ++i)
if (qoi_indices.has_index(i))
{
this->get_adjoint_rhs(i).close();
*(temprhs[i]) -= this->get_adjoint_rhs(i);
this->matrix->vector_mult_add(*(temprhs[i]), this->get_adjoint_solution(i));
*(temprhs[i]) *= -1.0;
}
oldparameters.value_copy(parameters);
parameterperturbation *= -1.0;
parameters += parameterperturbation;
this->assembly(false, true);
this->matrix->close();
matrix->get_transpose(*matrix);
this->assemble_qoi_derivative(qoi_indices,
/* include_liftfunc = */ false,
/* apply_constraints = */ true);
for (unsigned int i=0; i != this->qoi.size(); ++i)
if (qoi_indices.has_index(i))
{
this->get_adjoint_rhs(i).close();
*(temprhs[i]) -= this->get_adjoint_rhs(i);
this->matrix->vector_mult_add(*(temprhs[i]), this->get_adjoint_solution(i));
*(temprhs[i]) /= (2.0*delta_p);
}
// Finally, assemble the jacobian at the non-perturbed parameter
// values. Ignore assemble_before_solve; if we had a good
// non-perturbed matrix before we've already overwritten it.
oldparameters.value_copy(parameters);
// if (this->assemble_before_solve)
{
// Build the Jacobian
this->assembly(false, true);
this->matrix->close();
// Take the discrete adjoint
matrix->get_transpose(*matrix);
}
// The weighted adjoint-adjoint problem is linear
LinearSolver<Number> *linear_solver = this->get_linear_solver();
// Our iteration counts and residuals will be sums of the individual
// results
std::pair<unsigned int, Real> solver_params =
this->get_linear_solve_parameters();
std::pair<unsigned int, Real> totalrval = std::make_pair(0,0.0);
for (unsigned int i=0; i != this->qoi.size(); ++i)
if (qoi_indices.has_index(i))
{
const std::pair<unsigned int, Real> rval =
linear_solver->solve (*matrix, this->add_weighted_sensitivity_adjoint_solution(i),
*(temprhs[i]),
solver_params.second,
solver_params.first);
totalrval.first += rval.first;
totalrval.second += rval.second;
}
this->release_linear_solver(linear_solver);
for (unsigned int i=0; i != this->qoi.size(); ++i)
if (qoi_indices.has_index(i))
delete temprhs[i];
// The linear solver may not have fit our constraints exactly
#ifdef LIBMESH_ENABLE_CONSTRAINTS
for (unsigned int i=0; i != this->qoi.size(); ++i)
if (qoi_indices.has_index(i))
this->get_dof_map().enforce_constraints_exactly
(*this, &this->get_weighted_sensitivity_adjoint_solution(i),
/* homogeneous = */ true);
#endif
// Stop logging the nonlinear solve
STOP_LOG("weighted_sensitivity_adjoint_solve()", "ImplicitSystem");
return totalrval;
}
| std::pair< unsigned int, Real > libMesh::ImplicitSystem::weighted_sensitivity_solve | ( | const ParameterVector & | parameters, |
| const ParameterVector & | weights | ||
| ) | [virtual, inherited] |
Assembles & solves the linear system(s) (dR/du)*u_w = sum(w_p*-dR/dp), for those parameters p contained within parameters weighted by the values w_p found within weights.
Returns a pair with the total number of linear iterations performed and the (sum of the) final residual norms
Reimplemented from libMesh::System.
Definition at line 574 of file implicit_system.C.
References libMesh::System::add_weighted_sensitivity_solution(), libMesh::ImplicitSystem::assembly(), libMesh::NumericVector< T >::clone(), libMesh::NumericVector< T >::close(), libMesh::SparseMatrix< T >::close(), libMesh::ParameterVector::deep_copy(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::System::get_dof_map(), libMesh::ImplicitSystem::get_linear_solve_parameters(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::System::get_weighted_sensitivity_solution(), libMesh::ImplicitSystem::matrix, libMesh::Real, libMesh::ImplicitSystem::release_linear_solver(), libMesh::ExplicitSystem::rhs, libMesh::LinearSolver< T >::solve(), libMesh::START_LOG(), libMesh::TOLERANCE, and libMesh::ParameterVector::value_copy().
{
// Log how long the linear solve takes.
START_LOG("weighted_sensitivity_solve()", "ImplicitSystem");
// We currently get partial derivatives via central differencing
const Real delta_p = TOLERANCE;
ParameterVector& parameters =
const_cast<ParameterVector&>(parameters_in);
// The forward system should now already be solved.
// Now we're assembling a weighted sum of sensitivity systems:
//
// dR/du (u, v)(sum(w_l*u'_l)) = -sum_l(w_l*R'_l (u, v)) forall v
// We'll assemble the rhs first, because the R' term will require
// perturbing the system, and some applications may not be able to
// assemble a perturbed residual without simultaneously constructing
// a perturbed jacobian.
// We approximate the _l partial derivatives via a central
// differencing perturbation in the w_l direction:
//
// sum_l(w_l*v_l) ~= (v(p + dp*w_l*e_l) - v(p - dp*w_l*e_l))/(2*dp)
ParameterVector oldparameters, parameterperturbation;
parameters.deep_copy(oldparameters);
weights.deep_copy(parameterperturbation);
parameterperturbation *= delta_p;
parameters += parameterperturbation;
this->assembly(true, false, true);
this->rhs->close();
UniquePtr<NumericVector<Number> > temprhs = this->rhs->clone();
oldparameters.value_copy(parameters);
parameterperturbation *= -1.0;
parameters += parameterperturbation;
this->assembly(true, false, true);
this->rhs->close();
*temprhs -= *(this->rhs);
*temprhs /= (2.0*delta_p);
// Finally, assemble the jacobian at the non-perturbed parameter
// values
oldparameters.value_copy(parameters);
// Build the Jacobian
this->assembly(false, true);
this->matrix->close();
// The weighted sensitivity problem is linear
LinearSolver<Number> *linear_solver = this->get_linear_solver();
std::pair<unsigned int, Real> solver_params =
this->get_linear_solve_parameters();
const std::pair<unsigned int, Real> rval =
linear_solver->solve (*matrix, this->add_weighted_sensitivity_solution(),
*temprhs,
solver_params.second,
solver_params.first);
this->release_linear_solver(linear_solver);
// The linear solver may not have fit our constraints exactly
#ifdef LIBMESH_ENABLE_CONSTRAINTS
this->get_dof_map().enforce_constraints_exactly
(*this, &this->get_weighted_sensitivity_solution(),
/* homogeneous = */ true);
#endif
// Stop logging the nonlinear solve
STOP_LOG("weighted_sensitivity_solve()", "ImplicitSystem");
return rval;
}
| void libMesh::System::write_header | ( | Xdr & | io, |
| const std::string & | version, | ||
| const bool | write_additional_data | ||
| ) | const [inherited] |
Writes the basic data header for this System.
This method implements the output of a System object, embedded in the output of an EquationSystems<T_sys>. This warrants some documentation. The output of this part consists of 5 sections:
for this system
5.) The number of variables in the system (unsigned int)
for each variable in the system
6.) The name of the variable (string)
6.1.) subdomain where the variable lives
7.) Combined in an FEType:
end variable loop
8.) The number of additional vectors (unsigned int),
for each additional vector in the system object
9.) the name of the additional vector (string)
end system
Definition at line 1269 of file system_io.C.
References libMesh::System::_vectors, libMesh::Variable::active_subdomains(), libMesh::Xdr::data(), libMesh::FEType::family, libMesh::System::get_mesh(), libMesh::FEType::inf_map, libMesh::libmesh_assert(), libMesh::System::n_vars(), libMesh::System::n_vectors(), libMesh::System::name(), libMesh::FEType::order, libMesh::ParallelObject::processor_id(), libMesh::FEType::radial_family, libMesh::FEType::radial_order, libMesh::System::variable(), libMesh::System::variable_name(), libMesh::System::variable_type(), and libMesh::Xdr::writing().
{
libmesh_assert (io.writing());
// Only write the header information
// if we are processor 0.
if (this->get_mesh().processor_id() != 0)
return;
std::string comment;
char buf[80];
// 5.)
// Write the number of variables in the system
{
// set up the comment
comment = "# No. of Variables in System \"";
comment += this->name();
comment += "\"";
unsigned int nv = this->n_vars();
io.data (nv, comment.c_str());
}
for (unsigned int var=0; var<this->n_vars(); var++)
{
// 6.)
// Write the name of the var-th variable
{
// set up the comment
comment = "# Name, Variable No. ";
std::sprintf(buf, "%u", var);
comment += buf;
comment += ", System \"";
comment += this->name();
comment += "\"";
std::string var_name = this->variable_name(var);
io.data (var_name, comment.c_str());
}
// 6.1.) Variable subdomains
{
// set up the comment
comment = "# Subdomains, Variable \"";
std::sprintf(buf, "%s", this->variable_name(var).c_str());
comment += buf;
comment += "\", System \"";
comment += this->name();
comment += "\"";
const std::set<subdomain_id_type> & domains = this->variable(var).active_subdomains();
std::vector<subdomain_id_type> domain_array;
domain_array.assign(domains.begin(), domains.end());
io.data (domain_array, comment.c_str());
}
// 7.)
// Write the approximation order of the var-th variable
// in this system
{
// set up the comment
comment = "# Approximation Order, Variable \"";
std::sprintf(buf, "%s", this->variable_name(var).c_str());
comment += buf;
comment += "\", System \"";
comment += this->name();
comment += "\"";
int order = static_cast<int>(this->variable_type(var).order);
io.data (order, comment.c_str());
}
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
// do the same for radial_order
{
comment = "# Radial Approximation Order, Variable \"";
std::sprintf(buf, "%s", this->variable_name(var).c_str());
comment += buf;
comment += "\", System \"";
comment += this->name();
comment += "\"";
int rad_order = static_cast<int>(this->variable_type(var).radial_order);
io.data (rad_order, comment.c_str());
}
#endif
// Write the Finite Element type of the var-th variable
// in this System
{
// set up the comment
comment = "# FE Family, Variable \"";
std::sprintf(buf, "%s", this->variable_name(var).c_str());
comment += buf;
comment += "\", System \"";
comment += this->name();
comment += "\"";
const FEType& type = this->variable_type(var);
int fam = static_cast<int>(type.family);
io.data (fam, comment.c_str());
#ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
comment = "# Radial FE Family, Variable \"";
std::sprintf(buf, "%s", this->variable_name(var).c_str());
comment += buf;
comment += "\", System \"";
comment += this->name();
comment += "\"";
int radial_fam = static_cast<int>(type.radial_family);
io.data (radial_fam, comment.c_str());
comment = "# Infinite Mapping Type, Variable \"";
std::sprintf(buf, "%s", this->variable_name(var).c_str());
comment += buf;
comment += "\", System \"";
comment += this->name();
comment += "\"";
int i_map = static_cast<int>(type.inf_map);
io.data (i_map, comment.c_str());
#endif
}
} // end of the variable loop
// 8.)
// Write the number of additional vectors in the System.
// If write_additional_data==false, then write zero for
// the number of additional vectors.
{
{
// set up the comment
comment = "# No. of Additional Vectors, System \"";
comment += this->name();
comment += "\"";
unsigned int nvecs = write_additional_data ? this->n_vectors () : 0;
io.data (nvecs, comment.c_str());
}
if (write_additional_data)
{
std::map<std::string, NumericVector<Number>* >::const_iterator
vec_pos = this->_vectors.begin();
unsigned int cnt=0;
for (; vec_pos != this->_vectors.end(); ++vec_pos)
{
// 9.)
// write the name of the cnt-th additional vector
comment = "# Name of ";
std::sprintf(buf, "%d", cnt++);
comment += buf;
comment += "th vector";
std::string vec_name = vec_pos->first;
io.data (vec_name, comment.c_str());
}
}
}
}
| void libMesh::System::write_parallel_data | ( | Xdr & | io, |
| const bool | write_additional_data | ||
| ) | const [inherited] |
Writes additional data, namely vectors, for this System. This method may safely be called on a distributed-memory mesh. This method will create an individual file for each processor in the simulation where the local solution components for that processor will be stored.
This method implements the output of the vectors contained in this System object, embedded in the output of an EquationSystems<T_sys>.
9.) The global solution vector, re-ordered to be node-major (More on this later.)
for each additional vector in the object
10.) The global additional vector, re-ordered to be node-major (More on this later.)
Note that the actual IO is handled through the Xdr class (to be renamed later?) which provides a uniform interface to both the XDR (eXternal Data Representation) interface and standard ASCII output. Thus this one section of code will read XDR or ASCII files with no changes.
Definition at line 1477 of file system_io.C.
References libMesh::System::_vectors, libMesh::Xdr::data(), libMesh::FEType::family, libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::DofObject::invalid_id, libMesh::libmesh_assert(), libMesh::ParallelObject::n_processors(), libMesh::System::n_vars(), libMesh::System::name(), libMesh::System::number(), libMesh::ParallelObject::processor_id(), libMesh::SCALAR, libMesh::DofMap::SCALAR_dof_indices(), libMesh::System::solution, libMesh::Variable::type(), libMesh::System::variable(), and libMesh::Xdr::writing().
{
// PerfLog pl("IO Performance",false);
// pl.push("write_parallel_data");
// std::size_t total_written_size = 0;
std::string comment;
libmesh_assert (io.writing());
std::vector<Number> io_buffer; io_buffer.reserve(this->solution->local_size());
// build the ordered nodes and element maps.
// when writing/reading parallel files we need to iterate
// over our nodes/elements in order of increasing global id().
// however, this is not guaranteed to be ordering we obtain
// by using the node_iterators/element_iterators directly.
// so build a set, sorted by id(), that provides the ordering.
// further, for memory economy build the set but then transfer
// its contents to vectors, which will be sorted.
std::vector<const DofObject*> ordered_nodes, ordered_elements;
{
std::set<const DofObject*, CompareDofObjectsByID>
ordered_nodes_set (this->get_mesh().local_nodes_begin(),
this->get_mesh().local_nodes_end());
ordered_nodes.insert(ordered_nodes.end(),
ordered_nodes_set.begin(),
ordered_nodes_set.end());
}
{
std::set<const DofObject*, CompareDofObjectsByID>
ordered_elements_set (this->get_mesh().local_elements_begin(),
this->get_mesh().local_elements_end());
ordered_elements.insert(ordered_elements.end(),
ordered_elements_set.begin(),
ordered_elements_set.end());
}
const unsigned int sys_num = this->number();
const unsigned int nv = this->n_vars();
// Loop over each non-SCALAR variable and each node, and write out the value.
for (unsigned int var=0; var<nv; var++)
if (this->variable(var).type().family != SCALAR)
{
// First write the node DOF values
for (std::vector<const DofObject*>::const_iterator
it = ordered_nodes.begin(); it != ordered_nodes.end(); ++it)
for (unsigned int comp=0; comp<(*it)->n_comp(sys_num, var); comp++)
{
//libMesh::out << "(*it)->id()=" << (*it)->id() << std::endl;
libmesh_assert_not_equal_to ((*it)->dof_number(sys_num, var, comp),
DofObject::invalid_id);
io_buffer.push_back((*this->solution)((*it)->dof_number(sys_num, var, comp)));
}
// Then write the element DOF values
for (std::vector<const DofObject*>::const_iterator
it = ordered_elements.begin(); it != ordered_elements.end(); ++it)
for (unsigned int comp=0; comp<(*it)->n_comp(sys_num, var); comp++)
{
libmesh_assert_not_equal_to ((*it)->dof_number(sys_num, var, comp),
DofObject::invalid_id);
io_buffer.push_back((*this->solution)((*it)->dof_number(sys_num, var, comp)));
}
}
// Finally, write the SCALAR data on the last processor
for (unsigned int var=0; var<this->n_vars(); var++)
if(this->variable(var).type().family == SCALAR)
{
if (this->processor_id() == (this->n_processors()-1))
{
const DofMap& dof_map = this->get_dof_map();
std::vector<dof_id_type> SCALAR_dofs;
dof_map.SCALAR_dof_indices(SCALAR_dofs, var);
for(unsigned int i=0; i<SCALAR_dofs.size(); i++)
{
io_buffer.push_back( (*this->solution)(SCALAR_dofs[i]) );
}
}
}
// 9.)
//
// Actually write the reordered solution vector
// for the ith system to disk
// set up the comment
{
comment = "# System \"";
comment += this->name();
comment += "\" Solution Vector";
}
io.data (io_buffer, comment.c_str());
// total_written_size += io_buffer.size();
// Only write additional vectors if wanted
if (write_additional_data)
{
std::map<std::string, NumericVector<Number>* >::const_iterator
pos = _vectors.begin();
for(; pos != this->_vectors.end(); ++pos)
{
io_buffer.clear(); io_buffer.reserve( pos->second->local_size());
// Loop over each non-SCALAR variable and each node, and write out the value.
for (unsigned int var=0; var<nv; var++)
if(this->variable(var).type().family != SCALAR)
{
// First write the node DOF values
for (std::vector<const DofObject*>::const_iterator
it = ordered_nodes.begin(); it != ordered_nodes.end(); ++it)
for (unsigned int comp=0; comp<(*it)->n_comp(sys_num, var); comp++)
{
libmesh_assert_not_equal_to ((*it)->dof_number(sys_num, var, comp),
DofObject::invalid_id);
io_buffer.push_back((*pos->second)((*it)->dof_number(sys_num, var, comp)));
}
// Then write the element DOF values
for (std::vector<const DofObject*>::const_iterator
it = ordered_elements.begin(); it != ordered_elements.end(); ++it)
for (unsigned int comp=0; comp<(*it)->n_comp(sys_num, var); comp++)
{
libmesh_assert_not_equal_to ((*it)->dof_number(sys_num, var, comp),
DofObject::invalid_id);
io_buffer.push_back((*pos->second)((*it)->dof_number(sys_num, var, comp)));
}
}
// Finally, write the SCALAR data on the last processor
for (unsigned int var=0; var<this->n_vars(); var++)
if(this->variable(var).type().family == SCALAR)
{
if (this->processor_id() == (this->n_processors()-1))
{
const DofMap& dof_map = this->get_dof_map();
std::vector<dof_id_type> SCALAR_dofs;
dof_map.SCALAR_dof_indices(SCALAR_dofs, var);
for(unsigned int i=0; i<SCALAR_dofs.size(); i++)
{
io_buffer.push_back( (*pos->second)(SCALAR_dofs[i]) );
}
}
}
// 10.)
//
// Actually write the reordered additional vector
// for this system to disk
// set up the comment
{
comment = "# System \"";
comment += this->name();
comment += "\" Additional Vector \"";
comment += pos->first;
comment += "\"";
}
io.data (io_buffer, comment.c_str());
// total_written_size += io_buffer.size();
}
}
// const Real
// dt = pl.get_elapsed_time(),
// rate = total_written_size*sizeof(Number)/dt;
// libMesh::err << "Write " << total_written_size << " \"Number\" values\n"
// << " Elapsed time = " << dt << '\n'
// << " Rate = " << rate/1.e6 << "(MB/sec)\n\n";
// pl.pop("write_parallel_data");
}
| void libMesh::RBParametrized::write_parameter_data_to_files | ( | const std::string & | continuous_param_file_name, |
| const std::string & | discrete_param_file_name, | ||
| const bool | write_binary_data | ||
| ) | [inherited] |
Write out the parameter ranges to files.
| virtual void libMesh::RBConstruction::write_riesz_representors_to_files | ( | const std::string & | riesz_representors_dir, |
| const bool | write_binary_residual_representors | ||
| ) | [virtual] |
Write out all the Riesz representor data to files. residual_representors_dir specifies which directory to write to. write_binary_residual_representors specifies whether we write binary or ASCII data.
Reimplemented in libMesh::TransientRBConstruction.
| void libMesh::System::write_serialized_data | ( | Xdr & | io, |
| const bool | write_additional_data = true |
||
| ) | const [inherited] |
Writes additional data, namely vectors, for this System. This method may safely be called on a distributed-memory mesh.
This method implements the output of the vectors contained in this System object, embedded in the output of an EquationSystems<T_sys>.
9.) The global solution vector, re-ordered to be node-major (More on this later.)
for each additional vector in the object
10.) The global additional vector, re-ordered to be node-major (More on this later.)
Definition at line 1688 of file system_io.C.
References libMesh::System::_vectors, libMesh::Xdr::comment(), libMesh::System::name(), libMesh::ParallelObject::processor_id(), libMesh::System::solution, and libMesh::System::write_serialized_vector().
{
parallel_object_only();
std::string comment;
// PerfLog pl("IO Performance",false);
// pl.push("write_serialized_data");
// std::size_t total_written_size = 0;
// total_written_size +=
this->write_serialized_vector(io, *this->solution);
// set up the comment
if (this->processor_id() == 0)
{
comment = "# System \"";
comment += this->name();
comment += "\" Solution Vector";
io.comment (comment);
}
// Only write additional vectors if wanted
if (write_additional_data)
{
std::map<std::string, NumericVector<Number>* >::const_iterator
pos = _vectors.begin();
for(; pos != this->_vectors.end(); ++pos)
{
// total_written_size +=
this->write_serialized_vector(io, *pos->second);
// set up the comment
if (this->processor_id() == 0)
{
comment = "# System \"";
comment += this->name();
comment += "\" Additional Vector \"";
comment += pos->first;
comment += "\"";
io.comment (comment);
}
}
}
// const Real
// dt = pl.get_elapsed_time(),
// rate = total_written_size*sizeof(Number)/dt;
// libMesh::out << "Write " << total_written_size << " \"Number\" values\n"
// << " Elapsed time = " << dt << '\n'
// << " Rate = " << rate/1.e6 << "(MB/sec)\n\n";
// pl.pop("write_serialized_data");
// // test the new method
// {
// std::vector<std::string> names;
// std::vector<NumericVector<Number>*> vectors_to_write;
// names.push_back("Solution Vector");
// vectors_to_write.push_back(this->solution.get());
// // Only write additional vectors if wanted
// if (write_additional_data)
// {
// std::map<std::string, NumericVector<Number>* >::const_iterator
// pos = _vectors.begin();
// for(; pos != this->_vectors.end(); ++pos)
// {
// names.push_back("Additional Vector " + pos->first);
// vectors_to_write.push_back(pos->second);
// }
// }
// total_written_size =
// this->write_serialized_vectors (io, names, vectors_to_write);
// const Real
// dt2 = pl.get_elapsed_time(),
// rate2 = total_written_size*sizeof(Number)/(dt2-dt);
// libMesh::out << "Write (new) " << total_written_size << " \"Number\" values\n"
// << " Elapsed time = " << (dt2-dt) << '\n'
// << " Rate = " << rate2/1.e6 << "(MB/sec)\n\n";
// }
}
| std::size_t libMesh::System::write_serialized_vectors | ( | Xdr & | io, |
| const std::vector< const NumericVector< Number > * > & | vectors | ||
| ) | const [inherited] |
Serialize & write a number of identically distributed vectors. This method allows for optimization for the multiple vector case by only communicating the metadata once.
Definition at line 2287 of file system_io.C.
References libMesh::Xdr::data(), libMesh::FEType::family, libMesh::System::get_mesh(), libMesh::libmesh_assert(), libMesh::MeshBase::n_elem(), libMesh::MeshTools::n_elem(), n_nodes, libMesh::MeshBase::n_nodes(), libMesh::System::n_vars(), libMesh::ParallelObject::processor_id(), libMesh::SCALAR, libMesh::Variable::type(), libMesh::System::variable(), libMesh::System::write_SCALAR_dofs(), libMesh::System::write_serialized_blocked_dof_objects(), and libMesh::Xdr::writing().
{
parallel_object_only();
libmesh_assert (io.writing());
// Cache these - they are not free!
const dof_id_type
n_nodes = this->get_mesh().n_nodes(),
n_elem = this->get_mesh().n_elem();
std::size_t written_length = 0.;
if (this->processor_id() == 0)
{
unsigned int
n_vec = cast_int<unsigned int>(vectors.size());
dof_id_type
vec_size = vectors.empty() ? 0 : vectors[0]->size();
// Set the number of vectors
io.data(n_vec, "# number of vectors");
// Set the buffer size
io.data(vec_size, "# vector length");
}
//---------------------------------
// Collect the values for all nodes
written_length +=
this->write_serialized_blocked_dof_objects (vectors,
n_nodes,
this->get_mesh().local_nodes_begin(),
this->get_mesh().local_nodes_end(),
io);
//------------------------------------
// Collect the values for all elements
written_length +=
this->write_serialized_blocked_dof_objects (vectors,
n_elem,
this->get_mesh().local_elements_begin(),
this->get_mesh().local_elements_end(),
io);
//-------------------------------------------
// Finally loop over all the SCALAR variables
for (unsigned int vec=0; vec<vectors.size(); vec++)
for (unsigned int var=0; var<this->n_vars(); var++)
if(this->variable(var).type().family == SCALAR)
{
libmesh_assert_not_equal_to (vectors[vec], 0);
written_length +=
this->write_SCALAR_dofs (*vectors[vec], var, io);
}
return written_length;
}
| void libMesh::RBConstruction::zero_constrained_dofs_on_vector | ( | NumericVector< Number > & | vector | ) |
It is sometimes useful to be able to zero vector entries that correspond to constrained dofs.
| void libMesh::System::zero_variable | ( | NumericVector< Number > & | v, |
| unsigned int | var_num | ||
| ) | const [inherited] |
Zeroes all dofs in v that correspond to variable number var_num.
Definition at line 1340 of file system.C.
References libMesh::MeshBase::active_local_elements_begin(), libMesh::MeshBase::active_local_elements_end(), libMesh::DofObject::dof_number(), libMesh::System::get_mesh(), libMesh::MeshBase::local_nodes_begin(), libMesh::MeshBase::local_nodes_end(), mesh, libMesh::DofObject::n_comp(), libMesh::System::n_vars(), libMesh::System::number(), and libMesh::NumericVector< T >::set().
{
/* Make sure the call makes sense. */
libmesh_assert_less (var_num, this->n_vars());
/* Get a reference to the mesh. */
const MeshBase& mesh = this->get_mesh();
/* Check which system we are. */
const unsigned int sys_num = this->number();
/* Loop over nodes. */
{
MeshBase::const_node_iterator it = mesh.local_nodes_begin();
const MeshBase::const_node_iterator end_it = mesh.local_nodes_end();
for ( ; it != end_it; ++it)
{
const Node* node = *it;
unsigned int n_comp = node->n_comp(sys_num,var_num);
for(unsigned int i=0; i<n_comp; i++)
{
const dof_id_type index = node->dof_number(sys_num,var_num,i);
v.set(index,0.0);
}
}
}
/* Loop over elements. */
{
MeshBase::const_element_iterator it = mesh.active_local_elements_begin();
const MeshBase::const_element_iterator end_it = mesh.active_local_elements_end();
for ( ; it != end_it; ++it)
{
const Elem* elem = *it;
unsigned int n_comp = elem->n_comp(sys_num,var_num);
for(unsigned int i=0; i<n_comp; i++)
{
const dof_id_type index = elem->dof_number(sys_num,var_num,i);
v.set(index,0.0);
}
}
}
}
const Parallel::Communicator& libMesh::ParallelObject::_communicator [protected, inherited] |
Definition at line 104 of file parallel_object.h.
Referenced by libMesh::EquationSystems::build_solution_vector(), libMesh::ParallelObject::comm(), libMesh::EquationSystems::get_solution(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::operator=(), and libMesh::ParallelObject::processor_id().
ReferenceCounter::Counts libMesh::ReferenceCounter::_counts [static, protected, inherited] |
Actually holds the data.
Definition at line 118 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::get_info(), libMesh::ReferenceCounter::increment_constructor_count(), and libMesh::ReferenceCounter::increment_destructor_count().
ReferenceCounter::Counts libMesh::ReferenceCounter::_counts [static, protected, inherited] |
Actually holds the data.
Definition at line 118 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::get_info(), libMesh::ReferenceCounter::increment_constructor_count(), and libMesh::ReferenceCounter::increment_destructor_count().
bool libMesh::ReferenceCounter::_enable_print_counter = true [static, protected, inherited] |
Flag to control whether reference count information is printed when print_info is called.
Definition at line 137 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().
bool libMesh::ReferenceCounter::_enable_print_counter = true [static, protected, inherited] |
Flag to control whether reference count information is printed when print_info is called.
Definition at line 137 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().
Real libMesh::LinearImplicitSystem::_final_linear_residual [protected, inherited] |
The final residual for the linear system Ax=b.
Definition at line 196 of file linear_implicit_system.h.
Referenced by libMesh::LinearImplicitSystem::final_linear_residual(), libMesh::LinearImplicitSystem::solve(), and libMesh::FrequencySystem::solve().
Threads::spin_mutex libMesh::ReferenceCounter::_mutex [static, protected, inherited] |
Mutual exclusion object to enable thread-safe reference counting.
Definition at line 131 of file reference_counter.h.
Threads::spin_mutex libMesh::ReferenceCounter::_mutex [static, protected, inherited] |
Mutual exclusion object to enable thread-safe reference counting.
Definition at line 131 of file reference_counter.h.
unsigned int libMesh::LinearImplicitSystem::_n_linear_iterations [protected, inherited] |
The number of linear iterations required to solve the linear system Ax=b.
Definition at line 191 of file linear_implicit_system.h.
Referenced by libMesh::LinearImplicitSystem::n_linear_iterations(), libMesh::LinearImplicitSystem::solve(), and libMesh::FrequencySystem::solve().
Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects [static, protected, inherited] |
The number of objects. Print the reference count information when the number returns to 0.
Definition at line 126 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().
Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects [static, protected, inherited] |
The number of objects. Print the reference count information when the number returns to 0.
Definition at line 126 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().
ShellMatrix<Number>* libMesh::LinearImplicitSystem::_shell_matrix [protected, inherited] |
User supplies shell matrix or NULL if no shell matrix is used.
Definition at line 201 of file linear_implicit_system.h.
Referenced by libMesh::LinearImplicitSystem::attach_shell_matrix(), libMesh::LinearImplicitSystem::get_shell_matrix(), and libMesh::LinearImplicitSystem::solve().
const SystemSubset* libMesh::LinearImplicitSystem::_subset [protected, inherited] |
The current subset on which to solve (or NULL if none).
Definition at line 206 of file linear_implicit_system.h.
Referenced by libMesh::LinearImplicitSystem::restrict_solve_to(), and libMesh::LinearImplicitSystem::solve().
SubsetSolveMode libMesh::LinearImplicitSystem::_subset_solve_mode [protected, inherited] |
If restrict-solve-to-subset mode is active, this member decides what happens with the dofs outside the subset.
Definition at line 212 of file linear_implicit_system.h.
Referenced by libMesh::LinearImplicitSystem::restrict_solve_to(), and libMesh::LinearImplicitSystem::solve().
std::string libMesh::RBConstructionBase< LinearImplicitSystem >::alternative_solver [protected, inherited] |
Set this string to specify an alternative solver used in the set_alternative_solver() function above. Currently-supported values are: .) unchanged, to continue using the default truth solve solver .) amg, to use the BoomerAMG from Hypre (NOT for indefinite problems!) .) mumps, to use a sparse direct solver Note1: mumps and amg will only be available if PETSc has been compiled with them. Note2: RBConstruction::process_parameters_file() is responsible for reading in this value ("rb_alternative_solver") from file for RBConstruction-derived subclasses Note3: RBSCMSystem::process_parameters_file() reads this value ("scm_alternative_solver") for RBSCMSystem-derived subclasses
Definition at line 271 of file rb_construction_base.h.
std::vector< SparseMatrix<Number>* > libMesh::RBConstruction::Aq_vector [private] |
Vector storing the Q_a matrices from the affine expansion
Definition at line 820 of file rb_construction.h.
bool libMesh::System::assemble_before_solve [inherited] |
Flag which tells the system to whether or not to call the user assembly function during each call to solve(). By default, every call to solve() begins with a call to the user assemble, so this flag is true. (For explicit systems, "solving" the system occurs during the assembly step, so this flag is always true for explicit systems.)
You will only want to set this to false if you need direct control over when the system is assembled, and are willing to track the state of its assembly yourself. An example of such a case is an implicit system with multiple right hand sides. In this instance, a single assembly would likely be followed with multiple calls to solve.
The frequency system and Newmark system have their own versions of this flag, called _finished_assemble, which might be able to be replaced with this more general concept.
Definition at line 1468 of file system.h.
Referenced by libMesh::ImplicitSystem::adjoint_solve(), libMesh::ImplicitSystem::disable_cache(), libMesh::System::disable_cache(), libMesh::ImplicitSystem::sensitivity_solve(), libMesh::CondensedEigenSystem::solve(), libMesh::EigenSystem::solve(), and libMesh::LinearImplicitSystem::solve().
bool libMesh::RBConstruction::assert_convergence [protected] |
A boolean flag to indicate whether to check for proper convergence after each solve.
Definition at line 787 of file rb_construction.h.
Boolean flag to indicate whether we compute the RB_inner_product_matrix. This is false by default in RBConstruction since (in the default implementation) the RB inner-product matrix will just be the identity. But we may need the inner-product matrix subclasses.
Definition at line 569 of file rb_construction.h.
Boolean flag to indicate whether this is a constrained problem (e.g. Stokes) or not.
Definition at line 519 of file rb_construction.h.
Function pointer for assembling the constraint matrix.
Definition at line 815 of file rb_construction.h.
| UniquePtr< SparseMatrix<Number> > libMesh::RBConstruction::constraint_matrix |
The constraint matrix, e.g. the pressure matrix entries in a Stokes problem.
Definition at line 484 of file rb_construction.h.
UniquePtr<NumericVector<Number> > libMesh::System::current_local_solution [inherited] |
All the values I need to compute my contribution to the simulation at hand. Think of this as the current solution with any ghost values needed from other processors. This vector is necessarily larger than the solution vector in the case of a parallel simulation. The update() member is used to synchronize the contents of the solution and current_local_solution vectors.
Definition at line 1527 of file system.h.
Referenced by libMesh::__libmesh_petsc_snes_residual(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::NonlinearImplicitSystem::assembly(), libMesh::EquationSystems::build_solution_vector(), libMesh::System::clear(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::System::current_solution(), DMlibMeshFunction(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::EquationSystems::get_solution(), libMesh::System::init_data(), libMesh::FEMContext::pre_fe_reinit(), libMesh::System::project_solution(), libMesh::System::re_update(), libMesh::System::reinit(), libMesh::System::restrict_vectors(), and libMesh::System::update().
unsigned int libMesh::RBConstruction::delta_N [protected] |
The number of basis functions that we add at each greedy step. This defaults to 1 in the steady case.
Definition at line 768 of file rb_construction.h.
Referenced by get_delta_N(), and libMesh::TransientRBConstruction::set_delta_N().
Public member variable which we use to determine whether or not we enforce hanging-dof and/or periodic constraints exactly. This is primarily important in nonlinear problems where we may "undersolve" Newton iterates for the sake of efficiency.
Definition at line 584 of file rb_construction.h.
Boolean flag to indicate whether we exit the greedy if we select the same parameters twice in a row. In some problems this indicates that the greedy has "saturated" typically due to numerical rounding effects.
Definition at line 540 of file rb_construction.h.
int libMesh::System::extra_quadrature_order [inherited] |
A member int that can be employed to indicate increased or reduced quadrature order.
Note for FEMSystem users: By default, when calling the user-defined residual functions, the FEMSystem will first set up an appropriate FEType::default_quadrature_rule() object for performing the integration. This rule will integrate elements of order up to 2*p+1 exactly (where p is the sum of the base FEType and local p refinement levels), but if additional (or reduced) quadrature accuracy is desired then this extra_quadrature_order (default 0) will be added.
Definition at line 1500 of file system.h.
Referenced by libMesh::FEMContext::FEMContext().
| std::vector< NumericVector<Number>* > libMesh::RBConstruction::Fq_representor |
Vector storing the residual representors associated with the right-hand side. These are basis independent and hence stored here, whereas the Aq_representors are stored in RBEvaluation
Definition at line 504 of file rb_construction.h.
| std::vector<Number> libMesh::RBConstruction::Fq_representor_innerprods |
Vectors storing the residual representor inner products to be used in computing the residuals online. We store the Fq representor norms here because they are independent of a reduced basis space. The basis dependent representors are stored in RBEvaluation.
Definition at line 513 of file rb_construction.h.
A boolean flag to indicate whether or not the Fq representor norms have already been computed --- used to make sure that we don't recompute them unnecessarily.
Definition at line 598 of file rb_construction.h.
std::vector< NumericVector<Number>* > libMesh::RBConstruction::Fq_vector [private] |
Vector storing the Q_f vectors in the affine decomposition of the right-hand side.
Definition at line 826 of file rb_construction.h.
Boolean flag to indicate whether we require a Dirichlet boundary condition on internal mesh dofs. This is useful for example in problems with subdomain-only-variables.
Definition at line 554 of file rb_construction.h.
Boolean flag to indicate whether we impose "fluxes" (i.e. element boundary contributions to the weak form) on internal element boundaries in the assembly routines.
Definition at line 561 of file rb_construction.h.
Pointer to inner product assembly.
Definition at line 809 of file rb_construction.h.
| UniquePtr< SparseMatrix<Number> > libMesh::RBConstruction::inner_product_matrix |
The inner product matrix.
Definition at line 472 of file rb_construction.h.
| UniquePtr< LinearSolver<Number> > libMesh::RBConstruction::inner_product_solver |
We store an extra linear solver object which we can optionally use for solving all systems in which the system matrix is set to inner_product_matrix.
Definition at line 455 of file rb_construction.h.
UniquePtr< NumericVector<Number> > libMesh::RBConstructionBase< LinearImplicitSystem >::inner_product_storage_vector [protected, inherited] |
We keep an extra temporary vector that is useful for performing inner products (avoids unnecessary memory allocation/deallocation).
Definition at line 257 of file rb_construction_base.h.
UniquePtr<LinearSolver<Number> > libMesh::LinearImplicitSystem::linear_solver [inherited] |
The LinearSolver defines the interface used to solve the linear_implicit system. This class handles all the details of interfacing with various linear algebra packages like PETSc or LASPACK.
Definition at line 150 of file linear_implicit_system.h.
Referenced by libMesh::LinearImplicitSystem::clear(), libMesh::LinearImplicitSystem::get_linear_solver(), libMesh::LinearImplicitSystem::init_data(), libMesh::LinearImplicitSystem::reinit(), libMesh::LinearImplicitSystem::solve(), and libMesh::FrequencySystem::solve().
SparseMatrix<Number>* libMesh::ImplicitSystem::matrix [inherited] |
The system matrix. Implicit systems are characterized by the need to solve the linear system Ax=b. This is the system matrix A.
Definition at line 338 of file implicit_system.h.
Referenced by libMesh::ImplicitSystem::add_system_matrix(), libMesh::ImplicitSystem::adjoint_solve(), libMesh::ImplicitSystem::assemble(), libMesh::FEMSystem::assembly(), libMesh::LinearImplicitSystem::assembly(), libMesh::NonlinearImplicitSystem::assembly(), libMesh::ImplicitSystem::clear(), libMesh::NewmarkSystem::compute_matrix(), libMesh::ContinuationSystem::continuation_solve(), libMesh::ImplicitSystem::init_matrices(), libMesh::ImplicitSystem::sensitivity_solve(), libMesh::NewtonSolver::solve(), libMesh::NoxNonlinearSolver< T >::solve(), libMesh::EigenTimeSolver::solve(), libMesh::LinearImplicitSystem::solve(), libMesh::FrequencySystem::solve(), libMesh::NonlinearImplicitSystem::solve(), libMesh::ContinuationSystem::solve_tangent(), libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve(), and libMesh::ImplicitSystem::weighted_sensitivity_solve().
unsigned int libMesh::RBConstruction::Nmax [protected] |
Maximum number of reduced basis functions we are willing to use.
Definition at line 762 of file rb_construction.h.
Referenced by get_Nmax().
std::vector< SparseMatrix<Number>* > libMesh::RBConstruction::non_dirichlet_Aq_vector [private] |
We may also need a second set of matrices/vectors that do not have the Dirichlet boundary conditions enforced.
Definition at line 839 of file rb_construction.h.
std::vector< NumericVector<Number>* > libMesh::RBConstruction::non_dirichlet_Fq_vector [private] |
Definition at line 840 of file rb_construction.h.
The inner product matrix without Dirichlet conditions enforced. (This is only computed if store_non_dirichlet_operators == true.)
Definition at line 478 of file rb_construction.h.
std::vector< std::vector< NumericVector<Number>* > > libMesh::RBConstruction::non_dirichlet_outputs_vector [private] |
Definition at line 841 of file rb_construction.h.
We also need a pointer to store the original linear solver in case we switch to inner_product_solver.
Definition at line 461 of file rb_construction.h.
| std::vector< std::vector< Number > > libMesh::RBConstruction::output_dual_innerprods |
The vector storing the dual norm inner product terms for each output.
Definition at line 496 of file rb_construction.h.
bool libMesh::RBConstruction::output_dual_innerprods_computed [protected] |
A boolean flag to indicate whether or not the output dual norms have already been computed --- used to make sure that we don't recompute them unnecessarily.
Definition at line 781 of file rb_construction.h.
std::vector< std::vector< NumericVector<Number>* > > libMesh::RBConstruction::outputs_vector [private] |
The libMesh vectors that define the output functionals. Each row corresponds to the affine expansion of an output.
Definition at line 832 of file rb_construction.h.
std::vector<Number> libMesh::System::qoi [inherited] |
Values of the quantities of interest. This vector needs to be both resized and filled by the user before any quantity of interest assembly is done and before any sensitivities are calculated.
Definition at line 1546 of file system.h.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::ImplicitSystem::adjoint_solve(), libMesh::SensitivityData::allocate_data(), libMesh::SensitivityData::allocate_hessian_data(), libMesh::ExplicitSystem::assemble_qoi(), libMesh::FEMSystem::assemble_qoi(), libMesh::ExplicitSystem::assemble_qoi_derivative(), libMesh::FEMSystem::assemble_qoi_derivative(), libMesh::DifferentiableSystem::attach_qoi(), libMesh::DiffContext::DiffContext(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::FEMContext::pre_fe_reinit(), libMesh::QoISet::size(), and libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve().
bool libMesh::RBConstruction::quiet_mode [protected] |
Flag to indicate whether we print out extra information during the Offline stage.
Definition at line 774 of file rb_construction.h.
Referenced by is_quiet(), and set_quiet_mode().
This member holds the (parameter independent) assembly functors that define the "affine expansion" of the PDE that we are solving.
Definition at line 804 of file rb_construction.h.
RBEvaluation* libMesh::RBConstruction::rb_eval [private] |
The current RBEvaluation object we are using to perform the Evaluation stage of the reduced basis method.
Definition at line 798 of file rb_construction.h.
Boolean flag to indicate whether we reuse the preconditioner on consecutive Offline solves for updating residual data.
Definition at line 525 of file rb_construction.h.
NumericVector<Number>* libMesh::ExplicitSystem::rhs [inherited] |
The system matrix. Implicit systems are characterized by the need to solve the linear system Ax=b. This is the right-hand-side vector b.
Definition at line 124 of file explicit_system.h.
Referenced by libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_residual(), libMesh::ExplicitSystem::add_system_rhs(), libMesh::ImplicitSystem::assemble(), libMesh::ImplicitSystem::assemble_residual_derivatives(), libMesh::FEMSystem::assembly(), libMesh::LinearImplicitSystem::assembly(), libMesh::NonlinearImplicitSystem::assembly(), libMesh::ExplicitSystem::clear(), libMesh::Problem_Interface::computeF(), libMesh::ContinuationSystem::continuation_solve(), DMlibMeshFunction(), libMesh::NewtonSolver::line_search(), libMesh::NewtonSolver::solve(), libMesh::LinearImplicitSystem::solve(), libMesh::FrequencySystem::solve(), libMesh::NonlinearImplicitSystem::solve(), libMesh::ContinuationSystem::solve_tangent(), libMesh::NewmarkSystem::update_rhs(), libMesh::ImplicitSystem::weighted_sensitivity_adjoint_solve(), and libMesh::ImplicitSystem::weighted_sensitivity_solve().
bool libMesh::RBConstructionBase< LinearImplicitSystem >::serial_training_set [protected, inherited] |
This boolean flag indicates whether or not the training set should be the same on all processors. By default it is false, but in the case of the Empirical Interpolation Method (RBEIMConstruction), for example, we need the training set to be identical on all processors.
Definition at line 250 of file rb_construction_base.h.
UniquePtr<NumericVector<Number> > libMesh::System::solution [inherited] |
Data structure to hold solution values.
Definition at line 1515 of file system.h.
Referenced by libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_snes_residual(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::AdaptiveTimeSolver::advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), libMesh::ContinuationSystem::apply_predictor(), libMesh::FEMSystem::assembly(), libMesh::LinearImplicitSystem::assembly(), libMesh::EquationSystems::build_solution_vector(), libMesh::System::clear(), libMesh::System::compare(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ContinuationSystem::continuation_solve(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::GMVIO::copy_nodal_solution(), DMlibMeshFunction(), libMesh::UnsteadySolver::du(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::EigenSystem::get_eigenpair(), libMesh::EquationSystems::get_solution(), libMesh::System::init_data(), libMesh::ContinuationSystem::initialize_tangent(), libMesh::DofMap::max_constraint_error(), libMesh::FEMSystem::mesh_position_get(), libMesh::ErrorVector::plot_error(), libMesh::System::project_solution(), libMesh::System::re_update(), libMesh::System::read_legacy_data(), libMesh::System::read_parallel_data(), libMesh::System::read_serialized_data(), libMesh::System::reinit(), libMesh::System::restrict_vectors(), libMesh::MemorySolutionHistory::retrieve(), libMesh::ContinuationSystem::save_current_solution(), libMesh::TwostepTimeSolver::solve(), libMesh::NewtonSolver::solve(), libMesh::LinearImplicitSystem::solve(), libMesh::FrequencySystem::solve(), libMesh::NonlinearImplicitSystem::solve(), libMesh::ContinuationSystem::solve_tangent(), libMesh::MemorySolutionHistory::store(), libMesh::System::update(), libMesh::System::update_global_solution(), libMesh::ContinuationSystem::update_solution(), libMesh::NewmarkSystem::update_u_v_a(), libMesh::System::write_parallel_data(), and libMesh::System::write_serialized_data().
Boolean flag to indicate whether we store a second copy of each affine operator and vector which does not have Dirichlet bcs enforced.
Definition at line 576 of file rb_construction.h.
Real libMesh::System::time [inherited] |
For time-dependent problems, this is the time t at the beginning of the current timestep.
Note for DifferentiableSystem users: do *not* access this time during an assembly! Use the DiffContext::time value instead to get correct results.
Definition at line 1538 of file system.h.
Referenced by libMesh::UnsteadySolver::adjoint_advance_timestep(), libMesh::AdaptiveTimeSolver::advance_timestep(), libMesh::UnsteadySolver::advance_timestep(), libMesh::EquationSystems::allgather(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::MemorySolutionHistory::find_stored_entry(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::ProjectSolution::operator()(), libMesh::ProjectFEMSolution::operator()(), libMesh::BoundaryProjectSolution::operator()(), libMesh::System::project_vector(), libMesh::EquationSystems::reinit(), libMesh::System::reinit_constraints(), libMesh::MemorySolutionHistory::retrieve(), libMesh::TwostepTimeSolver::solve(), and libMesh::MemorySolutionHistory::store().
| std::vector<Real> libMesh::RBConstruction::training_error_bounds |
Vector storing the values of the error bound for each parameter in the training set --- the parameter giving the largest error bound is chosen for the next snapshot in the Greedy basis training.
Definition at line 448 of file rb_construction.h.
Tolerance for training reduced basis using the Greedy scheme.
Definition at line 846 of file rb_construction.h.
Referenced by get_training_tolerance(), and set_training_tolerance().
| std::vector< Number > libMesh::RBConstruction::truth_outputs |
Vector storing the truth output values from the most recent truth solve.
Definition at line 490 of file rb_construction.h.
A boolean flag to indicate whether or not we initialize the Greedy algorithm by performing rb_solves on the training set with an "empty" (i.e. N=0) reduced basis space.
Definition at line 591 of file rb_construction.h.
bool libMesh::System::use_fixed_solution [inherited] |
A boolean to be set to true by systems using elem_fixed_solution, for optional use by e.g. stabilized methods. False by default.
Note for FEMSystem users: Warning: if this variable is set to true, it must be before init_data() is called.
Definition at line 1485 of file system.h.
Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::SteadySolver::_general_residual(), libMesh::DifferentiableSystem::clear(), libMesh::DiffContext::DiffContext(), and libMesh::FEMContext::pre_fe_reinit().
Boolean flag to indicate whether we use inner_product_solver or not.
Definition at line 467 of file rb_construction.h.
Boolean flag to indicate whether we use an absolute or relative error bound in the Greedy algorithm for training a Reduced Basis.
Definition at line 532 of file rb_construction.h.
bool libMesh::RBParametrized::verbose_mode [inherited] |
Public boolean to toggle verbose mode.
Definition at line 172 of file rb_parametrized.h.
Boolean flag to indicate whether train_reduced_basis writes out offline data after each truth solve (to allow continuing in case the code crashes or something).
Definition at line 547 of file rb_construction.h.