Go to the documentation of this file.
19 #include "libmesh/libmesh_config.h"
20 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
30 #include "libmesh/libmesh_common.h"
31 #include "libmesh/fourth_error_estimators.h"
32 #include "libmesh/error_vector.h"
33 #include "libmesh/fe_base.h"
34 #include "libmesh/libmesh_logging.h"
35 #include "libmesh/elem.h"
36 #include "libmesh/system.h"
37 #include "libmesh/dense_vector.h"
38 #include "libmesh/tensor_tools.h"
39 #include "libmesh/enum_error_estimator_type.h"
40 #include "libmesh/enum_norm_type.h"
66 for (
unsigned int v=0; v<
n_vars; v++)
72 FEBase * side_fe =
nullptr;
74 const std::set<unsigned char> & elem_dims =
77 for (
const auto &
dim : elem_dims)
98 unsigned short dim = fine_elem.
dim();
100 FEBase * fe_fine =
nullptr;
103 FEBase * fe_coarse =
nullptr;
109 std::vector<std::vector<RealTensor>> d2phi_coarse = fe_coarse->
get_d2phi();
110 std::vector<std::vector<RealTensor>> d2phi_fine = fe_fine->
get_d2phi();
111 std::vector<Real> JxW_face = fe_fine->
get_JxW();
113 for (
unsigned int qp=0; qp != n_qp; ++qp)
117 Number laplacian_fine = 0., laplacian_coarse = 0.;
119 const unsigned int n_coarse_dofs = Ucoarse.
size();
120 for (
unsigned int i=0; i != n_coarse_dofs; ++i)
122 laplacian_coarse += d2phi_coarse[i][qp](0,0) * Ucoarse(i);
124 laplacian_coarse += d2phi_coarse[i][qp](1,1) * Ucoarse(i);
126 laplacian_coarse += d2phi_coarse[i][qp](2,2) * Ucoarse(i);
129 const unsigned int n_fine_dofs = Ufine.
size();
130 for (
unsigned int i=0; i != n_fine_dofs; ++i)
132 laplacian_fine += d2phi_fine[i][qp](0,0) * Ufine(i);
134 laplacian_fine += d2phi_fine[i][qp](1,1) * Ufine(i);
136 laplacian_fine += d2phi_fine[i][qp](2,2) * Ufine(i);
142 const Number jump = laplacian_fine - laplacian_coarse;
146 error += JxW_face[qp] * jump2;
158 #else // defined (LIBMESH_ENABLE_SECOND_DERIVATIVES)
160 #include "libmesh/fourth_error_estimators.h"
168 libmesh_error_msg(
"Error: LaplacianErrorEstimator requires second " \
169 <<
"derivative support; try configuring libmesh with " \
170 <<
"--enable-second");
177 libmesh_error_msg(
"Error: LaplacianErrorEstimator requires second " \
178 <<
"derivative support; try configuring libmesh with " \
179 <<
"--enable-second");
184 #endif // defined (LIBMESH_ENABLE_SECOND_DERIVATIVES)
std::unique_ptr< FEMContext > coarse_context
SystemNorm error_norm
When estimating the error in a single system, the error_norm is used to control the scaling and norm ...
ErrorEstimatorType
Defines an enum for the different types of error estimators which are available.
virtual void init_context(FEMContext &c) override
An initialization function, for requesting specific data from the FE objects.
The libMesh namespace provides an interface to certain functionality in the library.
virtual unsigned short dim() const =0
unsigned int n_vars() const
Number of variables in solution.
unsigned int var
The variable number currently being evaluated.
This class forms the foundation from which generic finite elements may be derived.
Real fine_error
The fine and coarse error values to be set by each side_integration();.
const std::vector< Real > & get_JxW() const
const std::vector< std::vector< OutputTensor > > & get_d2phi() const
Real weight(unsigned int var) const
virtual void internal_side_integration() override
The function which calculates a laplacian jump based error term on an internal side.
LaplacianErrorEstimator()
Constructor.
std::unique_ptr< FEMContext > fine_context
Context objects for integrating on the fine and coarse elements sharing a face.
virtual unsigned int n_quadrature_points() const =0
This abstract base class implements utility functions for error estimators which are based on integra...
virtual unsigned int size() const override
virtual Real hmax() const
This is the base class from which all geometric element types are derived.
const std::set< unsigned char > & elem_dimensions() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual ErrorEstimatorType type() const override
This class provides all data required for a physics package (e.g.