Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhei committed Jun 5, 2024
1 parent 20a2c61 commit e542161
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions source/mesh_refinement/composition_gradient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace aspect

for (const unsigned int k : this->introspection().get_compositional_field_base_element_indices())
{
const Quadrature<dim> quadrature (composition.base_element(k).get_unit_support_points());
const Quadrature<dim> quadrature (this->get_fe().base_element(k).get_unit_support_points());
const unsigned int dofs_per_cell = quadrature.size();
FEValues<dim> fe_values (this->get_mapping(),
this->get_fe(),
Expand All @@ -54,16 +54,18 @@ namespace aspect
// we have to extract them in this structure
std::vector<Tensor<1,dim>> composition_gradients (quadrature.size());

for (const auto &cell : this->get_dof_handler().active_cell_iterators())
if (cell->is_locally_owned())
{
const unsigned int idx = cell->active_cell_index();
fe_values.reinit(cell);

for (const unsigned int c : this->introspection().get_compositional_field_indices_with_base_element(k))
for (const unsigned int c : this->introspection().get_compositional_field_indices_with_base_element(k))
{
const typename Simulator<dim>::AdvectionField composition = Simulator<dim>::AdvectionField::composition(c);
for (const auto &cell : this->get_dof_handler().active_cell_iterators())
if (cell->is_locally_owned())
{
fe_values[composition.scalar_extractor(c)].get_function_gradients (this->get_solution(),
composition_gradients);
const unsigned int idx = cell->active_cell_index();
fe_values.reinit(cell);


fe_values[composition.scalar_extractor(this->introspection())].get_function_gradients (this->get_solution(),
composition_gradients);

// For each composition dof, write into the output vector the
// composition gradient. Note that quadrature points and dofs
Expand All @@ -79,8 +81,9 @@ namespace aspect
// will yield convergence of the error indicators to zero as h->0)
this_indicator[idx] *= std::pow(cell->diameter(), power);
}
indicators.add(composition_scaling_factors[c], this_indicator);
}

indicators.add(composition_scaling_factors[c], this_indicator);
}
}
}

Expand Down

0 comments on commit e542161

Please sign in to comment.