From 62c384cdf5b69a6a4ba5cd27ce0cff259fc44d64 Mon Sep 17 00:00:00 2001
From: Haibing Shao <haibing.shao@ufz.de>
Date: Tue, 2 Jul 2024 13:40:31 +0200
Subject: [PATCH] Add a switch if use power BC

add  is using power bc into the FlowAndTemperatureControl class
---
 .../BHE/CreateFlowAndTemperatureControl.cpp   | 32 +++++++++++++++----
 .../BHE/FlowAndTemperatureControl.h           |  7 ++++
 2 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/ProcessLib/HeatTransportBHE/BHE/CreateFlowAndTemperatureControl.cpp b/ProcessLib/HeatTransportBHE/BHE/CreateFlowAndTemperatureControl.cpp
index c290cfa6eaa..57ca51b21e4 100644
--- a/ProcessLib/HeatTransportBHE/BHE/CreateFlowAndTemperatureControl.cpp
+++ b/ProcessLib/HeatTransportBHE/BHE/CreateFlowAndTemperatureControl.cpp
@@ -42,7 +42,10 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
             config.getConfigParameter<std::string>("temperature_curve"),
             "Required temperature curve not found.");
 
-        return TemperatureCurveConstantFlow{flow_rate, temperature_curve};
+        auto const is_power_bc = false;
+
+        return TemperatureCurveConstantFlow{flow_rate, temperature_curve,
+                                            is_power_bc};
     }
     if (type == "TemperatureCurveFlowCurve")
     {
@@ -58,7 +61,10 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
             config.getConfigParameter<std::string>("temperature_curve"),
             "Required temperature curve not found.");
 
-        return TemperatureCurveFlowCurve{flow_rate_curve, temperature_curve};
+        auto const is_power_bc = false;
+
+        return TemperatureCurveFlowCurve{flow_rate_curve, temperature_curve,
+                                         is_power_bc};
     }
     if (type == "FixedPowerConstantFlow")
     {
@@ -67,9 +73,12 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
 
         //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerConstantFlow__flow_rate}
         auto const flow_rate = config.getConfigParameter<double>("flow_rate");
+
+        auto const is_power_bc = true;
+
         return FixedPowerConstantFlow{flow_rate, power,
                                       refrigerant.specific_heat_capacity,
-                                      refrigerant.density};
+                                      refrigerant.density, is_power_bc};
     }
 
     if (type == "FixedPowerFlowCurve")
@@ -83,9 +92,11 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
         //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerFlowCurve__power}
         auto const power = config.getConfigParameter<double>("power");
 
+        auto const is_power_bc = true;
+
         return FixedPowerFlowCurve{flow_rate_curve, power,
                                    refrigerant.specific_heat_capacity,
-                                   refrigerant.density};
+                                   refrigerant.density, is_power_bc};
     }
 
     if (type == "PowerCurveConstantFlow")
@@ -99,9 +110,11 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
         //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__PowerCurveConstantFlow__flow_rate}
         auto const flow_rate = config.getConfigParameter<double>("flow_rate");
 
+        auto const is_power_bc = true;
+
         return PowerCurveConstantFlow{power_curve, flow_rate,
                                       refrigerant.specific_heat_capacity,
-                                      refrigerant.density};
+                                      refrigerant.density, is_power_bc};
     }
 
     if (type == "PowerCurveFlowCurve")
@@ -118,9 +131,11 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
             config.getConfigParameter<std::string>("flow_rate_curve"),
             "Required flow rate curve not found.");
 
+        auto const is_power_bc = false;
+
         return PowerCurveFlowCurve{power_curve, flow_rate_curve,
                                    refrigerant.specific_heat_capacity,
-                                   refrigerant.density};
+                                   refrigerant.density, is_power_bc};
     }
 
     if (type == "BuildingPowerCurveConstantFlow")
@@ -143,9 +158,12 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
         //! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__BuildingPowerCurveConstantFlow__flow_rate}
         auto const flow_rate = config.getConfigParameter<double>("flow_rate");
 
+        auto const is_power_bc = true;
+
         return BuildingPowerCurveConstantFlow{
             building_power_curves, flow_rate,
-            refrigerant.specific_heat_capacity, refrigerant.density};
+            refrigerant.specific_heat_capacity, refrigerant.density,
+            is_power_bc};
     }
     OGS_FATAL("FlowAndTemperatureControl type '{:s}' is not implemented.",
               type);
diff --git a/ProcessLib/HeatTransportBHE/BHE/FlowAndTemperatureControl.h b/ProcessLib/HeatTransportBHE/BHE/FlowAndTemperatureControl.h
index b0b815a57c9..d0f384a721a 100644
--- a/ProcessLib/HeatTransportBHE/BHE/FlowAndTemperatureControl.h
+++ b/ProcessLib/HeatTransportBHE/BHE/FlowAndTemperatureControl.h
@@ -35,6 +35,7 @@ struct TemperatureCurveConstantFlow
     }
     double flow_rate;
     MathLib::PiecewiseLinearInterpolation const& temperature_curve;
+    bool const is_power_bc = false;
 };
 
 struct TemperatureCurveFlowCurve
@@ -47,6 +48,7 @@ struct TemperatureCurveFlowCurve
     }
     MathLib::PiecewiseLinearInterpolation const& flow_rate_curve;
     MathLib::PiecewiseLinearInterpolation const& temperature_curve;
+    bool const is_power_bc = false;
 };
 
 struct FixedPowerConstantFlow
@@ -60,6 +62,7 @@ struct FixedPowerConstantFlow
     double power;  // Value is expected to be in Watt.
     double heat_capacity;
     double density;
+    bool const is_power_bc = true;
 };
 
 struct FixedPowerFlowCurve
@@ -74,6 +77,7 @@ struct FixedPowerFlowCurve
     double power;  // Value is expected to be in Watt.
     double heat_capacity;
     double density;
+    bool const is_power_bc = true;
 };
 
 struct PowerCurveConstantFlow
@@ -92,6 +96,7 @@ struct PowerCurveConstantFlow
     double flow_rate;
     double heat_capacity;
     double density;
+    bool const is_power_bc = true;
 };
 
 struct PowerCurveFlowCurve
@@ -111,6 +116,7 @@ struct PowerCurveFlowCurve
 
     double heat_capacity;
     double density;
+    bool const is_power_bc = true;
 };
 
 struct BuildingPowerCurveConstantFlow
@@ -134,6 +140,7 @@ struct BuildingPowerCurveConstantFlow
     double flow_rate;
     double heat_capacity;
     double density;
+    bool const is_power_bc = true;
 };
 
 using FlowAndTemperatureControl = std::variant<TemperatureCurveConstantFlow,
-- 
GitLab