107 template <
class InputVector,
int spacedim>
110 const InputVector & solution,
111 const unsigned int component);
137 template <
class InputVector,
int spacedim>
141 const InputVector & solution,
142 const unsigned int component)
146 std::vector<typename InputVector::value_type>
values(1);
152 std::vector<Vector<typename InputVector::value_type>>
values(
157 return values[0](component);
168 for (
unsigned int i = 0; i < dim; ++i)
218 template <
class InputVector,
int spacedim>
221 const InputVector & solution,
222 const unsigned int component);
252 template <
class InputVector,
int spacedim>
256 const InputVector & solution,
257 const unsigned int component)
261 std::vector<Tensor<1, dim, typename InputVector::value_type>>
values(
269 std::vector<Tensor<1, dim, typename InputVector::value_type>>>
302 const double radicand =
303 ::sqr(
d[0][0] -
d[1][1]) + 4 * ::sqr(
d[0][1]);
305 0.5 * (
d[0][0] +
d[1][1] + std::sqrt(radicand)),
306 0.5 * (
d[0][0] +
d[1][1] - std::sqrt(radicand))};
426 const double am =
trace(
d) / 3.;
430 for (
unsigned int i = 0; i < 3; ++i)
433 const double ss01 = s[0][1] * s[0][1], ss12 = s[1][2] * s[1][2],
434 ss02 = s[0][2] * s[0][2];
436 const double J2 = (s[0][0] * s[0][0] + s[1][1] * s[1][1] +
437 s[2][2] * s[2][2] + 2 * (ss01 + ss02 + ss12)) /
440 (Utilities::fixed_power<3>(s[0][0]) +
441 Utilities::fixed_power<3>(s[1][1]) +
442 Utilities::fixed_power<3>(s[2][2]) + 3. * s[0][0] * (ss01 + ss02) +
443 3. * s[1][1] * (ss01 + ss12) + 3. * s[2][2] * (ss02 + ss12) +
444 6. * s[0][1] * s[0][2] * s[1][2]) /
447 const double R = std::sqrt(4. * J2 / 3.);
449 double EE[3] = {0, 0, 0};
457 EE[0] = EE[1] = EE[2] = am;
462 const double R3 = R * R * R;
463 const double XX = 4. * J3 / R3;
471 const double a = (XX > 0 ? -1. : 1.) * R / 2;
472 EE[0] = EE[1] = am + a;
478 EE[0] = am + R * std::cos(theta);
479 EE[1] = am + R * std::cos(theta + 2. / 3. *
numbers::PI);
480 EE[2] = am + R * std::cos(theta + 4. / 3. *
numbers::PI);
518 for (
unsigned int i = 0; i < dim; ++i)
519 for (
unsigned int j = i + 1; j < dim; ++j)
521 const double s = (
d[i][j] +
d[j][i]) / 2;
522 d[i][j] =
d[j][i] = s;
557 template <
class InputVector,
int spacedim>
560 const InputVector & solution,
561 const unsigned int component);
591 template <
class InputVector,
int spacedim>
595 const InputVector & solution,
596 const unsigned int component)
600 std::vector<Tensor<2, dim, typename InputVector::value_type>>
values(
608 std::vector<Tensor<2, dim, typename InputVector::value_type>>>
648 for (
unsigned int i = 0; i < dim; ++i)
649 for (
unsigned int j = i + 1; j < dim; ++j)
650 for (
unsigned int k = j + 1; k < dim; ++k)
652 const double s = (
d[i][j][k] +
d[i][k][j] +
d[j][i][k] +
653 d[j][k][i] +
d[k][i][j] +
d[k][j][i]) /
655 d[i][j][k] =
d[i][k][j] =
d[j][i][k] =
d[j][k][i] =
d[k][i][j] =
660 for (
unsigned int i = 0; i < dim; ++i)
661 for (
unsigned int j = i + 1; j < dim; ++j)
665 const double s = (
d[i][i][j] +
d[i][j][i] +
d[j][i][i]) / 3;
666 d[i][i][j] =
d[i][j][i] =
d[j][i][i] = s;
670 const double t = (
d[i][j][j] +
d[j][i][j] +
d[j][j][i]) / 3;
671 d[i][j][j] =
d[j][i][j] =
d[j][j][i] = t;
676 template <
int order,
int dim>
741 template <
class DerivativeDescription,
749 const InputVector & solution,
750 const unsigned int component,
752 typename DerivativeDescription::Derivative &derivative)
782 std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
792 typename DerivativeDescription::Derivative projected_derivative;
795 x_fe_midpoint_value.
reinit(cell);
801 const typename DerivativeDescription::ProjectedDerivative
802 this_midpoint_value =
803 DerivativeDescription::get_projected_derivative(fe_midpoint_value,
825 GridTools::get_active_neighbors<DoFHandler<dim, spacedim>>(
826 cell, active_neighbors);
831 auto neighbor_ptr = active_neighbors.begin();
832 for (; neighbor_ptr != active_neighbors.end(); ++neighbor_ptr)
834 const auto neighbor = *neighbor_ptr;
837 x_fe_midpoint_value.
reinit(neighbor);
843 const typename DerivativeDescription::ProjectedDerivative
844 neighbor_midpoint_value =
845 DerivativeDescription::get_projected_derivative(
846 neighbor_fe_midpoint_value, solution, component);
860 const double distance = y.
norm();
874 for (
unsigned int i = 0; i < dim; ++i)
875 for (
unsigned int j = 0; j < dim; ++j)
876 Y[i][j] += y[i] * y[j];
881 typename DerivativeDescription::ProjectedDerivative
882 projected_finite_difference =
883 (neighbor_midpoint_value - this_midpoint_value);
884 projected_finite_difference /= distance;
886 projected_derivative +=
outer_product(y, projected_finite_difference);
903 derivative = Y_inverse * projected_derivative;
916 template <
class DerivativeDescription,
927 const InputVector & solution,
928 const unsigned int component)
931 if (std::get<0>(*cell)->is_locally_owned() ==
false)
932 *std::get<1>(*cell) = 0;
935 typename DerivativeDescription::Derivative derivative;
938 approximate_cell<DerivativeDescription, dim, InputVector, spacedim>(
948 *std::get<1>(*cell) =
964 template <
class DerivativeDescription,
971 const InputVector & solution,
972 const unsigned int component,
983 std::tuple<typename DoFHandler<dim, spacedim>::active_cell_iterator,
995 [&mapping, &dof_handler, &solution, component](
999 approximate<DerivativeDescription, dim, InputVector, spacedim>(
1000 cell, mapping, dof_handler, solution, component);
1002 std::function<void(internal::Assembler::CopyData const &)>(),
1016 template <
int dim,
class InputVector,
int spacedim>
1020 const InputVector & solution,
1022 const unsigned int component)
1024 internal::approximate_derivative<internal::Gradient<dim>, dim>(
1029 template <
int dim,
class InputVector,
int spacedim>
1032 const InputVector & solution,
1034 const unsigned int component)
1040 internal::approximate_derivative<internal::Gradient<dim>, dim>(
1041 reference_cell.template get_default_linear_mapping<dim, spacedim>(),
1049 template <
int dim,
class InputVector,
int spacedim>
1053 const InputVector & solution,
1055 const unsigned int component)
1057 internal::approximate_derivative<internal::SecondDerivative<dim>, dim>(
1062 template <
int dim,
class InputVector,
int spacedim>
1065 const InputVector & solution,
1067 const unsigned int component)
1073 internal::approximate_derivative<internal::SecondDerivative<dim>, dim>(
1074 reference_cell.template get_default_linear_mapping<dim, spacedim>(),
1082 template <
int dim,
int spacedim,
class InputVector,
int order>
1087 const InputVector & solution,
1095 const unsigned int component)
1099 mapping, dof, solution, component, cell, derivative);
1104 template <
int dim,
int spacedim,
class InputVector,
int order>
1108 const InputVector & solution,
1116 const unsigned int component)
1120 cell->reference_cell()
1121 .template get_default_linear_mapping<dim, spacedim>(),
1131 template <
int dim,
int order>
1143 #include "derivative_approximation.inst"
static ProjectedDerivative get_projected_derivative(const FEValues< dim, spacedim > &fe_values, const InputVector &solution, const unsigned int component)
static const UpdateFlags update_flags
static void symmetrize(Derivative &derivative_tensor)
static double derivative_norm(const Derivative &d)
static const UpdateFlags update_flags
static ProjectedDerivative get_projected_derivative(const FEValues< dim, spacedim > &fe_values, const InputVector &solution, const unsigned int component)
static double derivative_norm(const Derivative &d)
static void symmetrize(Derivative &derivative_tensor)
static ProjectedDerivative get_projected_derivative(const FEValues< dim, spacedim > &fe_values, const InputVector &solution, const unsigned int component)
static double derivative_norm(const Derivative &d)
static const UpdateFlags update_flags
static void symmetrize(Derivative &derivative_tensor)
cell_iterator end() const
const Triangulation< dim, spacedim > & get_triangulation() const
active_cell_iterator begin_active(const unsigned int level=0) const
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
const hp::FECollection< dim, spacedim > & get_fe_collection() const
const Point< spacedim > & quadrature_point(const unsigned int q_point) const
void get_function_values(const InputVector &fe_function, std::vector< typename InputVector::value_type > &values) const
void get_function_gradients(const InputVector &fe_function, std::vector< Tensor< 1, spacedim, typename InputVector::value_type >> &gradients) const
const FiniteElement< dim, spacedim > & get_fe() const
void get_function_hessians(const InputVector &fe_function, std::vector< Tensor< 2, spacedim, typename InputVector::value_type >> &hessians) const
unsigned int n_components() const
numbers::NumberTraits< Number >::real_type norm() const
unsigned int n_active_cells() const
bool is_mixed_mesh() const
const std::vector< ReferenceCell > & get_reference_cells() const
const FEValuesType & get_present_fe_values() const
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, lda >> &cell, const unsigned int q_index=numbers::invalid_unsigned_int, const unsigned int mapping_index=numbers::invalid_unsigned_int, const unsigned int fe_index=numbers::invalid_unsigned_int)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcInsufficientDirections()
static ::ExceptionBase & ExcVectorLengthVsNActiveCells(int arg1, int arg2)
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotImplemented()
#define AssertIndexRange(index, range)
#define AssertThrow(cond, exc)
@ update_hessians
Second derivatives of shape functions.
@ update_values
Shape function values.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
void approximate(SynchronousIterators< std::tuple< typename DoFHandler< dim, spacedim >::active_cell_iterator, Vector< float >::iterator >> const &cell, const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, const InputVector &solution, const unsigned int component)
void approximate_derivative(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, const InputVector &solution, const unsigned int component, Vector< float > &derivative_norm)
void approximate_cell(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, const InputVector &solution, const unsigned int component, const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, typename DerivativeDescription::Derivative &derivative)
void approximate_gradient(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const InputVector &solution, Vector< float > &derivative_norm, const unsigned int component=0)
double derivative_norm(const Tensor< order, dim > &derivative)
void approximate_derivative_tensor(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const InputVector &solution, const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, Tensor< order, dim > &derivative, const unsigned int component=0)
void approximate_second_derivative(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const InputVector &solution, Vector< float > &derivative_norm, const unsigned int component=0)
Expression fabs(const Expression &x)
Expression acos(const Expression &x)
void reference_cell(Triangulation< dim, spacedim > &tria, const ReferenceCell &reference_cell)
@ eigenvalues
Eigenvalue vector is filled.
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
VectorType::value_type * begin(VectorType &V)
VectorType::value_type * end(VectorType &V)
void run(const std::vector< std::vector< Iterator >> &colored_iterators, Worker worker, Copier copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length=2 *MultithreadInfo::n_threads(), const unsigned int chunk_size=8)
static constexpr double PI
constexpr DEAL_II_HOST SymmetricTensor< 4, dim, Number > outer_product(const SymmetricTensor< 2, dim, Number > &t1, const SymmetricTensor< 2, dim, Number > &t2)
constexpr DEAL_II_HOST Number trace(const SymmetricTensor< 2, dim2, Number > &)
constexpr DEAL_II_HOST SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)
constexpr DEAL_II_HOST SymmetricTensor< 2, dim, Number > symmetrize(const Tensor< 2, dim, Number > &t)
constexpr DEAL_II_HOST Number determinant(const SymmetricTensor< 2, dim, Number > &)