diff --git a/source/simulator/assembly.cc b/source/simulator/assembly.cc index a6cc205e389..28792deb442 100644 --- a/source/simulator/assembly.cc +++ b/source/simulator/assembly.cc @@ -813,10 +813,6 @@ namespace aspect system_matrix.compress(VectorOperation::add); system_rhs.compress(VectorOperation::add); - // If we change the system_rhs, matrix-free Stokes must update - if (stokes_matrix_free) - stokes_matrix_free->assemble(); - // if the model is compressible then we need to adjust the right hand // side of the equation to make it compatible with the matrix on the // left @@ -826,6 +822,10 @@ namespace aspect make_pressure_rhs_compatible(system_rhs); } + // If we change the system_rhs, matrix-free Stokes must update + if (stokes_matrix_free) + stokes_matrix_free->assemble(); + // record that we have just rebuilt the matrix rebuild_stokes_matrix = false; }