15 const DoFHandler<dim> &dof_handler_cls =
19 FEValues<dim> fe_values_phase_gradient_projection(*this->
mapping,
25 FEValues<dim> fe_values_cls(*this->
mapping,
26 dof_handler_cls.get_fe(),
27 *this->cell_quadrature,
31 const unsigned int n_q_points =
32 fe_values_phase_gradient_projection.get_quadrature().size();
33 const unsigned int n_dofs_per_cell =
34 fe_values_phase_gradient_projection.get_fe().n_dofs_per_cell();
37 FullMatrix<double> local_matrix(n_dofs_per_cell, n_dofs_per_cell);
38 Vector<double> local_rhs(n_dofs_per_cell);
41 std::vector<types::global_dof_index> local_dof_indices(n_dofs_per_cell);
44 FEValuesExtractors::Vector phase_indicator_gradients(0);
47 std::vector<Tensor<1, dim>> present_cls_phase_gradients(n_q_points);
50 std::vector<Tensor<1, dim>> phi(n_dofs_per_cell);
51 std::vector<Tensor<2, dim>> grad_phi(n_dofs_per_cell);
54 const double diffusion_factor =
56 .surface_tension_force.phase_indicator_gradient_diffusion_factor;
62 for (
const auto &cell : this->
dof_handler->active_cell_iterators())
64 if (cell->is_locally_owned())
71 typename DoFHandler<dim>::active_cell_iterator cls_cell(
78 fe_values_phase_gradient_projection.reinit(cell);
79 fe_values_cls.reinit(cls_cell);
82 std::vector<double> JxW_vec =
83 fe_values_phase_gradient_projection.get_JxW_values();
86 auto &fe_phase_gradient_projection =
87 fe_values_phase_gradient_projection.get_fe();
90 fe_phase_gradient_projection.degree);
93 fe_values_cls.get_function_gradients(present_cls_solution,
94 present_cls_phase_gradients);
97 for (
unsigned int q = 0; q < n_q_points; ++q)
100 for (
unsigned int k = 0; k < n_dofs_per_cell; ++k)
102 phi[k] = fe_values_phase_gradient_projection
103 [phase_indicator_gradients]
105 grad_phi[k] = fe_values_phase_gradient_projection
106 [phase_indicator_gradients]
111 for (
unsigned int i = 0; i < n_dofs_per_cell; ++i)
114 for (
unsigned int j = 0; j < n_dofs_per_cell; ++j)
116 local_matrix(i, j) +=
118 h * h * diffusion_factor *
119 scalar_product(grad_phi[i], grad_phi[j])) *
124 phi[i] * present_cls_phase_gradients[q] * JxW_vec[q];
129 cell->get_dof_indices(local_dof_indices);
130 this->
constraints.distribute_local_to_global(local_matrix,
138 this->
system_rhs.compress(VectorOperation::add);