Skip to content

Commit a38a87b

Browse files
authored
Merge pull request #303 from masterleinad/compute_stress_relevant
Use Vector with locally relevant dofs in compute_stress
2 parents 7038828 + 773c53d commit a38a87b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

source/MechanicalPhysics.cc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,18 @@ MechanicalPhysics<dim, p_order, MaterialStates, MemorySpaceType>::solve()
278278
// If the stress is under the yield criterion, the deformation is elastic and
279279
// we are done. Otherwise we need to use the radial return algorithm to
280280
// compute the plastic deformation.
281-
auto incremental_displacement = displacement;
282-
// TODO Remove this once we support refinement/material addition
283-
if (displacement.get_partitioner()->is_compatible(
284-
*(_old_displacement.get_partitioner())))
281+
dealii::IndexSet locally_relevant_dofs =
282+
dealii::DoFTools::extract_locally_relevant_dofs(_dof_handler);
283+
dealii::LA::distributed::Vector<double, dealii::MemorySpace::Host>
284+
incremental_displacement(
285+
_dof_handler.locally_owned_dofs(), locally_relevant_dofs,
286+
_mechanical_operator->rhs().get_mpi_communicator());
287+
incremental_displacement = displacement;
288+
if (_old_displacement.size() > 0)
285289
{
286290
incremental_displacement -= _old_displacement;
287291
}
292+
incremental_displacement.update_ghost_values();
288293
compute_stress(incremental_displacement);
289294

290295
_old_displacement.swap(displacement);

0 commit comments

Comments
 (0)