libMesh
adjoint_refinement_estimator.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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_REFINEMENT_ESTIMATOR_H
21 #define LIBMESH_ADJOINT_REFINEMENT_ESTIMATOR_H
22 
23 // Local Includes
24 #include "libmesh/error_estimator.h"
25 #include "libmesh/libmesh.h"
26 #include "libmesh/qoi_set.h"
27 
28 // C++ includes
29 #include <cstddef>
30 #include <vector>
31 
32 #ifdef LIBMESH_ENABLE_AMR
33 
34 namespace libMesh
35 {
36 
37 // Forward declarations
38 class DifferentiablePhysics;
39 
51 {
52 public:
53 
58 
67  virtual ~AdjointRefinementEstimator() = default;
68 
73  QoISet & qoi_set() { return _qoi_set; }
74 
79  const QoISet & qoi_set() const { return _qoi_set; }
80 
97  virtual void estimate_error (const System & system,
98  ErrorVector & error_per_cell,
99  const NumericVector<Number> * solution_vector = nullptr,
100  bool estimate_parent_error = false);
101 
106  Number & get_global_QoI_error_estimate(unsigned int qoi_index)
107  {
108  return computed_global_QoI_errors[qoi_index];
109  }
110 
111  virtual ErrorEstimatorType type() const;
112 
116  unsigned char number_h_refinements;
117 
121  unsigned char number_p_refinements;
122 
128  { return this->_residual_evaluation_physics; }
129 
134  { this->_residual_evaluation_physics = set_physics; }
135 
136 protected:
137 
143 
144  /* A vector to hold the computed global QoI error estimate */
145  std::vector<Number> computed_global_QoI_errors;
146 
151 };
152 
153 } // namespace libMesh
154 
155 #endif // #ifdef LIBMESH_ENABLE_AMR
156 
157 #endif // LIBMESH_ADJOINT_REFINEMENT_ESTIMATOR_H
libMesh::System
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:100
libMesh::Number
Real Number
Definition: libmesh_common.h:195
libMesh::AdjointRefinementEstimator::type
virtual ErrorEstimatorType type() const
Definition: adjoint_refinement_estimator.C:85
libMesh::AdjointRefinementEstimator::computed_global_QoI_errors
std::vector< Number > computed_global_QoI_errors
Definition: adjoint_refinement_estimator.h:145
libMesh::ErrorEstimatorType
ErrorEstimatorType
Defines an enum for the different types of error estimators which are available.
Definition: enum_error_estimator_type.h:33
libMesh::DifferentiablePhysics
This class provides a specific system class.
Definition: diff_physics.h:76
libMesh::AdjointRefinementEstimator::_qoi_set
QoISet _qoi_set
A QoISet to handle cases with multiple QoIs available.
Definition: adjoint_refinement_estimator.h:150
libMesh::ErrorEstimator
This class holds functions that will estimate the error in a finite element solution on a given mesh.
Definition: error_estimator.h:67
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::AdjointRefinementEstimator::_residual_evaluation_physics
DifferentiablePhysics * _residual_evaluation_physics
Pointer to object to use for physics assembly evaluations.
Definition: adjoint_refinement_estimator.h:142
libMesh::NumericVector< Number >
libMesh::QoISet
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
Definition: qoi_set.h:45
libMesh::ErrorVector
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
Definition: error_vector.h:50
libMesh::AdjointRefinementEstimator::number_h_refinements
unsigned char number_h_refinements
How many h refinements to perform to get the fine grid.
Definition: adjoint_refinement_estimator.h:116
libMesh::AdjointRefinementEstimator::number_p_refinements
unsigned char number_p_refinements
How many p refinements to perform to get the fine grid.
Definition: adjoint_refinement_estimator.h:121
libMesh::AdjointRefinementEstimator::AdjointRefinementEstimator
AdjointRefinementEstimator()
Constructor.
Definition: adjoint_refinement_estimator.C:73
libMesh::AdjointRefinementEstimator::~AdjointRefinementEstimator
virtual ~AdjointRefinementEstimator()=default
libMesh::AdjointRefinementEstimator::qoi_set
QoISet & qoi_set()
Access to the QoISet (default: weight all QoIs equally) to use when computing errors.
Definition: adjoint_refinement_estimator.h:73
libMesh::AdjointRefinementEstimator::estimate_error
virtual void estimate_error(const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false)
This function does uniform refinements and an adjoint solve to get an adjoint solution on each cell,...
Definition: adjoint_refinement_estimator.C:90
libMesh::AdjointRefinementEstimator::qoi_set
const QoISet & qoi_set() const
Access to the QoISet (default: weight all QoIs equally) to use when computing errors.
Definition: adjoint_refinement_estimator.h:79
libMesh::AdjointRefinementEstimator
This class implements a "brute force" goal-oriented error estimator which computes an estimate of err...
Definition: adjoint_refinement_estimator.h:50
libMesh::AdjointRefinementEstimator::set_residual_evaluation_physics
void set_residual_evaluation_physics(DifferentiablePhysics *set_physics)
Set the _residual_evaluation_physics member to argument.
Definition: adjoint_refinement_estimator.h:133
libMesh::AdjointRefinementEstimator::operator=
AdjointRefinementEstimator & operator=(const AdjointRefinementEstimator &)=default
libMesh::AdjointRefinementEstimator::get_residual_evaluation_physics
DifferentiablePhysics * get_residual_evaluation_physics()
Definition: adjoint_refinement_estimator.h:127
libMesh::AdjointRefinementEstimator::get_global_QoI_error_estimate
Number & get_global_QoI_error_estimate(unsigned int qoi_index)
This is an accessor function to access the computed global QoI error estimates.
Definition: adjoint_refinement_estimator.h:106