libMesh
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
libMesh::AdjointResidualErrorEstimator Class Reference

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>

Inheritance diagram for libMesh::AdjointResidualErrorEstimator:
[legend]

Public Types

typedef std::map< std::pair< const System *, unsigned int >, 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...
 
AdjointResidualErrorEstimatoroperator= (const AdjointResidualErrorEstimator &)=delete
 
 AdjointResidualErrorEstimator (AdjointResidualErrorEstimator &&)=default
 Defaulted move ctor, move assignment operator, and destructor. More...
 
AdjointResidualErrorEstimatoroperator= (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...
 
QoISetqoi_set ()
 Access to the QoISet (default: weight all QoIs equally) to use when computing errors. More...
 
const QoISetqoi_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...
 

Detailed Description

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.

Author
Roy H. Stogner
Date
2009

Definition at line 50 of file adjoint_residual_error_estimator.h.

Member Typedef Documentation

◆ ErrorMap

typedef std::map<std::pair<const System *, unsigned int>, ErrorVector *> libMesh::ErrorEstimator::ErrorMap
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.

Constructor & Destructor Documentation

◆ AdjointResidualErrorEstimator() [1/3]

libMesh::AdjointResidualErrorEstimator::AdjointResidualErrorEstimator ( )

Constructor.

Responsible for picking default subestimators.

◆ AdjointResidualErrorEstimator() [2/3]

libMesh::AdjointResidualErrorEstimator::AdjointResidualErrorEstimator ( const AdjointResidualErrorEstimator )
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.

◆ AdjointResidualErrorEstimator() [3/3]

libMesh::AdjointResidualErrorEstimator::AdjointResidualErrorEstimator ( AdjointResidualErrorEstimator &&  )
default

Defaulted move ctor, move assignment operator, and destructor.

◆ ~AdjointResidualErrorEstimator()

virtual libMesh::AdjointResidualErrorEstimator::~AdjointResidualErrorEstimator ( )
virtualdefault

Member Function Documentation

◆ dual_error_estimator()

std::unique_ptr<ErrorEstimator>& libMesh::AdjointResidualErrorEstimator::dual_error_estimator ( )

Access to the "subestimator" (default: PatchRecovery) to use on the dual/adjoint solution.

Definition at line 84 of file adjoint_residual_error_estimator.h.

References _dual_error_estimator.

84 { return _dual_error_estimator; }
std::unique_ptr< ErrorEstimator > _dual_error_estimator
An error estimator for the adjoint problem.

◆ estimate_error()

virtual void libMesh::AdjointResidualErrorEstimator::estimate_error ( const System system,
ErrorVector error_per_cell,
const NumericVector< Number > *  solution_vector = nullptr,
bool  estimate_parent_error = false 
)
overridevirtual

Compute the adjoint-weighted error on each element and place it in the error_per_cell vector.

Note
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.

◆ estimate_errors() [1/2]

virtual void libMesh::ErrorEstimator::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 
)
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.

◆ estimate_errors() [2/2]

virtual void libMesh::ErrorEstimator::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 
)
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

Reimplemented in libMesh::UniformRefinementEstimator.

◆ operator=() [1/2]

AdjointResidualErrorEstimator& libMesh::AdjointResidualErrorEstimator::operator= ( const AdjointResidualErrorEstimator )
delete

◆ operator=() [2/2]

AdjointResidualErrorEstimator& libMesh::AdjointResidualErrorEstimator::operator= ( AdjointResidualErrorEstimator &&  )
default

◆ primal_error_estimator()

std::unique_ptr<ErrorEstimator>& libMesh::AdjointResidualErrorEstimator::primal_error_estimator ( )

Access to the "subestimator" (default: PatchRecovery) to use on the primal/forward solution.

Definition at line 78 of file adjoint_residual_error_estimator.h.

References _primal_error_estimator.

78 { return _primal_error_estimator; }
std::unique_ptr< ErrorEstimator > _primal_error_estimator
An error estimator for the forward problem.

◆ qoi_set() [1/2]

QoISet& libMesh::AdjointResidualErrorEstimator::qoi_set ( )

Access to the QoISet (default: weight all QoIs equally) to use when computing errors.

Definition at line 90 of file adjoint_residual_error_estimator.h.

References _qoi_set.

90 { return _qoi_set; }
QoISet _qoi_set
A QoISet to handle cases with multiple QoIs available.

◆ qoi_set() [2/2]

const QoISet& libMesh::AdjointResidualErrorEstimator::qoi_set ( ) const

Access to the QoISet (default: weight all QoIs equally) to use when computing errors.

Definition at line 96 of file adjoint_residual_error_estimator.h.

References _qoi_set.

96 { return _qoi_set; }
QoISet _qoi_set
A QoISet to handle cases with multiple QoIs available.

◆ reduce_error()

void libMesh::ErrorEstimator::reduce_error ( std::vector< ErrorVectorReal > &  error_per_cell,
const Parallel::Communicator comm 
) const
protectedinherited

This method takes the local error contributions in error_per_cell from each processor and combines them to get the global error vector.

◆ type()

virtual ErrorEstimatorType libMesh::AdjointResidualErrorEstimator::type ( ) const
overridevirtual
Returns
The type for the ErrorEstimator subclass.

Implements libMesh::ErrorEstimator.

Member Data Documentation

◆ _dual_error_estimator

std::unique_ptr<ErrorEstimator> libMesh::AdjointResidualErrorEstimator::_dual_error_estimator
protected

An error estimator for the adjoint problem.

Definition at line 134 of file adjoint_residual_error_estimator.h.

Referenced by dual_error_estimator().

◆ _primal_error_estimator

std::unique_ptr<ErrorEstimator> libMesh::AdjointResidualErrorEstimator::_primal_error_estimator
protected

An error estimator for the forward problem.

Definition at line 129 of file adjoint_residual_error_estimator.h.

Referenced by primal_error_estimator().

◆ _qoi_set

QoISet libMesh::AdjointResidualErrorEstimator::_qoi_set
protected

A QoISet to handle cases with multiple QoIs available.

Definition at line 139 of file adjoint_residual_error_estimator.h.

Referenced by qoi_set().

◆ error_norm

SystemNorm libMesh::ErrorEstimator::error_norm
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.

◆ error_plot_suffix

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 105 of file adjoint_residual_error_estimator.h.


The documentation for this class was generated from the following file: