31 std::string
const& name,
33 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
34 std::vector<ProcessVariable>
const& variables,
35 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
36 unsigned const integration_order,
39 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>>
const&
41 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media)
46 DBUG(
"Create HeatTransportBHE Process.");
52 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
61 std::vector<std::reference_wrapper<ProcessVariable>> per_process_variables;
63 for (std::string
const& pv_name : range)
65 if (pv_name !=
"temperature_soil" &&
66 pv_name.find(
"temperature_BHE") == std::string::npos)
69 "Found a process variable name '{}'. It should be "
70 "'temperature_soil' or 'temperature_BHE_X'",
73 auto variable = std::find_if(variables.cbegin(), variables.cend(),
75 { return v.getName() == pv_name; });
77 if (variable == variables.end())
80 "Could not find process variable '{:s}' in the provided "
81 "variables list for config tag <{:s}>.",
82 pv_name,
"process_variable");
84 DBUG(
"Found process variable '{:s}' for config tag <{:s}>.",
85 variable->getName(),
"process_variable");
87 per_process_variables.emplace_back(
90 process_variables.push_back(std::move(per_process_variables));
96 std::vector<BHE::BHETypes> bhes;
98 auto const& bhe_configs =
102 auto const using_server_communication =
107 auto const& bhe_config :
109 bhe_configs.getConfigSubtreeList(
"borehole_heat_exchanger"))
112 const std::string bhe_type =
114 bhe_config.getConfigParameter<std::string>(
"type");
116 if (bhe_type ==
"1U")
119 BHE::createBHEUType<BHE::BHE_1U>(bhe_config, curves));
123 if (bhe_type ==
"CXA")
126 BHE::createBHECoaxial<BHE::BHE_CXA>(bhe_config, curves));
130 if (bhe_type ==
"CXC")
133 BHE::createBHECoaxial<BHE::BHE_CXC>(bhe_config, curves));
137 if (bhe_type ==
"2U")
140 BHE::createBHEUType<BHE::BHE_2U>(bhe_config, curves));
144 if (bhe_type ==
"1P")
147 BHE::createBHE1PType<BHE::BHE_1P>(bhe_config, curves));
150 OGS_FATAL(
"Unknown BHE type '{:s}'.", bhe_type);
158 auto const using_tespy =
159 visit([](
auto const& bhe) {
return bhe.use_python_bcs; }, bhes[0]);
164 if (using_tespy || using_server_communication)
167 pybind11::object scope =
168 pybind11::module::import(
"__main__").attr(
"__dict__");
170 if (!scope.contains(
"bc_bhe"))
172 "Function 'bc_bhe' is not defined in the python script file, "
173 "or there was no python script file specified.");
179 if (py_object ==
nullptr)
181 "Not able to access the correct bc pointer from python script "
185 py_object->dataframe_network = py_object->initializeDataContainer();
186 if (!py_object->isOverriddenEssential())
189 "Method `initializeDataContainer' not overridden in Python "
193 std::get<3>(py_object->dataframe_network).clear();
219 std::move(media_map), std::move(bhes), py_object, using_tespy,
220 using_server_communication);
226 return std::make_unique<HeatTransportBHEProcess>(
227 std::move(name), mesh, std::move(jacobian_assembler), parameters,
228 integration_order, std::move(process_variables),
229 std::move(process_data), std::move(secondary_variables));
std::unique_ptr< Process > createHeatTransportBHEProcess(std::string const &name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)