331 using number = Number;
333 if (
const auto *triangulation =
dynamic_cast<
338 (subdomain_id_ == triangulation->locally_owned_subdomain()),
340 "For distributed Triangulation objects and associated "
341 "DoFHandler objects, asking for any subdomain other than the "
342 "locally owned one does not make sense."));
343 subdomain_id = triangulation->locally_owned_subdomain();
347 subdomain_id = subdomain_id_;
351 const unsigned int n_solution_vectors = solutions.size();
356 ExcMessage(
"You are not allowed to list the special boundary "
357 "indicator for internal boundaries in your boundary "
360 for (
const auto &boundary_function : neumann_bc)
362 (void)boundary_function;
363 Assert(boundary_function.second->n_components == n_components,
365 boundary_function.second->n_components,
374 Assert((coefficient ==
nullptr) ||
380 Assert(solutions.size() == errors.size(),
382 for (
unsigned int n = 0; n < solutions.size(); ++n)
386 Assert((coefficient ==
nullptr) ||
391 for (
const auto &boundary_function : neumann_bc)
393 (void)boundary_function;
394 Assert(boundary_function.second->n_components == n_components,
396 boundary_function.second->n_components,
401 for (
unsigned int n = 0; n < n_solution_vectors; ++n)
408 std::vector<std::vector<std::vector<Tensor<1, spacedim, number>>>>
409 gradients_here(n_solution_vectors,
413 std::vector<std::vector<std::vector<Tensor<1, spacedim, number>>>>
414 gradients_neighbor(gradients_here);
415 std::vector<Vector<typename ProductType<number, double>::type>>
416 grad_dot_n_neighbor(n_solution_vectors,
424 if (coefficient ==
nullptr)
425 for (
unsigned int c = 0; c < n_components; ++c)
426 coefficient_values(c) = 1;
448 (cell->subdomain_id() == subdomain_id)) &&
450 (cell->material_id() == material_id)))
452 for (
unsigned int n = 0; n < n_solution_vectors; ++n)
453 (*errors[n])(cell->active_cell_index()) = 0;
456 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
458 *solutions[s], gradients_here[s]);
462 for (
unsigned int n = 0; n < 2; ++n)
465 auto neighbor = cell->neighbor(n);
467 while (neighbor->has_children())
468 neighbor = neighbor->child(n == 0 ? 1 : 0);
470 fe_face_values.
reinit(cell, n);
476 fe_values.
reinit(neighbor);
478 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
480 *solutions[s], gradients_neighbor[s]);
482 fe_face_values.
reinit(neighbor, n == 0 ? 1 : 0);
485 .get_normal_vectors()[0];
489 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
490 for (
unsigned int c = 0; c < n_components; ++c)
491 grad_dot_n_neighbor[s](c) =
492 -(gradients_neighbor[s][n == 0 ? 1 : 0][c] *
495 else if (neumann_bc.find(n) != neumann_bc.end())
499 if (n_components == 1)
502 neumann_bc.find(n)->second->value(cell->vertex(n));
504 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
505 grad_dot_n_neighbor[s](0) = v;
510 neumann_bc.find(n)->second->vector_value(cell->vertex(n),
513 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
514 grad_dot_n_neighbor[s] = v;
519 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
520 grad_dot_n_neighbor[s] = 0;
524 if (coefficient !=
nullptr)
528 const double c_value = coefficient->
value(cell->vertex(n));
529 for (
unsigned int c = 0; c < n_components; ++c)
530 coefficient_values(c) = c_value;
538 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
539 for (
unsigned int component = 0; component < n_components;
541 if (component_mask[component] ==
true)
546 gradients_here[s][n][component] * normal;
549 ((grad_dot_n_here - grad_dot_n_neighbor[s](component)) *
550 coefficient_values(component));
551 (*errors[s])(cell->active_cell_index()) +=
554 double>::type>::abs_square(jump) *
559 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
560 (*errors[s])(cell->active_cell_index()) =
561 std::sqrt((*errors[s])(cell->active_cell_index()));
static void estimate(const Mapping< 1, spacedim > &mapping, const DoFHandler< 1, spacedim > &dof, const Quadrature< 0 > &quadrature, const std::map< types::boundary_id, const Function< spacedim, Number > * > &neumann_bc, const ReadVector< Number > &solution, Vector< float > &error, const ComponentMask &component_mask={}, const Function< spacedim > *coefficient=nullptr, const unsigned int n_threads=numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id, const types::material_id material_id=numbers::invalid_material_id, const Strategy strategy=cell_diameter_over_24)
static void estimate(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim - 1 > &quadrature, const std::map< types::boundary_id, const Function< spacedim, Number > * > &neumann_bc, const ReadVector< Number > &solution, Vector< float > &error, const ComponentMask &component_mask={}, const Function< spacedim > *coefficients=nullptr, const unsigned int n_threads=numbers::invalid_unsigned_int, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id, const types::material_id material_id=numbers::invalid_material_id, const Strategy strategy=cell_diameter_over_24)