diff --git a/source/mesh_deformation/interface.cc b/source/mesh_deformation/interface.cc index 2fb7974f0fc..f83ffd37715 100644 --- a/source/mesh_deformation/interface.cc +++ b/source/mesh_deformation/interface.cc @@ -197,13 +197,10 @@ namespace aspect template MeshDeformationHandler::MeshDeformationHandler (Simulator &simulator) : sim(simulator), // reference to the simulator that owns the MeshDeformationHandler - mesh_deformation_fe (FE_Q(1),dim), // Q1 elements which describe the mesh geometry + mesh_deformation_fe (FE_Q(sim.parameters.stokes_velocity_degree),dim), mesh_deformation_dof_handler (sim.triangulation), include_initial_topography(false) { - // Now reset the mapping of the simulator to be something that captures mesh deformation in time. - sim.mapping = std::make_unique> (mesh_deformation_dof_handler, - mesh_displacements); } @@ -1358,6 +1355,22 @@ namespace aspect // cells are created. DoFRenumbering::hierarchical (mesh_deformation_dof_handler); + // If necessary reset the mapping of the simulator to something + // that captures mesh deformation in time. This has to + // happen after we distribute the mesh_deformation DoFs + // above. + if (dynamic_cast*>(&(this->get_mapping())) == nullptr) + { + sim.mapping.reset (new MappingQEulerian (this->get_geometry_model().has_curved_elements() ? 4 : 1, + mesh_deformation_dof_handler, + mesh_displacements)); + + for (auto &pm : sim.particle_managers) + pm.get_particle_handler().initialize(this->get_triangulation(), + this->get_mapping(), + pm.get_property_manager().get_n_property_components()); + } + if (this->is_stokes_matrix_free()) { mesh_deformation_dof_handler.distribute_mg_dofs(); @@ -1394,7 +1407,7 @@ namespace aspect { object = std::make_unique>>( - /* degree = */ 1, + mesh_deformation_fe.degree, mesh_deformation_dof_handler, level_displacements[level], level); diff --git a/source/simulator/core.cc b/source/simulator/core.cc index beb7bbfe617..7cf3a35262d 100644 --- a/source/simulator/core.cc +++ b/source/simulator/core.cc @@ -99,7 +99,7 @@ namespace aspect * of a curved mesh, and a cartesian mapping for a rectangular mesh that is * not deformed. Use a MappingQ1 if the initial mesh is deformed. * If mesh deformation is enabled, each mapping is later swapped out for a - * MappingQ1Eulerian, which allows for mesh deformation during the + * MappingQEulerian, which allows for mesh deformation during the * computation. */ template