#include <patch_recovery_error_estimator.h>
Classes | |
class | EstimateError |
Public Types | |
typedef std::map< std::pair< const System *, unsigned int >, ErrorVector * > | ErrorMap |
Public Member Functions | |
PatchRecoveryErrorEstimator () | |
PatchRecoveryErrorEstimator (const PatchRecoveryErrorEstimator &)=default | |
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 |
void | set_patch_reuse (bool) |
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) |
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) |
Public Attributes | |
unsigned int | target_patch_size |
Patch::PMF | patch_growth_strategy |
SystemNorm | error_norm |
Protected Member Functions | |
void | reduce_error (std::vector< ErrorVectorReal > &error_per_cell, const Parallel::Communicator &comm) const |
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 |
Friends | |
class | EstimateError |
This class implements the Patch Recovery error indicator.
Definition at line 55 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 124 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 153 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().
|
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(), 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.
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
FIXME: This is a default implementation - derived classes should reimplement it for efficiency.
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::EquationSystems::n_systems(), n_vars, libMesh::System::n_vars(), and libMesh::SystemNorm::type().
|
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 libMesh::Parallel::Communicator::sum().
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), 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 76 of file patch_recovery_error_estimator.C.
References 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 142 of file patch_recovery_error_estimator.h.
Referenced by estimate_error().
|
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 161 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 99 of file patch_recovery_error_estimator.h.
Referenced by libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), and libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()().
|
protected |
Definition at line 115 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 91 of file patch_recovery_error_estimator.h.
Referenced by libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), and libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()().