Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions source/mesh_deformation/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,10 @@ namespace aspect
template <int dim>
MeshDeformationHandler<dim>::MeshDeformationHandler (Simulator<dim> &simulator)
: sim(simulator), // reference to the simulator that owns the MeshDeformationHandler
mesh_deformation_fe (FE_Q<dim>(1),dim), // Q1 elements which describe the mesh geometry
mesh_deformation_fe (FE_Q<dim>(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<MappingQ1Eulerian<dim, LinearAlgebra::Vector>> (mesh_deformation_dof_handler,
mesh_displacements);
}


Expand Down Expand Up @@ -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<const MappingQEulerian<dim, LinearAlgebra::Vector>*>(&(this->get_mapping())) == nullptr)
{
sim.mapping.reset (new MappingQEulerian<dim, LinearAlgebra::Vector> (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();
Expand Down Expand Up @@ -1394,7 +1407,7 @@ namespace aspect
{
object = std::make_unique<MappingQEulerian<dim,
dealii::LinearAlgebra::distributed::Vector<double>>>(
/* degree = */ 1,
mesh_deformation_fe.degree,
mesh_deformation_dof_handler,
level_displacements[level],
level);
Expand Down
2 changes: 1 addition & 1 deletion source/simulator/core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <int dim>
Expand Down
Loading