libMesh
|
This abstract base class implements utility functions for error estimators which are based on integrated jumps between elements. More...
#include <jump_error_estimator.h>
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 | |
JumpErrorEstimator () | |
Constructor. More... | |
JumpErrorEstimator (const JumpErrorEstimator &)=delete | |
This class cannot be (default) copy constructed/assigned because it has unique_ptr members. More... | |
JumpErrorEstimator & | operator= (const JumpErrorEstimator &)=delete |
JumpErrorEstimator (JumpErrorEstimator &&)=default | |
Defaulted move ctor, move assignment operator, and destructor. More... | |
JumpErrorEstimator & | operator= (JumpErrorEstimator &&)=default |
virtual | ~JumpErrorEstimator ()=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 derived class's jump error estimate formula to estimate the error on each cell. More... | |
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... | |
virtual ErrorEstimatorType | type () const =0 |
Public Attributes | |
bool | scale_by_n_flux_faces |
This boolean flag allows you to scale the error indicator result for each element by the number of "flux faces" the element actually has. More... | |
bool | use_unweighted_quadrature_rules |
This boolean flag allows you to use "unweighted" quadrature rules (sized to exactly integrate unweighted shape functions in master element space) rather than "default" quadrature rules (sized to exactly integrate polynomials of one higher degree than mass matrix terms). More... | |
bool | integrate_slits |
A boolean flag, by default false, to be set to true if integrations should be performed on "slits" where two elements' faces overlap even if those elements are not connected by neighbor links. 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 | reinit_sides () |
A utility function to reinit the finite element data on elements sharing a side. More... | |
float | coarse_n_flux_faces_increment () |
A utility function to correctly increase n_flux_faces for the coarse element. More... | |
virtual void | init_context (FEMContext &c) |
An initialization function, to give derived classes a chance to request specific data from the FE objects. More... | |
virtual void | internal_side_integration ()=0 |
The function, to be implemented by derived classes, which calculates an error term on an internal side. More... | |
virtual bool | boundary_side_integration () |
The function, to be implemented by derived classes, which calculates an error term on a boundary side. More... | |
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... | |
Protected Attributes | |
bool | integrate_boundary_sides |
A boolean flag, by default false, to be set to true if integrations with boundary_side_integration() should be performed. More... | |
std::unique_ptr< FEMContext > | fine_context |
Context objects for integrating on the fine and coarse elements sharing a face. More... | |
std::unique_ptr< FEMContext > | coarse_context |
Real | fine_error |
The fine and coarse error values to be set by each side_integration();. More... | |
Real | coarse_error |
unsigned int | var |
The variable number currently being evaluated. More... | |
This abstract base class implements utility functions for error estimators which are based on integrated jumps between elements.
Definition at line 48 of file jump_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.
|
inline |
Constructor.
Definition at line 55 of file jump_error_estimator.h.
|
delete |
This class cannot be (default) copy constructed/assigned because it has unique_ptr members.
Explicitly deleting these functions is the best way to document this fact.
|
default |
Defaulted move ctor, move assignment operator, and destructor.
|
virtualdefault |
|
inlineprotectedvirtual |
The function, to be implemented by derived classes, which calculates an error term on a boundary side.
true
if the flux bc function is in fact defined on the current side. Reimplemented in libMesh::KellyErrorEstimator, and libMesh::DiscontinuityMeasure.
Definition at line 163 of file jump_error_estimator.h.
Referenced by estimate_error().
|
protected |
A utility function to correctly increase n_flux_faces for the coarse element.
Definition at line 591 of file jump_error_estimator.C.
References coarse_context, dim, and fine_context.
Referenced by estimate_error().
|
overridevirtual |
This function uses the derived class's jump error estimate formula to estimate the error on each cell.
The estimated error is output in the vector error_per_cell
Conventions for assigning the direction of the normal:
Case (1.) Elements are at the same level, e<f Compute the flux jump on the face and add it as a contribution to error_per_cell[e] and error_per_cell[f]
| | |
f | |
---|---|
e | —> n |
Case (2.) The neighbor is at a higher level. Compute the flux jump on e's face and add it as a contribution to error_per_cell[e] and error_per_cell[f]
| | | | | | e |—> n | | | | | |--------—| f |
Implements libMesh::ErrorEstimator.
Definition at line 56 of file jump_error_estimator.C.
References libMesh::Elem::active(), libMesh::ElemInternal::active_family_tree_by_neighbor(), boundary_side_integration(), libMesh::FEAbstract::build(), libMesh::Elem::child_ref_range(), coarse_context, coarse_error, coarse_n_flux_faces_increment(), libMesh::FEGenericBase< OutputType >::coarsened_dof_values(), dim, libMesh::ErrorEstimator::error_norm, libMesh::ErrorVectorReal, fine_context, fine_error, libMesh::NumericVector< T >::get(), libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::FEAbstract::get_xyz(), libMesh::DofObject::id(), libMesh::index_range(), init_context(), integrate_boundary_sides, integrate_slits, internal_side_integration(), libMesh::FEMap::inverse_map(), libMesh::Elem::level(), libMesh::libmesh_assert(), libMesh::libmesh_ignore(), libMesh::make_range(), mesh, n_vars, libMesh::System::n_vars(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), libMesh::Real, libMesh::ErrorEstimator::reduce_error(), libMesh::FEAbstract::reinit(), reinit_sides(), libMesh::SCALAR, scale_by_n_flux_faces, libMesh::Elem::side_index_range(), libMesh::DenseVector< T >::size(), libMesh::System::solution, libMesh::NumericVector< T >::swap(), libMesh::FEType::unweighted_quadrature_rule(), use_unweighted_quadrature_rules, var, and libMesh::SystemNorm::weight().
Referenced by assemble_and_solve(), main(), and SlitMeshRefinedSystemTest::testSystem().
|
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 94 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().
|
protectedvirtual |
An initialization function, to give derived classes a chance to request specific data from the FE objects.
Reimplemented in libMesh::KellyErrorEstimator, libMesh::DiscontinuityMeasure, and libMesh::LaplacianErrorEstimator.
Definition at line 48 of file jump_error_estimator.C.
Referenced by estimate_error().
|
protectedpure virtual |
The function, to be implemented by derived classes, which calculates an error term on an internal side.
Implemented in libMesh::KellyErrorEstimator, libMesh::DiscontinuityMeasure, and libMesh::LaplacianErrorEstimator.
Referenced by estimate_error().
|
delete |
|
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(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), and libMesh::ExactErrorEstimator::estimate_error().
|
protected |
A utility function to reinit the finite element data on elements sharing a side.
Definition at line 553 of file jump_error_estimator.C.
References coarse_context, dim, libMesh::ErrorEstimator::error_norm, fine_context, libMesh::FEMap::inverse_map(), n_vars, libMesh::FEAbstract::reinit(), libMesh::SCALAR, and libMesh::SystemNorm::weight().
Referenced by estimate_error().
|
pure virtualinherited |
Implemented in libMesh::ExactErrorEstimator, libMesh::AdjointResidualErrorEstimator, libMesh::UniformRefinementEstimator, libMesh::AdjointRefinementEstimator, libMesh::PatchRecoveryErrorEstimator, libMesh::KellyErrorEstimator, libMesh::WeightedPatchRecoveryErrorEstimator, libMesh::DiscontinuityMeasure, and libMesh::LaplacianErrorEstimator.
|
protected |
Definition at line 175 of file jump_error_estimator.h.
Referenced by coarse_n_flux_faces_increment(), estimate_error(), libMesh::DiscontinuityMeasure::init_context(), libMesh::KellyErrorEstimator::init_context(), libMesh::LaplacianErrorEstimator::internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), libMesh::KellyErrorEstimator::internal_side_integration(), and reinit_sides().
|
protected |
Definition at line 180 of file jump_error_estimator.h.
Referenced by estimate_error(), libMesh::LaplacianErrorEstimator::internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), and libMesh::KellyErrorEstimator::internal_side_integration().
|
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(), 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()(), libMesh::PatchRecoveryErrorEstimator::PatchRecoveryErrorEstimator(), reinit_sides(), and libMesh::UniformRefinementEstimator::UniformRefinementEstimator().
|
protected |
Context objects for integrating on the fine and coarse elements sharing a face.
Definition at line 175 of file jump_error_estimator.h.
Referenced by libMesh::DiscontinuityMeasure::boundary_side_integration(), libMesh::KellyErrorEstimator::boundary_side_integration(), coarse_n_flux_faces_increment(), estimate_error(), libMesh::LaplacianErrorEstimator::internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), libMesh::KellyErrorEstimator::internal_side_integration(), and reinit_sides().
|
protected |
The fine and coarse error values to be set by each side_integration();.
Definition at line 180 of file jump_error_estimator.h.
Referenced by libMesh::DiscontinuityMeasure::boundary_side_integration(), libMesh::KellyErrorEstimator::boundary_side_integration(), estimate_error(), libMesh::LaplacianErrorEstimator::internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), and libMesh::KellyErrorEstimator::internal_side_integration().
|
protected |
A boolean flag, by default false, to be set to true if integrations with boundary_side_integration() should be performed.
Definition at line 169 of file jump_error_estimator.h.
Referenced by libMesh::DiscontinuityMeasure::attach_essential_bc_function(), libMesh::KellyErrorEstimator::attach_flux_bc_function(), and estimate_error().
bool libMesh::JumpErrorEstimator::integrate_slits |
A boolean flag, by default false, to be set to true if integrations should be performed on "slits" where two elements' faces overlap even if those elements are not connected by neighbor links.
This may only be useful for flex-IGA meshes, where highly-nonconforming meshes are given pseudo-conforming solutions via nodal constraints.
Note that, to safely use this option in parallel, it is also necessary to expand the default algebraic ghosting requirements to include elements on the opposite sides of slits from local elements.
Definition at line 130 of file jump_error_estimator.h.
Referenced by estimate_error(), and SlitMeshRefinedSystemTest::testSystem().
bool libMesh::JumpErrorEstimator::scale_by_n_flux_faces |
This boolean flag allows you to scale the error indicator result for each element by the number of "flux faces" the element actually has.
This tends to weight more evenly cells which are on the boundaries and thus have fewer contributions to their flux. The value is initialized to false, simply set it to true if you want to use the feature.
Definition at line 100 of file jump_error_estimator.h.
Referenced by estimate_error().
bool libMesh::JumpErrorEstimator::use_unweighted_quadrature_rules |
This boolean flag allows you to use "unweighted" quadrature rules (sized to exactly integrate unweighted shape functions in master element space) rather than "default" quadrature rules (sized to exactly integrate polynomials of one higher degree than mass matrix terms).
The results with the former, lower-order rules will be somewhat less accurate in many cases but will be much cheaper to compute.
The value is initialized to false, simply set it to true if you want to use the feature.
Definition at line 114 of file jump_error_estimator.h.
Referenced by estimate_error(), and main().
|
protected |
The variable number currently being evaluated.
Definition at line 185 of file jump_error_estimator.h.
Referenced by libMesh::DiscontinuityMeasure::boundary_side_integration(), libMesh::KellyErrorEstimator::boundary_side_integration(), estimate_error(), libMesh::LaplacianErrorEstimator::internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), and libMesh::KellyErrorEstimator::internal_side_integration().