From 1acc4362f9bf98f3e3ce9e859ec8874f0956969c Mon Sep 17 00:00:00 2001
From: Wenqing Wang <wenqing.wang@ufz.de>
Date: Thu, 21 Feb 2019 14:49:08 +0100
Subject: [PATCH] [HT] Introduced two members of process IDs for the staggered
 scheme

---
 ProcessLib/HT/CreateHTProcess.cpp |  7 ++++++-
 ProcessLib/HT/HTProcess.cpp       | 19 ++++++++++---------
 ProcessLib/HT/HTProcess.h         |  8 ++++++--
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/ProcessLib/HT/CreateHTProcess.cpp b/ProcessLib/HT/CreateHTProcess.cpp
index 8c421c21434..ca665c136be 100644
--- a/ProcessLib/HT/CreateHTProcess.cpp
+++ b/ProcessLib/HT/CreateHTProcess.cpp
@@ -75,6 +75,10 @@ std::unique_ptr<Process> createHTProcess(
             process_variables.push_back(std::move(per_process_variables));
         }
     }
+    // Process IDs, which are set according to the appearance order of the
+    // process variables.
+    const int _heat_transport_process_id = 0;
+    const int _hydraulic_process_id = 1;
 
     MaterialLib::PorousMedium::PorousMediaProperties porous_media_properties{
         MaterialLib::PorousMedium::createPorousMediaProperties(mesh, config,
@@ -239,7 +243,8 @@ std::unique_ptr<Process> createHTProcess(
         mesh, std::move(jacobian_assembler), parameters, integration_order,
         std::move(process_variables), std::move(material_properties),
         std::move(secondary_variables), std::move(named_function_caller),
-        use_monolithic_scheme, std::move(surfaceflux));
+        use_monolithic_scheme, std::move(surfaceflux),
+        _heat_transport_process_id, _hydraulic_process_id);
 }
 
 }  // namespace HT
diff --git a/ProcessLib/HT/HTProcess.cpp b/ProcessLib/HT/HTProcess.cpp
index 2e22402088e..0de70fb4e80 100644
--- a/ProcessLib/HT/HTProcess.cpp
+++ b/ProcessLib/HT/HTProcess.cpp
@@ -35,13 +35,17 @@ HTProcess::HTProcess(
     SecondaryVariableCollection&& secondary_variables,
     NumLib::NamedFunctionCaller&& named_function_caller,
     bool const use_monolithic_scheme,
-    std::unique_ptr<ProcessLib::SurfaceFluxData>&& surfaceflux)
+    std::unique_ptr<ProcessLib::SurfaceFluxData>&& surfaceflux,
+    const int heat_transport_process_id,
+    const int hydraulic_process_id)
     : Process(mesh, std::move(jacobian_assembler), parameters,
               integration_order, std::move(process_variables),
               std::move(secondary_variables), std::move(named_function_caller),
               use_monolithic_scheme),
       _material_properties(std::move(material_properties)),
-      _surfaceflux(std::move(surfaceflux))
+      _surfaceflux(std::move(surfaceflux)),
+      _heat_transport_process_id(heat_transport_process_id),
+      _hydraulic_process_id(hydraulic_process_id)
 {
 }
 
@@ -67,14 +71,11 @@ void HTProcess::initializeConcreteProcess(
     }
     else
     {
-        const int heat_transport_process_id = 0;
-        const int hydraulic_process_id = 1;
-
         ProcessLib::createLocalAssemblers<StaggeredHTFEM>(
             mesh.getDimension(), mesh.getElements(), dof_table,
             pv.getShapeFunctionOrder(), _local_assemblers,
             mesh.isAxiallySymmetric(), integration_order, *_material_properties,
-            heat_transport_process_id, hydraulic_process_id);
+            _heat_transport_process_id, _hydraulic_process_id);
     }
 
     _secondary_variables.addSecondaryVariable(
@@ -99,7 +100,7 @@ void HTProcess::assembleConcreteProcess(const double t,
     }
     else
     {
-        if (_coupled_solutions->process_id == 0)
+        if (_coupled_solutions->process_id == _heat_transport_process_id)
         {
             DBUG(
                 "Assemble the equations of heat transport process within "
@@ -259,7 +260,7 @@ Eigen::Vector3d HTProcess::getFlux(std::size_t element_id,
     return _local_assemblers[element_id]->getFlux(p, t, local_x);
 }
 
-// this is almost a copy of the implemention in the GroundwaterFlow
+// this is almost a copy of the implementation in the GroundwaterFlow
 void HTProcess::postTimestepConcreteProcess(GlobalVector const& x,
                                             const double t,
                                             const double /*delta_t*/,
@@ -272,7 +273,7 @@ void HTProcess::postTimestepConcreteProcess(GlobalVector const& x,
             "The condition of process_id = 0 must be satisfied for "
             "monolithic HTProcess, which is a single process.");
     }
-    if (!_use_monolithic_scheme && process_id != 1)
+    if (!_use_monolithic_scheme && process_id != _hydraulic_process_id)
     {
         DBUG("This is the thermal part of the staggered HTProcess.");
         return;
diff --git a/ProcessLib/HT/HTProcess.h b/ProcessLib/HT/HTProcess.h
index 7b5a93a7057..1c1d06b1e6d 100644
--- a/ProcessLib/HT/HTProcess.h
+++ b/ProcessLib/HT/HTProcess.h
@@ -61,8 +61,9 @@ public:
         SecondaryVariableCollection&& secondary_variables,
         NumLib::NamedFunctionCaller&& named_function_caller,
         bool const use_monolithic_scheme,
-        std::unique_ptr<ProcessLib::SurfaceFluxData>&& surfaceflux);
-
+        std::unique_ptr<ProcessLib::SurfaceFluxData>&& surfaceflux,
+        const int heat_transport_process_id,
+        const int hydraulic_process_id);
     //! \name ODESystem interface
     //! @{
 
@@ -118,6 +119,9 @@ private:
     std::array<std::unique_ptr<GlobalVector>, 2> _xs_previous_timestep;
 
     std::unique_ptr<ProcessLib::SurfaceFluxData> _surfaceflux;
+
+    const int _heat_transport_process_id;
+    const int _hydraulic_process_id;
 };
 
 }  // namespace HT
-- 
GitLab