libMesh
|
This class implements a goal oriented error indicator, by weighting residual-based estimates from the primal problem against estimates from the adjoint problem. More...
#include <adjoint_residual_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 | |
AdjointResidualErrorEstimator () | |
Constructor. More... | |
AdjointResidualErrorEstimator (const AdjointResidualErrorEstimator &)=delete | |
This class cannot be (default) copy constructed/assigned because it has unique_ptr members. More... | |
AdjointResidualErrorEstimator & | operator= (const AdjointResidualErrorEstimator &)=delete |
AdjointResidualErrorEstimator (AdjointResidualErrorEstimator &&)=default | |
Defaulted move ctor, move assignment operator, and destructor. More... | |
AdjointResidualErrorEstimator & | operator= (AdjointResidualErrorEstimator &&)=default |
virtual | ~AdjointResidualErrorEstimator ()=default |
std::unique_ptr< ErrorEstimator > & | primal_error_estimator () |
Access to the "subestimator" (default: PatchRecovery) to use on the primal/forward solution. More... | |
std::unique_ptr< ErrorEstimator > & | dual_error_estimator () |
Access to the "subestimator" (default: PatchRecovery) to use on the dual/adjoint solution. More... | |
QoISet & | qoi_set () |
Access to the QoISet (default: weight all QoIs equally) to use when computing errors. More... | |
const QoISet & | qoi_set () const |
Access to the QoISet (default: weight all QoIs equally) to use when computing errors. More... | |
virtual void | estimate_error (const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false) override |
Compute the adjoint-weighted error on each element and place it in the error_per_cell vector. More... | |
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) |
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... | |
Public Attributes | |
std::string | error_plot_suffix |
To aid in investigating error estimator behavior, set this string to a suffix with which to plot (prefixed by "primal_" or "dual_") the subestimator results. 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 | 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 | |
std::unique_ptr< ErrorEstimator > | _primal_error_estimator |
An error estimator for the forward problem. More... | |
std::unique_ptr< ErrorEstimator > | _dual_error_estimator |
An error estimator for the adjoint problem. More... | |
QoISet | _qoi_set |
A QoISet to handle cases with multiple QoIs available. More... | |
This class implements a goal oriented error indicator, by weighting residual-based estimates from the primal problem against estimates from the adjoint problem.
This is based on a trick suggested by Brian Carnes, (first proposed by Babuska and Miller in 1984) but if it doesn't actually work then the misunderstanding or misimplementation will be the fault of Roy Stogner. It's also Roy's fault there's no literature reference here yet.
Definition at line 49 of file adjoint_residual_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.
libMesh::AdjointResidualErrorEstimator::AdjointResidualErrorEstimator | ( | ) |
Constructor.
Responsible for picking default subestimators.
Definition at line 42 of file adjoint_residual_error_estimator.C.
|
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 |
|
inline |
Access to the "subestimator" (default: PatchRecovery) to use on the dual/adjoint solution.
Definition at line 83 of file adjoint_residual_error_estimator.h.
References _dual_error_estimator.
|
overridevirtual |
Compute the adjoint-weighted error on each element and place it in the error_per_cell
vector.
this->error_norm
is ignored; the error estimate is in the seminorm given by the absolute value of the error in the quantity of interest functional. The primal and dual subestimator error_norm values are used, and should be chosen appropriately for your model. Implements libMesh::ErrorEstimator.
Definition at line 61 of file adjoint_residual_error_estimator.C.
References _dual_error_estimator, _primal_error_estimator, _qoi_set, libMesh::System::adjoint_solve(), libMesh::SystemNorm::calculate_norm(), libMesh::ErrorEstimator::error_norm, error_plot_suffix, libMesh::ErrorVectorReal, libMesh::System::get_adjoint_solution(), libMesh::System::get_equation_systems(), libMesh::System::get_mesh(), libMesh::QoISet::has_index(), libMesh::index_range(), libMesh::System::is_adjoint_already_solved(), libMesh::SystemNorm::is_identity(), libMesh::libmesh_assert(), mesh, libMesh::System::n_qois(), n_vars, libMesh::System::n_vars(), libMesh::ErrorVector::plot_error(), libMesh::Real, libMesh::System::solution, and libMesh::QoISet::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(), 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 93 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().
|
delete |
|
default |
|
inline |
Access to the "subestimator" (default: PatchRecovery) to use on the primal/forward solution.
Definition at line 77 of file adjoint_residual_error_estimator.h.
References _primal_error_estimator.
|
inline |
Access to the QoISet (default: weight all QoIs equally) to use when computing errors.
Definition at line 89 of file adjoint_residual_error_estimator.h.
References _qoi_set.
|
inline |
Access to the QoISet (default: weight all QoIs equally) to use when computing errors.
Definition at line 95 of file adjoint_residual_error_estimator.h.
References _qoi_set.
|
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(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), and libMesh::ExactErrorEstimator::estimate_error().
|
overridevirtual |
Implements libMesh::ErrorEstimator.
Definition at line 54 of file adjoint_residual_error_estimator.C.
References libMesh::ADJOINT_RESIDUAL.
|
protected |
An error estimator for the adjoint problem.
Definition at line 133 of file adjoint_residual_error_estimator.h.
Referenced by dual_error_estimator(), and estimate_error().
|
protected |
An error estimator for the forward problem.
Definition at line 128 of file adjoint_residual_error_estimator.h.
Referenced by estimate_error(), and primal_error_estimator().
|
protected |
A QoISet to handle cases with multiple QoIs available.
Definition at line 138 of file adjoint_residual_error_estimator.h.
Referenced by estimate_error(), and qoi_set().
|
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(), libMesh::JumpErrorEstimator::estimate_error(), 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(), libMesh::JumpErrorEstimator::reinit_sides(), and libMesh::UniformRefinementEstimator::UniformRefinementEstimator().
std::string libMesh::AdjointResidualErrorEstimator::error_plot_suffix |
To aid in investigating error estimator behavior, set this string to a suffix with which to plot (prefixed by "primal_" or "dual_") the subestimator results.
The suffix should end with a file extension (e.g. ".gmv") that the ErrorVector::plot_error recognizes.
Definition at line 104 of file adjoint_residual_error_estimator.h.
Referenced by estimate_error().