libMesh
adjoint_residual_error_estimator.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_ADJOINT_RESIDUAL_ERROR_ESTIMATOR_H
21 #define LIBMESH_ADJOINT_RESIDUAL_ERROR_ESTIMATOR_H
22 
23 // Local Includes
24 #include "libmesh/error_estimator.h"
25 #include "libmesh/qoi_set.h"
26 
27 // C++ includes
28 #include <cstddef>
29 #include <string>
30 #include <vector>
31 #include <memory>
32 
33 namespace libMesh
34 {
50 {
51 public:
52 
57 
65 
71  virtual ~AdjointResidualErrorEstimator() = default;
72 
77  std::unique_ptr<ErrorEstimator> & primal_error_estimator() { return _primal_error_estimator; }
78 
83  std::unique_ptr<ErrorEstimator> & dual_error_estimator() { return _dual_error_estimator; }
84 
89  QoISet & qoi_set() { return _qoi_set; }
90 
95  const QoISet & qoi_set() const { return _qoi_set; }
96 
104  std::string error_plot_suffix;
105 
116  virtual void estimate_error (const System & system,
117  ErrorVector & error_per_cell,
118  const NumericVector<Number> * solution_vector = nullptr,
119  bool estimate_parent_error = false) override;
120 
121  virtual ErrorEstimatorType type() const override;
122 
123 protected:
124 
128  std::unique_ptr<ErrorEstimator> _primal_error_estimator;
129 
133  std::unique_ptr<ErrorEstimator> _dual_error_estimator;
134 
139 };
140 
141 
142 } // namespace libMesh
143 
144 #endif // LIBMESH_ADJOINT_RESIDUAL_ERROR_ESTIMATOR_H
std::unique_ptr< ErrorEstimator > & dual_error_estimator()
Access to the "subestimator" (default: PatchRecovery) to use on the dual/adjoint solution.
This class implements a goal oriented error indicator, by weighting residual-based estimates from the...
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
Definition: qoi_set.h:45
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
Definition: error_vector.h:50
ErrorEstimatorType
Defines an enum for the different types of error estimators which are available.
QoISet & qoi_set()
Access to the QoISet (default: weight all QoIs equally) to use when computing errors.
QoISet _qoi_set
A QoISet to handle cases with multiple QoIs available.
The libMesh namespace provides an interface to certain functionality in the library.
std::string error_plot_suffix
To aid in investigating error estimator behavior, set this string to a suffix with which to plot (pre...
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
This class holds functions that will estimate the error in a finite element solution on a given mesh...
virtual ~AdjointResidualErrorEstimator()=default
const QoISet & qoi_set() const
Access to the QoISet (default: weight all QoIs equally) to use when computing errors.
std::unique_ptr< ErrorEstimator > _dual_error_estimator
An error estimator for the adjoint problem.
std::unique_ptr< ErrorEstimator > & primal_error_estimator()
Access to the "subestimator" (default: PatchRecovery) to use on the primal/forward solution...
std::unique_ptr< ErrorEstimator > _primal_error_estimator
An error estimator for the forward problem.
AdjointResidualErrorEstimator & operator=(const AdjointResidualErrorEstimator &)=delete
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...
virtual ErrorEstimatorType type() const override