From 2bc45c9f5de36fac2be5b5517554312d009dcb45 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Fri, 3 Mar 2023 13:05:33 +0100
Subject: [PATCH] [PL] Pass solution time derivatives to postTimestep

---
 .../ComponentTransport/ComponentTransportFEM.h    |  1 +
 .../ComponentTransportProcess.cpp                 |  4 +++-
 .../ComponentTransportProcess.h                   |  1 +
 ProcessLib/HT/HTProcess.cpp                       | 10 ++++++----
 ProcessLib/HT/HTProcess.h                         |  1 +
 .../HeatTransportBHE/HeatTransportBHEProcess.cpp  |  5 +++--
 .../HeatTransportBHE/HeatTransportBHEProcess.h    |  1 +
 ProcessLib/HydroMechanics/HydroMechanicsFEM.h     |  1 +
 .../HydroMechanics/HydroMechanicsProcess.cpp      |  5 +++--
 ProcessLib/HydroMechanics/HydroMechanicsProcess.h |  1 +
 .../LIE/HydroMechanics/HydroMechanicsProcess.cpp  |  6 ++++--
 .../LIE/HydroMechanics/HydroMechanicsProcess.h    |  1 +
 .../HydroMechanicsLocalAssemblerInterface.h       |  4 +++-
 ProcessLib/LiquidFlow/LiquidFlowProcess.cpp       |  1 +
 ProcessLib/LiquidFlow/LiquidFlowProcess.h         |  1 +
 ProcessLib/LocalAssemblerInterface.cpp            | 12 ++++++++++--
 ProcessLib/LocalAssemblerInterface.h              |  5 ++++-
 ProcessLib/PhaseField/PhaseFieldFEM.h             |  1 +
 ProcessLib/PhaseField/PhaseFieldProcess.cpp       |  3 ++-
 ProcessLib/PhaseField/PhaseFieldProcess.h         |  1 +
 ProcessLib/Process.cpp                            | 15 ++++++++++++---
 ProcessLib/Process.h                              |  4 +++-
 .../RichardsMechanics/RichardsMechanicsFEM.h      |  1 +
 .../RichardsMechanicsProcess.cpp                  |  5 +++--
 .../RichardsMechanics/RichardsMechanicsProcess.h  |  1 +
 ProcessLib/SmallDeformation/SmallDeformationFEM.h | 13 +++++++++----
 .../SmallDeformation/SmallDeformationProcess.cpp  |  5 +++--
 .../SmallDeformation/SmallDeformationProcess.h    |  1 +
 .../SmallDeformationNonlocalFEM.h                 |  1 +
 .../SmallDeformationNonlocalProcess.cpp           |  3 ++-
 .../SmallDeformationNonlocalProcess.h             |  1 +
 .../SteadyStateDiffusion/SteadyStateDiffusion.h   | 10 ++++++----
 ProcessLib/StokesFlow/StokesFlowProcess.cpp       |  3 ++-
 ProcessLib/StokesFlow/StokesFlowProcess.h         |  1 +
 ProcessLib/TH2M/TH2MFEM.h                         |  1 +
 ProcessLib/TH2M/TH2MProcess.cpp                   |  5 +++--
 ProcessLib/TH2M/TH2MProcess.h                     |  1 +
 .../ThermoHydroMechanicsFEM.h                     |  1 +
 .../ThermoHydroMechanicsProcess.cpp               |  5 +++--
 .../ThermoHydroMechanicsProcess.h                 |  1 +
 .../ThermoMechanicalPhaseFieldFEM.h               |  1 +
 .../ThermoMechanicalPhaseFieldProcess.cpp         |  4 +++-
 .../ThermoMechanicalPhaseFieldProcess.h           |  1 +
 ProcessLib/ThermoMechanics/ThermoMechanicsFEM.h   |  1 +
 .../ThermoMechanics/ThermoMechanicsProcess.cpp    |  5 +++--
 .../ThermoMechanics/ThermoMechanicsProcess.h      |  1 +
 .../ThermoRichardsFlow/ThermoRichardsFlowFEM.h    |  1 +
 .../ThermoRichardsFlowProcess.cpp                 |  5 +++--
 .../ThermoRichardsFlowProcess.h                   |  1 +
 .../LocalAssemblerInterface.h                     |  1 +
 .../ThermoRichardsMechanicsProcess.cpp            |  3 ++-
 .../ThermoRichardsMechanicsProcess.h              |  1 +
 ProcessLib/TimeLoop.cpp                           |  2 +-
 53 files changed, 125 insertions(+), 45 deletions(-)

diff --git a/ProcessLib/ComponentTransport/ComponentTransportFEM.h b/ProcessLib/ComponentTransport/ComponentTransportFEM.h
index 1e7bd7ad69d..bb9ea194a99 100644
--- a/ProcessLib/ComponentTransport/ComponentTransportFEM.h
+++ b/ProcessLib/ComponentTransport/ComponentTransportFEM.h
@@ -1775,6 +1775,7 @@ public:
     }
 
     void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                              Eigen::VectorXd const& /*local_x_dot*/,
                               double const /*t*/, double const /*dt*/) override
     {
         unsigned const n_integration_points =
diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp
index d80f2ebc3f1..7026da94892 100644
--- a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp
+++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp
@@ -422,6 +422,7 @@ void ComponentTransportProcess::computeSecondaryVariableConcrete(
 
 void ComponentTransportProcess::postTimestepConcreteProcess(
     std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& x_dot,
     const double t,
     const double dt,
     int const process_id)
@@ -439,7 +440,8 @@ void ComponentTransportProcess::postTimestepConcreteProcess(
     ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
     GlobalExecutor::executeSelectedMemberOnDereferenced(
         &ComponentTransportLocalAssemblerInterface::postTimestep,
-        _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, t, dt);
+        _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, x_dot, t,
+        dt);
 
     if (!_surfaceflux)  // computing the surfaceflux is optional
     {
diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.h b/ProcessLib/ComponentTransport/ComponentTransportProcess.h
index 6831a8cdc4d..d6298c610ba 100644
--- a/ProcessLib/ComponentTransport/ComponentTransportProcess.h
+++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.h
@@ -134,6 +134,7 @@ public:
                                           int const /*process_id*/) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      const double t,
                                      const double dt,
                                      int const process_id) override;
diff --git a/ProcessLib/HT/HTProcess.cpp b/ProcessLib/HT/HTProcess.cpp
index aed6f24a42a..fc0749c08e6 100644
--- a/ProcessLib/HT/HTProcess.cpp
+++ b/ProcessLib/HT/HTProcess.cpp
@@ -189,10 +189,12 @@ Eigen::Vector3d HTProcess::getFlux(std::size_t element_id,
 }
 
 // this is almost a copy of the implementation in the GroundwaterFlow
-void HTProcess::postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
-                                            const double t,
-                                            const double /*delta_t*/,
-                                            int const process_id)
+void HTProcess::postTimestepConcreteProcess(
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& /*x_dot*/,
+    const double t,
+    const double /*delta_t*/,
+    int const process_id)
 {
     // For the monolithic scheme, process_id is always zero.
     if (_use_monolithic_scheme && process_id != 0)
diff --git a/ProcessLib/HT/HTProcess.h b/ProcessLib/HT/HTProcess.h
index ff595a6b664..99f26904f8b 100644
--- a/ProcessLib/HT/HTProcess.h
+++ b/ProcessLib/HT/HTProcess.h
@@ -81,6 +81,7 @@ public:
         int const process_id) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      const double t,
                                      const double delta_t,
                                      int const process_id) override;
diff --git a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp
index 2fa58409ca1..a859f7bf6e7 100644
--- a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp
+++ b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp
@@ -307,8 +307,9 @@ void HeatTransportBHEProcess::preTimestepConcreteProcess(
 }
 
 void HeatTransportBHEProcess::postTimestepConcreteProcess(
-    std::vector<GlobalVector*> const& x, const double t, const double dt,
-    int const process_id)
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& /*x_dot*/, const double t,
+    const double dt, int const process_id)
 {
     if (_process_data.py_bc_object == nullptr ||
         !_process_data._use_server_communication)
diff --git a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.h b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.h
index c46b4e69efc..8670c83f8bd 100644
--- a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.h
+++ b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.h
@@ -74,6 +74,7 @@ private:
                                     int const process_id) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      const double t, const double dt,
                                      int const process_id) override;
 
diff --git a/ProcessLib/HydroMechanics/HydroMechanicsFEM.h b/ProcessLib/HydroMechanics/HydroMechanicsFEM.h
index af485aa1033..4c8a249bf4b 100644
--- a/ProcessLib/HydroMechanics/HydroMechanicsFEM.h
+++ b/ProcessLib/HydroMechanics/HydroMechanicsFEM.h
@@ -256,6 +256,7 @@ public:
     }
 
     void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                              Eigen::VectorXd const& /*local_x_dot*/,
                               double const /*t*/,
                               double const /*dt*/) override
     {
diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp
index b0b018f65b4..21623bc27a3 100644
--- a/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp
+++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp
@@ -384,7 +384,8 @@ void HydroMechanicsProcess<DisplacementDim>::preTimestepConcreteProcess(
 
 template <int DisplacementDim>
 void HydroMechanicsProcess<DisplacementDim>::postTimestepConcreteProcess(
-    std::vector<GlobalVector*> const& x, double const t, double const dt,
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& x_dot, double const t, double const dt,
     const int process_id)
 {
     if (process_id != 0)
@@ -404,7 +405,7 @@ void HydroMechanicsProcess<DisplacementDim>::postTimestepConcreteProcess(
     ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
     GlobalExecutor::executeSelectedMemberOnDereferenced(
         &LocalAssemblerIF::postTimestep, _local_assemblers,
-        pv.getActiveElementIDs(), dof_tables, x, t, dt);
+        pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt);
 }
 
 template <int DisplacementDim>
diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess.h b/ProcessLib/HydroMechanics/HydroMechanicsProcess.h
index 6aa4c45fc87..3ec003f9d89 100644
--- a/ProcessLib/HydroMechanics/HydroMechanicsProcess.h
+++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess.h
@@ -91,6 +91,7 @@ private:
                                     const int process_id) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      const double t, const double dt,
                                      int const process_id) override;
 
diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
index 2824e8b091d..b542000a637 100644
--- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
+++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
@@ -449,7 +449,8 @@ void HydroMechanicsProcess<GlobalDim>::initializeConcreteProcess(
 
 template <int GlobalDim>
 void HydroMechanicsProcess<GlobalDim>::postTimestepConcreteProcess(
-    std::vector<GlobalVector*> const& x, const double t, double const dt,
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& x_dot, const double t, double const dt,
     int const process_id)
 {
     if (process_id == 0)
@@ -467,7 +468,8 @@ void HydroMechanicsProcess<GlobalDim>::postTimestepConcreteProcess(
             getProcessVariables(process_id)[0];
         GlobalExecutor::executeSelectedMemberOnDereferenced(
             &HydroMechanicsLocalAssemblerInterface::postTimestep,
-            _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, t, dt);
+            _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, x_dot,
+            t, dt);
     }
 
     DBUG("Compute the secondary variables for HydroMechanicsProcess.");
diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h
index bf6f6ead0da..cb9d275dd98 100644
--- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h
+++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h
@@ -51,6 +51,7 @@ public:
     //! @}
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      double const t, double const dt,
                                      int const process_id) override;
 
diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h
index e3f5c12c139..deee7e49ed8 100644
--- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h
+++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h
@@ -99,7 +99,9 @@ public:
         }
     }
 
-    void postTimestepConcrete(Eigen::VectorXd const& local_x_, const double t,
+    void postTimestepConcrete(Eigen::VectorXd const& local_x_,
+                              Eigen::VectorXd const& /*local_x_dot*/,
+                              const double t,
                               double const dt) override
     {
         _local_u.setZero();
diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp
index e775c5c1fb6..569ad13dd3d 100644
--- a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp
+++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp
@@ -149,6 +149,7 @@ Eigen::Vector3d LiquidFlowProcess::getFlux(
 // this is almost a copy of the implementation in the GroundwaterFlow
 void LiquidFlowProcess::postTimestepConcreteProcess(
     std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& /*x_dot*/,
     const double t,
     const double /*dt*/,
     int const process_id)
diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.h b/ProcessLib/LiquidFlow/LiquidFlowProcess.h
index 0e7fe884809..a331f5740b8 100644
--- a/ProcessLib/LiquidFlow/LiquidFlowProcess.h
+++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.h
@@ -81,6 +81,7 @@ public:
                             std::vector<GlobalVector*> const& x) const override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      const double t,
                                      const double dt,
                                      int const process_id) override;
diff --git a/ProcessLib/LocalAssemblerInterface.cpp b/ProcessLib/LocalAssemblerInterface.cpp
index cc1052e14bc..87e16e27072 100644
--- a/ProcessLib/LocalAssemblerInterface.cpp
+++ b/ProcessLib/LocalAssemblerInterface.cpp
@@ -131,9 +131,11 @@ void LocalAssemblerInterface::preTimestep(
 void LocalAssemblerInterface::postTimestep(
     std::size_t const mesh_item_id,
     std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables,
-    std::vector<GlobalVector*> const& x, double const t, double const dt)
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& x_dot, double const t, double const dt)
 {
     std::vector<double> local_x_vec;
+    std::vector<double> local_x_dot_vec;
 
     auto const n_processes = x.size();
     for (std::size_t process_id = 0; process_id < n_processes; ++process_id)
@@ -144,10 +146,16 @@ void LocalAssemblerInterface::postTimestep(
         auto const local_solution = x[process_id]->get(indices);
         local_x_vec.insert(std::end(local_x_vec), std::begin(local_solution),
                            std::end(local_solution));
+
+        auto const local_solution_dot = x_dot[process_id]->get(indices);
+        local_x_dot_vec.insert(std::end(local_x_dot_vec),
+                               std::begin(local_solution_dot),
+                               std::end(local_solution_dot));
     }
     auto const local_x = MathLib::toVector(local_x_vec);
+    auto const local_x_dot = MathLib::toVector(local_x_dot_vec);
 
-    postTimestepConcrete(local_x, t, dt);
+    postTimestepConcrete(local_x, local_x_dot, t, dt);
 }
 
 void LocalAssemblerInterface::postNonLinearSolver(
diff --git a/ProcessLib/LocalAssemblerInterface.h b/ProcessLib/LocalAssemblerInterface.h
index 1442c3bf242..fe30f2fd389 100644
--- a/ProcessLib/LocalAssemblerInterface.h
+++ b/ProcessLib/LocalAssemblerInterface.h
@@ -90,7 +90,9 @@ public:
     virtual void postTimestep(
         std::size_t const mesh_item_id,
         std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables,
-        std::vector<GlobalVector*> const& x, double const t, double const dt);
+        std::vector<GlobalVector*> const& x,
+        std::vector<GlobalVector*> const& x_dot, double const t,
+        double const dt);
 
     void postNonLinearSolver(std::size_t const mesh_item_id,
                              NumLib::LocalToGlobalIndexMap const& dof_table,
@@ -134,6 +136,7 @@ private:
     }
 
     virtual void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                                      Eigen::VectorXd const& /*local_x_dot*/,
                                       double const /*t*/, double const /*dt*/)
     {
     }
diff --git a/ProcessLib/PhaseField/PhaseFieldFEM.h b/ProcessLib/PhaseField/PhaseFieldFEM.h
index e0f79d5df36..3865e5e5b10 100644
--- a/ProcessLib/PhaseField/PhaseFieldFEM.h
+++ b/ProcessLib/PhaseField/PhaseFieldFEM.h
@@ -290,6 +290,7 @@ public:
     }
 
     void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                              Eigen::VectorXd const& /*local_x_dot*/,
                               double const /*t*/,
                               double const /*dt*/) override
     {
diff --git a/ProcessLib/PhaseField/PhaseFieldProcess.cpp b/ProcessLib/PhaseField/PhaseFieldProcess.cpp
index 48fc07c8e42..74bf60895dc 100644
--- a/ProcessLib/PhaseField/PhaseFieldProcess.cpp
+++ b/ProcessLib/PhaseField/PhaseFieldProcess.cpp
@@ -277,7 +277,8 @@ void PhaseFieldProcess<DisplacementDim>::preTimestepConcreteProcess(
 
 template <int DisplacementDim>
 void PhaseFieldProcess<DisplacementDim>::postTimestepConcreteProcess(
-    std::vector<GlobalVector*> const& x, const double t,
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& /*x_dot*/, const double t,
     const double /*delta_t*/, int const process_id)
 {
     if (isPhaseFieldProcess(process_id))
diff --git a/ProcessLib/PhaseField/PhaseFieldProcess.h b/ProcessLib/PhaseField/PhaseFieldProcess.h
index 875032dfbbc..da2a453a98d 100644
--- a/ProcessLib/PhaseField/PhaseFieldProcess.h
+++ b/ProcessLib/PhaseField/PhaseFieldProcess.h
@@ -76,6 +76,7 @@ private:
                                     const int process_id) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      const double t, const double delta_t,
                                      int const process_id) override;
 
diff --git a/ProcessLib/Process.cpp b/ProcessLib/Process.cpp
index a1ca553e86f..850d3948d72 100644
--- a/ProcessLib/Process.cpp
+++ b/ProcessLib/Process.cpp
@@ -393,12 +393,21 @@ void Process::preTimestep(std::vector<GlobalVector*> const& x, const double t,
     _boundary_conditions[process_id].preTimestep(t, x, process_id);
 }
 
-void Process::postTimestep(std::vector<GlobalVector*> const& x, const double t,
-                           const double delta_t, int const process_id)
+void Process::postTimestep(std::vector<GlobalVector*> const& x,
+                           std::vector<GlobalVector*> const& x_dot,
+                           const double t, const double delta_t,
+                           int const process_id)
 {
     for (auto* const solution : x)
+    {
+        MathLib::LinAlg::setLocalAccessibleVector(*solution);
+    }
+    for (auto* const solution : x_dot)
+    {
         MathLib::LinAlg::setLocalAccessibleVector(*solution);
-    postTimestepConcreteProcess(x, t, delta_t, process_id);
+    }
+
+    postTimestepConcreteProcess(x, x_dot, t, delta_t, process_id);
 
     _boundary_conditions[process_id].postTimestep(t, x, process_id);
 }
diff --git a/ProcessLib/Process.h b/ProcessLib/Process.h
index 13690b44745..693cf75b92b 100644
--- a/ProcessLib/Process.h
+++ b/ProcessLib/Process.h
@@ -66,7 +66,8 @@ public:
                      const double delta_t, const int process_id);
 
     /// Postprocessing after a complete timestep.
-    void postTimestep(std::vector<GlobalVector*> const& x, const double t,
+    void postTimestep(std::vector<GlobalVector*> const& x,
+                      std::vector<GlobalVector*> const& x_dot, const double t,
                       const double delta_t, int const process_id);
 
     /// Calculates secondary variables, e.g. stress and strain for deformation
@@ -248,6 +249,7 @@ private:
 
     virtual void postTimestepConcreteProcess(
         std::vector<GlobalVector*> const& /*x*/,
+        std::vector<GlobalVector*> const& /*x_dot*/,
         const double /*t*/,
         const double /*dt*/,
         int const /*process_id*/)
diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM.h b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM.h
index 2a28693ed49..0f93231ebeb 100644
--- a/ProcessLib/RichardsMechanics/RichardsMechanicsFEM.h
+++ b/ProcessLib/RichardsMechanics/RichardsMechanicsFEM.h
@@ -153,6 +153,7 @@ public:
     }
 
     void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                              Eigen::VectorXd const& /*local_x_dot*/,
                               double const /*t*/,
                               double const /*dt*/) override
     {
diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp
index a9603cf2e26..5b15d385cc2 100644
--- a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp
+++ b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.cpp
@@ -423,7 +423,8 @@ void RichardsMechanicsProcess<DisplacementDim>::
 
 template <int DisplacementDim>
 void RichardsMechanicsProcess<DisplacementDim>::postTimestepConcreteProcess(
-    std::vector<GlobalVector*> const& x, double const t, double const dt,
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& x_dot, double const t, double const dt,
     const int process_id)
 {
     if (hasMechanicalProcess(process_id))
@@ -435,7 +436,7 @@ void RichardsMechanicsProcess<DisplacementDim>::postTimestepConcreteProcess(
             getProcessVariables(process_id)[0];
         GlobalExecutor::executeSelectedMemberOnDereferenced(
             &LocalAssemblerIF::postTimestep, _local_assemblers,
-            pv.getActiveElementIDs(), dof_tables, x, t, dt);
+            pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt);
     }
 }
 
diff --git a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.h b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.h
index 4128105bdaa..0c694f62696 100644
--- a/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.h
+++ b/ProcessLib/RichardsMechanics/RichardsMechanicsProcess.h
@@ -90,6 +90,7 @@ private:
         GlobalMatrix& Jac) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      double const t, double const dt,
                                      const int process_id) override;
 
diff --git a/ProcessLib/SmallDeformation/SmallDeformationFEM.h b/ProcessLib/SmallDeformation/SmallDeformationFEM.h
index e6c155adf09..e785b4d6119 100644
--- a/ProcessLib/SmallDeformation/SmallDeformationFEM.h
+++ b/ProcessLib/SmallDeformation/SmallDeformationFEM.h
@@ -236,6 +236,7 @@ public:
     MathLib::KelvinVector::KelvinMatrixType<DisplacementDim>
     updateConstitutiveRelations(
         Eigen::Ref<Eigen::VectorXd const> const& local_x,
+        Eigen::Ref<Eigen::VectorXd const> const& /*local_x_dot*/,
         ParameterLib::SpatialPosition const& x_position, double const t,
         double const dt,
         IntegrationPointData<BMatricesType, ShapeMatricesType, DisplacementDim>&
@@ -310,7 +311,7 @@ public:
 
     void assembleWithJacobian(double const t, double const dt,
                               std::vector<double> const& local_x,
-                              std::vector<double> const& /*local_xdot*/,
+                              std::vector<double> const& local_x_dot,
                               std::vector<double>& /*local_M_data*/,
                               std::vector<double>& /*local_K_data*/,
                               std::vector<double>& local_b_data,
@@ -352,6 +353,9 @@ public:
             auto const C = updateConstitutiveRelations(
                 Eigen::Map<NodalForceVectorType const>(
                     local_x.data(), ShapeFunction::NPOINTS * DisplacementDim),
+                Eigen::Map<NodalForceVectorType const>(
+                    local_x_dot.data(),
+                    ShapeFunction::NPOINTS * DisplacementDim),
                 x_position, t, dt, _ip_data[ip]);
 
             auto const rho = _process_data.solid_density(t, x_position)[0];
@@ -361,8 +365,9 @@ public:
         }
     }
 
-    void postTimestepConcrete(Eigen::VectorXd const& local_x, double const t,
-                              double const dt) override
+    void postTimestepConcrete(Eigen::VectorXd const& local_x,
+                              Eigen::VectorXd const& local_x_dot,
+                              double const t, double const dt) override
     {
         unsigned const n_integration_points =
             _integration_method.getNumberOfPoints();
@@ -374,7 +379,7 @@ public:
         {
             x_position.setIntegrationPoint(ip);
 
-            updateConstitutiveRelations(local_x, x_position, t, dt,
+            updateConstitutiveRelations(local_x, local_x_dot, x_position, t, dt,
                                         _ip_data[ip]);
 
             auto& eps = _ip_data[ip].eps;
diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
index e5b00677d86..4813db18602 100644
--- a/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
+++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.cpp
@@ -181,7 +181,8 @@ void SmallDeformationProcess<DisplacementDim>::
 
 template <int DisplacementDim>
 void SmallDeformationProcess<DisplacementDim>::postTimestepConcreteProcess(
-    std::vector<GlobalVector*> const& x, const double t, const double dt,
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& x_dot, const double t, const double dt,
     int const process_id)
 {
     DBUG("PostTimestep SmallDeformationProcess.");
@@ -193,7 +194,7 @@ void SmallDeformationProcess<DisplacementDim>::postTimestepConcreteProcess(
     ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
     GlobalExecutor::executeSelectedMemberOnDereferenced(
         &LocalAssemblerInterface::postTimestep, _local_assemblers,
-        pv.getActiveElementIDs(), dof_tables, x, t, dt);
+        pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt);
 
     std::unique_ptr<GlobalVector> material_forces;
     ProcessLib::SmallDeformation::writeMaterialForces(
diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.h b/ProcessLib/SmallDeformation/SmallDeformationProcess.h
index 0d0ae5107b1..30c8c756dfa 100644
--- a/ProcessLib/SmallDeformation/SmallDeformationProcess.h
+++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.h
@@ -62,6 +62,7 @@ private:
         GlobalMatrix& Jac) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      const double t, const double dt,
                                      int const process_id) override;
 
diff --git a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h
index acc4c2d6bc7..e445b43af46 100644
--- a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h
+++ b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h
@@ -543,6 +543,7 @@ public:
     }
 
     void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                              Eigen::VectorXd const& /*local_x_dot*/,
                               double const /*t*/, double const /*dt*/) override
     {
         unsigned const n_integration_points =
diff --git a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp
index d1fcf282a31..721b7067497 100644
--- a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp
+++ b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.cpp
@@ -272,6 +272,7 @@ void SmallDeformationNonlocalProcess<DisplacementDim>::
 template <int DisplacementDim>
 void SmallDeformationNonlocalProcess<DisplacementDim>::
     postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                std::vector<GlobalVector*> const& x_dot,
                                 double const t,
                                 double const dt,
                                 int const process_id)
@@ -285,7 +286,7 @@ void SmallDeformationNonlocalProcess<DisplacementDim>::
     ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
     GlobalExecutor::executeSelectedMemberOnDereferenced(
         &LocalAssemblerInterface::postTimestep, _local_assemblers,
-        pv.getActiveElementIDs(), dof_tables, x, t, dt);
+        pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt);
 }
 
 template <int DisplacementDim>
diff --git a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.h b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.h
index d2abf804576..20de29e33f8 100644
--- a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.h
+++ b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalProcess.h
@@ -67,6 +67,7 @@ private:
         GlobalMatrix& Jac) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      double const t, double const dt,
                                      int const process_id) override;
 
diff --git a/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.h b/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.h
index 9847c46880c..f8bbd8298c2 100644
--- a/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.h
+++ b/ProcessLib/SteadyStateDiffusion/SteadyStateDiffusion.h
@@ -58,10 +58,12 @@ public:
         return _local_assemblers[element_id]->getFlux(p, t, local_x);
     }
 
-    void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
-                                     const double t,
-                                     const double /*delta_t*/,
-                                     int const process_id) override
+    void postTimestepConcreteProcess(
+        std::vector<GlobalVector*> const& x,
+        std::vector<GlobalVector*> const& /*x_dot*/,
+        const double t,
+        const double /*delta_t*/,
+        int const process_id) override
     {
         // For this single process, process_id is always zero.
         if (process_id != 0)
diff --git a/ProcessLib/StokesFlow/StokesFlowProcess.cpp b/ProcessLib/StokesFlow/StokesFlowProcess.cpp
index 5cc64069193..14156ae3901 100644
--- a/ProcessLib/StokesFlow/StokesFlowProcess.cpp
+++ b/ProcessLib/StokesFlow/StokesFlowProcess.cpp
@@ -190,6 +190,7 @@ void StokesFlowProcess<GlobalDim>::computeSecondaryVariableConcrete(
 template <int GlobalDim>
 void StokesFlowProcess<GlobalDim>::postTimestepConcreteProcess(
     std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& x_dot,
     const double t,
     const double dt,
     int const process_id)
@@ -209,7 +210,7 @@ void StokesFlowProcess<GlobalDim>::postTimestepConcreteProcess(
     ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
     GlobalExecutor::executeSelectedMemberOnDereferenced(
         &StokesFlowLocalAssemblerInterface::postTimestep, _local_assemblers,
-        pv.getActiveElementIDs(), dof_tables, x, t, dt);
+        pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt);
 }
 
 template <int GlobalDim>
diff --git a/ProcessLib/StokesFlow/StokesFlowProcess.h b/ProcessLib/StokesFlow/StokesFlowProcess.h
index c16b3fa9a15..68d7e21b93f 100644
--- a/ProcessLib/StokesFlow/StokesFlowProcess.h
+++ b/ProcessLib/StokesFlow/StokesFlowProcess.h
@@ -55,6 +55,7 @@ public:
                                           int const /*process_id*/) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      const double t,
                                      const double dt,
                                      int const process_id) override;
diff --git a/ProcessLib/TH2M/TH2MFEM.h b/ProcessLib/TH2M/TH2MFEM.h
index 6ec3d71b5ec..cc077ef17ea 100644
--- a/ProcessLib/TH2M/TH2MFEM.h
+++ b/ProcessLib/TH2M/TH2MFEM.h
@@ -149,6 +149,7 @@ private:
     }
 
     void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                              Eigen::VectorXd const& /*local_x_dot*/,
                               double const /*t*/,
                               double const /*dt*/) override
     {
diff --git a/ProcessLib/TH2M/TH2MProcess.cpp b/ProcessLib/TH2M/TH2MProcess.cpp
index 2cd415061c2..a53373046b3 100644
--- a/ProcessLib/TH2M/TH2MProcess.cpp
+++ b/ProcessLib/TH2M/TH2MProcess.cpp
@@ -363,7 +363,8 @@ void TH2MProcess<DisplacementDim>::preTimestepConcreteProcess(
 
 template <int DisplacementDim>
 void TH2MProcess<DisplacementDim>::postTimestepConcreteProcess(
-    std::vector<GlobalVector*> const& x, double const t, double const dt,
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& x_dot, double const t, double const dt,
     const int process_id)
 {
     DBUG("PostTimestep TH2MProcess.");
@@ -371,7 +372,7 @@ void TH2MProcess<DisplacementDim>::postTimestepConcreteProcess(
     ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
     GlobalExecutor::executeSelectedMemberOnDereferenced(
         &LocalAssemblerInterface::postTimestep, local_assemblers_,
-        pv.getActiveElementIDs(), dof_tables, x, t, dt);
+        pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt);
 }
 
 template <int DisplacementDim>
diff --git a/ProcessLib/TH2M/TH2MProcess.h b/ProcessLib/TH2M/TH2MProcess.h
index aa412b8868f..e985238230e 100644
--- a/ProcessLib/TH2M/TH2MProcess.h
+++ b/ProcessLib/TH2M/TH2MProcess.h
@@ -96,6 +96,7 @@ private:
                                     const int process_id) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      const double t, const double dt,
                                      int const /*process_id*/) override;
 
diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h
index 5f43641ec4f..85677012dba 100644
--- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h
+++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h
@@ -147,6 +147,7 @@ public:
     }
 
     void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                              Eigen::VectorXd const& /*local_x_dot*/,
                               double const /*t*/,
                               double const /*dt*/) override
     {
diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp
index 93f76a2bed6..d57c6cbee2e 100644
--- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp
+++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.cpp
@@ -372,7 +372,8 @@ void ThermoHydroMechanicsProcess<DisplacementDim>::preTimestepConcreteProcess(
 
 template <int DisplacementDim>
 void ThermoHydroMechanicsProcess<DisplacementDim>::postTimestepConcreteProcess(
-    std::vector<GlobalVector*> const& x, double const t, double const dt,
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& x_dot, double const t, double const dt,
     const int process_id)
 {
     if (process_id != 0)
@@ -393,7 +394,7 @@ void ThermoHydroMechanicsProcess<DisplacementDim>::postTimestepConcreteProcess(
 
     GlobalExecutor::executeSelectedMemberOnDereferenced(
         &LocalAssemblerInterface::postTimestep, _local_assemblers,
-        pv.getActiveElementIDs(), dof_tables, x, t, dt);
+        pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt);
 }
 
 template <int DisplacementDim>
diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.h b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.h
index a2a548a619c..123b186bb3b 100644
--- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.h
+++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsProcess.h
@@ -91,6 +91,7 @@ private:
                                     const int process_id) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      const double t, const double dt,
                                      int const process_id) override;
 
diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM.h b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM.h
index 4a2391e1169..c57fa88ff7f 100644
--- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM.h
+++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldFEM.h
@@ -253,6 +253,7 @@ public:
     }
 
     void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                              Eigen::VectorXd const& /*local_x_dot*/,
                               double const /*t*/, double const /*dt*/) override
     {
         unsigned const n_integration_points =
diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp
index d71643e7780..1a948966d5a 100644
--- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp
+++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.cpp
@@ -278,6 +278,7 @@ void ThermoMechanicalPhaseFieldProcess<DisplacementDim>::
 template <int DisplacementDim>
 void ThermoMechanicalPhaseFieldProcess<DisplacementDim>::
     postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                std::vector<GlobalVector*> const& x_dot,
                                 double const t,
                                 double const dt,
                                 int const process_id)
@@ -299,7 +300,8 @@ void ThermoMechanicalPhaseFieldProcess<DisplacementDim>::
     ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
     GlobalExecutor::executeSelectedMemberOnDereferenced(
         &ThermoMechanicalPhaseFieldLocalAssemblerInterface::postTimestep,
-        _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, t, dt);
+        _local_assemblers, pv.getActiveElementIDs(), dof_tables, x, x_dot, t,
+        dt);
 }
 
 template <int DisplacementDim>
diff --git a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h
index 3a7967474fb..0bc74f00845 100644
--- a/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h
+++ b/ProcessLib/ThermoMechanicalPhaseField/ThermoMechanicalPhaseFieldProcess.h
@@ -108,6 +108,7 @@ private:
                                     const int process_id) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      double const t, double const dt,
                                      int const process_id) override;
 
diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsFEM.h b/ProcessLib/ThermoMechanics/ThermoMechanicsFEM.h
index 8fb6e8d309f..eae77e1a27e 100644
--- a/ProcessLib/ThermoMechanics/ThermoMechanicsFEM.h
+++ b/ProcessLib/ThermoMechanics/ThermoMechanicsFEM.h
@@ -225,6 +225,7 @@ public:
     }
 
     void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                              Eigen::VectorXd const& /*local_x_dot*/,
                               double const /*t*/, double const /*dt*/) override
     {
         unsigned const n_integration_points =
diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp
index 3d7f94b91c1..efd54a16250 100644
--- a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp
+++ b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp
@@ -330,7 +330,8 @@ void ThermoMechanicsProcess<DisplacementDim>::preTimestepConcreteProcess(
 
 template <int DisplacementDim>
 void ThermoMechanicsProcess<DisplacementDim>::postTimestepConcreteProcess(
-    std::vector<GlobalVector*> const& x, double const t, double const dt,
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& x_dot, double const t, double const dt,
     int const process_id)
 {
     if (process_id != 0)
@@ -350,7 +351,7 @@ void ThermoMechanicsProcess<DisplacementDim>::postTimestepConcreteProcess(
     ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
     GlobalExecutor::executeSelectedMemberOnDereferenced(
         &LocalAssemblerInterface::postTimestep, _local_assemblers,
-        pv.getActiveElementIDs(), dof_tables, x, t, dt);
+        pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt);
 }
 
 template <int DisplacementDim>
diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.h b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.h
index 4ecb93d8650..fc1046dcce1 100644
--- a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.h
+++ b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.h
@@ -84,6 +84,7 @@ private:
                                     const int process_id) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      const double t, const double dt,
                                      int const process_id) override;
 
diff --git a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM.h b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM.h
index f6a5b081f9c..0dd5422503e 100644
--- a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM.h
+++ b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowFEM.h
@@ -96,6 +96,7 @@ public:
     }
 
     void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                              Eigen::VectorXd const& /*local_x_dot*/,
                               double const /*t*/,
                               double const /*dt*/) override
     {
diff --git a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp
index 207d5463b76..e4d15a92b0c 100644
--- a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp
+++ b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.cpp
@@ -173,7 +173,8 @@ void ThermoRichardsFlowProcess::assembleWithJacobianConcreteProcess(
 }
 
 void ThermoRichardsFlowProcess::postTimestepConcreteProcess(
-    std::vector<GlobalVector*> const& x, double const t, double const dt,
+    std::vector<GlobalVector*> const& x,
+    std::vector<GlobalVector*> const& x_dot, double const t, double const dt,
     const int process_id)
 {
     if (process_id != 0)
@@ -188,7 +189,7 @@ void ThermoRichardsFlowProcess::postTimestepConcreteProcess(
     ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
     GlobalExecutor::executeSelectedMemberOnDereferenced(
         &LocalAssemblerIF::postTimestep, _local_assemblers,
-        pv.getActiveElementIDs(), dof_tables, x, t, dt);
+        pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt);
 }
 
 void ThermoRichardsFlowProcess::computeSecondaryVariableConcrete(
diff --git a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.h b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.h
index a2b2397fb04..c93f2ee3091 100644
--- a/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.h
+++ b/ProcessLib/ThermoRichardsFlow/ThermoRichardsFlowProcess.h
@@ -127,6 +127,7 @@ private:
         GlobalMatrix& Jac) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      double const t, double const dt,
                                      const int process_id) override;
 
diff --git a/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h b/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h
index f5edbc4d373..e3ba811b6d4 100644
--- a/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h
+++ b/ProcessLib/ThermoRichardsMechanics/LocalAssemblerInterface.h
@@ -105,6 +105,7 @@ struct LocalAssemblerInterface : public ProcessLib::LocalAssemblerInterface,
     }
 
     void postTimestepConcrete(Eigen::VectorXd const& /*local_x*/,
+                              Eigen::VectorXd const& /*local_x_dot*/,
                               double const /*t*/,
                               double const /*dt*/) override
     {
diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp
index 8594a81dcb5..acdf602bfa9 100644
--- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp
+++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.cpp
@@ -274,6 +274,7 @@ ThermoRichardsMechanicsProcess<DisplacementDim, ConstitutiveTraits>::
 template <int DisplacementDim, typename ConstitutiveTraits>
 void ThermoRichardsMechanicsProcess<DisplacementDim, ConstitutiveTraits>::
     postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                std::vector<GlobalVector*> const& x_dot,
                                 double const t, double const dt,
                                 const int process_id)
 {
@@ -284,7 +285,7 @@ void ThermoRichardsMechanicsProcess<DisplacementDim, ConstitutiveTraits>::
     ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
     GlobalExecutor::executeSelectedMemberOnDereferenced(
         &LocalAssemblerIF::postTimestep, local_assemblers_,
-        pv.getActiveElementIDs(), dof_tables, x, t, dt);
+        pv.getActiveElementIDs(), dof_tables, x, x_dot, t, dt);
 }
 
 template <int DisplacementDim, typename ConstitutiveTraits>
diff --git a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.h b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.h
index f9f6c07c2bb..c25db50b506 100644
--- a/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.h
+++ b/ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsProcess.h
@@ -191,6 +191,7 @@ private:
                                     const int /*process_id*/) override;
 
     void postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
+                                     std::vector<GlobalVector*> const& x_dot,
                                      double const t, double const dt,
                                      const int process_id) override;
 
diff --git a/ProcessLib/TimeLoop.cpp b/ProcessLib/TimeLoop.cpp
index 5cb4a4aeb6a..048e5d88830 100644
--- a/ProcessLib/TimeLoop.cpp
+++ b/ProcessLib/TimeLoop.cpp
@@ -100,7 +100,7 @@ void postTimestepForAllProcesses(
         auto& x_dot = *x_dots[process_id];
         pcs.computeSecondaryVariable(t, dt, process_solutions, x_dot,
                                      process_id);
-        pcs.postTimestep(process_solutions, t, dt, process_id);
+        pcs.postTimestep(process_solutions, x_dots, t, dt, process_id);
     }
     for (auto& x_dot : x_dots)
     {
-- 
GitLab