#include <error_estimator.h>
Public Types | |
typedef std::map< std::pair< const System *, unsigned int >, ErrorVector * > | ErrorMap |
Public Member Functions | |
ErrorEstimator ()=default | |
ErrorEstimator (const ErrorEstimator &)=default | |
ErrorEstimator (ErrorEstimator &&)=default | |
ErrorEstimator & | operator= (const ErrorEstimator &)=default |
ErrorEstimator & | operator= (ErrorEstimator &&)=default |
virtual | ~ErrorEstimator ()=default |
virtual void | estimate_error (const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false)=0 |
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) |
virtual ErrorEstimatorType | type () const =0 |
Public Attributes | |
SystemNorm | error_norm |
Protected Member Functions | |
void | reduce_error (std::vector< ErrorVectorReal > &error_per_cell, const Parallel::Communicator &comm) const |
This class holds functions that will estimate the error in a finite element solution on a given mesh. These error estimates can be useful in their own right, or may be used to guide adaptive mesh refinement.
Definition at line 64 of file error_estimator.h.
typedef std::map<std::pair<const System *, unsigned int>, ErrorVector *> libMesh::ErrorEstimator::ErrorMap |
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.
|
default |
Constructor. Empty. Derived classes should reset error_norm as appropriate.
|
default |
Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this simple class.
|
default |
|
virtualdefault |
|
pure virtual |
This pure virtual function must be redefined in derived classes to compute the error for each active element and place it in the "error_per_cell" vector.
If solution_vector is not nullptr, the estimator will (if able) attempt to estimate an error in that field instead of in system.solution.
If estimate_parent_error is not false, the estimator will (if able) attempt to give a consistent estimate of errors in parent elements that would be generated by coarsening.
Implemented in libMesh::ExactErrorEstimator, libMesh::AdjointResidualErrorEstimator, libMesh::AdjointRefinementEstimator, libMesh::JumpErrorEstimator, libMesh::PatchRecoveryErrorEstimator, libMesh::UniformRefinementEstimator, and libMesh::WeightedPatchRecoveryErrorEstimator.
Referenced by estimate_errors().
|
virtual |
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 error_norm, estimate_error(), libMesh::EquationSystems::get_system(), libMesh::index_range(), and libMesh::EquationSystems::n_systems().
|
virtual |
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 error_norm, estimate_error(), libMesh::EquationSystems::get_system(), libMesh::EquationSystems::n_systems(), n_vars, libMesh::System::n_vars(), and libMesh::SystemNorm::type().
|
default |
|
default |
|
protected |
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(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), and libMesh::ExactErrorEstimator::estimate_error().
|
pure virtual |
Implemented in libMesh::ExactErrorEstimator, libMesh::AdjointResidualErrorEstimator, libMesh::AdjointRefinementEstimator, libMesh::UniformRefinementEstimator, libMesh::PatchRecoveryErrorEstimator, libMesh::KellyErrorEstimator, libMesh::WeightedPatchRecoveryErrorEstimator, libMesh::DiscontinuityMeasure, and libMesh::LaplacianErrorEstimator.
SystemNorm libMesh::ErrorEstimator::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. 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(), 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()(), libMesh::PatchRecoveryErrorEstimator::PatchRecoveryErrorEstimator(), libMesh::JumpErrorEstimator::reinit_sides(), and libMesh::UniformRefinementEstimator::UniformRefinementEstimator().