libMesh
|
This class implements the Patch Recovery error indicator. More...
#include <patch_recovery_error_estimator.h>
Classes | |
class | EstimateError |
Class to compute the error contribution for a range of elements. More... | |
Public Types | |
typedef std::map< std::pair< const System *, unsigned int >, std::unique_ptr< ErrorVector > > | ErrorMap |
When calculating many error vectors at once, we need a data structure to hold them all. More... | |
Public Member Functions | |
PatchRecoveryErrorEstimator () | |
Constructor. More... | |
PatchRecoveryErrorEstimator (const PatchRecoveryErrorEstimator &)=default | |
Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this class. More... | |
PatchRecoveryErrorEstimator (PatchRecoveryErrorEstimator &&)=default | |
PatchRecoveryErrorEstimator & | operator= (const PatchRecoveryErrorEstimator &)=default |
PatchRecoveryErrorEstimator & | operator= (PatchRecoveryErrorEstimator &&)=default |
virtual | ~PatchRecoveryErrorEstimator ()=default |
virtual void | estimate_error (const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false) override |
This function uses the Patch Recovery error estimate to estimate the error on each cell. More... | |
void | set_patch_reuse (bool) |
void | extra_quadrature_order (const int extraorder) |
Increases or decreases the order of the quadrature rule used for numerical integration. More... | |
virtual ErrorEstimatorType | type () const override |
virtual void | estimate_errors (const EquationSystems &equation_systems, ErrorVector &error_per_cell, const std::map< const System *, SystemNorm > &error_norms, const std::map< const System *, const NumericVector< Number > *> *solution_vectors=nullptr, bool estimate_parent_error=false) |
This virtual function can be redefined in derived classes, but by default computes the sum of the error_per_cell for each system in the equation_systems. More... | |
virtual void | estimate_errors (const EquationSystems &equation_systems, ErrorMap &errors_per_cell, const std::map< const System *, const NumericVector< Number > *> *solution_vectors=nullptr, bool estimate_parent_error=false) |
This virtual function can be redefined in derived classes, but by default it calls estimate_error repeatedly to calculate the requested error vectors. More... | |
Public Attributes | |
unsigned int | target_patch_size |
The PatchErrorEstimator will build patches of at least this many elements to perform estimates. More... | |
Patch::PMF | patch_growth_strategy |
The PatchErrorEstimator will use this pointer to a Patch member function when growing patches. More... | |
SystemNorm | error_norm |
When estimating the error in a single system, the error_norm is used to control the scaling and norm choice for each variable. More... | |
Protected Member Functions | |
void | reduce_error (std::vector< ErrorVectorReal > &error_per_cell, const Parallel::Communicator &comm) const |
This method takes the local error contributions in error_per_cell from each processor and combines them to get the global error vector. More... | |
Static Protected Member Functions | |
static std::vector< Real > | specpoly (const unsigned int dim, const Order order, const Point p, const unsigned int matsize) |
Protected Attributes | |
bool | patch_reuse |
int | _extra_order |
Extra order to use for quadrature rule. More... | |
Friends | |
class | EstimateError |
This class implements the Patch Recovery error indicator.
Definition at line 47 of file patch_recovery_error_estimator.h.
|
inherited |
When calculating many error vectors at once, we need a data structure to hold them all.
Definition at line 121 of file error_estimator.h.
libMesh::PatchRecoveryErrorEstimator::PatchRecoveryErrorEstimator | ( | ) |
Constructor.
Defaults to H1 seminorm. All Hilbert norms and seminorms should be supported now. W1,p and W2,p norms would be natural to support if any contributors make the effort.
Definition at line 65 of file patch_recovery_error_estimator.C.
References libMesh::ErrorEstimator::error_norm, and libMesh::H1_SEMINORM.
|
default |
Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this class.
|
default |
|
virtualdefault |
|
overridevirtual |
This function uses the Patch Recovery error estimate to estimate the error on each cell.
The estimated error is output in the vector error_per_cell
Implements libMesh::ErrorEstimator.
Reimplemented in libMesh::WeightedPatchRecoveryErrorEstimator.
Definition at line 154 of file patch_recovery_error_estimator.C.
References libMesh::ParallelObject::comm(), EstimateError, libMesh::System::get_mesh(), mesh, libMesh::Threads::parallel_for(), libMesh::ErrorEstimator::reduce_error(), libMesh::System::solution, and libMesh::NumericVector< T >::swap().
Referenced by main().
|
virtualinherited |
This virtual function can be redefined in derived classes, but by default computes the sum of the error_per_cell for each system in the equation_systems.
Currently this function ignores the error_norm member variable, and uses the function argument error_norms instead.
This function is named estimate_errors instead of estimate_error because otherwise C++ can get confused.
Reimplemented in libMesh::UniformRefinementEstimator.
Definition at line 47 of file error_estimator.C.
References libMesh::ErrorEstimator::error_norm, libMesh::ErrorEstimator::estimate_error(), libMesh::EquationSystems::get_system(), libMesh::index_range(), libMesh::make_range(), and libMesh::EquationSystems::n_systems().
|
virtualinherited |
This virtual function can be redefined in derived classes, but by default it calls estimate_error repeatedly to calculate the requested error vectors.
FIXME: This is a default implementation - derived classes should reimplement it for efficiency.
Currently this function ignores the error_norm.weight() values because it calculates each variable's error individually, unscaled.
The user selects which errors get computed by filling a map with error vectors: If errors_per_cell[&system][v] exists, it will be filled with the error values in variable v
of system
Reimplemented in libMesh::UniformRefinementEstimator.
Definition at line 93 of file error_estimator.C.
References libMesh::ErrorEstimator::error_norm, libMesh::ErrorEstimator::estimate_error(), libMesh::EquationSystems::get_system(), libMesh::make_range(), libMesh::EquationSystems::n_systems(), n_vars, libMesh::System::n_vars(), and libMesh::SystemNorm::type().
|
inline |
Increases or decreases the order of the quadrature rule used for numerical integration.
The default extraorder
is 1, because properly integrating L2 error requires integrating the squares of terms with order p+1, and 2p+2 is 1 higher than what we default to using for reasonable mass matrix integration.
Definition at line 102 of file patch_recovery_error_estimator.h.
References _extra_order.
|
default |
|
default |
|
protectedinherited |
This method takes the local error contributions in error_per_cell
from each processor and combines them to get the global error vector.
Definition at line 32 of file error_estimator.C.
References TIMPI::Communicator::sum().
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), and libMesh::ExactErrorEstimator::estimate_error().
void libMesh::PatchRecoveryErrorEstimator::set_patch_reuse | ( | bool | patch_reuse_flag | ) |
Definition at line 58 of file patch_recovery_error_estimator.C.
References patch_reuse.
|
staticprotected |
Definition at line 77 of file patch_recovery_error_estimator.C.
References dim, libMesh::make_range(), and libMesh::Real.
Referenced by libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), and libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()().
|
overridevirtual |
Implements libMesh::ErrorEstimator.
Reimplemented in libMesh::WeightedPatchRecoveryErrorEstimator.
Definition at line 50 of file patch_recovery_error_estimator.C.
References libMesh::PATCH_RECOVERY.
|
friend |
Definition at line 149 of file patch_recovery_error_estimator.h.
Referenced by estimate_error().
|
protected |
Extra order to use for quadrature rule.
Definition at line 122 of file patch_recovery_error_estimator.h.
Referenced by extra_quadrature_order(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), and libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()().
|
inherited |
When estimating the error in a single system, the error_norm
is used to control the scaling and norm choice for each variable.
Not all estimators will support all norm choices. The default scaling is for all variables to be weighted equally. The default norm choice depends on the error estimator.
Part of this functionality was supported via component_scale and sobolev_order in older libMesh versions, and a small part was supported via component_mask in even older versions. Hopefully the encapsulation here will allow us to avoid changing this API again.
Definition at line 158 of file error_estimator.h.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::AdjointRefinementEstimator::AdjointRefinementEstimator(), libMesh::DiscontinuityMeasure::boundary_side_integration(), libMesh::KellyErrorEstimator::boundary_side_integration(), libMesh::DiscontinuityMeasure::DiscontinuityMeasure(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::ErrorEstimator::estimate_errors(), libMesh::ExactErrorEstimator::ExactErrorEstimator(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::LaplacianErrorEstimator::init_context(), libMesh::DiscontinuityMeasure::init_context(), libMesh::KellyErrorEstimator::init_context(), libMesh::LaplacianErrorEstimator::internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), libMesh::KellyErrorEstimator::internal_side_integration(), libMesh::KellyErrorEstimator::KellyErrorEstimator(), libMesh::LaplacianErrorEstimator::LaplacianErrorEstimator(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), PatchRecoveryErrorEstimator(), libMesh::JumpErrorEstimator::reinit_sides(), and libMesh::UniformRefinementEstimator::UniformRefinementEstimator().
Patch::PMF libMesh::PatchRecoveryErrorEstimator::patch_growth_strategy |
The PatchErrorEstimator will use this pointer to a Patch member function when growing patches.
The default strategy used is Patch::add_local_face_neighbors. Patch::add_local_point_neighbors may be more reliable but slower.
Definition at line 91 of file patch_recovery_error_estimator.h.
Referenced by libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), and libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()().
|
protected |
Definition at line 117 of file patch_recovery_error_estimator.h.
Referenced by libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), and set_patch_reuse().
unsigned int libMesh::PatchRecoveryErrorEstimator::target_patch_size |
The PatchErrorEstimator will build patches of at least this many elements to perform estimates.
Definition at line 83 of file patch_recovery_error_estimator.h.
Referenced by libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), and libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()().