@@ -145,7 +145,7 @@ namespace aspect
145145 std::string
146146 StokesMatrixFreeHandlerGlobalCoarseningImplementation<dim, velocity_degree>::name () const
147147 {
148- return " GC- GMG" ;
148+ return " GMG-GC " ;
149149 }
150150
151151
@@ -173,11 +173,10 @@ namespace aspect
173173 template <int dim, int velocity_degree>
174174 void StokesMatrixFreeHandlerGlobalCoarseningImplementation<dim, velocity_degree>::evaluate_material_model ()
175175 {
176- sim.pcout << " evaluate_material_model()" << std::endl;
177176 const auto &dof_handler_projection = dofhandlers_projection.back ();
178177
179178 dealii::LinearAlgebra::distributed::Vector<double > active_viscosity_vector (dof_handler_projection.locally_owned_dofs (),
180- this ->get_triangulation (). get_communicator ());
179+ this ->get_mpi_communicator ());
181180
182181 const Quadrature<dim> &quadrature_formula = this ->introspection ().quadratures .velocities ;
183182
@@ -248,8 +247,8 @@ namespace aspect
248247 active_viscosity_vector.compress (VectorOperation::insert);
249248 }
250249
251- minimum_viscosity = dealii::Utilities::MPI::min (minimum_viscosity_local, this ->get_triangulation (). get_communicator ());
252- maximum_viscosity = dealii::Utilities::MPI::max (maximum_viscosity_local, this ->get_triangulation (). get_communicator ());
250+ minimum_viscosity = dealii::Utilities::MPI::min (minimum_viscosity_local, this ->get_mpi_communicator ());
251+ maximum_viscosity = dealii::Utilities::MPI::max (maximum_viscosity_local, this ->get_mpi_communicator ());
253252
254253 FEValues<dim> fe_values_projection (this ->get_mapping (),
255254 fe_projection,
@@ -369,7 +368,7 @@ namespace aspect
369368 AffineConstraints<double > cs;
370369 std::shared_ptr<MatrixFree<dim,double >>
371370 mf (new MatrixFree<dim,double >());
372- mf->reinit (*sim. mapping , dofhandlers_projection[l], cs, QGauss<1 >(degree+1 ));
371+ mf->reinit (this -> get_mapping () , dofhandlers_projection[l], cs, QGauss<1 >(degree+1 ));
373372 temp_ops[l].initialize (mf);
374373 }
375374
@@ -380,9 +379,9 @@ namespace aspect
380379 temp_ops[l].initialize_dof_vector (vec);
381380 });
382381
383- transfer.template interpolate_to_mg (dof_handler_projection,
384- level_viscosity_vector,
385- active_viscosity_vector);
382+ transfer.interpolate_to_mg (dof_handler_projection,
383+ level_viscosity_vector,
384+ active_viscosity_vector);
386385
387386 for (unsigned int level=min_level; level<=max_level; ++level)
388387 {
@@ -1454,14 +1453,6 @@ namespace aspect
14541453 if (solve_newton_system == false )
14551454 outputs.pressure_normalization_adjustment = this ->normalize_pressure (solution_vector);
14561455
1457- // convert melt pressures
1458- // TODO: We assert in the StokesMatrixFreeHandler constructor that we
1459- // are not including melt transport.
1460- // TODO: We have to const_cast, because the compute_melt_variables
1461- // function assembles and solves an equation. To avoid this we either
1462- // have to hand over non-const references to the current function, or
1463- // call the compute_melt_variables function after finishing the current function.
1464-
14651456 return outputs;
14661457 }
14671458
@@ -1489,16 +1480,16 @@ namespace aspect
14891480 }
14901481 }
14911482
1492- have_periodic_hanging_nodes = (dealii::Utilities::MPI::max (have_periodic_hanging_nodes ? 1 : 0 , this ->get_triangulation (). get_communicator ())) == 1 ;
1483+ have_periodic_hanging_nodes = (dealii::Utilities::MPI::max (have_periodic_hanging_nodes ? 1 : 0 , this ->get_mpi_communicator ())) == 1 ;
14931484 AssertThrow (have_periodic_hanging_nodes==false , ExcNotImplemented ());
14941485 }
14951486
1496- const Mapping<dim> &mapping = *sim. mapping ;
1487+ const Mapping<dim> &mapping = this -> get_mapping () ;
14971488
14981489 // This vector will be refilled with the new MatrixFree objects below:
14991490 matrix_free_objects.clear ();
15001491
1501- trias = dealii::MGTransferGlobalCoarseningTools::create_geometric_coarsening_sequence (sim. triangulation );
1492+ trias = dealii::MGTransferGlobalCoarseningTools::create_geometric_coarsening_sequence (this -> get_triangulation () );
15021493 min_level = 0 ;
15031494 max_level = trias.size () - 1 ;
15041495 constraints_v.resize (min_level, max_level);
@@ -1540,38 +1531,57 @@ namespace aspect
15401531 constraint.reinit (locally_relevant_dofs);
15411532#endif
15421533
1543- sim.compute_initial_velocity_boundary_constraints (constraint); // TODO: this can't work
1544- sim.compute_current_velocity_boundary_constraints (constraint); // TODO: this can't work
15451534
1546- for (const auto &p : sim.boundary_velocity_manager .get_zero_boundary_velocity_indicators ())
1535+ std::set<types::boundary_id> dirichlet_boundary = this ->get_boundary_velocity_manager ().get_zero_boundary_velocity_indicators ();
1536+ for (const auto boundary_id: this ->get_boundary_velocity_manager ().get_prescribed_boundary_velocity_indicators ())
1537+ {
1538+ const ComponentMask component_mask = this ->get_boundary_velocity_manager ().get_component_mask (boundary_id);
1539+
1540+ if (component_mask != ComponentMask (this ->introspection ().n_components , false ))
1541+ {
1542+ ComponentMask velocity_mask (fe_v.n_components (), false );
1543+
1544+ for (unsigned int i=0 ; i<dim; ++i)
1545+ velocity_mask.set (i, component_mask[this ->introspection ().component_indices .velocities [i]]);
1546+
1547+ VectorTools::interpolate_boundary_values (mapping,
1548+ dof_handler,
1549+ boundary_id,
1550+ Functions::ZeroFunction<dim>(dim),
1551+ constraint,
1552+ velocity_mask);
1553+ }
1554+ else
1555+ {
1556+ // no mask given: add at the end
1557+ dirichlet_boundary.insert (boundary_id);
1558+ }
1559+ }
1560+
1561+
1562+ for (const auto id : dirichlet_boundary)
15471563 {
15481564 VectorTools::interpolate_boundary_values (mapping,
15491565 dof_handler,
1550- p ,
1566+ id ,
15511567 Functions::ZeroFunction<dim>(dim),
15521568 constraint);
1553-
15541569 }
15551570
15561571
1557- // VectorTools::interpolate_boundary_values(
1558- // mapping,
1559- // dof_handler,
1560- // 0,
1561- // Functions::ZeroFunction<dim, typename LevelOperatorType::value_type>(
1562- // dof_handler_in.get_fe().n_components()),
1563- // constraint);
1564- Assert (sim.boundary_velocity_manager .get_active_plugins ().size () == 0 ,
1572+ Assert (this ->get_boundary_velocity_manager ().get_active_plugins ().size () == 0 ,
15651573 ExcNotImplemented ());
15661574
1567- Assert (sim.boundary_velocity_manager .get_tangential_boundary_velocity_indicators ().size () == 0 ,
1568- ExcNotImplemented ());
1569- // VectorTools::compute_no_normal_flux_constraints (dof_handler_v,
1570- // /* first_vector_component= */
1571- // 0,
1572- // sim.boundary_velocity_manager.get_tangential_boundary_velocity_indicators(),
1573- // constraints_v,
1574- // *sim.mapping);
1575+ if (this ->get_boundary_velocity_manager ().get_tangential_boundary_velocity_indicators ().size () > 0 )
1576+ {
1577+ Assert (false , dealii::StandardExceptions::ExcNotImplemented (" This is not tested." ));
1578+ VectorTools::compute_no_normal_flux_constraints (dof_handler,
1579+ 0 /* first_vector_component */ ,
1580+ this ->get_boundary_velocity_manager ().get_tangential_boundary_velocity_indicators (),
1581+ constraint,
1582+ mapping);
1583+
1584+ }
15751585
15761586 DoFTools::make_hanging_node_constraints (dof_handler, constraint);
15771587 constraint.close ();
@@ -1607,7 +1617,7 @@ namespace aspect
16071617
16081618 matrix_free = std::make_shared<MatrixFree<dim,double >>();
16091619 matrix_free_objects.push_back (matrix_free);
1610- mg_matrices_A_block[l].reinit (mapping, dofhandlers_v[l], dofhandlers_p[l], constraints_v[l], matrix_free);
1620+ mg_matrices_A_block[l].reinit (mapping, dofhandlers_v[l], dofhandlers_p[l], constraints_v[l], constraints_p[l], matrix_free);
16111621
16121622 matrix_free = std::make_shared<MatrixFree<dim,double >>();
16131623 matrix_free_objects.push_back (matrix_free);
@@ -1625,52 +1635,6 @@ namespace aspect
16251635 }
16261636 }
16271637
1628-
1629-
1630- // Multigrid DoF setup
1631- #if 0
1632- {
1633- //Ablock GMG
1634- dof_handler_v.distribute_mg_dofs();
1635-
1636- mg_constrained_dofs_A_block.clear();
1637- mg_constrained_dofs_A_block.initialize(dof_handler_v);
1638-
1639- std::set<types::boundary_id> dirichlet_boundary = this->get_boundary_velocity_manager().get_zero_boundary_velocity_indicators();
1640- for (const auto boundary_id: this->get_boundary_velocity_manager().get_prescribed_boundary_velocity_indicators())
1641- {
1642- const ComponentMask component_mask = this->get_boundary_velocity_manager().get_component_mask(boundary_id);
1643-
1644- if (component_mask != ComponentMask(this->introspection().n_components, false))
1645- {
1646- ComponentMask velocity_mask(fe_v.n_components(), false);
1647-
1648- for (unsigned int i=0; i<dim; ++i)
1649- velocity_mask.set(i, component_mask[this->introspection().component_indices.velocities[i]]);
1650-
1651- mg_constrained_dofs_A_block.make_zero_boundary_constraints(dof_handler_v, {boundary_id}, velocity_mask);
1652- }
1653- else
1654- {
1655- // no mask given: add at the end
1656- dirichlet_boundary.insert(boundary_id);
1657- }
1658- }
1659-
1660- // Unconditionally call this function, even if the set is empty. Otherwise, the data structure
1661- // for boundary indices will not be created (if mesh has no Dirichlet conditions).
1662- mg_constrained_dofs_A_block.make_zero_boundary_constraints(dof_handler_v, dirichlet_boundary);
1663-
1664- //Schur complement matrix GMG
1665- dof_handler_p.distribute_mg_dofs();
1666-
1667- mg_constrained_dofs_Schur_complement.clear();
1668- mg_constrained_dofs_Schur_complement.initialize(dof_handler_p);
1669-
1670- dof_handler_projection.distribute_mg_dofs();
1671- }
1672- #endif
1673-
16741638 // Setup the matrix-free operators
16751639 std::shared_ptr<MatrixFree<dim,double >> matrix_free = std::make_shared<MatrixFree<dim,double >>();
16761640 matrix_free_objects.push_back (matrix_free);
@@ -1758,13 +1722,14 @@ namespace aspect
17581722 template <int dim, int velocity_degree>
17591723 void StokesMatrixFreeHandlerGlobalCoarseningImplementation<dim, velocity_degree>::build_preconditioner()
17601724 {
1761- TimerOutput::Scope timer ( this ->get_computing_timer (), " Build Stokes preconditioner" );
1725+ this ->get_computing_timer (). enter_subsection ( " Build Stokes preconditioner" );
17621726
17631727 for (auto l = min_level; l <= max_level; ++l)
17641728 {
17651729 mg_matrices_Schur_complement[l].compute_diagonal ();
17661730 mg_matrices_A_block[l].compute_diagonal ();
17671731 }
1732+ this ->get_computing_timer ().leave_subsection (" Build Stokes preconditioner" );
17681733 }
17691734
17701735
0 commit comments