Skip to content
Snippets Groups Projects
Commit b20c9c50 authored by Chaofan Chen's avatar Chaofan Chen
Browse files

BHE; Move the function body in "CreateFlowAndTemperatureControl.h" to the cpp file.

In the case of the CXA/CXC or 2U BHE, we also need to call the function named "createFlowAndTemperatureControl", and this will cause an error of multiple definition when compiling. Besides, we also need to enrich flow and temperature boundary conditions including the BHE coupled with heat pump.
parent d56246d9
No related branches found
No related tags found
No related merge requests found
/**
* \file
*
* \copyright
* Copyright (c) 2012-2018, 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 "CreateFlowAndTemperatureControl.h"
namespace ProcessLib
{
namespace HeatTransportBHE
{
namespace BHE
{
FlowAndTemperatureControl createFlowAndTemperatureControl(
BaseLib::ConfigTree const& config,
std::map<std::string,
std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
curves,
RefrigerantProperties const& refrigerant)
{
auto find_curve_or_error = [&](std::string const& name,
std::string const& error_message)
-> MathLib::PiecewiseLinearInterpolation const& {
auto const it = curves.find(name);
if (it == curves.end())
{
ERR(error_message.c_str());
OGS_FATAL(
"Curve with name '%s' could not be found in the curves list.",
name.c_str());
}
return *it->second;
};
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__type}
auto const type = config.getConfigParameter<std::string>("type");
if (type == "TemperatureCurveConstantFlow")
{
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__TemperatureCurveConstantFlow__flow_rate}
double const flow_rate = config.getConfigParameter<double>("flow_rate");
auto const& temperature_curve = find_curve_or_error(
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__TemperatureCurveConstantFlow__temperature_curve}
config.getConfigParameter<std::string>("temperature_curve"),
"Required temperature curve not found.");
return TemperatureCurveConstantFlow{flow_rate, temperature_curve};
}
if (type == "FixedPowerConstantFlow")
{
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerConstantFlow__power}
double const power = config.getConfigParameter<double>("power");
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerConstantFlow__flow_rate}
double const flow_rate = config.getConfigParameter<double>("flow_rate");
return FixedPowerConstantFlow{flow_rate, power,
refrigerant.specific_heat_capacity,
refrigerant.density};
}
if (type == "FixedPowerFlowCurve")
{
auto const& flow_rate_curve = find_curve_or_error(
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerFlowCurve__flow_rate_curve}
config.getConfigParameter<std::string>("flow_rate_curve"),
"Required flow rate curve not found.");
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerFlowCurve__power}
double const power = config.getConfigParameter<double>("power");
return FixedPowerFlowCurve{flow_rate_curve, power,
refrigerant.specific_heat_capacity,
refrigerant.density};
}
OGS_FATAL("FlowAndTemperatureControl type '%s' is not implemented.",
type.c_str());
}
} // namespace BHE
} // namespace HeatTransportBHE
} // namespace ProcessLib
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
#pragma once #pragma once
#include "BaseLib/ConfigTree.h"
#include "BaseLib/Error.h"
#include "FlowAndTemperatureControl.h"
#include "RefrigerantProperties.h" #include "RefrigerantProperties.h"
namespace ProcessLib namespace ProcessLib
...@@ -24,65 +27,7 @@ FlowAndTemperatureControl createFlowAndTemperatureControl( ...@@ -24,65 +27,7 @@ FlowAndTemperatureControl createFlowAndTemperatureControl(
std::map<std::string, std::map<std::string,
std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const& std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
curves, curves,
RefrigerantProperties const& refrigerant) RefrigerantProperties const& refrigerant);
{
auto find_curve_or_error = [&](std::string const& name,
std::string const& error_message)
-> MathLib::PiecewiseLinearInterpolation const& {
auto const it = curves.find(name);
if (it == curves.end())
{
ERR(error_message.c_str());
OGS_FATAL(
"Curve with name '%s' could not be found in the curves list.",
name.c_str());
}
return *it->second;
};
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__type}
auto const type = config.getConfigParameter<std::string>("type");
if (type == "TemperatureCurveConstantFlow")
{
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__TemperatureCurveConstantFlow__flow_rate}
double const flow_rate = config.getConfigParameter<double>("flow_rate");
auto const& temperature_curve = find_curve_or_error(
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__TemperatureCurveConstantFlow__temperature_curve}
config.getConfigParameter<std::string>("temperature_curve"),
"Required temperature curve not found.");
return TemperatureCurveConstantFlow{flow_rate, temperature_curve};
}
if (type == "FixedPowerConstantFlow")
{
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerConstantFlow__power}
double const power = config.getConfigParameter<double>("power");
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerConstantFlow__flow_rate}
double const flow_rate = config.getConfigParameter<double>("flow_rate");
return FixedPowerConstantFlow{flow_rate, power,
refrigerant.specific_heat_capacity,
refrigerant.density};
}
if (type == "FixedPowerFlowCurve")
{
auto const& flow_rate_curve = find_curve_or_error(
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerFlowCurve__flow_rate_curve}
config.getConfigParameter<std::string>("flow_rate_curve"),
"Required flow rate curve not found.");
//! \ogs_file_param{prj__processes__process__HEAT_TRANSPORT_BHE__borehole_heat_exchangers__borehole_heat_exchanger__flow_and_temperature_control__FixedPowerFlowCurve__power}
double const power = config.getConfigParameter<double>("power");
return FixedPowerFlowCurve{flow_rate_curve, power,
refrigerant.specific_heat_capacity,
refrigerant.density};
}
OGS_FATAL("FlowAndTemperatureControl type '%s' is not implemented.",
type.c_str());
}
} // namespace BHE } // namespace BHE
} // namespace HeatTransportBHE } // namespace HeatTransportBHE
} // namespace ProcessLib } // namespace ProcessLib
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment