From 193a183d6c7dc610b425eb400bd9884de234561c Mon Sep 17 00:00:00 2001
From: ChaofanChen <chaofan.chen@ufz.de>
Date: Wed, 30 Jan 2019 18:12:26 +0100
Subject: [PATCH] [PL] Move the similar parts between CXA and CXC to a basic
 class.

---
 .../HeatTransportBHE/BHE/BHECommonCoaxial.h   | 51 +++++++++++
 ProcessLib/HeatTransportBHE/BHE/BHE_CXA.cpp   | 82 ++++++------------
 ProcessLib/HeatTransportBHE/BHE/BHE_CXA.h     | 32 ++-----
 ProcessLib/HeatTransportBHE/BHE/BHE_CXC.cpp   | 74 ++++++----------
 ProcessLib/HeatTransportBHE/BHE/BHE_CXC.h     | 31 ++-----
 .../HeatTransportBHE/BHE/BoreholeGeometry.cpp | 33 +++++++
 .../HeatTransportBHE/BHE/BoreholeGeometry.h   |  7 ++
 .../HeatTransportBHE/BHE/CreateBHE1U.cpp      | 52 ++---------
 .../HeatTransportBHE/BHE/CreateBHECXA.cpp     | 56 ++----------
 .../HeatTransportBHE/BHE/CreateBHECXC.cpp     | 66 +++-----------
 .../HeatTransportBHE/BHE/GroutParameters.cpp  | 40 +++++++++
 .../HeatTransportBHE/BHE/GroutParameters.h    |  9 ++
 ProcessLib/HeatTransportBHE/BHE/Physics.h     |  6 ++
 .../BHE/PipeConfigurationCXA.h                | 34 --------
 ...rationCXC.h => PipeConfigurationCoaxial.h} |  4 +-
 .../BHE/RefrigerantProperties.cpp             | 45 ++++++++++
 .../BHE/RefrigerantProperties.h               | 10 +++
 .../BHE/ThermoMechanicalFlowProperties.h      | 86 ++++++++++++++++++-
 18 files changed, 385 insertions(+), 333 deletions(-)
 create mode 100644 ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.h
 create mode 100644 ProcessLib/HeatTransportBHE/BHE/BoreholeGeometry.cpp
 create mode 100644 ProcessLib/HeatTransportBHE/BHE/GroutParameters.cpp
 delete mode 100644 ProcessLib/HeatTransportBHE/BHE/PipeConfigurationCXA.h
 rename ProcessLib/HeatTransportBHE/BHE/{PipeConfigurationCXC.h => PipeConfigurationCoaxial.h} (90%)
 create mode 100644 ProcessLib/HeatTransportBHE/BHE/RefrigerantProperties.cpp

diff --git a/ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.h b/ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.h
new file mode 100644
index 00000000000..ad0488b9aea
--- /dev/null
+++ b/ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.h
@@ -0,0 +1,51 @@
+/**
+ *
+ * \copyright
+ * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ */
+
+#pragma once
+
+#include "BHECommon.h"
+#include "PipeConfigurationCoaxial.h"
+
+namespace ProcessLib
+{
+namespace HeatTransportBHE
+{
+namespace BHE
+{
+class BHECoaxialCommon : public BHECommon
+{
+public:
+    BHECoaxialCommon(BoreholeGeometry const& borehole,
+                     RefrigerantProperties const& refrigerant,
+                     GroutParameters const& grout,
+                     FlowAndTemperatureControl const& flowAndTemperatureControl,
+                     PipeConfigurationCoaxial const& pipes)
+        : BHECommon{borehole, refrigerant, grout, flowAndTemperatureControl},
+          _pipes(pipes)
+    {
+    }
+    static constexpr int number_of_unknowns = 3;
+    static constexpr int number_of_grout_zones = 1;
+
+protected:
+    PipeConfigurationCoaxial const _pipes;
+
+    /// Here we store the thermal resistances needed for computation of the heat
+    /// exchange coefficients in the governing equations of BHE.
+    /// These governing equations can be found in
+    /// 1) Diersch (2013) FEFLOW book on page 958, M.3, or
+    /// 2) Diersch (2011) Comp & Geosci 37:1122-1135, Eq. 90-97.
+    std::array<double, number_of_unknowns> _thermal_resistances;
+
+    /// Flow velocity inside the pipes and annulus. Depends on the flow_rate.
+    double _flow_velocity, _flow_velocity_annulus;
+};
+}  // end of namespace BHE
+}  // end of namespace HeatTransportBHE
+}  // end of namespace ProcessLib
diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_CXA.cpp b/ProcessLib/HeatTransportBHE/BHE/BHE_CXA.cpp
index 2a305b3765a..07becb92b95 100644
--- a/ProcessLib/HeatTransportBHE/BHE/BHE_CXA.cpp
+++ b/ProcessLib/HeatTransportBHE/BHE/BHE_CXA.cpp
@@ -24,9 +24,9 @@ BHE_CXA::BHE_CXA(BoreholeGeometry const& borehole,
                  RefrigerantProperties const& refrigerant,
                  GroutParameters const& grout,
                  FlowAndTemperatureControl const& flowAndTemperatureControl,
-                 PipeConfigurationCXA const& pipes)
-    : BHECommon{borehole, refrigerant, grout, flowAndTemperatureControl},
-      _pipes(pipes)
+                 PipeConfigurationCoaxial const& pipes)
+    : BHECoaxialCommon{borehole, refrigerant, grout, flowAndTemperatureControl,
+                       pipes}
 {
     // Initialize thermal resistances.
     auto values = apply_visitor(
@@ -97,20 +97,16 @@ void BHE_CXA::updateHeatTransferCoefficients(double const flow_rate)
 
 {
     auto const tm_flow_properties_annulus =
-        calculateThermoMechanicalFlowPropertiesAnnulus(
-            _pipes.inner_outflow_pipe,
-            _pipes.outer_pipe,
-            borehole_geometry.length,
-            refrigerant,
-            flow_rate);
+        calculateThermoMechanicalFlowPropertiesAnnulus(_pipes.inner_pipe,
+                                                       _pipes.outer_pipe,
+                                                       borehole_geometry.length,
+                                                       refrigerant,
+                                                       flow_rate);
 
     _flow_velocity_annulus = tm_flow_properties_annulus.velocity;
 
-    auto const tm_flow_properties =
-        calculateThermoMechanicalFlowPropertiesPipe(_pipes.inner_outflow_pipe,
-                                                    borehole_geometry.length,
-                                                    refrigerant,
-                                                    flow_rate);
+    auto const tm_flow_properties = calculateThermoMechanicalFlowPropertiesPipe(
+        _pipes.inner_pipe, borehole_geometry.length, refrigerant, flow_rate);
 
     _flow_velocity = tm_flow_properties.velocity;
     _thermal_resistances =
@@ -121,51 +117,29 @@ void BHE_CXA::updateHeatTransferCoefficients(double const flow_rate)
 /// Nu_o is the Nusselt number of inner pipe, Nu_i is the Nusselt number of
 /// annulus.
 std::array<double, BHE_CXA::number_of_unknowns> BHE_CXA::calcThermalResistances(
-    double const Nu_o, double const Nu_i)
+    double const Nu_inner_outflow_pipe, double const Nu_annulus)
 {
-    static constexpr double pi = boost::math::constants::pi<double>();
-
-    double const& D = borehole_geometry.diameter;
-    double const& lambda_r = refrigerant.thermal_conductivity;
-    double const& lambda_g = grout.lambda_g;
-    double const& d_o = _pipes.outer_pipe.diameter;
-    double const& d_i = _pipes.inner_outflow_pipe.diameter;
-    double const& b_o = _pipes.outer_pipe.wall_thickness;
-    double const& b_i = _pipes.inner_outflow_pipe.wall_thickness;
-    double const& lambda_p_o = _pipes.outer_pipe.wall_thermal_conductivity;
-    double const& lambda_p_i =
-        _pipes.inner_outflow_pipe.wall_thermal_conductivity;
-
-    // thermal resistances due to advective flow of refrigerant in the _pipes
-    // Eq. 58, 59, 60 in Diersch_2011_CG
-    double const d_h = d_o - d_i - 2 * b_i;
-    double const d_i_o = d_i + 2 * b_i;
-    double const d_o_o = d_o + 2 * b_o;
-    double const R_adv_o = 1.0 / (Nu_o * lambda_r * pi);
-    double const R_adv_a_i = 1.0 / (Nu_i * lambda_r * pi) * (d_h / d_i_o);
-    double const R_adv_b_i = 1.0 / (Nu_i * lambda_r * pi) * (d_h / d_o);
+    // thermal resistances due to advective flow of refrigerant in the pipes
+    auto const R_advective = calculateAdvectiveThermalResistance(
+        _pipes.inner_pipe, _pipes.outer_pipe, refrigerant,
+        Nu_inner_outflow_pipe, Nu_annulus);
 
     // thermal resistance due to thermal conductivity of the pipe wall material
-    // Eq. 66
-    double const R_con_o = std::log(d_i_o / d_i) / (2.0 * pi * lambda_p_i);
-    double const R_con_i = std::log(d_o_o / d_o) / (2.0 * pi * lambda_p_o);
-
-    // Eq. 68
-    double const chi =
-        std::log(std::sqrt(D * D + d_o_o * d_o_o) / std::sqrt(2) / d_o_o) /
-        std::log(D / d_o_o);
-    // Eq. 69
-    // thermal resistances of the grout
-    double const R_g = std::log(D / d_o_o) / 2 / pi / lambda_g;
-    // Eq. 67
-    // thermal resistance due to the grout transition.
-    double const R_con_b = chi * R_g;
-    // Eq. 56 and 57
-    double const R_ff = R_adv_o + R_adv_a_i + R_con_o;
-    double const R_fig = R_adv_b_i + R_con_i + R_con_b;
+    auto const R_conductive = calculatePipeWallThermalResistance(
+        _pipes.inner_pipe, _pipes.outer_pipe);
+
+    // thermal resistance due to the grout transition and grout-soil exchange.
+    auto const R = calculateGroutAndGroutSoilExchangeThermalResistance(
+        _pipes.outer_pipe, grout, borehole_geometry.diameter);
 
     // thermal resistance due to grout-soil exchange
-    double const R_gs = (1 - chi) * R_g;
+    double const R_gs = R.grout_soil;
+
+    // Eq. 56 and 57
+    double const R_ff = R_advective.inner_pipe_coaxial + R_advective.a_annulus +
+                        R_conductive.inner_pipe_coaxial;
+    double const R_fig =
+        R_advective.b_annulus + R_conductive.annulus + R.conductive_b;
 
     return {{R_fig, R_ff, R_gs}};
 
diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_CXA.h b/ProcessLib/HeatTransportBHE/BHE/BHE_CXA.h
index 5cdadeb6c04..15584bc7406 100644
--- a/ProcessLib/HeatTransportBHE/BHE/BHE_CXA.h
+++ b/ProcessLib/HeatTransportBHE/BHE/BHE_CXA.h
@@ -13,9 +13,9 @@
 
 #include "BaseLib/Error.h"
 
-#include "BHECommon.h"
+#include "BHECommonCoaxial.h"
 #include "FlowAndTemperatureControl.h"
-#include "PipeConfigurationCXA.h"
+#include "PipeConfigurationCoaxial.h"
 
 namespace ProcessLib
 {
@@ -36,17 +36,15 @@ namespace BHE
  * surrounding soil is regulated through the thermal resistance values, which
  * are calculated specifically during the initialization of the class.
  */
-class BHE_CXA final : public BHECommon
+
+class BHE_CXA final : public BHECoaxialCommon
 {
 public:
     BHE_CXA(BoreholeGeometry const& borehole,
             RefrigerantProperties const& refrigerant,
             GroutParameters const& grout,
             FlowAndTemperatureControl const& flowAndTemperatureControl,
-            PipeConfigurationCXA const& pipes);
-
-    static constexpr int number_of_unknowns = 3;
-    static constexpr int number_of_grout_zones = 1;
+            PipeConfigurationCoaxial const& pipes);
 
     std::array<double, number_of_unknowns> pipeHeatCapacities() const;
 
@@ -118,14 +116,10 @@ public:
     static constexpr std::pair<int, int> inflow_outflow_bc_component_ids[] = {
         {0, 1}};
 
-private:
-    // Placing it here before using it in the cross_section_areas.
-    PipeConfigurationCXA const _pipes;
-
 public:
     std::array<double, number_of_unknowns> const cross_section_areas = {
-        {_pipes.outer_pipe.area() - _pipes.inner_outflow_pipe.outsideArea(),
-         _pipes.inner_outflow_pipe.area(),
+        {_pipes.outer_pipe.area() - _pipes.inner_pipe.outsideArea(),
+         _pipes.inner_pipe.area(),
          borehole_geometry.area() - _pipes.outer_pipe.outsideArea()}};
 
 private:
@@ -133,18 +127,6 @@ private:
 
     std::array<double, number_of_unknowns> calcThermalResistances(
         double const Nu_o, double const Nu_i);
-
-private:
-    /// PHI_fig, PHI_ff, PHI_gs;
-    /// Here we store the thermal resistances needed for computation of the heat
-    /// exchange coefficients in the governing equations of BHE.
-    /// These governing equations can be found in
-    /// 1) Diersch (2013) FEFLOW book on page 958, M.3, or
-    /// 2) Diersch (2011) Comp & Geosci 37:1122-1135, Eq. 90-97.
-    std::array<double, number_of_unknowns> _thermal_resistances;
-
-    /// Flow velocity inside the pipes and annulus. Depends on the flow_rate.
-    double _flow_velocity, _flow_velocity_annulus;
 };
 }  // namespace BHE
 }  // namespace HeatTransportBHE
diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_CXC.cpp b/ProcessLib/HeatTransportBHE/BHE/BHE_CXC.cpp
index b13df15c940..773d9dba212 100644
--- a/ProcessLib/HeatTransportBHE/BHE/BHE_CXC.cpp
+++ b/ProcessLib/HeatTransportBHE/BHE/BHE_CXC.cpp
@@ -24,9 +24,9 @@ BHE_CXC::BHE_CXC(BoreholeGeometry const& borehole,
                  RefrigerantProperties const& refrigerant,
                  GroutParameters const& grout,
                  FlowAndTemperatureControl const& flowAndTemperatureControl,
-                 PipeConfigurationCXC const& pipes)
-    : BHECommon{borehole, refrigerant, grout, flowAndTemperatureControl},
-      _pipes(pipes)
+                 PipeConfigurationCoaxial const& pipes)
+    : BHECoaxialCommon{borehole, refrigerant, grout, flowAndTemperatureControl,
+                       pipes}
 {
     // Initialize thermal resistances.
     auto values = apply_visitor(
@@ -97,7 +97,7 @@ void BHE_CXC::updateHeatTransferCoefficients(double const flow_rate)
 
 {
     auto const tm_flow_properties_annulus =
-        calculateThermoMechanicalFlowPropertiesAnnulus(_pipes.inner_inflow_pipe,
+        calculateThermoMechanicalFlowPropertiesAnnulus(_pipes.inner_pipe,
                                                        _pipes.outer_pipe,
                                                        borehole_geometry.length,
                                                        refrigerant,
@@ -105,11 +105,8 @@ void BHE_CXC::updateHeatTransferCoefficients(double const flow_rate)
 
     _flow_velocity_annulus = tm_flow_properties_annulus.velocity;
 
-    auto const tm_flow_properties =
-        calculateThermoMechanicalFlowPropertiesPipe(_pipes.inner_inflow_pipe,
-                                                    borehole_geometry.length,
-                                                    refrigerant,
-                                                    flow_rate);
+    auto const tm_flow_properties = calculateThermoMechanicalFlowPropertiesPipe(
+        _pipes.inner_pipe, borehole_geometry.length, refrigerant, flow_rate);
 
     _flow_velocity = tm_flow_properties.velocity;
     _thermal_resistances =
@@ -122,49 +119,30 @@ void BHE_CXC::updateHeatTransferCoefficients(double const flow_rate)
 std::array<double, BHE_CXC::number_of_unknowns> BHE_CXC::calcThermalResistances(
     double const Nu_annulus, double const Nu_inner_inflow_pipe)
 {
-    static constexpr double pi = boost::math::constants::pi<double>();
-
-    double const& D = borehole_geometry.diameter;
-    double const& lambda_r = refrigerant.thermal_conductivity;
-    double const& lambda_g = grout.lambda_g;
-    double const& d_o = _pipes.outer_pipe.diameter;
-    double const& d_i = _pipes.inner_inflow_pipe.diameter;
-    double const& b_o = _pipes.outer_pipe.wall_thickness;
-    double const& b_i = _pipes.inner_inflow_pipe.wall_thickness;
-    double const& lambda_p_o = _pipes.outer_pipe.wall_thermal_conductivity;
-    double const& lambda_p_i =
-        _pipes.inner_inflow_pipe.wall_thermal_conductivity;
-
-    // thermal resistances due to advective flow of refrigerant in the _pipes
-    // Eq. 73, 74, 75 in Diersch_2011_CG
-    double const d_h = d_o - d_i - 2 * b_i;
-    double const d_i_o = d_i + 2 * b_i;
-    double const d_o_o = d_o + 2 * b_o;
-    double const R_adv_i = 1.0 / (Nu_inner_inflow_pipe * lambda_r * pi);
-    double const R_adv_a_o = 1.0 / (Nu_annulus * lambda_r * pi) * (d_h / d_i_o);
-    double const R_adv_b_o = 1.0 / (Nu_annulus * lambda_r * pi) * (d_h / d_o);
+    // thermal resistances due to advective flow of refrigerant in the pipes
+    auto const R_advective =
+        calculateAdvectiveThermalResistance(_pipes.inner_pipe,
+                                            _pipes.outer_pipe,
+                                            refrigerant,
+                                            Nu_inner_inflow_pipe,
+                                            Nu_annulus);
 
     // thermal resistance due to thermal conductivity of the pipe wall material
-    // Eq. 81
-    double const R_con_o = std::log(d_o_o / d_o) / (2.0 * pi * lambda_p_o);
-    double const R_con_i = std::log(d_i_o / d_i) / (2.0 * pi * lambda_p_i);
-
-    // Eq. 83
-    double const chi =
-        std::log(std::sqrt(D * D + d_o_o * d_o_o) / std::sqrt(2) / d_o_o) /
-        std::log(D / d_o_o);
-    // Eq. 84
-    // thermal resistances of the grout
-    double const R_g = std::log(D / d_o_o) / 2 / pi / lambda_g;
-    // Eq. 82
-    // thermal resistance due to the grout transition.
-    double const R_con_b = chi * R_g;
-    // Eq. 71 and 72
-    double const R_ff = R_adv_i + R_adv_a_o + R_con_i;
-    double const R_fog = R_adv_b_o + R_con_o + R_con_b;
+    auto const R_conductive = calculatePipeWallThermalResistance(
+        _pipes.inner_pipe, _pipes.outer_pipe);
+
+    // thermal resistance due to the grout transition grout-soil exchange.
+    auto const R = calculateGroutAndGroutSoilExchangeThermalResistance(
+        _pipes.outer_pipe, grout, borehole_geometry.diameter);
 
     // thermal resistance due to grout-soil exchange
-    double const R_gs = (1 - chi) * R_g;
+    double const R_gs = R.grout_soil;
+
+    // Eq. 71 and 72
+    double const R_ff = R_advective.inner_pipe_coaxial + R_advective.a_annulus +
+                        R_conductive.inner_pipe_coaxial;
+    double const R_fog =
+        R_advective.b_annulus + R_conductive.annulus + R.conductive_b;
 
     return {{R_ff, R_fog, R_gs}};
 
diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_CXC.h b/ProcessLib/HeatTransportBHE/BHE/BHE_CXC.h
index 9c40e9b7191..a91db70fab0 100644
--- a/ProcessLib/HeatTransportBHE/BHE/BHE_CXC.h
+++ b/ProcessLib/HeatTransportBHE/BHE/BHE_CXC.h
@@ -13,9 +13,9 @@
 
 #include "BaseLib/Error.h"
 
-#include "BHECommon.h"
+#include "BHECommonCoaxial.h"
 #include "FlowAndTemperatureControl.h"
-#include "PipeConfigurationCXC.h"
+#include "PipeConfigurationCoaxial.h"
 
 namespace ProcessLib
 {
@@ -36,17 +36,14 @@ namespace BHE
  * surrounding soil is regulated through the thermal resistance values, which
  * are calculated specifically during the initialization of the class.
  */
-class BHE_CXC final : public BHECommon
+class BHE_CXC final : public BHECoaxialCommon
 {
 public:
     BHE_CXC(BoreholeGeometry const& borehole,
             RefrigerantProperties const& refrigerant,
             GroutParameters const& grout,
             FlowAndTemperatureControl const& flowAndTemperatureControl,
-            PipeConfigurationCXC const& pipes);
-
-    static constexpr int number_of_unknowns = 3;
-    static constexpr int number_of_grout_zones = 1;
+            PipeConfigurationCoaxial const& pipes);
 
     std::array<double, number_of_unknowns> pipeHeatCapacities() const;
 
@@ -118,14 +115,10 @@ public:
     static constexpr std::pair<int, int> inflow_outflow_bc_component_ids[] = {
         {0, 1}};
 
-private:
-    // Placing it here before using it in the cross_section_areas.
-    PipeConfigurationCXC const _pipes;
-
 public:
     std::array<double, number_of_unknowns> const cross_section_areas = {
-        {_pipes.inner_inflow_pipe.area(),
-         _pipes.outer_pipe.area() - _pipes.inner_inflow_pipe.outsideArea(),
+        {_pipes.inner_pipe.area(),
+         _pipes.outer_pipe.area() - _pipes.inner_pipe.outsideArea(),
          borehole_geometry.area() - _pipes.outer_pipe.outsideArea()}};
 
 private:
@@ -133,18 +126,6 @@ private:
 
     std::array<double, number_of_unknowns> calcThermalResistances(
         double const Nu_o, double const Nu_i);
-
-private:
-    /// PHI_ff, PHI_fog, PHI_gs;
-    /// Here we store the thermal resistances needed for computation of the heat
-    /// exchange coefficients in the governing equations of BHE.
-    /// These governing equations can be found in
-    /// 1) Diersch (2013) FEFLOW book on page 958, M.3, or
-    /// 2) Diersch (2011) Comp & Geosci 37:1122-1135, Eq. 90-97.
-    std::array<double, number_of_unknowns> _thermal_resistances;
-
-    /// Flow velocity inside the pipes and annulus. Depends on the flow_rate.
-    double _flow_velocity, _flow_velocity_annulus;
 };
 }  // namespace BHE
 }  // namespace HeatTransportBHE
diff --git a/ProcessLib/HeatTransportBHE/BHE/BoreholeGeometry.cpp b/ProcessLib/HeatTransportBHE/BHE/BoreholeGeometry.cpp
new file mode 100644
index 00000000000..7ace92bbbcf
--- /dev/null
+++ b/ProcessLib/HeatTransportBHE/BHE/BoreholeGeometry.cpp
@@ -0,0 +1,33 @@
+/**
+ * \file
+ *
+ * \copyright
+ * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ *
+ */
+
+#include "BoreholeGeometry.h"
+#include "BaseLib/ConfigTree.h"
+
+namespace ProcessLib
+{
+namespace HeatTransportBHE
+{
+namespace BHE
+{
+BoreholeGeometry createBoreholeGeometry(BaseLib::ConfigTree const& config)
+{
+    const double borehole_length =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole__length}
+        config.getConfigParameter<double>("length");
+    const double borehole_diameter =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole__diameter}
+        config.getConfigParameter<double>("diameter");
+    return {borehole_length, borehole_diameter};
+}
+}  // namespace BHE
+}  // namespace HeatTransportBHE
+}  // namespace ProcessLib
diff --git a/ProcessLib/HeatTransportBHE/BHE/BoreholeGeometry.h b/ProcessLib/HeatTransportBHE/BHE/BoreholeGeometry.h
index aa54041c954..0cf692da4e4 100644
--- a/ProcessLib/HeatTransportBHE/BHE/BoreholeGeometry.h
+++ b/ProcessLib/HeatTransportBHE/BHE/BoreholeGeometry.h
@@ -13,6 +13,10 @@
 
 #include <boost/math/constants/constants.hpp>
 
+namespace BaseLib
+{
+class ConfigTree;
+}
 namespace ProcessLib
 {
 namespace HeatTransportBHE
@@ -39,6 +43,9 @@ struct BoreholeGeometry
         return pi * diameter * diameter / 4;
     }
 };
+
+BoreholeGeometry createBoreholeGeometry(BaseLib::ConfigTree const& config);
+
 }  // namespace BHE
 }  // namespace HeatTransportBHE
 }  // namespace ProcessLib
diff --git a/ProcessLib/HeatTransportBHE/BHE/CreateBHE1U.cpp b/ProcessLib/HeatTransportBHE/BHE/CreateBHE1U.cpp
index 2bbf2317821..c3b65d521aa 100644
--- a/ProcessLib/HeatTransportBHE/BHE/CreateBHE1U.cpp
+++ b/ProcessLib/HeatTransportBHE/BHE/CreateBHE1U.cpp
@@ -25,14 +25,8 @@ BHE::BHE_1U createBHE1U(
         curves)
 {
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole}
-    auto const& borehole_config = config.getConfigSubtree("borehole");
-    const double borehole_length =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole__length}
-        borehole_config.getConfigParameter<double>("length");
-    const double borehole_diameter =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole__diameter}
-        borehole_config.getConfigParameter<double>("diameter");
-    BoreholeGeometry const borehole{borehole_length, borehole_diameter};
+    auto const borehole_geometry =
+        createBoreholeGeometry(config.getConfigSubtree("borehole"));
 
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes}
     auto const& pipes_config = config.getConfigSubtree("pipes");
@@ -52,44 +46,11 @@ BHE::BHE_1U createBHE1U(
                                     pipe_longitudinal_dispersion_length};
 
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout}
-    auto const& grout_config = config.getConfigSubtree("grout");
-    const double grout_density =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__density}
-        grout_config.getConfigParameter<double>("density");
-    const double grout_porosity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__porosity}
-        grout_config.getConfigParameter<double>("porosity");
-    const double grout_heat_capacity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__heat_capacity}
-        grout_config.getConfigParameter<double>("heat_capacity");
-    const double grout_thermal_conductivity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__thermal_conductivity}
-        grout_config.getConfigParameter<double>("thermal_conductivity");
-    GroutParameters const grout{grout_density, grout_porosity,
-                                grout_heat_capacity,
-                                grout_thermal_conductivity};
+    auto const grout = createGroutParameters(config.getConfigSubtree("grout"));
 
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant}
-    auto const& refrigerant_config = config.getConfigSubtree("refrigerant");
-    double const refrigerant_density =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__density}
-        refrigerant_config.getConfigParameter<double>("density");
-    double const refrigerant_viscosity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__viscosity}
-        refrigerant_config.getConfigParameter<double>("viscosity");
-    double const refrigerant_heat_capacity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__specific_heat_capacity}
-        refrigerant_config.getConfigParameter<double>("specific_heat_capacity");
-    double const refrigerant_thermal_conductivity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__thermal_conductivity}
-        refrigerant_config.getConfigParameter<double>("thermal_conductivity");
-    double const refrigerant_reference_temperature =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__reference_temperature}
-        refrigerant_config.getConfigParameter<double>("reference_temperature");
-    RefrigerantProperties const refrigerant{
-        refrigerant_viscosity, refrigerant_density,
-        refrigerant_thermal_conductivity, refrigerant_heat_capacity,
-        refrigerant_reference_temperature};
+    auto const refrigerant =
+        createRefrigerantProperties(config.getConfigSubtree("refrigerant"));
 
     auto const flowAndTemperatureControl = createFlowAndTemperatureControl(
         //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control}
@@ -97,7 +58,8 @@ BHE::BHE_1U createBHE1U(
         curves,
         refrigerant);
 
-    return {borehole, refrigerant, grout, flowAndTemperatureControl, pipes};
+    return {borehole_geometry, refrigerant, grout, flowAndTemperatureControl,
+            pipes};
 }
 }  // namespace BHE
 }  // namespace HeatTransportBHE
diff --git a/ProcessLib/HeatTransportBHE/BHE/CreateBHECXA.cpp b/ProcessLib/HeatTransportBHE/BHE/CreateBHECXA.cpp
index 571042f2210..25da31c8aea 100644
--- a/ProcessLib/HeatTransportBHE/BHE/CreateBHECXA.cpp
+++ b/ProcessLib/HeatTransportBHE/BHE/CreateBHECXA.cpp
@@ -25,14 +25,8 @@ BHE::BHE_CXA createBHECXA(
         curves)
 {
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole}
-    auto const& borehole_config = config.getConfigSubtree("borehole");
-    const double borehole_length =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole__length}
-        borehole_config.getConfigParameter<double>("length");
-    const double borehole_diameter =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole__diameter}
-        borehole_config.getConfigParameter<double>("diameter");
-    BoreholeGeometry const borehole{borehole_length, borehole_diameter};
+    auto const borehole_geometry =
+        createBoreholeGeometry(config.getConfigSubtree("borehole"));
 
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes}
     auto const& pipes_config = config.getConfigSubtree("pipes");
@@ -45,48 +39,15 @@ BHE::BHE_CXA createBHECXA(
         //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes__longitudinal_dispersion_length}
         pipes_config.getConfigParameter<double>(
             "longitudinal_dispersion_length");
-    PipeConfigurationCXA const pipes{inner_pipe, outer_pipe,
-                                     pipe_longitudinal_dispersion_length};
+    PipeConfigurationCoaxial const pipes{inner_pipe, outer_pipe,
+                                         pipe_longitudinal_dispersion_length};
 
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout}
-    auto const& grout_config = config.getConfigSubtree("grout");
-    const double grout_density =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__density}
-        grout_config.getConfigParameter<double>("density");
-    const double grout_porosity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__porosity}
-        grout_config.getConfigParameter<double>("porosity");
-    const double grout_heat_capacity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__heat_capacity}
-        grout_config.getConfigParameter<double>("heat_capacity");
-    const double grout_thermal_conductivity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__thermal_conductivity}
-        grout_config.getConfigParameter<double>("thermal_conductivity");
-    GroutParameters const grout{grout_density, grout_porosity,
-                                grout_heat_capacity,
-                                grout_thermal_conductivity};
+    auto const grout = createGroutParameters(config.getConfigSubtree("grout"));
 
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant}
-    auto const& refrigerant_config = config.getConfigSubtree("refrigerant");
-    double const refrigerant_density =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__density}
-        refrigerant_config.getConfigParameter<double>("density");
-    double const refrigerant_viscosity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__viscosity}
-        refrigerant_config.getConfigParameter<double>("viscosity");
-    double const refrigerant_heat_capacity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__specific_heat_capacity}
-        refrigerant_config.getConfigParameter<double>("specific_heat_capacity");
-    double const refrigerant_thermal_conductivity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__thermal_conductivity}
-        refrigerant_config.getConfigParameter<double>("thermal_conductivity");
-    double const refrigerant_reference_temperature =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__reference_temperature}
-        refrigerant_config.getConfigParameter<double>("reference_temperature");
-    RefrigerantProperties const refrigerant{
-        refrigerant_viscosity, refrigerant_density,
-        refrigerant_thermal_conductivity, refrigerant_heat_capacity,
-        refrigerant_reference_temperature};
+    auto const refrigerant =
+        createRefrigerantProperties(config.getConfigSubtree("refrigerant"));
 
     auto const flowAndTemperatureControl = createFlowAndTemperatureControl(
         //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control}
@@ -94,7 +55,8 @@ BHE::BHE_CXA createBHECXA(
         curves,
         refrigerant);
 
-    return {borehole, refrigerant, grout, flowAndTemperatureControl, pipes};
+    return {borehole_geometry, refrigerant, grout, flowAndTemperatureControl,
+            pipes};
 }
 }  // namespace BHE
 }  // namespace HeatTransportBHE
diff --git a/ProcessLib/HeatTransportBHE/BHE/CreateBHECXC.cpp b/ProcessLib/HeatTransportBHE/BHE/CreateBHECXC.cpp
index 5852eea8098..6f82545e263 100644
--- a/ProcessLib/HeatTransportBHE/BHE/CreateBHECXC.cpp
+++ b/ProcessLib/HeatTransportBHE/BHE/CreateBHECXC.cpp
@@ -25,68 +25,29 @@ BHE::BHE_CXC createBHECXC(
         curves)
 {
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole}
-    auto const& borehole_config = config.getConfigSubtree("borehole");
-    const double borehole_length =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole__length}
-        borehole_config.getConfigParameter<double>("length");
-    const double borehole_diameter =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__borehole__diameter}
-        borehole_config.getConfigParameter<double>("diameter");
-    BoreholeGeometry const borehole{borehole_length, borehole_diameter};
+    auto const borehole_geometry =
+        createBoreholeGeometry(config.getConfigSubtree("borehole"));
 
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes}
     auto const& pipes_config = config.getConfigSubtree("pipes");
-    //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes__inner}
-    Pipe const inner_pipe = createPipe(pipes_config.getConfigSubtree("inner"));
-    Pipe const outer_pipe =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes__outer}
-        createPipe(pipes_config.getConfigSubtree("outer"));
+    //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes__outer}
+    Pipe const outer_pipe = createPipe(pipes_config.getConfigSubtree("outer"));
+    Pipe const inner_pipe =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes__inner}
+        createPipe(pipes_config.getConfigSubtree("inner"));
     const double pipe_longitudinal_dispersion_length =
         //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__pipes__longitudinal_dispersion_length}
         pipes_config.getConfigParameter<double>(
             "longitudinal_dispersion_length");
-    PipeConfigurationCXC const pipes{inner_pipe, outer_pipe,
-                                     pipe_longitudinal_dispersion_length};
+    PipeConfigurationCoaxial const pipes{inner_pipe, outer_pipe,
+                                         pipe_longitudinal_dispersion_length};
 
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout}
-    auto const& grout_config = config.getConfigSubtree("grout");
-    const double grout_density =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__density}
-        grout_config.getConfigParameter<double>("density");
-    const double grout_porosity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__porosity}
-        grout_config.getConfigParameter<double>("porosity");
-    const double grout_heat_capacity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__heat_capacity}
-        grout_config.getConfigParameter<double>("heat_capacity");
-    const double grout_thermal_conductivity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__thermal_conductivity}
-        grout_config.getConfigParameter<double>("thermal_conductivity");
-    GroutParameters const grout{grout_density, grout_porosity,
-                                grout_heat_capacity,
-                                grout_thermal_conductivity};
+    auto const grout = createGroutParameters(config.getConfigSubtree("grout"));
 
     //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant}
-    auto const& refrigerant_config = config.getConfigSubtree("refrigerant");
-    double const refrigerant_density =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__density}
-        refrigerant_config.getConfigParameter<double>("density");
-    double const refrigerant_viscosity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__viscosity}
-        refrigerant_config.getConfigParameter<double>("viscosity");
-    double const refrigerant_heat_capacity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__specific_heat_capacity}
-        refrigerant_config.getConfigParameter<double>("specific_heat_capacity");
-    double const refrigerant_thermal_conductivity =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__thermal_conductivity}
-        refrigerant_config.getConfigParameter<double>("thermal_conductivity");
-    double const refrigerant_reference_temperature =
-        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__reference_temperature}
-        refrigerant_config.getConfigParameter<double>("reference_temperature");
-    RefrigerantProperties const refrigerant{
-        refrigerant_viscosity, refrigerant_density,
-        refrigerant_thermal_conductivity, refrigerant_heat_capacity,
-        refrigerant_reference_temperature};
+    auto const refrigerant =
+        createRefrigerantProperties(config.getConfigSubtree("refrigerant"));
 
     auto const flowAndTemperatureControl = createFlowAndTemperatureControl(
         //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control}
@@ -94,7 +55,8 @@ BHE::BHE_CXC createBHECXC(
         curves,
         refrigerant);
 
-    return {borehole, refrigerant, grout, flowAndTemperatureControl, pipes};
+    return {borehole_geometry, refrigerant, grout, flowAndTemperatureControl,
+            pipes};
 }
 }  // namespace BHE
 }  // namespace HeatTransportBHE
diff --git a/ProcessLib/HeatTransportBHE/BHE/GroutParameters.cpp b/ProcessLib/HeatTransportBHE/BHE/GroutParameters.cpp
new file mode 100644
index 00000000000..36f6d79ef17
--- /dev/null
+++ b/ProcessLib/HeatTransportBHE/BHE/GroutParameters.cpp
@@ -0,0 +1,40 @@
+/**
+ * \file
+ *
+ * \copyright
+ * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ *
+ */
+
+#include "GroutParameters.h"
+#include "BaseLib/ConfigTree.h"
+
+namespace ProcessLib
+{
+namespace HeatTransportBHE
+{
+namespace BHE
+{
+GroutParameters createGroutParameters(BaseLib::ConfigTree const& config)
+{
+    const double grout_density =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__density}
+        config.getConfigParameter<double>("density");
+    const double grout_porosity =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__porosity}
+        config.getConfigParameter<double>("porosity");
+    const double grout_heat_capacity =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__heat_capacity}
+        config.getConfigParameter<double>("heat_capacity");
+    const double grout_thermal_conductivity =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__grout__thermal_conductivity}
+        config.getConfigParameter<double>("thermal_conductivity");
+    return {grout_density, grout_porosity, grout_heat_capacity,
+            grout_thermal_conductivity};
+}
+}  // namespace BHE
+}  // namespace HeatTransportBHE
+}  // namespace ProcessLib
diff --git a/ProcessLib/HeatTransportBHE/BHE/GroutParameters.h b/ProcessLib/HeatTransportBHE/BHE/GroutParameters.h
index 91828558e58..beb7a1aaa30 100644
--- a/ProcessLib/HeatTransportBHE/BHE/GroutParameters.h
+++ b/ProcessLib/HeatTransportBHE/BHE/GroutParameters.h
@@ -11,6 +11,12 @@
 
 #pragma once
 
+#include <boost/math/constants/constants.hpp>
+
+namespace BaseLib
+{
+class ConfigTree;
+}
 namespace ProcessLib
 {
 namespace HeatTransportBHE
@@ -43,6 +49,9 @@ struct GroutParameters
      */
     double const lambda_g;
 };
+
+GroutParameters createGroutParameters(BaseLib::ConfigTree const& config);
+
 }  // namespace BHE
 }  // namespace HeatTransportBHE
 }  // namespace ProcessLib
diff --git a/ProcessLib/HeatTransportBHE/BHE/Physics.h b/ProcessLib/HeatTransportBHE/BHE/Physics.h
index d705c3d0458..8f7dc069545 100644
--- a/ProcessLib/HeatTransportBHE/BHE/Physics.h
+++ b/ProcessLib/HeatTransportBHE/BHE/Physics.h
@@ -96,6 +96,12 @@ inline double nusseltNumberAnnulus(double const reynolds_number,
              0.14 * std::pow(diameter_ratio, 0.6)) /
             (1.0 + diameter_ratio));
 }
+
+inline double PipeOutsideDiameter(double const pipe_diameter,
+                                  double const pipe_wall_thickness)
+{
+    return pipe_diameter + 2. * pipe_wall_thickness;
+}
 }  // end of namespace BHE
 }  // end of namespace HeatTransportBHE
 }  // end of namespace ProcessLib
diff --git a/ProcessLib/HeatTransportBHE/BHE/PipeConfigurationCXA.h b/ProcessLib/HeatTransportBHE/BHE/PipeConfigurationCXA.h
deleted file mode 100644
index bf94568419a..00000000000
--- a/ProcessLib/HeatTransportBHE/BHE/PipeConfigurationCXA.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * \file
- *
- * \copyright
- * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
- *            Distributed under a Modified BSD License.
- *              See accompanying file LICENSE.txt or
- *              http://www.opengeosys.org/project/license
- *
- */
-
-#pragma once
-
-#include <boost/math/constants/constants.hpp>
-
-#include "BaseLib/ConfigTree.h"
-#include "Pipe.h"
-
-namespace ProcessLib
-{
-namespace HeatTransportBHE
-{
-namespace BHE
-{
-struct PipeConfigurationCXA
-{
-    Pipe const inner_outflow_pipe;
-    Pipe const outer_pipe;
-
-    double const longitudinal_dispersion_length;
-};
-}  // namespace BHE
-}  // namespace HeatTransportBHE
-}  // namespace ProcessLib
diff --git a/ProcessLib/HeatTransportBHE/BHE/PipeConfigurationCXC.h b/ProcessLib/HeatTransportBHE/BHE/PipeConfigurationCoaxial.h
similarity index 90%
rename from ProcessLib/HeatTransportBHE/BHE/PipeConfigurationCXC.h
rename to ProcessLib/HeatTransportBHE/BHE/PipeConfigurationCoaxial.h
index 3344d9e4c69..91aca4a7a76 100644
--- a/ProcessLib/HeatTransportBHE/BHE/PipeConfigurationCXC.h
+++ b/ProcessLib/HeatTransportBHE/BHE/PipeConfigurationCoaxial.h
@@ -22,9 +22,9 @@ namespace HeatTransportBHE
 {
 namespace BHE
 {
-struct PipeConfigurationCXC
+struct PipeConfigurationCoaxial
 {
-    Pipe const inner_inflow_pipe;
+    Pipe const inner_pipe;
     Pipe const outer_pipe;
 
     double const longitudinal_dispersion_length;
diff --git a/ProcessLib/HeatTransportBHE/BHE/RefrigerantProperties.cpp b/ProcessLib/HeatTransportBHE/BHE/RefrigerantProperties.cpp
new file mode 100644
index 00000000000..b338f548388
--- /dev/null
+++ b/ProcessLib/HeatTransportBHE/BHE/RefrigerantProperties.cpp
@@ -0,0 +1,45 @@
+/**
+ * \file
+ *
+ * \copyright
+ * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ *
+ */
+
+#include "RefrigerantProperties.h"
+#include "BaseLib/ConfigTree.h"
+
+namespace ProcessLib
+{
+namespace HeatTransportBHE
+{
+namespace BHE
+{
+RefrigerantProperties createRefrigerantProperties(
+    BaseLib::ConfigTree const& config)
+{
+    double const refrigerant_density =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__density}
+        config.getConfigParameter<double>("density");
+    double const refrigerant_viscosity =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__viscosity}
+        config.getConfigParameter<double>("viscosity");
+    double const refrigerant_heat_capacity =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__specific_heat_capacity}
+        config.getConfigParameter<double>("specific_heat_capacity");
+    double const refrigerant_thermal_conductivity =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__thermal_conductivity}
+        config.getConfigParameter<double>("thermal_conductivity");
+    double const refrigerant_reference_temperature =
+        //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__refrigerant__reference_temperature}
+        config.getConfigParameter<double>("reference_temperature");
+    return {refrigerant_viscosity, refrigerant_density,
+            refrigerant_thermal_conductivity, refrigerant_heat_capacity,
+            refrigerant_reference_temperature};
+}
+}  // namespace BHE
+}  // namespace HeatTransportBHE
+}  // namespace ProcessLib
diff --git a/ProcessLib/HeatTransportBHE/BHE/RefrigerantProperties.h b/ProcessLib/HeatTransportBHE/BHE/RefrigerantProperties.h
index 080c95369c1..0cb06ba1fc1 100644
--- a/ProcessLib/HeatTransportBHE/BHE/RefrigerantProperties.h
+++ b/ProcessLib/HeatTransportBHE/BHE/RefrigerantProperties.h
@@ -11,6 +11,12 @@
 
 #pragma once
 
+#include <boost/math/constants/constants.hpp>
+
+namespace BaseLib
+{
+class ConfigTree;
+}
 namespace ProcessLib
 {
 namespace HeatTransportBHE
@@ -41,6 +47,10 @@ struct RefrigerantProperties
 
     double const reference_temperature;
 };
+
+RefrigerantProperties createRefrigerantProperties(
+    BaseLib::ConfigTree const& config);
+
 }  // namespace BHE
 }  // namespace HeatTransportBHE
 }  // namespace ProcessLib
diff --git a/ProcessLib/HeatTransportBHE/BHE/ThermoMechanicalFlowProperties.h b/ProcessLib/HeatTransportBHE/BHE/ThermoMechanicalFlowProperties.h
index 34f0a7ee2e8..1fec22c71ee 100644
--- a/ProcessLib/HeatTransportBHE/BHE/ThermoMechanicalFlowProperties.h
+++ b/ProcessLib/HeatTransportBHE/BHE/ThermoMechanicalFlowProperties.h
@@ -11,6 +11,7 @@
 
 #pragma once
 
+#include "GroutParameters.h"
 #include "Physics.h"
 #include "Pipe.h"
 #include "RefrigerantProperties.h"
@@ -27,6 +28,25 @@ struct ThermoMechanicalFlowProperties
     double nusselt_number;
 };
 
+struct AdvectiveThermalResistanceCoaxial
+{
+    double inner_pipe_coaxial;
+    double a_annulus;
+    double b_annulus;
+};
+
+struct PipeWallThermalResistanceCoaxial
+{
+    double const inner_pipe_coaxial;
+    double const annulus;
+};
+
+struct GroutAndGroutSoilExchangeThermalResistanceCoaxial
+{
+    double const conductive_b;
+    double const grout_soil;
+};
+
 inline ThermoMechanicalFlowProperties
 calculateThermoMechanicalFlowPropertiesPipe(Pipe const& pipe,
                                             double const length,
@@ -54,7 +74,7 @@ calculateThermoMechanicalFlowPropertiesAnnulus(
                       fluid.thermal_conductivity);
 
     double const inner_pipe_outside_diameter =
-        inner_pipe.diameter + 2. * inner_pipe.wall_thickness;
+        PipeOutsideDiameter(inner_pipe.diameter, inner_pipe.wall_thickness);
 
     // Velocity between the outer pipe and inner pipe.
     double const velocity =
@@ -72,6 +92,70 @@ calculateThermoMechanicalFlowPropertiesAnnulus(
         nusseltNumberAnnulus(Re, Pr, diameter_ratio, pipe_aspect_ratio);
     return {velocity, nusselt_number};
 }
+
+inline AdvectiveThermalResistanceCoaxial calculateAdvectiveThermalResistance(
+    Pipe const& inner_pipe, Pipe const& outer_pipe,
+    RefrigerantProperties const& fluid, double const Nu_inner_pipe,
+    double const Nu_annulus)
+{
+    static constexpr double pi = boost::math::constants::pi<double>();
+
+    double const hydraulic_diameter_annulus = outer_pipe.diameter -
+                                              inner_pipe.diameter -
+                                              2 * inner_pipe.wall_thickness;
+    double const inner_pipe_outside_diameter =
+        PipeOutsideDiameter(inner_pipe.diameter, inner_pipe.wall_thickness);
+    double const inner_pipe_coaxial =
+        1.0 / (Nu_inner_pipe * fluid.thermal_conductivity * pi);
+    double const a_annulus =
+        1.0 / (Nu_annulus * fluid.thermal_conductivity * pi) *
+        (hydraulic_diameter_annulus / inner_pipe_outside_diameter);
+    double const b_annulus = 1.0 /
+                             (Nu_annulus * fluid.thermal_conductivity * pi) *
+                             (hydraulic_diameter_annulus / outer_pipe.diameter);
+    return {inner_pipe_coaxial, a_annulus, b_annulus};
+}
+
+inline PipeWallThermalResistanceCoaxial calculatePipeWallThermalResistance(
+    Pipe const& inner_pipe, Pipe const& outer_pipe)
+{
+    static constexpr double pi = boost::math::constants::pi<double>();
+
+    double const inner_pipe_outside_diameter =
+        PipeOutsideDiameter(inner_pipe.diameter, inner_pipe.wall_thickness);
+    double const outer_pipe_outside_diameter =
+        PipeOutsideDiameter(outer_pipe.diameter, outer_pipe.wall_thickness);
+    double const inner_pipe_coaxial =
+        std::log(inner_pipe_outside_diameter / inner_pipe.diameter) /
+        (2.0 * pi * inner_pipe.wall_thermal_conductivity);
+    double const Annulus =
+        std::log(outer_pipe_outside_diameter / outer_pipe.diameter) /
+        (2.0 * pi * outer_pipe.wall_thermal_conductivity);
+    return {inner_pipe_coaxial, Annulus};
+}
+
+inline GroutAndGroutSoilExchangeThermalResistanceCoaxial
+calculateGroutAndGroutSoilExchangeThermalResistance(
+    Pipe const& outer_pipe, GroutParameters const& grout_parameters,
+    double const borehole_diameter)
+{
+    static constexpr double pi = boost::math::constants::pi<double>();
+
+    double const outer_pipe_outside_diameter =
+        PipeOutsideDiameter(outer_pipe.diameter, outer_pipe.wall_thickness);
+    double const chi =
+        std::log(std::sqrt(borehole_diameter * borehole_diameter +
+                           outer_pipe_outside_diameter *
+                               outer_pipe_outside_diameter) /
+                 std::sqrt(2) / outer_pipe_outside_diameter) /
+        std::log(borehole_diameter / outer_pipe_outside_diameter);
+    double const R_g =
+        std::log(borehole_diameter / outer_pipe_outside_diameter) / 2 /
+        (pi * grout_parameters.lambda_g);
+    double const conductive_b = chi * R_g;
+    double const grout_soil = (1 - chi) * R_g;
+    return {conductive_b, grout_soil};
+}
 }  // namespace BHE
 }  // namespace HeatTransportBHE
 }  // namespace ProcessLib
-- 
GitLab