#include <fourth_error_estimators.h>
Public Types | |
typedef std::map< std::pair< const System *, unsigned int >, ErrorVector * > | ErrorMap |
Public Member Functions | |
LaplacianErrorEstimator () | |
LaplacianErrorEstimator (const LaplacianErrorEstimator &)=delete | |
LaplacianErrorEstimator & | operator= (const LaplacianErrorEstimator &)=delete |
LaplacianErrorEstimator (LaplacianErrorEstimator &&)=default | |
LaplacianErrorEstimator & | operator= (LaplacianErrorEstimator &&)=default |
virtual | ~LaplacianErrorEstimator ()=default |
virtual ErrorEstimatorType | type () const override |
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) |
Public Attributes | |
bool | scale_by_n_flux_faces |
SystemNorm | error_norm |
Protected Member Functions | |
virtual void | init_context (FEMContext &c) override |
virtual void | internal_side_integration () override |
void | reinit_sides () |
float | coarse_n_flux_faces_increment () |
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 class is an error indicator based on laplacian jumps between elements. See the JumpErrorEstimator class for most user APIs
Definition at line 41 of file fourth_error_estimators.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::LaplacianErrorEstimator::LaplacianErrorEstimator | ( | ) |
Constructor. Defaults to H2 seminorm; changes to error_norm are ignored.
Definition at line 46 of file fourth_error_estimators.C.
References libMesh::ErrorEstimator::error_norm, and libMesh::H2_SEMINORM.
|
delete |
This class cannot be (default) copy constructed/assigned because its base class has unique_ptr members.
|
default |
Defaulted move ctor, move assignment operator, and destructor.
|
virtualdefault |
|
inlineprotectedvirtualinherited |
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 libMesh::JumpErrorEstimator::estimate_error().
|
protectedinherited |
A utility function to correctly increase n_flux_faces for the coarse element
Definition at line 462 of file jump_error_estimator.C.
References libMesh::JumpErrorEstimator::coarse_context, and libMesh::JumpErrorEstimator::fine_context.
Referenced by libMesh::JumpErrorEstimator::estimate_error().
|
overridevirtualinherited |
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(), libMesh::JumpErrorEstimator::boundary_side_integration(), libMesh::Elem::child_ref_range(), libMesh::JumpErrorEstimator::coarse_context, libMesh::JumpErrorEstimator::coarse_error, libMesh::JumpErrorEstimator::coarse_n_flux_faces_increment(), libMesh::FEGenericBase< OutputType >::coarsened_dof_values(), libMesh::ParallelObject::comm(), libMesh::ErrorEstimator::error_norm, libMesh::ErrorVectorReal, libMesh::FEType::family, libMesh::JumpErrorEstimator::fine_context, libMesh::JumpErrorEstimator::fine_error, libMesh::System::get_dof_map(), libMesh::System::get_mesh(), libMesh::FEAbstract::get_xyz(), libMesh::DofObject::id(), libMesh::index_range(), libMesh::JumpErrorEstimator::init_context(), libMesh::JumpErrorEstimator::integrate_boundary_sides, libMesh::JumpErrorEstimator::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(), libMesh::JumpErrorEstimator::reinit_sides(), libMesh::SCALAR, libMesh::JumpErrorEstimator::scale_by_n_flux_faces, libMesh::Elem::side_index_range(), libMesh::DenseVector< T >::size(), libMesh::System::solution, libMesh::NumericVector< T >::swap(), libMesh::JumpErrorEstimator::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().
|
overrideprotectedvirtual |
An initialization function, for requesting specific data from the FE objects
Reimplemented from libMesh::JumpErrorEstimator.
Definition at line 63 of file fourth_error_estimators.C.
References libMesh::FEMContext::elem_dimensions(), libMesh::ErrorEstimator::error_norm, libMesh::JumpErrorEstimator::fine_context, libMesh::FEGenericBase< OutputType >::get_d2phi(), n_vars, libMesh::DiffContext::n_vars(), and libMesh::SystemNorm::weight().
|
overrideprotectedvirtual |
The function which calculates a laplacian jump based error term on an internal side
Implements libMesh::JumpErrorEstimator.
Definition at line 90 of file fourth_error_estimators.C.
References libMesh::JumpErrorEstimator::coarse_context, libMesh::JumpErrorEstimator::coarse_error, libMesh::Elem::dim(), libMesh::ErrorEstimator::error_norm, libMesh::JumpErrorEstimator::fine_context, libMesh::JumpErrorEstimator::fine_error, libMesh::FEGenericBase< OutputType >::get_d2phi(), libMesh::FEAbstract::get_JxW(), libMesh::Elem::hmax(), libMesh::FEAbstract::n_quadrature_points(), libMesh::TensorTools::norm_sq(), libMesh::Real, libMesh::DenseVector< T >::size(), libMesh::JumpErrorEstimator::var, and libMesh::SystemNorm::weight().
|
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(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), and libMesh::ExactErrorEstimator::estimate_error().
|
protectedinherited |
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 libMesh::JumpErrorEstimator::coarse_context, libMesh::ErrorEstimator::error_norm, libMesh::JumpErrorEstimator::fine_context, libMesh::FEAbstract::get_fe_type(), libMesh::FEInterface::inverse_map(), n_vars, libMesh::FEAbstract::reinit(), libMesh::SCALAR, and libMesh::SystemNorm::weight().
Referenced by libMesh::JumpErrorEstimator::estimate_error().
|
overridevirtual |
Implements libMesh::ErrorEstimator.
Definition at line 55 of file fourth_error_estimators.C.
References libMesh::LAPLACIAN.
|
protectedinherited |
Definition at line 144 of file jump_error_estimator.h.
Referenced by libMesh::JumpErrorEstimator::coarse_n_flux_faces_increment(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::KellyErrorEstimator::init_context(), internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), libMesh::KellyErrorEstimator::internal_side_integration(), and libMesh::JumpErrorEstimator::reinit_sides().
|
protectedinherited |
Definition at line 149 of file jump_error_estimator.h.
Referenced by libMesh::JumpErrorEstimator::estimate_error(), 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(), 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(), init_context(), libMesh::DiscontinuityMeasure::init_context(), libMesh::KellyErrorEstimator::init_context(), internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), libMesh::KellyErrorEstimator::internal_side_integration(), libMesh::KellyErrorEstimator::KellyErrorEstimator(), LaplacianErrorEstimator(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::PatchRecoveryErrorEstimator(), libMesh::JumpErrorEstimator::reinit_sides(), and libMesh::UniformRefinementEstimator::UniformRefinementEstimator().
|
protectedinherited |
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(), libMesh::JumpErrorEstimator::coarse_n_flux_faces_increment(), libMesh::JumpErrorEstimator::estimate_error(), init_context(), libMesh::DiscontinuityMeasure::init_context(), libMesh::KellyErrorEstimator::init_context(), internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), libMesh::KellyErrorEstimator::internal_side_integration(), and libMesh::JumpErrorEstimator::reinit_sides().
|
protectedinherited |
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(), libMesh::JumpErrorEstimator::estimate_error(), internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), and libMesh::KellyErrorEstimator::internal_side_integration().
|
protectedinherited |
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 libMesh::JumpErrorEstimator::estimate_error().
|
inherited |
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 libMesh::JumpErrorEstimator::estimate_error().
|
protectedinherited |
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(), libMesh::JumpErrorEstimator::estimate_error(), internal_side_integration(), libMesh::DiscontinuityMeasure::internal_side_integration(), and libMesh::KellyErrorEstimator::internal_side_integration().