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

This class defines a solver which uses a PETSc SNES context to handle a DifferentiableSystem. More...

#include <petsc_diff_solver.h>

Inheritance diagram for libMesh::PetscDiffSolver:
[legend]

Public Types

typedef DiffSolver Parent
 
enum  SolveResult {
  INVALID_SOLVE_RESULT = 0, CONVERGED_NO_REASON = 1, CONVERGED_ABSOLUTE_RESIDUAL = 2, CONVERGED_RELATIVE_RESIDUAL = 4,
  CONVERGED_ABSOLUTE_STEP = 8, CONVERGED_RELATIVE_STEP = 16, DIVERGED_NO_REASON = 32, DIVERGED_MAX_NONLINEAR_ITERATIONS = 64,
  DIVERGED_BACKTRACKING_FAILURE = 128, DIVERGED_LINEAR_SOLVER_FAILURE = 256
}
 Enumeration return type for the solve() function. More...
 
typedef ImplicitSystem sys_type
 The type of system. More...
 

Public Member Functions

 PetscDiffSolver (sys_type &system)
 Constructor. More...
 
virtual ~PetscDiffSolver ()
 Destructor. More...
 
virtual void reinit () override
 The reinitialization function. More...
 
virtual void init () override
 The initialization function. More...
 
void clear ()
 The clear function. More...
 
virtual unsigned int solve () override
 This method performs a solve. More...
 
unsigned int total_outer_iterations ()
 
unsigned int total_inner_iterations ()
 
unsigned int solve_result ()
 
const sys_typesystem () const
 
sys_typesystem ()
 
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< DiffSolverbuild (sys_type &s)
 Factory method. More...
 
static std::string get_info ()
 Gets a string containing the reference information. More...
 
static void print_info (std::ostream &out=libMesh::out)
 Prints the reference information, by default to libMesh::out. More...
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects. More...
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info() More...
 
static void disable_print_counter_info ()
 

Public Attributes

unsigned int max_linear_iterations
 Each linear solver step should exit after max_linear_iterations is exceeded. More...
 
unsigned int max_nonlinear_iterations
 The DiffSolver should exit in failure if max_nonlinear_iterations is exceeded and continue_after_max_iterations is false, or should end the nonlinear solve if max_nonlinear_iterations is exceeded and continue_after_max_iterations is true. More...
 
bool quiet
 The DiffSolver should not print anything to libMesh::out unless quiet is set to false; default is true. More...
 
bool verbose
 The DiffSolver may print a lot more to libMesh::out if verbose is set to true; default is false. More...
 
bool continue_after_max_iterations
 Defaults to true, telling the DiffSolver to continue rather than exit when a solve has reached its maximum number of nonlinear iterations. More...
 
bool continue_after_backtrack_failure
 Defaults to false, telling the DiffSolver to throw an error when the backtracking scheme fails to find a descent direction. More...
 
Real absolute_residual_tolerance
 The DiffSolver should exit after the residual is reduced to either less than absolute_residual_tolerance or less than relative_residual_tolerance times the initial residual. More...
 
Real relative_residual_tolerance
 
Real absolute_step_tolerance
 The DiffSolver should exit after the full nonlinear step norm is reduced to either less than absolute_step_tolerance or less than relative_step_tolerance times the largest nonlinear solution which has been seen so far. More...
 
Real relative_step_tolerance
 
double initial_linear_tolerance
 Any required linear solves will at first be done with this tolerance; the DiffSolver may tighten the tolerance for later solves. More...
 
double minimum_linear_tolerance
 The tolerance for linear solves is kept above this minimum. More...
 
std::unique_ptr< LinearSolutionMonitorlinear_solution_monitor
 Pointer to functor which is called right after each linear solve. More...
 

Protected Types

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

Protected Member Functions

void increment_constructor_count (const std::string &name)
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name)
 Increments the destruction counter. More...
 

Protected Attributes

SNES _snes
 Nonlinear solver context. More...
 
PetscDMWrapper _dm_wrapper
 Wrapper object for interacting with PetscDM. More...
 
Real max_solution_norm
 The largest solution norm which the DiffSolver has yet seen will be stored here, to be used for stopping criteria based on relative_step_tolerance. More...
 
Real max_residual_norm
 The largest nonlinear residual which the DiffSolver has yet seen will be stored here, to be used for stopping criteria based on relative_residual_tolerance. More...
 
unsigned int _outer_iterations
 The number of outer iterations used by the last solve. More...
 
unsigned int _inner_iterations
 The number of inner iterations used by the last solve. More...
 
sys_type_system
 A reference to the system we are solving. More...
 
unsigned int _solve_result
 Initialized to zero. More...
 
const Parallel::Communicator & _communicator
 

Static Protected Attributes

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

Private Member Functions

void setup_petsc_data ()
 Common helper function to setup PETSc data structures. More...
 

Detailed Description

This class defines a solver which uses a PETSc SNES context to handle a DifferentiableSystem.

This class is part of the new DifferentiableSystem framework, which is still experimental. Users of this framework should beware of bugs and future API changes.

Author
Roy H. Stogner
Date
2008

Definition at line 55 of file petsc_diff_solver.h.

Member Typedef Documentation

◆ Counts

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

Data structure to log the information.

The log is identified by the class name.

Definition at line 117 of file reference_counter.h.

◆ Parent

Definition at line 70 of file petsc_diff_solver.h.

◆ sys_type

The type of system.

Definition at line 77 of file diff_solver.h.

Member Enumeration Documentation

◆ SolveResult

Enumeration return type for the solve() function.

Multiple SolveResults may be combined (OR'd) in the single return. To test which ones are present, just AND the return value with any of the SolveResult flags defined below.

Enumerator
INVALID_SOLVE_RESULT 

A default or invalid solve result.

This usually means no solve has occurred yet.

CONVERGED_NO_REASON 

The solver converged but no particular reason is specified.

CONVERGED_ABSOLUTE_RESIDUAL 

The DiffSolver achieved the desired absolute residual tolerance.

CONVERGED_RELATIVE_RESIDUAL 

The DiffSolver achieved the desired relative residual tolerance.

CONVERGED_ABSOLUTE_STEP 

The DiffSolver achieved the desired absolute step size tolerance.

CONVERGED_RELATIVE_STEP 

The DiffSolver achieved the desired relative step size tolerance.

DIVERGED_NO_REASON 

The DiffSolver diverged but no particular reason is specified.

DIVERGED_MAX_NONLINEAR_ITERATIONS 

The DiffSolver reached the maximum allowed number of nonlinear iterations before satisfying any convergence tests.

DIVERGED_BACKTRACKING_FAILURE 

The DiffSolver failed to find a descent direction by backtracking (See newton_solver.C)

DIVERGED_LINEAR_SOLVER_FAILURE 

The linear solver used by the DiffSolver failed to find a solution.

Definition at line 222 of file diff_solver.h.

222  {
228 
234 
240 
246 
252 
258 
263  DIVERGED_NO_REASON = 32,
264 
271 
277 
283  };

Constructor & Destructor Documentation

◆ PetscDiffSolver()

libMesh::PetscDiffSolver::PetscDiffSolver ( sys_type system)
explicit

Constructor.

Requires a reference to the system to be solved.

Definition at line 199 of file petsc_diff_solver.C.

200  : Parent(s)
201 {
202 }

◆ ~PetscDiffSolver()

libMesh::PetscDiffSolver::~PetscDiffSolver ( )
virtual

Destructor.

Definition at line 216 of file petsc_diff_solver.C.

217 {
218  this->clear();
219 }

References clear().

Member Function Documentation

◆ build()

std::unique_ptr< DiffSolver > libMesh::DiffSolver::build ( sys_type s)
staticinherited

Factory method.

Requires a reference to the system to be solved.

Returns
A NewtonSolver by default.

Definition at line 53 of file diff_solver.C.

54 {
55  return libmesh_make_unique<NewtonSolver>(s);
56 }

Referenced by libMesh::TimeSolver::init().

◆ clear()

void libMesh::PetscDiffSolver::clear ( )

The clear function.

Called if we reinit or when we destroy this object.

Definition at line 223 of file petsc_diff_solver.C.

224 {
225  LOG_SCOPE("clear()", "PetscDiffSolver");
226 
227  int ierr = LibMeshSNESDestroy(&_snes);
228  LIBMESH_CHKERR(ierr);
229 
230 #if !PETSC_VERSION_LESS_THAN(3,7,3)
231 #if defined(LIBMESH_ENABLE_AMR) && defined(LIBMESH_HAVE_METAPHYSICL)
232  _dm_wrapper.clear();
233 #endif
234 #endif
235 }

References _dm_wrapper, _snes, libMesh::PetscDMWrapper::clear(), and libMesh::ierr.

Referenced by reinit(), and ~PetscDiffSolver().

◆ comm()

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

Definition at line 94 of file parallel_object.h.

95  { return _communicator; }

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::PetscLinearSolver< Number >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::DofMap::add_constraints_to_send_list(), add_cube_convex_hull_to_mesh(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::ImplicitSystem::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::DynaIO::add_spline_constraints(), libMesh::System::add_vector(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::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::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::MeshTools::create_subdomain_bounding_box(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::DTKSolutionTransfer::DTKSolutionTransfer(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::RBConstruction::enrich_RB_space(), libMesh::EpetraVector< T >::EpetraVector(), AssembleOptimization::equality_constraints(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::RBEIMConstruction::evaluate_mesh_function(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::DofMap::gather_constraints(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::EigenSystem::init_matrices(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_rb_construction(), integrate_function(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_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_preconditioner_apply(), 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(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::FEMSystem::mesh_position_set(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::DofMap::n_constrained_dofs(), 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::DofMap::print_dof_constraints(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::DistributedMesh::renumber_dof_objects(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::RBEIMConstruction::set_explicit_sys_subvector(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), setup_petsc_data(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::split_mesh(), libMesh::BoundaryInfo::sync(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), libMesh::MeshRefinement::test_unflagged(), SystemsTest::testBlockRestrictedVarNDofs(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), SystemsTest::testProjectCubeWithMeshFunction(), CheckpointIOTest::testSplitter(), libMesh::MeshTools::total_weight(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBEIMConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::VTKIO::write_nodal_data(), libMesh::RBEvaluation::write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::TransientRBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::RBEIMEvaluationSerialization::write_to_file(), and libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file().

◆ disable_print_counter_info()

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 106 of file reference_counter.C.

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

References libMesh::ReferenceCounter::_enable_print_counter.

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

◆ enable_print_counter_info()

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

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

Definition at line 100 of file reference_counter.C.

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

References libMesh::ReferenceCounter::_enable_print_counter.

◆ get_info()

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

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

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

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

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

◆ increment_constructor_count()

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

Increments the construction counter.

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

Definition at line 181 of file reference_counter.h.

182 {
183  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
184  std::pair<unsigned int, unsigned int> & p = _counts[name];
185 
186  p.first++;
187 }

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

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

◆ increment_destructor_count()

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

Increments the destruction counter.

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

Definition at line 194 of file reference_counter.h.

195 {
196  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
197  std::pair<unsigned int, unsigned int> & p = _counts[name];
198 
199  p.second++;
200 }

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

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

◆ init()

void libMesh::PetscDiffSolver::init ( )
overridevirtual

The initialization function.

Reimplemented from libMesh::DiffSolver.

Definition at line 205 of file petsc_diff_solver.C.

206 {
207  LOG_SCOPE("init()", "PetscDiffSolver");
208 
209  Parent::init();
210 
211  this->setup_petsc_data();
212 }

References libMesh::DiffSolver::init(), and setup_petsc_data().

◆ n_objects()

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

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

Definition at line 83 of file reference_counter.h.

84  { return _n_objects; }

References libMesh::ReferenceCounter::_n_objects.

◆ n_processors()

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

Definition at line 100 of file parallel_object.h.

101  { return cast_int<processor_id_type>(_communicator.size()); }

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::DofMap::add_constraints_to_send_list(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), 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::ExodusII_IO::copy_scalar_solution(), 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::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::partition(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::prepare_send_list(), libMesh::DofMap::print_dof_constraints(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), OverlappingFunctorTest::run_partitioner_test(), libMesh::DofMap::scatter_constraints(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), CheckpointIOTest::testSplitter(), WriteVecAndScalar::testWrite(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::VTKIO::write_nodal_data(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

◆ print_info()

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

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

Definition at line 87 of file reference_counter.C.

88 {
90  out_stream << ReferenceCounter::get_info();
91 }

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

◆ processor_id()

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

Definition at line 106 of file parallel_object.h.

107  { return cast_int<processor_id_type>(_communicator.rank()); }

References libMesh::ParallelObject::_communicator.

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::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), 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::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO::copy_scalar_solution(), 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::RBEIMConstruction::evaluate_mesh_function(), 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::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::DofMap::get_local_constraints(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), HeatSystem::init_data(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::DofMap::is_evaluable(), libMesh::SparsityPattern::Build::join(), libMesh::DofMap::last_dof(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEIMEvaluation::legacy_write_out_interpolation_points_elem(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DofMap::local_variable_indices(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::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::DofMap::print_dof_constraints(), 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::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::LaplaceMeshSmoother::smooth(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusCopyElementSolution(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), CheckpointIOTest::testSplitter(), WriteVecAndScalar::testWrite(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO::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::VTKIO::write_nodal_data(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEvaluation::write_out_vectors(), write_output_solvedata(), libMesh::System::write_parallel_data(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

◆ reinit()

void libMesh::PetscDiffSolver::reinit ( )
overridevirtual

The reinitialization function.

This method is used after changes in the mesh.

Reimplemented from libMesh::DiffSolver.

Definition at line 239 of file petsc_diff_solver.C.

240 {
241  LOG_SCOPE("reinit()", "PetscDiffSolver");
242 
243  // We need to wipe out all the old PETSc data
244  // if we are reinit'ing, since we'll need to build
245  // it all back up again.
246  this->clear();
247 
248  Parent::reinit();
249 
250  this->setup_petsc_data();
251 }

References clear(), libMesh::DiffSolver::reinit(), and setup_petsc_data().

◆ setup_petsc_data()

void libMesh::PetscDiffSolver::setup_petsc_data ( )
private

Common helper function to setup PETSc data structures.

Definition at line 355 of file petsc_diff_solver.C.

356 {
357  int ierr=0;
358 
359  ierr = SNESCreate(this->comm().get(),&_snes);
360  LIBMESH_CHKERR(ierr);
361 
363  this, PETSC_NULL);
364  LIBMESH_CHKERR(ierr);
365 
366  if (libMesh::on_command_line("--solver-system-names"))
367  {
368  ierr = SNESSetOptionsPrefix(_snes, (_system.name()+"_").c_str());
369  LIBMESH_CHKERR(ierr);
370  }
371 
372  bool use_petsc_dm = libMesh::on_command_line("--use_petsc_dm");
373 
374  // This needs to be called before SNESSetFromOptions
375 #if !PETSC_VERSION_LESS_THAN(3,7,3)
376 #if defined(LIBMESH_ENABLE_AMR) && defined(LIBMESH_HAVE_METAPHYSICL)
377  if (use_petsc_dm)
379 #endif
380 #endif
381 
382  // If we're not using PETSc DM, let's keep around
383  // the old style for fieldsplit
384  if (!use_petsc_dm)
385  {
386  ierr = SNESSetFromOptions(_snes);
387  LIBMESH_CHKERR(ierr);
388 
389  KSP my_ksp;
390  ierr = SNESGetKSP(_snes, &my_ksp);
391  LIBMESH_CHKERR(ierr);
392 
393  PC my_pc;
394  ierr = KSPGetPC(my_ksp, &my_pc);
395  LIBMESH_CHKERR(ierr);
396 
398  }
399 }

References libMesh::__libmesh_petsc_diff_solver_monitor(), _dm_wrapper, _snes, libMesh::DiffSolver::_system, libMesh::ParallelObject::comm(), libMesh::ReferenceElem::get(), libMesh::ierr, libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::System::name(), libMesh::on_command_line(), and libMesh::petsc_auto_fieldsplit().

Referenced by init(), and reinit().

◆ solve()

unsigned int libMesh::PetscDiffSolver::solve ( )
overridevirtual

This method performs a solve.

What occurs in this method will depend on the PETSc SNES settings. See the PETSc documentation for more details.

Implements libMesh::DiffSolver.

Definition at line 309 of file petsc_diff_solver.C.

310 {
311  LOG_SCOPE("solve()", "PetscDiffSolver");
312 
313  PetscVector<Number> & x =
314  *(cast_ptr<PetscVector<Number> *>(_system.solution.get()));
315  PetscMatrix<Number> & jac =
316  *(cast_ptr<PetscMatrix<Number> *>(_system.matrix));
317  PetscVector<Number> & r =
318  *(cast_ptr<PetscVector<Number> *>(_system.rhs));
319 
320  int ierr = 0;
321 
322  ierr = SNESSetFunction (_snes, r.vec(),
324  LIBMESH_CHKERR(ierr);
325 
326  ierr = SNESSetJacobian (_snes, jac.mat(), jac.mat(),
328  LIBMESH_CHKERR(ierr);
329 
330  ierr = SNESSetFromOptions(_snes);
331  LIBMESH_CHKERR(ierr);
332 
333  ierr = SNESSolve (_snes, PETSC_NULL, x.vec());
334  LIBMESH_CHKERR(ierr);
335 
336 #ifdef LIBMESH_ENABLE_CONSTRAINTS
338 #endif
339 
340  SNESConvergedReason reason;
341  SNESGetConvergedReason(_snes, &reason);
342 
343  PetscInt l_its, nl_its;
344  ierr = SNESGetLinearSolveIterations(_snes,&l_its);
345  LIBMESH_CHKERR(ierr);
346  this->_inner_iterations = l_its;
347 
348  ierr = SNESGetIterationNumber(_snes,&nl_its);
349  LIBMESH_CHKERR(ierr);
350  this->_outer_iterations = nl_its;
351 
352  return convert_solve_result(reason);
353 }

References libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::DiffSolver::_inner_iterations, libMesh::DiffSolver::_outer_iterations, _snes, libMesh::DiffSolver::_system, libMesh::convert_solve_result(), libMesh::DofMap::enforce_constraints_exactly(), libMesh::System::get_dof_map(), libMesh::ierr, libMesh::PetscMatrix< T >::mat(), libMesh::ImplicitSystem::matrix, libMesh::ExplicitSystem::rhs, libMesh::System::solution, and libMesh::PetscVector< T >::vec().

◆ solve_result()

unsigned int libMesh::DiffSolver::solve_result ( )
inlineinherited
Returns
The value of the SolveResult from the last solve.

Definition at line 132 of file diff_solver.h.

132 { return _solve_result; }

References libMesh::DiffSolver::_solve_result.

◆ system() [1/2]

sys_type& libMesh::DiffSolver::system ( )
inlineinherited
Returns
A writable reference to the system we are solving.

Definition at line 142 of file diff_solver.h.

142 { return _system; }

References libMesh::DiffSolver::_system.

◆ system() [2/2]

const sys_type& libMesh::DiffSolver::system ( ) const
inlineinherited
Returns
A constant reference to the system we are solving.

Definition at line 137 of file diff_solver.h.

137 { return _system; }

References libMesh::DiffSolver::_system.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), and libMesh::__libmesh_petsc_diff_solver_residual().

◆ total_inner_iterations()

unsigned int libMesh::DiffSolver::total_inner_iterations ( )
inlineinherited
Returns
The number of "inner" (e.g. Krylov) iterations required by the last solve.

Definition at line 127 of file diff_solver.h.

127 { return _inner_iterations; }

References libMesh::DiffSolver::_inner_iterations.

◆ total_outer_iterations()

unsigned int libMesh::DiffSolver::total_outer_iterations ( )
inlineinherited
Returns
The number of "outer" (e.g. quasi-Newton) iterations required by the last solve.

Definition at line 121 of file diff_solver.h.

121 { return _outer_iterations; }

References libMesh::DiffSolver::_outer_iterations.

Member Data Documentation

◆ _communicator

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

◆ _counts

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

◆ _dm_wrapper

PetscDMWrapper libMesh::PetscDiffSolver::_dm_wrapper
protected

Wrapper object for interacting with PetscDM.

Definition at line 107 of file petsc_diff_solver.h.

Referenced by clear(), and setup_petsc_data().

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

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

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

◆ _inner_iterations

unsigned int libMesh::DiffSolver::_inner_iterations
protectedinherited

The number of inner iterations used by the last solve.

Definition at line 313 of file diff_solver.h.

Referenced by libMesh::NewtonSolver::solve(), solve(), and libMesh::DiffSolver::total_inner_iterations().

◆ _mutex

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

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 135 of file reference_counter.h.

◆ _n_objects

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

The number of objects.

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

Definition at line 130 of file reference_counter.h.

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

◆ _outer_iterations

unsigned int libMesh::DiffSolver::_outer_iterations
protectedinherited

The number of outer iterations used by the last solve.

Definition at line 308 of file diff_solver.h.

Referenced by libMesh::NewtonSolver::line_search(), libMesh::NewtonSolver::solve(), solve(), and libMesh::DiffSolver::total_outer_iterations().

◆ _snes

SNES libMesh::PetscDiffSolver::_snes
protected

Nonlinear solver context.

Definition at line 100 of file petsc_diff_solver.h.

Referenced by clear(), setup_petsc_data(), and solve().

◆ _solve_result

unsigned int libMesh::DiffSolver::_solve_result
protectedinherited

Initialized to zero.

solve_result is typically set internally in the solve() function before it returns. When non-zero, solve_result tells the result of the latest solve. See enum definition for description.

Definition at line 326 of file diff_solver.h.

Referenced by libMesh::NewtonSolver::line_search(), libMesh::NewtonSolver::solve(), libMesh::DiffSolver::solve_result(), and libMesh::NewtonSolver::test_convergence().

◆ _system

sys_type& libMesh::DiffSolver::_system
protectedinherited

◆ absolute_residual_tolerance

Real libMesh::DiffSolver::absolute_residual_tolerance
inherited

The DiffSolver should exit after the residual is reduced to either less than absolute_residual_tolerance or less than relative_residual_tolerance times the initial residual.

Users should increase any of these tolerances that they want to use for a stopping condition.

Definition at line 191 of file diff_solver.h.

Referenced by SolidSystem::init_data(), main(), libMesh::NewtonSolver::print_convergence(), TimeSolverTestImplementation< NewmarkSolver >::run_test_with_exact_soln(), libMesh::NewtonSolver::solve(), and libMesh::NewtonSolver::test_convergence().

◆ absolute_step_tolerance

Real libMesh::DiffSolver::absolute_step_tolerance
inherited

The DiffSolver should exit after the full nonlinear step norm is reduced to either less than absolute_step_tolerance or less than relative_step_tolerance times the largest nonlinear solution which has been seen so far.

Users should increase any of these tolerances that they want to use for a stopping condition.

Definition at line 203 of file diff_solver.h.

Referenced by libMesh::NewtonSolver::print_convergence(), libMesh::NewtonSolver::solve(), and libMesh::NewtonSolver::test_convergence().

◆ continue_after_backtrack_failure

bool libMesh::DiffSolver::continue_after_backtrack_failure
inherited

Defaults to false, telling the DiffSolver to throw an error when the backtracking scheme fails to find a descent direction.

Definition at line 180 of file diff_solver.h.

Referenced by libMesh::NewtonSolver::line_search(), and set_system_parameters().

◆ continue_after_max_iterations

bool libMesh::DiffSolver::continue_after_max_iterations
inherited

Defaults to true, telling the DiffSolver to continue rather than exit when a solve has reached its maximum number of nonlinear iterations.

Definition at line 174 of file diff_solver.h.

Referenced by set_system_parameters(), and libMesh::NewtonSolver::solve().

◆ initial_linear_tolerance

double libMesh::DiffSolver::initial_linear_tolerance
inherited

Any required linear solves will at first be done with this tolerance; the DiffSolver may tighten the tolerance for later solves.

Definition at line 210 of file diff_solver.h.

Referenced by SolidSystem::init_data(), main(), set_system_parameters(), and libMesh::NewtonSolver::solve().

◆ linear_solution_monitor

std::unique_ptr<LinearSolutionMonitor> libMesh::DiffSolver::linear_solution_monitor
inherited

Pointer to functor which is called right after each linear solve.

Definition at line 288 of file diff_solver.h.

Referenced by libMesh::__libmesh_petsc_diff_solver_monitor(), and libMesh::NewtonSolver::solve().

◆ max_linear_iterations

unsigned int libMesh::DiffSolver::max_linear_iterations
inherited

Each linear solver step should exit after max_linear_iterations is exceeded.

Definition at line 148 of file diff_solver.h.

Referenced by libMesh::ContinuationSystem::continuation_solve(), SolidSystem::init_data(), main(), set_system_parameters(), libMesh::NewtonSolver::solve(), and libMesh::ContinuationSystem::solve_tangent().

◆ max_nonlinear_iterations

unsigned int libMesh::DiffSolver::max_nonlinear_iterations
inherited

The DiffSolver should exit in failure if max_nonlinear_iterations is exceeded and continue_after_max_iterations is false, or should end the nonlinear solve if max_nonlinear_iterations is exceeded and continue_after_max_iterations is true.

Definition at line 156 of file diff_solver.h.

Referenced by libMesh::ContinuationSystem::continuation_solve(), SolidSystem::init_data(), main(), set_system_parameters(), libMesh::NewtonSolver::solve(), and libMesh::ContinuationSystem::update_solution().

◆ max_residual_norm

Real libMesh::DiffSolver::max_residual_norm
protectedinherited

The largest nonlinear residual which the DiffSolver has yet seen will be stored here, to be used for stopping criteria based on relative_residual_tolerance.

Definition at line 303 of file diff_solver.h.

Referenced by libMesh::DiffSolver::init(), libMesh::NewtonSolver::print_convergence(), libMesh::DiffSolver::reinit(), libMesh::NewtonSolver::solve(), and libMesh::NewtonSolver::test_convergence().

◆ max_solution_norm

Real libMesh::DiffSolver::max_solution_norm
protectedinherited

The largest solution norm which the DiffSolver has yet seen will be stored here, to be used for stopping criteria based on relative_step_tolerance.

Definition at line 296 of file diff_solver.h.

Referenced by libMesh::DiffSolver::init(), libMesh::NewtonSolver::print_convergence(), libMesh::DiffSolver::reinit(), libMesh::NewtonSolver::solve(), and libMesh::NewtonSolver::test_convergence().

◆ minimum_linear_tolerance

double libMesh::DiffSolver::minimum_linear_tolerance
inherited

The tolerance for linear solves is kept above this minimum.

Definition at line 215 of file diff_solver.h.

Referenced by set_system_parameters(), and libMesh::NewtonSolver::solve().

◆ quiet

bool libMesh::DiffSolver::quiet
inherited

The DiffSolver should not print anything to libMesh::out unless quiet is set to false; default is true.

Definition at line 162 of file diff_solver.h.

Referenced by SolidSystem::init_data(), libMesh::NewtonSolver::line_search(), main(), set_system_parameters(), and libMesh::NewtonSolver::solve().

◆ relative_residual_tolerance

Real libMesh::DiffSolver::relative_residual_tolerance
inherited

◆ relative_step_tolerance

Real libMesh::DiffSolver::relative_step_tolerance
inherited

◆ verbose

bool libMesh::DiffSolver::verbose
inherited

The documentation for this class was generated from the following files:
libMesh::DiffSolver::reinit
virtual void reinit()
The reinitialization function.
Definition: diff_solver.C:60
libMesh::DiffSolver::CONVERGED_ABSOLUTE_STEP
The DiffSolver achieved the desired absolute step size tolerance.
Definition: diff_solver.h:251
libMesh::PetscDiffSolver::clear
void clear()
The clear function.
Definition: petsc_diff_solver.C:223
libMesh::__libmesh_petsc_diff_solver_residual
PetscErrorCode __libmesh_petsc_diff_solver_residual(SNES, Vec x, Vec r, void *ctx)
Definition: petsc_diff_solver.C:86
libMesh::ExplicitSystem::rhs
NumericVector< Number > * rhs
The system matrix.
Definition: explicit_system.h:114
libMesh::DiffSolver::CONVERGED_RELATIVE_STEP
The DiffSolver achieved the desired relative step size tolerance.
Definition: diff_solver.h:257
libMesh::PetscDiffSolver::Parent
DiffSolver Parent
Definition: petsc_diff_solver.h:70
libMesh::PetscDiffSolver::_dm_wrapper
PetscDMWrapper _dm_wrapper
Wrapper object for interacting with PetscDM.
Definition: petsc_diff_solver.h:107
libMesh::ReferenceCounter::_counts
static Counts _counts
Actually holds the data.
Definition: reference_counter.h:122
libMesh::DiffSolver::DIVERGED_LINEAR_SOLVER_FAILURE
The linear solver used by the DiffSolver failed to find a solution.
Definition: diff_solver.h:282
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
libMesh::DiffSolver::DIVERGED_BACKTRACKING_FAILURE
The DiffSolver failed to find a descent direction by backtracking (See newton_solver....
Definition: diff_solver.h:276
libMesh::DiffSolver::CONVERGED_RELATIVE_RESIDUAL
The DiffSolver achieved the desired relative residual tolerance.
Definition: diff_solver.h:245
libMesh::ReferenceCounter::_n_objects
static Threads::atomic< unsigned int > _n_objects
The number of objects.
Definition: reference_counter.h:130
libMesh::DiffSolver::_solve_result
unsigned int _solve_result
Initialized to zero.
Definition: diff_solver.h:326
libMesh::DiffSolver::_inner_iterations
unsigned int _inner_iterations
The number of inner iterations used by the last solve.
Definition: diff_solver.h:313
libMesh::ierr
ierr
Definition: petsc_dm_wrapper.C:72
libMesh::ReferenceCounter::get_info
static std::string get_info()
Gets a string containing the reference information.
Definition: reference_counter.C:47
libMesh::DiffSolver::init
virtual void init()
The initialization function.
Definition: diff_solver.C:69
libMesh::__libmesh_petsc_diff_solver_jacobian
PetscErrorCode __libmesh_petsc_diff_solver_jacobian(SNES, Vec x, #if PETSC_RELEASE_LESS_THAN(3, 5, 0) Mat *libmesh_dbg_var(j), Mat *pc, MatStructure *msflag, #else Mat libmesh_dbg_var(j), Mat pc, #endif void *ctx)
Definition: petsc_diff_solver.C:132
libMesh::convert_solve_result
DiffSolver::SolveResult convert_solve_result(SNESConvergedReason r)
Definition: petsc_diff_solver.C:255
libMesh::PetscDiffSolver::setup_petsc_data
void setup_petsc_data()
Common helper function to setup PETSc data structures.
Definition: petsc_diff_solver.C:355
libMesh::Threads::spin_mtx
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:29
libMesh::DofMap::enforce_constraints_exactly
void enforce_constraints_exactly(const System &system, NumericVector< Number > *v=nullptr, bool homogeneous=false) const
Constrains the numeric vector v, which represents a solution defined on the mesh.
Definition: dof_map.h:2054
libMesh::ParallelObject::_communicator
const Parallel::Communicator & _communicator
Definition: parallel_object.h:112
libMesh::ImplicitSystem::matrix
SparseMatrix< Number > * matrix
The system matrix.
Definition: implicit_system.h:393
libMesh::DiffSolver::CONVERGED_NO_REASON
The solver converged but no particular reason is specified.
Definition: diff_solver.h:233
libMesh::DiffSolver::CONVERGED_ABSOLUTE_RESIDUAL
The DiffSolver achieved the desired absolute residual tolerance.
Definition: diff_solver.h:239
libMesh::DiffSolver::DIVERGED_NO_REASON
The DiffSolver diverged but no particular reason is specified.
Definition: diff_solver.h:263
libMesh::PetscDMWrapper::init_and_attach_petscdm
void init_and_attach_petscdm(System &system, SNES &snes)
Definition: petsc_dm_wrapper.C:445
libMesh::DiffSolver::DIVERGED_MAX_NONLINEAR_ITERATIONS
The DiffSolver reached the maximum allowed number of nonlinear iterations before satisfying any conve...
Definition: diff_solver.h:270
libMesh::PetscDMWrapper::clear
void clear()
Destroys and clears all build DM-related data.
Definition: petsc_dm_wrapper.C:430
libMesh::System::solution
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1539
libMesh::ReferenceElem::get
const Elem & get(const ElemType type_in)
Definition: reference_elem.C:237
libMesh::DiffSolver::_outer_iterations
unsigned int _outer_iterations
The number of outer iterations used by the last solve.
Definition: diff_solver.h:308
libMesh::System::name
const std::string & name() const
Definition: system.h:2067
libMesh::on_command_line
bool on_command_line(std::string arg)
Definition: libmesh.C:898
libMesh::__libmesh_petsc_diff_solver_monitor
PetscErrorCode __libmesh_petsc_diff_solver_monitor(SNES snes, PetscInt its, PetscReal fnorm, void *ctx)
Definition: petsc_diff_solver.C:43
libMesh::System::get_dof_map
const DofMap & get_dof_map() const
Definition: system.h:2099
libMesh::ReferenceCounter::_enable_print_counter
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called.
Definition: reference_counter.h:141
libMesh::petsc_auto_fieldsplit
void petsc_auto_fieldsplit(PC my_pc, const System &sys)
Definition: petsc_auto_fieldsplit.C:58
libMesh::DiffSolver::_system
sys_type & _system
A reference to the system we are solving.
Definition: diff_solver.h:318
libMesh::Quality::name
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
libMesh::PetscDiffSolver::_snes
SNES _snes
Nonlinear solver context.
Definition: petsc_diff_solver.h:100
libMesh::DiffSolver::INVALID_SOLVE_RESULT
A default or invalid solve result.
Definition: diff_solver.h:227