diff --git a/ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.cpp b/ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.cpp index eb2e2c5e00ef94d93c223d408b5ee7b0819ba9be..15090b71e66d4c0b54f6fd649c02af5023249998 100644 --- a/ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.cpp +++ b/ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.cpp @@ -131,6 +131,26 @@ BHECommonCoaxial::calcThermalResistances(double const Nu_inner_pipe, return getThermalResistances(R_gs, R_ff, R_fg); } +std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2> +BHECommonCoaxial::getBHEInflowDirichletBCNodesAndComponents( + std::size_t const top_node_id, + std::size_t const /*bottom_node_id*/, + int const in_component_id) const +{ + return {std::make_pair(top_node_id, in_component_id), + std::make_pair(top_node_id, in_component_id + 1)}; +} + +std::optional< + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>> +BHECommonCoaxial::getBHEBottomDirichletBCNodesAndComponents( + std::size_t const bottom_node_id, int const in_component_id, + int const out_component_id) const +{ + return {{std::make_pair(bottom_node_id, in_component_id), + std::make_pair(bottom_node_id, out_component_id)}}; +} + void BHECommonCoaxial::updateHeatTransferCoefficients(double const flow_rate) { auto const tm_flow_properties_annulus = diff --git a/ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.h b/ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.h index 1d1d30ac5d8d2993623d3e68b82f12a0e47dc03c..efb715f7a9a7498a98dc35e84f61e56873a29273 100644 --- a/ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.h +++ b/ProcessLib/HeatTransportBHE/BHE/BHECommonCoaxial.h @@ -48,6 +48,18 @@ public: static constexpr std::pair<int, int> inflow_outflow_bc_component_ids[] = { {0, 1}}; + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2> + getBHEInflowDirichletBCNodesAndComponents( + std::size_t const top_node_id, + std::size_t const /*bottom_node_id*/, + int const in_component_id) const; + + std::optional< + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>> + getBHEBottomDirichletBCNodesAndComponents(std::size_t const bottom_node_id, + int const in_component_id, + int const out_component_id) const; + std::array<double, number_of_unknowns> pipeHeatConductions() const; std::array<Eigen::Vector3d, number_of_unknowns> pipeAdvectionVectors( diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_1P.cpp b/ProcessLib/HeatTransportBHE/BHE/BHE_1P.cpp index c9dd0544ce21608a870b6436089c8fb9eab1fbe0..436a4c73f596668cb0659dfd2ef22ed4c2a79e24 100644 --- a/ProcessLib/HeatTransportBHE/BHE/BHE_1P.cpp +++ b/ProcessLib/HeatTransportBHE/BHE/BHE_1P.cpp @@ -147,6 +147,26 @@ std::array<double, BHE_1P::number_of_unknowns> BHE_1P::calcThermalResistances( return {{R_fg, R_gs}}; } +std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2> +BHE_1P::getBHEInflowDirichletBCNodesAndComponents( + std::size_t const top_node_id, + std::size_t const bottom_node_id, + int const in_component_id) const +{ + return {std::make_pair(top_node_id, in_component_id), + std::make_pair(bottom_node_id, in_component_id)}; +} + +std::optional< + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>> +BHE_1P::getBHEBottomDirichletBCNodesAndComponents( + std::size_t const /*bottom_node_id*/, + int const /*in_component_id*/, + int const /*out_component_id*/) const +{ + return {}; +} + std::array<double, BHE_1P::number_of_unknowns> BHE_1P::crossSectionAreas() const { return {{_pipe.single_pipe.area(), diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_1P.h b/ProcessLib/HeatTransportBHE/BHE/BHE_1P.h index cebe65cfbe9294b069865dc19f785a7f6862a3cb..b14896c1c47fd0e5aa0dfd53e3cd86c8fe75797b 100644 --- a/ProcessLib/HeatTransportBHE/BHE/BHE_1P.h +++ b/ProcessLib/HeatTransportBHE/BHE/BHE_1P.h @@ -111,6 +111,18 @@ public: static constexpr std::pair<int, int> inflow_outflow_bc_component_ids[] = { {0, 1}}; + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2> + getBHEInflowDirichletBCNodesAndComponents(std::size_t const top_node_id, + std::size_t const bottom_node_id, + int const in_component_id) const; + + std::optional< + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>> + getBHEBottomDirichletBCNodesAndComponents( + std::size_t const /*bottom_node_id*/, + int const /*in_component_id*/, + int const /*out_component_id*/) const; + public: std::array<double, number_of_unknowns> crossSectionAreas() const; diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp b/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp index 603c7afb045f3c8cca432231ade3718198e43ce8..38e0f829ccceab9784f56c548db6bae193b5d559 100644 --- a/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp +++ b/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp @@ -228,6 +228,27 @@ std::array<double, BHE_1U::number_of_unknowns> BHE_1U::calcThermalResistances( // ------------------------------------------------------------------------- } +std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2> +BHE_1U::getBHEInflowDirichletBCNodesAndComponents( + std::size_t const top_node_id, + std::size_t const /*bottom_node_id*/, + int const in_component_id) const +{ + return {std::make_pair(top_node_id, in_component_id), + std::make_pair(top_node_id, in_component_id + 1)}; +} + +std::optional< + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>> +BHE_1U::getBHEBottomDirichletBCNodesAndComponents( + std::size_t const bottom_node_id, + int const in_component_id, + int const out_component_id) const +{ + return {{std::make_pair(bottom_node_id, in_component_id), + std::make_pair(bottom_node_id, out_component_id)}}; +} + std::array<double, BHE_1U::number_of_unknowns> BHE_1U::crossSectionAreas() const { return {{_pipes.inlet.area(), _pipes.outlet.area(), diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_1U.h b/ProcessLib/HeatTransportBHE/BHE/BHE_1U.h index f9d065417385fd89ca50867ca9f1d50283214a80..a699fb256b6eefdd4198865b8f15a9c69123b90f 100644 --- a/ProcessLib/HeatTransportBHE/BHE/BHE_1U.h +++ b/ProcessLib/HeatTransportBHE/BHE/BHE_1U.h @@ -138,6 +138,17 @@ public: static constexpr std::pair<int, int> inflow_outflow_bc_component_ids[] = { {0, 1}}; + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2> + getBHEInflowDirichletBCNodesAndComponents( + std::size_t const top_node_id, + std::size_t const /*bottom_node_id*/, + int const in_component_id) const; + std::optional< + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>> + getBHEBottomDirichletBCNodesAndComponents(std::size_t const bottom_node_id, + int const in_component_id, + int const out_component_id) const; + public: std::array<double, number_of_unknowns> crossSectionAreas() const; diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_2U.cpp b/ProcessLib/HeatTransportBHE/BHE/BHE_2U.cpp index 4f70cf7c73407f3fa129b8fc15d175556ad08b91..75a862340f543929679328c7f9a0d1135d0303ae 100644 --- a/ProcessLib/HeatTransportBHE/BHE/BHE_2U.cpp +++ b/ProcessLib/HeatTransportBHE/BHE/BHE_2U.cpp @@ -258,6 +258,27 @@ std::array<double, BHE_2U::number_of_unknowns> BHE_2U::calcThermalResistances( // ------------------------------------------------------------------------- } +std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2> +BHE_2U::getBHEInflowDirichletBCNodesAndComponents( + std::size_t const top_node_id, + std::size_t const /*bottom_node_id*/, + int const in_component_id) const +{ + return {std::make_pair(top_node_id, in_component_id), + std::make_pair(top_node_id, in_component_id + 2)}; +} + +std::optional< + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>> +BHE_2U::getBHEBottomDirichletBCNodesAndComponents( + std::size_t const bottom_node_id, + int const in_component_id, + int const out_component_id) const +{ + return {{std::make_pair(bottom_node_id, in_component_id), + std::make_pair(bottom_node_id, out_component_id)}}; +} + std::array<double, BHE_2U::number_of_unknowns> BHE_2U::crossSectionAreas() const { return {{ diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_2U.h b/ProcessLib/HeatTransportBHE/BHE/BHE_2U.h index 466068806a39d80321ec2dc4a7cae5396515ed8a..0b0b22756a6939c7eba3184d91b04cbfe4036700 100644 --- a/ProcessLib/HeatTransportBHE/BHE/BHE_2U.h +++ b/ProcessLib/HeatTransportBHE/BHE/BHE_2U.h @@ -200,6 +200,18 @@ public: static constexpr std::pair<int, int> inflow_outflow_bc_component_ids[] = { {0, 2}, {1, 3}}; + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2> + getBHEInflowDirichletBCNodesAndComponents( + std::size_t const top_node_id, + std::size_t const /*bottom_node_id*/, + int const in_component_id) const; + + std::optional< + std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>> + getBHEBottomDirichletBCNodesAndComponents(std::size_t const bottom_node_id, + int const in_component_id, + int const out_component_id) const; + public: std::array<double, number_of_unknowns> crossSectionAreas() const; diff --git a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp index 261cf474be4ab188f10c17278e66924ec440d23a..cf4ca0df634524d5f523bb5d42b25743002562f4 100644 --- a/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp +++ b/ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp @@ -367,20 +367,31 @@ void HeatTransportBHEProcess::createBHEBoundaryConditionTopBottom( bcs.addBoundaryCondition( createBHEInflowDirichletBoundaryCondition( get_global_bhe_bc_indices( - {{{bc_top_node_id, in_out_component_id.first}, - {bc_top_node_id, - in_out_component_id.second}}}), + bhe.getBHEInflowDirichletBCNodesAndComponents( + bc_top_node_id, bc_bottom_node_id, + in_out_component_id.first)), [&bhe](double const T, double const t) { return bhe.updateFlowRateAndTemperature(T, t); })); } - // Bottom, outflow, all cases - bcs.addBoundaryCondition( - createBHEBottomDirichletBoundaryCondition( - get_global_bhe_bc_indices( - {{{bc_bottom_node_id, in_out_component_id.first}, - {bc_bottom_node_id, - in_out_component_id.second}}}))); + + auto const bottom_nodes_and_components = + bhe.getBHEBottomDirichletBCNodesAndComponents( + bc_bottom_node_id, + in_out_component_id.first, + in_out_component_id.second); + + if (bottom_nodes_and_components) + { + // Bottom, outflow, all cases + bcs.addBoundaryCondition( + createBHEBottomDirichletBoundaryCondition( + get_global_bhe_bc_indices( + {{{bc_bottom_node_id, in_out_component_id.first}, + {bc_bottom_node_id, + in_out_component_id.second}}}))); + } + } }; visit(createBCs, _process_data._vec_BHE_property[bhe_i]);