#include <jump_error_estimator.h>
Public Types | |
typedef std::map< std::pair< const System *, unsigned int >, ErrorVector * > | ErrorMap |
Public Member Functions | |
JumpErrorEstimator () | |
JumpErrorEstimator (const JumpErrorEstimator &)=delete | |
JumpErrorEstimator & | operator= (const JumpErrorEstimator &)=delete |
JumpErrorEstimator (JumpErrorEstimator &&)=default | |
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 |
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 | |
bool | scale_by_n_flux_faces |
SystemNorm | error_norm |
Protected Member Functions | |
void | reinit_sides () |
float | coarse_n_flux_faces_increment () |
virtual void | init_context (FEMContext &c) |
virtual void | internal_side_integration ()=0 |
virtual bool | boundary_side_integration () |
void | reduce_error (std::vector< ErrorVectorReal > &error_per_cell, const Parallel::Communicator &comm) const |
Protected Attributes | |
bool | integrate_boundary_sides |
std::unique_ptr< FEMContext > | fine_context |
std::unique_ptr< FEMContext > | coarse_context |
Real | fine_error |
Real | coarse_error |
unsigned int | var |
This abstract base class implements utility functions for error estimators which are based on integrated jumps between elements.
Definition at line 49 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 124 of file error_estimator.h.
|
inline |
Constructor.
Definition at line 56 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 132 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 462 of file jump_error_estimator.C.
References coarse_context, 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 53 of file jump_error_estimator.C.
References libMesh::Elem::active(), boundary_side_integration(), libMesh::Elem::child_ref_range(), coarse_context, coarse_error, coarse_n_flux_faces_increment(), libMesh::FEGenericBase< OutputType >::coarsened_dof_values(), libMesh::ParallelObject::comm(), libMesh::ErrorEstimator::error_norm, libMesh::ErrorVectorReal, libMesh::FEType::family, fine_context, fine_error, libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::FEAbstract::get_xyz(), libMesh::DofObject::id(), libMesh::index_range(), init_context(), integrate_boundary_sides, internal_side_integration(), libMesh::Elem::level(), libMesh::libmesh_ignore(), mesh, n_vars, libMesh::System::n_vars(), libMesh::Elem::neighbor_ptr(), libMesh::Elem::parent(), libMesh::ErrorEstimator::reduce_error(), 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(), var, libMesh::System::variable_type(), and libMesh::SystemNorm::weight().
|
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().
|
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 47 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 libMesh::Parallel::Communicator::sum().
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::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 424 of file jump_error_estimator.C.
References coarse_context, libMesh::ErrorEstimator::error_norm, fine_context, libMesh::FEAbstract::get_fe_type(), libMesh::FEInterface::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::AdjointRefinementEstimator, libMesh::UniformRefinementEstimator, libMesh::PatchRecoveryErrorEstimator, libMesh::KellyErrorEstimator, libMesh::WeightedPatchRecoveryErrorEstimator, libMesh::DiscontinuityMeasure, and libMesh::LaplacianErrorEstimator.
|
protected |
Definition at line 144 of file jump_error_estimator.h.
Referenced by coarse_n_flux_faces_increment(), estimate_error(), 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 149 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 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(), 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 144 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::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(), and reinit_sides().
|
protected |
The fine and coarse error values to be set by each side_integration();
Definition at line 149 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 138 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::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 99 of file jump_error_estimator.h.
Referenced by estimate_error().
|
protected |
The variable number currently being evaluated
Definition at line 154 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().