56 bool estimate_parent_error)
58 LOG_SCOPE(
"estimate_error()",
"JumpErrorEstimator");
106 #ifdef LIBMESH_ENABLE_AMR 112 error_per_cell.resize (
mesh.max_elem_id());
113 std::fill (error_per_cell.begin(), error_per_cell.end(), 0.);
127 std::vector<float> n_flux_faces;
129 n_flux_faces.resize(error_per_cell.size(), 0);
133 if (solution_vector && solution_vector != system.
solution.get())
138 newsol->
swap(*sys.solution);
156 FEBase * side_fe =
nullptr;
158 const std::set<unsigned char> & elem_dims =
161 for (
const auto & dim : elem_dims)
174 for (
const auto & e :
mesh.active_local_element_ptr_range())
178 #ifdef LIBMESH_ENABLE_AMR 185 bool compute_on_parent =
true;
186 if (!parent || !estimate_parent_error)
187 compute_on_parent =
false;
191 compute_on_parent =
false;
193 if (compute_on_parent &&
194 !error_per_cell[parent->
id()])
199 (*(system.
solution), dof_map, parent, Uparent,
false);
207 std::vector<const Elem *> active_neighbors;
209 active_family_tree_by_neighbor(active_neighbors,
212 for (std::size_t a=0,
213 n_active_neighbors = active_neighbors.size();
214 a != n_active_neighbors; ++a)
216 const Elem * f = active_neighbors[a];
223 libmesh_assert_equal_to
257 libmesh_assert_equal_to
269 bool found_boundary_flux =
false;
279 found_boundary_flux =
true;
288 #endif // #ifdef LIBMESH_ENABLE_AMR 294 for (
auto n_e : e->side_index_range())
296 if ((e->neighbor_ptr(n_e) !=
nullptr) ||
303 if (e->neighbor_ptr(n_e) !=
nullptr)
309 if ((f->
active() && (f->
level() == e->level()) && (e_id < f_id))
310 || (f->
level() < e->level()))
351 bool found_boundary_flux =
false;
360 found_boundary_flux =
true;
383 if (error_per_cell[i] != 0.)
384 error_per_cell[i] = std::sqrt(error_per_cell[i]);
395 for (
const auto & val : n_flux_faces)
396 libmesh_assert_equal_to (val, static_cast<float>(static_cast<unsigned int>(val)));
402 if (n_flux_faces[i] == 0.0)
411 if (solution_vector && solution_vector != system.
solution.get())
416 newsol->
swap(*sys.solution);
431 FEBase * fe_fine =
nullptr;
435 std::vector<Point> qface_point = fe_fine->get_xyz();
438 FEBase * fe_coarse =
nullptr;
441 std::vector<Point> qp_coarse;
451 for (
unsigned int v=0; v<
n_vars; v++)
468 const unsigned int divisor =
480 return 1.0f /
static_cast<float>(divisor);
virtual unsigned int size() const override
const Elem * parent() const
const std::vector< Point > & get_xyz() const
IntRange< unsigned short > side_index_range() const
std::unique_ptr< FEMContext > fine_context
The base class for all geometric element types.
IntRange< std::size_t > index_range(const std::vector< T > &vec)
const Parallel::Communicator & comm() const
virtual void internal_side_integration()=0
const unsigned int n_vars
const MeshBase & get_mesh() const
DIE A HORRIBLE DEATH HERE typedef float ErrorVectorReal
SimpleRange< ChildRefIter > child_ref_range()
FEType get_fe_type() const
static void coarsened_dof_values(const NumericVector< Number > &global_vector, const DofMap &dof_map, const Elem *coarse_elem, DenseVector< Number > &coarse_dofs, const unsigned int var, const bool use_old_dof_indices=false)
Manages the degrees of freedom (DOFs) in a simulation.
void libmesh_ignore(const Args &...)
virtual bool boundary_side_integration()
Manages consistently variables, degrees of freedom, and coefficient vectors.
std::unique_ptr< NumericVector< Number > > solution
virtual void reinit(const Elem *elem, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr)=0
static Point inverse_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
void reduce_error(std::vector< ErrorVectorReal > &error_per_cell, const Parallel::Communicator &comm) const
std::unique_ptr< FEMContext > coarse_context
const Elem * neighbor_ptr(unsigned int i) const
Real weight(unsigned int var) const
unsigned int level() const
const FEType & variable_type(const unsigned int i) const
virtual void swap(NumericVector< T > &v)
float coarse_n_flux_faces_increment()
bool scale_by_n_flux_faces
virtual void estimate_error(const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false) override
unsigned int n_vars() const
bool integrate_boundary_sides
const DofMap & get_dof_map() const
virtual void init_context(FEMContext &c)