#include <petsc_linear_solver.h>
Public Member Functions | |
PetscLinearSolver (const libMesh::Parallel::Communicator &comm_in) | |
~PetscLinearSolver () | |
virtual void | clear () override |
virtual void | init (const char *name=nullptr) override |
void | init (PetscMatrix< T > *matrix, const char *name=nullptr) |
virtual void | init_names (const System &) override |
virtual void | restrict_solve_to (const std::vector< unsigned int > *const dofs, const SubsetSolveMode subset_solve_mode=SUBSET_ZERO) override |
virtual std::pair< unsigned int, Real > | solve (SparseMatrix< T > &matrix_in, NumericVector< T > &solution_in, NumericVector< T > &rhs_in, const double tol, const unsigned int m_its) override |
virtual std::pair< unsigned int, Real > | adjoint_solve (SparseMatrix< T > &matrix_in, NumericVector< T > &solution_in, NumericVector< T > &rhs_in, const double tol, const unsigned int m_its) override |
virtual std::pair< unsigned int, Real > | solve (SparseMatrix< T > &matrix, SparseMatrix< T > &preconditioner, NumericVector< T > &solution, NumericVector< T > &rhs, const double tol, const unsigned int m_its) override |
virtual std::pair< unsigned int, Real > | solve (const ShellMatrix< T > &shell_matrix, NumericVector< T > &solution_in, NumericVector< T > &rhs_in, const double tol, const unsigned int m_its) override |
virtual std::pair< unsigned int, Real > | solve (const ShellMatrix< T > &shell_matrix, const SparseMatrix< T > &precond_matrix, NumericVector< T > &solution_in, NumericVector< T > &rhs_in, const double tol, const unsigned int m_its) override |
PC | pc () |
KSP | ksp () |
void | get_residual_history (std::vector< double > &hist) |
Real | get_initial_residual () |
virtual LinearConvergenceReason | get_converged_reason () const override |
bool | initialized () const |
SolverType | solver_type () const |
void | set_solver_type (const SolverType st) |
PreconditionerType | preconditioner_type () const |
void | set_preconditioner_type (const PreconditionerType pct) |
void | attach_preconditioner (Preconditioner< T > *preconditioner) |
virtual void | reuse_preconditioner (bool) |
bool | get_same_preconditioner () |
std::pair< unsigned int, Real > | solve (SparseMatrix< T > &matrix, SparseMatrix< T > *precond_matrix, NumericVector< T > &, NumericVector< T > &, const double, const unsigned int) |
std::pair< unsigned int, Real > | solve (const ShellMatrix< T > &matrix, const SparseMatrix< T > *precond_matrix, NumericVector< T > &, NumericVector< T > &, const double, const unsigned int) |
virtual void | print_converged_reason () const |
void | set_solver_configuration (SolverConfiguration &solver_configuration) |
const Parallel::Communicator & | comm () const |
processor_id_type | n_processors () const |
processor_id_type | processor_id () const |
Static Public Member Functions | |
static std::unique_ptr< LinearSolver< T > > | build (const libMesh::Parallel::Communicator &comm_in, const SolverPackage solver_package=libMesh::default_solver_package()) |
static std::string | get_info () |
static void | print_info (std::ostream &out=libMesh::out) |
static unsigned int | n_objects () |
static void | enable_print_counter_info () |
static void | disable_print_counter_info () |
Protected Types | |
typedef std::map< std::string, std::pair< unsigned int, unsigned int > > | Counts |
Protected Member Functions | |
void | increment_constructor_count (const std::string &name) |
void | increment_destructor_count (const std::string &name) |
Protected Attributes | |
SolverType | _solver_type |
PreconditionerType | _preconditioner_type |
bool | _is_initialized |
Preconditioner< T > * | _preconditioner |
bool | same_preconditioner |
SolverConfiguration * | _solver_configuration |
const Parallel::Communicator & | _communicator |
Static Protected Attributes | |
static Counts | _counts |
static Threads::atomic< unsigned int > | _n_objects |
static Threads::spin_mutex | _mutex |
static bool | _enable_print_counter = true |
Private Member Functions | |
void | set_petsc_solver_type () |
PetscInt | _restrict_solve_to_is_local_size () const |
void | _create_complement_is (const NumericVector< T > &vec_in) |
Static Private Member Functions | |
static PetscErrorCode | _petsc_shell_matrix_mult (Mat mat, Vec arg, Vec dest) |
static PetscErrorCode | _petsc_shell_matrix_mult_add (Mat mat, Vec arg, Vec add, Vec dest) |
static PetscErrorCode | _petsc_shell_matrix_get_diagonal (Mat mat, Vec dest) |
Private Attributes | |
PC | _pc |
KSP | _ksp |
IS | _restrict_solve_to_is |
IS | _restrict_solve_to_is_complement |
SubsetSolveMode | _subset_solve_mode |
This class provides an interface to PETSc iterative solvers that is compatible with the libMesh
LinearSolver<>
Definition at line 101 of file petsc_linear_solver.h.
|
protectedinherited |
Data structure to log the information. The log is identified by the class name.
Definition at line 117 of file reference_counter.h.
libMesh::PetscLinearSolver< T >::PetscLinearSolver | ( | const libMesh::Parallel::Communicator & | comm_in | ) |
Constructor. Initializes Petsc data structures
Definition at line 134 of file petsc_linear_solver.C.
References libMesh::LinearSolver< T >::_preconditioner_type, libMesh::BLOCK_JACOBI_PRECOND, libMesh::ILU_PRECOND, and libMesh::ParallelObject::n_processors().
|
inline |
|
private |
Creates _restrict_solve_to_is_complement
to contain all indices that are local in vec_in
, except those that are contained in _restrict_solve_to_is
.
Definition at line 355 of file petsc_linear_solver.h.
References ierr.
|
staticprivate |
Internal function if shell matrix mode is used.
Definition at line 1781 of file petsc_linear_solver.C.
References libMesh::ParallelObject::comm(), libMesh::Parallel::Communicator::get(), libMesh::ShellMatrix< T >::get_diagonal(), and ierr.
|
staticprivate |
Internal function if shell matrix mode is used.
Definition at line 1727 of file petsc_linear_solver.C.
References libMesh::ParallelObject::comm(), libMesh::Parallel::Communicator::get(), ierr, and libMesh::ShellMatrix< T >::vector_mult().
|
staticprivate |
Internal function if shell matrix mode is used.
Definition at line 1751 of file petsc_linear_solver.C.
References libMesh::ParallelObject::comm(), libMesh::Parallel::Communicator::get(), ierr, and libMesh::ShellMatrix< T >::vector_mult_add().
|
inlineprivate |
_restrict_solve_to_is
. Definition at line 340 of file petsc_linear_solver.h.
References ierr.
|
overridevirtual |
Call the Petsc solver. It calls the method below, using the same matrix for the system and preconditioner matrices.
Reimplemented from libMesh::LinearSolver< T >.
Definition at line 708 of file petsc_linear_solver.C.
References libMesh::PetscMatrix< T >::close(), ierr, libMesh::TriangleWrapper::init(), libMesh::NumericVector< T >::local_size(), libMesh::PetscMatrix< T >::mat(), libMesh::SUBSET_COPY_RHS, libMesh::SUBSET_DONT_TOUCH, and libMesh::SUBSET_ZERO.
|
inherited |
Attaches a Preconditioner object to be used
Definition at line 118 of file linear_solver.C.
|
staticinherited |
Builds a LinearSolver
using the linear solver package specified by solver_package
Definition at line 57 of file linear_solver.C.
Referenced by libMesh::ImplicitSystem::get_linear_solver(), and libMesh::TimeSolver::init().
|
overridevirtual |
Release all memory and clear data structures.
Reimplemented from libMesh::LinearSolver< T >.
Definition at line 149 of file petsc_linear_solver.C.
References libMesh::libMeshPrivateData::_is_initialized, libMesh::BLOCK_JACOBI_PRECOND, libMesh::GMRES, ierr, libMesh::ILU_PRECOND, and libMesh::initialized().
|
inlineinherited |
Parallel::Communicator
object used by this mesh. Definition at line 89 of file parallel_object.h.
References libMesh::ParallelObject::_communicator.
Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_tao_equality_constraints(), libMesh::__libmesh_tao_equality_constraints_jacobian(), libMesh::__libmesh_tao_gradient(), libMesh::__libmesh_tao_hessian(), libMesh::__libmesh_tao_inequality_constraints(), libMesh::__libmesh_tao_inequality_constraints_jacobian(), libMesh::__libmesh_tao_objective(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::ImplicitSystem::add_matrix(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::DofMap::attach_matrix(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::PetscDMWrapper::build_sf(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::PetscDMWrapper::check_section_n_dofs(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::MeshTools::create_subdomain_bounding_box(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::EpetraVector< T >::EpetraVector(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::FEMSystem::mesh_position_set(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::ReplicatedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_n_elem(), libMesh::DistributedMesh::parallel_n_nodes(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::MeshTools::paranoid_n_levels(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::CheckpointIO::select_split_config(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::split_mesh(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::MeshRefinement::test_level_one(), libMesh::MeshRefinement::test_unflagged(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().
|
staticinherited |
Definition at line 106 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
Referenced by libMesh::LibMeshInit::LibMeshInit().
|
staticinherited |
Methods to enable/disable the reference counter output from print_info()
Definition at line 100 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
|
overridevirtual |
Implements libMesh::LinearSolver< T >.
Definition at line 1684 of file petsc_linear_solver.C.
References libMesh::CONVERGED_ATOL, libMesh::CONVERGED_ATOL_NORMAL, libMesh::CONVERGED_CG_CONSTRAINED, libMesh::CONVERGED_CG_NEG_CURVE, libMesh::CONVERGED_HAPPY_BREAKDOWN, libMesh::CONVERGED_ITERATING, libMesh::CONVERGED_ITS, libMesh::CONVERGED_RTOL, libMesh::CONVERGED_RTOL_NORMAL, libMesh::CONVERGED_STEP_LENGTH, libMesh::DIVERGED_BREAKDOWN, libMesh::DIVERGED_BREAKDOWN_BICG, libMesh::DIVERGED_DTOL, libMesh::DIVERGED_INDEFINITE_MAT, libMesh::DIVERGED_INDEFINITE_PC, libMesh::DIVERGED_ITS, libMesh::DIVERGED_NAN, libMesh::DIVERGED_NONSYMMETRIC, libMesh::DIVERGED_NULL, libMesh::DIVERGED_PCSETUP_FAILED, libMesh::err, and libMesh::UNKNOWN_FLAG.
|
staticinherited |
Gets a string containing the reference information.
Definition at line 47 of file reference_counter.C.
References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().
Referenced by libMesh::ReferenceCounter::print_info().
Real libMesh::PetscLinearSolver< T >::get_initial_residual | ( | ) |
Use this method instead of the one above if you just want the starting residual and not the entire history.
Definition at line 1570 of file petsc_linear_solver.C.
References libMesh::err, and ierr.
void libMesh::PetscLinearSolver< T >::get_residual_history | ( | std::vector< double > & | hist | ) |
Fills the input vector with the sequence of residual norms from the latest iterative solve.
Definition at line 1537 of file petsc_linear_solver.C.
References ierr.
|
inlineinherited |
same_preconditioner
, which indicates if we reuse the same preconditioner for subsequent solves. Definition at line 322 of file linear_solver.h.
|
inlineprotectedinherited |
Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
Definition at line 181 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().
|
inlineprotectedinherited |
Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
Definition at line 194 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().
|
overridevirtual |
Initialize data structures if not done so already. Assigns a name, which is turned into an underscore-separated prefix for the underlying KSP object.
Implements libMesh::LinearSolver< T >.
Definition at line 192 of file petsc_linear_solver.C.
References libMesh::libMeshPrivateData::_is_initialized, ierr, libMesh::initialized(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_preconditioner_setup(), libMesh::Quality::name(), and libMesh::PetscPreconditioner< T >::set_petsc_preconditioner_type().
Referenced by libMesh::PetscLinearSolver< T >::ksp(), and libMesh::PetscLinearSolver< T >::pc().
void libMesh::PetscLinearSolver< T >::init | ( | PetscMatrix< T > * | matrix, |
const char * | name = nullptr |
||
) |
Initialize data structures if not done so already plus much more
Definition at line 285 of file petsc_linear_solver.C.
References libMesh::libMeshPrivateData::_is_initialized, ierr, libMesh::initialized(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_preconditioner_setup(), libMesh::PetscMatrix< T >::mat(), libMesh::Quality::name(), and libMesh::PetscPreconditioner< T >::set_petsc_preconditioner_type().
|
overridevirtual |
Apply names to the system to be solved. This sets an option prefix from the system name and sets field names from the system's variable names.
Since field names are applied to DoF numberings, this method must be called again after any System reinit.
Reimplemented from libMesh::LinearSolver< T >.
Definition at line 390 of file petsc_linear_solver.C.
References libMesh::petsc_auto_fieldsplit().
|
inlineinherited |
true
if the data structures are initialized, false otherwise. Definition at line 96 of file linear_solver.h.
|
inline |
This is useful if you are for example setting a custom convergence test with KSPSetConvergenceTest().
Definition at line 240 of file petsc_linear_solver.h.
References libMesh::PetscLinearSolver< T >::_ksp, and libMesh::PetscLinearSolver< T >::init().
|
inlinestaticinherited |
Prints the number of outstanding (created, but not yet destroyed) objects.
Definition at line 83 of file reference_counter.h.
References libMesh::ReferenceCounter::_n_objects.
|
inlineinherited |
Definition at line 95 of file parallel_object.h.
References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::size().
Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::DistributedMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshBase::get_info(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), libMesh::MeshBase::partition(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().
|
inline |
This allows you to specify the PCShellSetApply() and PCShellSetSetUp() functions if you desire. Just don't do anything crazy like calling libMeshPCDestroy() on the pointer!
Definition at line 232 of file petsc_linear_solver.h.
References libMesh::PetscLinearSolver< T >::_pc, and libMesh::PetscLinearSolver< T >::init().
|
inherited |
Definition at line 98 of file linear_solver.C.
|
virtualinherited |
Prints a useful message about why the latest linear solve con(di)verged.
Reimplemented in libMesh::AztecLinearSolver< T >, and libMesh::LaspackLinearSolver< T >.
Definition at line 170 of file linear_solver.C.
|
staticinherited |
Prints the reference information, by default to libMesh::out
.
Definition at line 87 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().
|
inlineinherited |
Definition at line 101 of file parallel_object.h.
References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::rank().
Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::EquationSystems::_read_impl(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::FEMSystem::assembly(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::DistributedMesh::delete_node(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), 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::DofMap::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::DofMap::is_evaluable(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DofMap::local_variable_indices(), 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::BoundaryInfo::n_shellface_conds(), libMesh::SparsityPattern::Build::operator()(), libMesh::DistributedMesh::own_node(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), 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_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::CheckpointIO::select_split_config(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::Parallel::Packing< T >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_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::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_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_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().
|
overridevirtual |
After calling this method, all successive solves will be restricted to the given set of dofs, which must contain local dofs on each processor only and not contain any duplicates. This mode can be disabled by calling this method with dofs
being a nullptr
.
Reimplemented from libMesh::LinearSolver< T >.
Definition at line 399 of file petsc_linear_solver.C.
References ierr, and PETSC_OWN_POINTER.
|
virtualinherited |
Set the same_preconditioner flag, which indicates if we reuse the same preconditioner for subsequent solves.
Definition at line 129 of file linear_solver.C.
Referenced by libMesh::ImplicitSystem::disable_cache().
|
private |
Tells PETSC to use the user-specified solver stored in _solver_type
Definition at line 1600 of file petsc_linear_solver.C.
References libMesh::BICG, libMesh::BICGSTAB, libMesh::CG, libMesh::CGS, libMesh::CHEBYSHEV, libMesh::CR, libMesh::Utility::enum_to_string(), libMesh::err, libMesh::GMRES, ierr, libMesh::LSQR, libMesh::MINRES, libMesh::RICHARDSON, libMesh::TCQMR, and libMesh::TFQMR.
|
inherited |
Sets the type of preconditioner to use.
Definition at line 108 of file linear_solver.C.
|
inherited |
Set the solver configuration object.
Definition at line 177 of file linear_solver.C.
|
inlineinherited |
|
inlineoverridevirtual |
Call the Petsc solver. It calls the method below, using the same matrix for the system and preconditioner matrices.
Implements libMesh::LinearSolver< T >.
Definition at line 157 of file petsc_linear_solver.h.
|
overridevirtual |
This method allows you to call a linear solver while specifying the matrix to use as the (left) preconditioning matrix.
Implements libMesh::LinearSolver< T >.
Definition at line 433 of file petsc_linear_solver.C.
References libMesh::PetscMatrix< T >::close(), ierr, libMesh::TriangleWrapper::init(), libMesh::NumericVector< T >::local_size(), libMesh::PetscMatrix< T >::mat(), libMesh::SUBSET_COPY_RHS, libMesh::SUBSET_DONT_TOUCH, and libMesh::SUBSET_ZERO.
|
overridevirtual |
This function solves a system whose matrix is a shell matrix.
Implements libMesh::LinearSolver< T >.
Definition at line 969 of file petsc_linear_solver.C.
References libMesh::PetscVector< T >::close(), ierr, libMesh::TriangleWrapper::init(), libMesh::NumericVector< T >::local_size(), libMesh::NumericVector< T >::size(), libMesh::SUBSET_COPY_RHS, libMesh::SUBSET_DONT_TOUCH, libMesh::SUBSET_ZERO, and libMesh::PetscVector< T >::vec().
|
inlineinherited |
This function calls the solver "_solver_type" preconditioned with the "_preconditioner_type" preconditioner. The preconditioning matrix is used if it is provided, or the system matrix is used if precond_matrix
is null
Definition at line 330 of file linear_solver.h.
|
overridevirtual |
This function solves a system whose matrix is a shell matrix, but a sparse matrix is used as preconditioning matrix, this allowing other preconditioners than JACOBI.
Implements libMesh::LinearSolver< T >.
Definition at line 1236 of file petsc_linear_solver.C.
References ierr, libMesh::TriangleWrapper::init(), libMesh::NumericVector< T >::local_size(), libMesh::NumericVector< T >::size(), libMesh::SUBSET_COPY_RHS, libMesh::SUBSET_DONT_TOUCH, and libMesh::SUBSET_ZERO.
|
inlineinherited |
This function solves a system whose matrix is a shell matrix, but an optional sparse matrix may be used as preconditioning matrix.
Definition at line 347 of file linear_solver.h.
|
inlineinherited |
|
protectedinherited |
Definition at line 107 of file parallel_object.h.
Referenced by libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::ParallelObject::comm(), libMesh::ParallelObject::n_processors(), libMesh::ParallelObject::operator=(), and libMesh::ParallelObject::processor_id().
|
staticprotectedinherited |
Actually holds the data.
Definition at line 122 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::get_info(), libMesh::ReferenceCounter::increment_constructor_count(), and libMesh::ReferenceCounter::increment_destructor_count().
|
staticprotectedinherited |
Flag to control whether reference count information is printed when print_info is called.
Definition at line 141 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().
|
protectedinherited |
Flag indicating if the data structures have been initialized.
Definition at line 287 of file linear_solver.h.
Referenced by libMesh::LinearSolver< Number >::initialized().
|
private |
Krylov subspace context
Definition at line 293 of file petsc_linear_solver.h.
Referenced by libMesh::PetscLinearSolver< T >::ksp().
|
staticprotectedinherited |
Mutual exclusion object to enable thread-safe reference counting.
Definition at line 135 of file reference_counter.h.
|
staticprotectedinherited |
The number of objects. Print the reference count information when the number returns to 0.
Definition at line 130 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().
|
private |
Preconditioner context
Definition at line 288 of file petsc_linear_solver.h.
Referenced by libMesh::PetscLinearSolver< T >::pc().
|
protectedinherited |
Holds the Preconditioner object to be used for the linear solves.
Definition at line 292 of file linear_solver.h.
|
protectedinherited |
Enum stating with type of preconditioner to use.
Definition at line 282 of file linear_solver.h.
Referenced by libMesh::AztecLinearSolver< T >::AztecLinearSolver(), and libMesh::PetscLinearSolver< T >::PetscLinearSolver().
|
private |
PETSc index set containing the dofs on which to solve (nullptr
means solve on all dofs).
Definition at line 299 of file petsc_linear_solver.h.
|
private |
PETSc index set, complement to _restrict_solve_to_is
. This will be created on demand by the method _create_complement_is()
.
Definition at line 306 of file petsc_linear_solver.h.
|
protectedinherited |
Optionally store a SolverOptions object that can be used to set parameters like solver type, tolerances and iteration limits.
Definition at line 306 of file linear_solver.h.
|
protectedinherited |
Enum stating which type of iterative solver to use.
Definition at line 277 of file linear_solver.h.
Referenced by libMesh::EigenSparseLinearSolver< T >::EigenSparseLinearSolver(), libMesh::LinearSolver< Number >::set_solver_type(), and libMesh::LinearSolver< Number >::solver_type().
|
private |
If restrict-solve-to-subset mode is active, this member decides what happens with the dofs outside the subset.
Definition at line 324 of file petsc_linear_solver.h.
|
protectedinherited |
Boolean flag to indicate whether we want to use an identical preconditioner to the previous solve. This can save substantial work in the cases where the system matrix is the same for successive solves.
Definition at line 300 of file linear_solver.h.