287 using number = Number;
296 "For distributed Triangulation objects and associated "
297 "DoFHandler objects, asking for any subdomain other than the "
298 "locally owned one does not make sense."));
303 subdomain_id = subdomain_id_;
307 const unsigned int n_solution_vectors = solutions.size();
312 ExcMessage(
"You are not allowed to list the special boundary "
313 "indicator for internal boundaries in your boundary "
316 for (
const auto &boundary_function : neumann_bc)
318 (void)boundary_function;
319 Assert(boundary_function.second->n_components == n_components,
320 ExcInvalidBoundaryFunction(boundary_function.first,
321 boundary_function.second->n_components,
326 ExcInvalidComponentMask());
328 ExcInvalidComponentMask());
330 Assert((coefficient ==
nullptr) ||
333 ExcInvalidCoefficient());
335 Assert(solutions.size() > 0, ExcNoSolutions());
336 Assert(solutions.size() == errors.size(),
337 ExcIncompatibleNumberOfElements(solutions.size(), errors.size()));
338 for (
unsigned int n = 0; n < solutions.size(); ++n)
342 Assert((coefficient ==
nullptr) ||
345 ExcInvalidCoefficient());
347 for (
const auto &boundary_function : neumann_bc)
349 (void)boundary_function;
350 Assert(boundary_function.second->n_components == n_components,
351 ExcInvalidBoundaryFunction(boundary_function.first,
352 boundary_function.second->n_components,
357 for (
unsigned int n = 0; n < n_solution_vectors; ++n)
364 std::vector<std::vector<std::vector<Tensor<1, spacedim, number>>>>
365 gradients_here(n_solution_vectors,
369 std::vector<std::vector<std::vector<Tensor<1, spacedim, number>>>>
370 gradients_neighbor(gradients_here);
371 std::vector<Vector<typename ProductType<number, double>::type>>
372 grad_dot_n_neighbor(n_solution_vectors,
380 if (coefficient ==
nullptr)
381 for (
unsigned int c = 0; c < n_components; ++c)
382 coefficient_values(c) = 1;
406 (cell->subdomain_id() == subdomain_id)) &&
408 (cell->material_id() == material_id)))
410 for (
unsigned int n = 0; n < n_solution_vectors; ++n)
411 (*errors[n])(cell->active_cell_index()) = 0;
414 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
416 *solutions[s], gradients_here[s]);
420 for (
unsigned int n = 0; n < 2; ++n)
423 auto neighbor = cell->neighbor(n);
425 while (neighbor->has_children())
426 neighbor = neighbor->child(n == 0 ? 1 : 0);
428 fe_face_values.
reinit(cell, n);
434 fe_values.
reinit(neighbor);
436 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
438 *solutions[s], gradients_neighbor[s]);
440 fe_face_values.
reinit(neighbor, n == 0 ? 1 : 0);
443 .get_normal_vectors()[0];
447 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
448 for (
unsigned int c = 0; c < n_components; ++c)
449 grad_dot_n_neighbor[s](c) =
450 -(gradients_neighbor[s][n == 0 ? 1 : 0][c] *
453 else if (neumann_bc.find(n) != neumann_bc.end())
457 if (n_components == 1)
460 neumann_bc.find(n)->second->value(cell->vertex(n));
462 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
463 grad_dot_n_neighbor[s](0) = v;
468 neumann_bc.find(n)->second->vector_value(cell->vertex(n),
471 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
472 grad_dot_n_neighbor[s] = v;
477 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
478 grad_dot_n_neighbor[s] = 0;
482 if (coefficient !=
nullptr)
486 const double c_value = coefficient->
value(cell->vertex(n));
487 for (
unsigned int c = 0; c < n_components; ++c)
488 coefficient_values(c) = c_value;
496 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
497 for (
unsigned int component = 0; component < n_components;
499 if (component_mask[component] ==
true)
504 gradients_here[s][n][component] * normal;
507 ((grad_dot_n_here - grad_dot_n_neighbor[s](component)) *
508 coefficient_values(component));
509 (*errors[s])(cell->active_cell_index()) +=
512 double>::type>::abs_square(jump) *
517 for (
unsigned int s = 0; s < n_solution_vectors; ++s)
518 (*errors[s])(cell->active_cell_index()) =
519 std::sqrt((*errors[s])(cell->active_cell_index()));
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)