330 using number = Number;
332 if (
const auto *triangulation =
dynamic_cast<
337 (subdomain_id_ == triangulation->locally_owned_subdomain()),
339 "For distributed Triangulation objects and associated "
340 "DoFHandler objects, asking for any subdomain other than the "
341 "locally owned one does not make sense."));
342 subdomain_id = triangulation->locally_owned_subdomain();
346 subdomain_id = subdomain_id_;
350 const unsigned int n_solution_vectors = solutions.size();
355 ExcMessage(
"You are not allowed to list the special boundary "
356 "indicator for internal boundaries in your boundary "
359 for (
const auto &boundary_function : neumann_bc)
361 (void)boundary_function;
362 Assert(boundary_function.second->n_components == n_components,
364 boundary_function.second->n_components,
373 Assert((coefficient ==
nullptr) ||
379 Assert(solutions.size() == errors.size(),
381 for (
unsigned int n = 0; n < solutions.size(); ++n)
385 Assert((coefficient ==
nullptr) ||
390 for (
const auto &boundary_function : neumann_bc)
392 (void)boundary_function;
393 Assert(boundary_function.second->n_components == n_components,
395 boundary_function.second->n_components,
400 for (
unsigned int n = 0; n < n_solution_vectors; ++n)
407 std::vector<std::vector<std::vector<Tensor<1, spacedim, number>>>>
408 gradients_here(n_solution_vectors,
412 std::vector<std::vector<std::vector<Tensor<1, spacedim, number>>>>
413 gradients_neighbor(gradients_here);
414 std::vector<Vector<typename ProductType<number, double>::type>>
415 grad_dot_n_neighbor(n_solution_vectors,
423 if (coefficient ==
nullptr)
424 for (
unsigned int c = 0; c < n_components; ++c)
425 coefficient_values(c) = 1;
447 (cell->subdomain_id() == subdomain_id)) &&
449 (cell->material_id() == material_id)))
451 for (
unsigned int n = 0; n < n_solution_vectors; ++n)
452 (*errors[n])(cell->active_cell_index()) = 0;
455 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
457 *solutions[s], gradients_here[s]);
461 for (
unsigned int n = 0; n < 2; ++n)
464 auto neighbor = cell->neighbor(n);
466 while (neighbor->has_children())
467 neighbor = neighbor->child(n == 0 ? 1 : 0);
475 fe_values.
reinit(neighbor);
477 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
479 *solutions[s], gradients_neighbor[s]);
484 .get_normal_vectors()[0];
488 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
489 for (
unsigned int c = 0; c < n_components; ++c)
490 grad_dot_n_neighbor[s](c) =
491 -(gradients_neighbor[s][n == 0 ? 1 : 0][c] *
494 else if (neumann_bc.find(n) != neumann_bc.end())
498 if (n_components == 1)
501 neumann_bc.find(n)->second->value(cell->vertex(n));
503 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
504 grad_dot_n_neighbor[s](0) = v;
509 neumann_bc.find(n)->second->vector_value(cell->vertex(n),
512 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
513 grad_dot_n_neighbor[s] = v;
518 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
519 grad_dot_n_neighbor[s] = 0;
523 if (coefficient !=
nullptr)
527 const double c_value = coefficient->
value(cell->vertex(n));
528 for (
unsigned int c = 0; c < n_components; ++c)
529 coefficient_values(c) = c_value;
537 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
538 for (
unsigned int component = 0; component < n_components;
540 if (component_mask[component] ==
true)
545 gradients_here[s][n][component] * normal;
548 ((grad_dot_n_here - grad_dot_n_neighbor[s](component)) *
549 coefficient_values(component));
550 (*errors[s])(cell->active_cell_index()) +=
553 double>::type>::abs_square(jump) *
558 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
559 (*errors[s])(cell->active_cell_index()) =
560 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)