diff --git a/ALE_Finite_Strain_Plasticity/src/NewtonStepSystem.h b/ALE_Finite_Strain_Plasticity/src/NewtonStepSystem.h index 142de36b..e19fb3a2 100644 --- a/ALE_Finite_Strain_Plasticity/src/NewtonStepSystem.h +++ b/ALE_Finite_Strain_Plasticity/src/NewtonStepSystem.h @@ -41,22 +41,33 @@ namespace PlasticityLab { dof_system.locally_owned_dofs, mpi_communicator); current_increment.reinit( + dof_system.locally_owned_dofs, dof_system.locally_relevant_dofs, mpi_communicator); Newton_step_residual.reinit( dof_system.locally_owned_dofs, mpi_communicator); previous_deformation.reinit( + dof_system.locally_owned_dofs, dof_system.locally_relevant_dofs, mpi_communicator); previous_time_derivative.reinit( + dof_system.locally_owned_dofs, dof_system.locally_relevant_dofs, mpi_communicator); previous_second_time_derivative.reinit( + dof_system.locally_owned_dofs, dof_system.locally_relevant_dofs, mpi_communicator); + _locally_owned_current_increment.reinit( + dof_system.locally_owned_dofs, + mpi_communicator); + _locally_owned_previous_deformation.reinit( + dof_system.locally_owned_dofs, + mpi_communicator); + _locally_owned_previous_time_derivative.reinit( dof_system.locally_owned_dofs, mpi_communicator); @@ -110,7 +121,19 @@ namespace PlasticityLab { previous_second_time_derivative = _locally_owned_previous_second_time_derivative; } - previous_deformation += current_increment; + + // Update the deformation vector with the computed + // increment. Because 'previous_deformation' is a vector with + // ghost entries, it is a read-only vector and we cannot write + // into it -- so we have to create a temporary vector first and + // only copy it at the end: + { + _locally_owned_previous_deformation = previous_deformation; + _locally_owned_current_increment = current_increment; + _locally_owned_previous_deformation += _locally_owned_current_increment; + previous_deformation = _locally_owned_previous_deformation; + } + if(reset_increment) { current_increment = 0; } @@ -125,9 +148,10 @@ namespace PlasticityLab { TrilinosWrappers::MPI::Vector previous_time_derivative; TrilinosWrappers::MPI::Vector previous_second_time_derivative; + TrilinosWrappers::MPI::Vector _locally_owned_previous_deformation; + TrilinosWrappers::MPI::Vector _locally_owned_current_increment; TrilinosWrappers::MPI::Vector _locally_owned_previous_time_derivative; TrilinosWrappers::MPI::Vector _locally_owned_previous_second_time_derivative; - }; } /* namespace PlasticityLab */ diff --git a/ALE_Finite_Strain_Plasticity/src/PlasticityLabProgDrivers.cpp b/ALE_Finite_Strain_Plasticity/src/PlasticityLabProgDrivers.cpp index a332df16..e8f9ac10 100644 --- a/ALE_Finite_Strain_Plasticity/src/PlasticityLabProgDrivers.cpp +++ b/ALE_Finite_Strain_Plasticity/src/PlasticityLabProgDrivers.cpp @@ -50,7 +50,19 @@ namespace PlasticityLab { therm_lbc_system.apply_constraints(therm_dof_system); therm_nonlinear_system.setup(therm_dof_system); - therm_nonlinear_system.previous_deformation = ambient_temperature; + // Initialize the temperature solution vector. Because we are + // initializing with a possibly non-zero value, we can't just + // assign that value to the vector in a parallel setting because + // the solution vector has ghost entries and so is + // read-only. Rather, we create a completely distributed vector, + // assign the value to it, and then copy that into the solution + // vector. + { + TrilinosWrappers::MPI::Vector tmp (therm_dof_system.locally_owned_dofs, + mpi_communicator); + tmp = ambient_temperature; + therm_nonlinear_system.previous_deformation = tmp; + } mixed_fe_dof_system.setup_dof_system(mixed_var_fe);