32 std::string
const& name,
34 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
35 std::vector<ProcessVariable>
const& variables,
36 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
37 unsigned const integration_order,
40 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>>
const&
42 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media)
47 DBUG(
"Create HeatTransportBHE Process.");
53 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
62 std::vector<std::reference_wrapper<ProcessVariable>> per_process_variables;
64 for (std::string
const& pv_name : range)
66 if (pv_name !=
"temperature_soil" &&
67 pv_name.find(
"temperature_BHE") == std::string::npos)
70 "Found a process variable name '{}'. It should be "
71 "'temperature_soil' or 'temperature_BHE_X'",
74 auto variable = std::find_if(variables.cbegin(), variables.cend(),
76 { return v.getName() == pv_name; });
78 if (variable == variables.end())
81 "Could not find process variable '{:s}' in the provided "
82 "variables list for config tag <{:s}>.",
83 pv_name,
"process_variable");
85 DBUG(
"Found process variable '{:s}' for config tag <{:s}>.",
86 variable->getName(),
"process_variable");
88 per_process_variables.emplace_back(
91 process_variables.push_back(std::move(per_process_variables));
97 std::vector<BHE::BHETypes> bhes;
99 auto const& bhe_configs =
103 auto const using_server_communication =
107 auto const using_algebraic_bc =
111 auto const weighting_factor =
115 auto const is_linear =
120 if (!using_algebraic_bc)
123 "You specified that the process simulated by OGS is linear. "
124 "For the Heat-Transport-BHE process this can only be done "
125 "together with setting the use_algebraic_bc option to true.")
130 "You specified that the process simulated by OGS is linear. "
131 "With that optimization the process will be assembled only "
132 "once and the non-linear solver will do only one iteration per "
133 "time step. No non-linearities will be resolved and OGS will "
134 "not detect if there are any non-linearities. It is your "
135 "responsibility to ensure that the assembled equation systems "
136 "are linear, indeed! There is no safety net!");
141 auto const& bhe_config :
143 bhe_configs.getConfigSubtreeList(
"borehole_heat_exchanger"))
146 const std::string bhe_type =
148 bhe_config.getConfigParameter<std::string>(
"type");
150 if (bhe_type ==
"1U")
153 BHE::createBHEUType<BHE::BHE_1U>(bhe_config, curves));
157 if (bhe_type ==
"CXA")
160 BHE::createBHECoaxial<BHE::BHE_CXA>(bhe_config, curves));
164 if (bhe_type ==
"CXC")
167 BHE::createBHECoaxial<BHE::BHE_CXC>(bhe_config, curves));
171 if (bhe_type ==
"2U")
174 BHE::createBHEUType<BHE::BHE_2U>(bhe_config, curves));
178 if (bhe_type ==
"1P")
181 BHE::createBHE1PType<BHE::BHE_1P>(bhe_config, curves));
184 OGS_FATAL(
"Unknown BHE type '{:s}'.", bhe_type);
192 auto const using_tespy =
193 visit([](
auto const& bhe) {
return bhe.use_python_bcs; }, bhes[0]);
198 if (using_tespy || using_server_communication)
201 pybind11::object scope =
202 pybind11::module::import(
"__main__").attr(
"__dict__");
204 if (!scope.contains(
"bc_bhe"))
206 "Function 'bc_bhe' is not defined in the python script file, "
207 "or there was no python script file specified.");
213 if (py_object ==
nullptr)
215 "Not able to access the correct bc pointer from python script "
219 py_object->dataframe_network = py_object->initializeDataContainer();
220 if (!py_object->isOverriddenEssential())
223 "Method `initializeDataContainer' not overridden in Python "
227 std::get<3>(py_object->dataframe_network).clear();
253 std::move(media_map), std::move(bhes), py_object, using_tespy,
254 using_server_communication,
255 {using_algebraic_bc, weighting_factor, is_linear});
261 return std::make_unique<HeatTransportBHEProcess>(
262 std::move(name), mesh, std::move(jacobian_assembler), parameters,
263 integration_order, std::move(process_variables),
264 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)