#include <adjoint_refinement_estimator.h>
Public Types | |
typedef std::map< std::pair< const System *, unsigned int >, ErrorVector * > | ErrorMap |
Public Member Functions | |
AdjointRefinementEstimator () | |
AdjointRefinementEstimator (const AdjointRefinementEstimator &)=default | |
AdjointRefinementEstimator (AdjointRefinementEstimator &&)=default | |
AdjointRefinementEstimator & | operator= (const AdjointRefinementEstimator &)=default |
AdjointRefinementEstimator & | operator= (AdjointRefinementEstimator &&)=default |
virtual | ~AdjointRefinementEstimator ()=default |
QoISet & | qoi_set () |
const QoISet & | qoi_set () const |
virtual void | estimate_error (const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false) |
Number & | get_global_QoI_error_estimate (unsigned int qoi_index) |
virtual ErrorEstimatorType | type () const |
DifferentiablePhysics * | get_residual_evaluation_physics () |
void | set_residual_evaluation_physics (DifferentiablePhysics *set_physics) |
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) |
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) |
Public Attributes | |
unsigned char | number_h_refinements |
unsigned char | number_p_refinements |
SystemNorm | error_norm |
Protected Member Functions | |
void | reduce_error (std::vector< ErrorVectorReal > &error_per_cell, const Parallel::Communicator &comm) const |
Protected Attributes | |
DifferentiablePhysics * | _residual_evaluation_physics |
std::vector< Number > | computed_global_QoI_errors |
QoISet | _qoi_set |
This class implements a "brute force" goal-oriented error estimator which computes an estimate of error in a quantity of interest based on the residual of the current coarse grid primal solution as weighted against an adjoint solution on a uniformly refined (in h and/or p, for an arbitrary number of levels) grid.
Definition at line 50 of file adjoint_refinement_estimator.h.
|
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.
libMesh::AdjointRefinementEstimator::AdjointRefinementEstimator | ( | ) |
Constructor. Sets the most common default parameter values.
Definition at line 73 of file adjoint_refinement_estimator.C.
References libMesh::ErrorEstimator::error_norm, and libMesh::INVALID_NORM.
|
default |
Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this class.
|
default |
|
virtualdefault |
|
virtual |
This function does uniform refinements and an adjoint solve to get an adjoint solution on each cell, then estimates the error by finding the weighted residual of the coarse solution with the fine adjoint solution.
system.solve() and system.assembly() must be called, and so should have no side effects.
Only the provided system is solved on the refined mesh; we don't support adjoint solves on loosely coupled collections of Systems.
The estimated error is output in the vector error_per_cell
Implements libMesh::ErrorEstimator.
Definition at line 90 of file adjoint_refinement_estimator.C.
References _qoi_set, _residual_evaluation_physics, std::abs(), libMesh::System::add_vector(), libMesh::System::adjoint_solve(), libMesh::as_range(), libMesh::DifferentiableSystem::assembly(), libMesh::NumericVector< T >::build(), libMesh::NumericVector< T >::clear(), libMesh::DifferentiableSystem::clone(), libMesh::NumericVector< T >::close(), libMesh::ParallelObject::comm(), computed_global_QoI_errors, libMesh::System::current_local_solution, libMesh::DofMap::dof_indices(), libMesh::NumericVector< T >::dot(), libMesh::DofMap::enforce_adjoint_constraints_exactly(), libMesh::ErrorVectorReal, libMesh::NumericVector< T >::get(), libMesh::System::get_adjoint_solution(), libMesh::System::get_dof_map(), libMesh::System::get_equation_systems(), libMesh::EquationSystems::get_mesh(), libMesh::DofMap::get_send_list(), libMesh::System::get_vector(), libMesh::GHOSTED, libMesh::DofMap::has_adjoint_dirichlet_boundaries(), libMesh::QoISet::has_index(), libMesh::DofObject::id(), libMesh::TriangleWrapper::init(), libMesh::System::is_adjoint_already_solved(), libMesh::NumericVector< T >::localize(), mesh, libMesh::System::n_dofs(), libMesh::System::n_local_dofs(), libMesh::System::n_qois(), libMesh::System::number(), number_h_refinements, number_p_refinements, libMesh::Elem::parent(), libMesh::System::project_solution_on_reinit(), libMesh::Real, libMesh::ErrorEstimator::reduce_error(), libMesh::EquationSystems::reinit(), libMesh::System::solution, libMesh::NumericVector< T >::swap(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::MeshRefinement::uniformly_p_coarsen(), libMesh::MeshRefinement::uniformly_p_refine(), libMesh::MeshRefinement::uniformly_refine(), libMesh::System::update(), libMesh::System::vectors_begin(), libMesh::System::vectors_end(), 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(), 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.
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
FIXME: This is a default implementation - derived classes should reimplement it for efficiency.
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::EquationSystems::n_systems(), n_vars, libMesh::System::n_vars(), and libMesh::SystemNorm::type().
|
inline |
This is an accessor function to access the computed global QoI error estimates
Definition at line 106 of file adjoint_refinement_estimator.h.
References computed_global_QoI_errors.
|
inline |
nullptr
if no external Physics object is attached. Definition at line 127 of file adjoint_refinement_estimator.h.
References _residual_evaluation_physics.
|
default |
|
default |
|
inline |
Access to the QoISet (default: weight all QoIs equally) to use when computing errors
Definition at line 73 of file adjoint_refinement_estimator.h.
References _qoi_set.
|
inline |
Access to the QoISet (default: weight all QoIs equally) to use when computing errors
Definition at line 79 of file adjoint_refinement_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 libMesh::Parallel::Communicator::sum().
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), estimate_error(), and libMesh::ExactErrorEstimator::estimate_error().
|
inline |
Set the _residual_evaluation_physics member to argument
Definition at line 133 of file adjoint_refinement_estimator.h.
References _residual_evaluation_physics.
|
virtual |
Implements libMesh::ErrorEstimator.
Definition at line 85 of file adjoint_refinement_estimator.C.
References libMesh::ADJOINT_REFINEMENT.
|
protected |
A QoISet to handle cases with multiple QoIs available
Definition at line 150 of file adjoint_refinement_estimator.h.
Referenced by estimate_error(), and qoi_set().
|
protected |
Pointer to object to use for physics assembly evaluations. Defaults to nullptr for backwards compatibility.
Definition at line 142 of file adjoint_refinement_estimator.h.
Referenced by estimate_error(), get_residual_evaluation_physics(), and set_residual_evaluation_physics().
|
protected |
Definition at line 145 of file adjoint_refinement_estimator.h.
Referenced by estimate_error(), and get_global_QoI_error_estimate().
|
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.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), AdjointRefinementEstimator(), libMesh::DiscontinuityMeasure::boundary_side_integration(), libMesh::KellyErrorEstimator::boundary_side_integration(), libMesh::DiscontinuityMeasure::DiscontinuityMeasure(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::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().
unsigned char libMesh::AdjointRefinementEstimator::number_h_refinements |
How many h refinements to perform to get the fine grid
Definition at line 116 of file adjoint_refinement_estimator.h.
Referenced by estimate_error().
unsigned char libMesh::AdjointRefinementEstimator::number_p_refinements |
How many p refinements to perform to get the fine grid
Definition at line 121 of file adjoint_refinement_estimator.h.
Referenced by estimate_error().