OGS
BHE_1P.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <Eigen/Core>
14#include <optional>
15
16#include "BHECommon.h"
17#include "BaseLib/Error.h"
20
21namespace ProcessLib
22{
23namespace HeatTransportBHE
24{
25namespace BHE
26{
39class BHE_1P final : public BHECommon
40{
41public:
42 BHE_1P(BoreholeGeometry const& borehole,
46 PipeConfiguration1PType const& pipes,
47 bool const use_python_bcs);
48
49 static constexpr int number_of_unknowns = 2;
50 static constexpr int number_of_grout_zones = 1;
51
52 std::array<double, number_of_unknowns> pipeHeatCapacities() const;
53
54 std::array<double, number_of_unknowns> pipeHeatConductions() const;
55
56 std::array<Eigen::Vector3d, number_of_unknowns> pipeAdvectionVectors(
57 Eigen::Vector3d const& elem_direction) const;
58
59 template <int NPoints,
60 typename SingleUnknownMatrixType,
61 typename RMatrixType,
62 typename RPiSMatrixType,
63 typename RSMatrixType>
64 static void assembleRMatrices(
65 int const idx_bhe_unknowns,
66 Eigen::MatrixBase<SingleUnknownMatrixType> const& matBHE_loc_R,
67 Eigen::MatrixBase<RMatrixType>& R_matrix,
68 Eigen::MatrixBase<RPiSMatrixType>& R_pi_s_matrix,
69 Eigen::MatrixBase<RSMatrixType>& R_s_matrix)
70 {
71 // Here we are looping over two resistance terms
72 // First PHI_fg is the resistance between pipe and grout
73 // Second PHI_gs is the resistance between grout and soil
74 switch (idx_bhe_unknowns)
75 {
76 case 0: // PHI_fg
77 R_matrix.block(0, NPoints, NPoints, NPoints) +=
78 -1.0 * matBHE_loc_R;
79 R_matrix.block(NPoints, 0, NPoints, NPoints) +=
80 -1.0 * matBHE_loc_R;
81
82 R_matrix.block(0, 0, NPoints, NPoints) +=
83 matBHE_loc_R; // K_i/o
84 R_matrix.block(NPoints, NPoints, NPoints, NPoints) +=
85 matBHE_loc_R; // K_fg
86 return;
87 case 1: // PHI_gs
88 R_s_matrix += matBHE_loc_R;
89
90 R_pi_s_matrix.block(NPoints, 0, NPoints, NPoints) +=
91 -1.0 * matBHE_loc_R;
92
93 R_matrix.block(NPoints, NPoints, NPoints, NPoints) +=
94 matBHE_loc_R; // K_fg
95 return;
96 default:
98 "Error!!! In the function BHE_1P::assembleRMatrices, "
99 "the index of bhe resistance term is out of range! ");
100 }
101 }
102
104 double updateFlowRateAndTemperature(double T_out, double current_time);
105
106 double thermalResistance(int const unknown_index) const
107 {
108 return _thermal_resistances[unknown_index];
109 }
110
111 static constexpr std::pair<int, int> inflow_outflow_bc_component_ids[] = {
112 {0, 1}};
113
114 static std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>
115 getBHEInflowDirichletBCNodesAndComponents(std::size_t const top_node_id,
116 std::size_t const bottom_node_id,
117 int const in_component_id);
118
119 static std::optional<
120 std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>>
122 std::size_t const /*bottom_node_id*/,
123 int const /*in_component_id*/,
124 int const /*out_component_id*/);
125
126public:
127 std::array<double, number_of_unknowns> crossSectionAreas() const;
128
129 void updateHeatTransferCoefficients(double const flow_rate);
130
131protected:
133
135 double _flow_velocity = std::numeric_limits<double>::quiet_NaN();
136
137private:
138 std::array<double, number_of_unknowns> calcThermalResistances(
139 double const Nu);
140
141 static double compute_R_gs(double const chi, double const R_g);
142
143private:
147 std::array<double, number_of_unknowns> _thermal_resistances;
148};
149} // namespace BHE
150} // namespace HeatTransportBHE
151} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
void updateHeatTransferCoefficients(double const flow_rate)
Definition BHE_1P.cpp:100
double _flow_velocity
Flow velocity inside the pipes. Depends on the flow_rate.
Definition BHE_1P.h:135
std::array< double, number_of_unknowns > _thermal_resistances
Definition BHE_1P.h:147
static double compute_R_gs(double const chi, double const R_g)
Definition BHE_1P.cpp:95
std::array< double, number_of_unknowns > calcThermalResistances(double const Nu)
Definition BHE_1P.cpp:112
std::array< double, number_of_unknowns > pipeHeatConductions() const
Definition BHE_1P.cpp:62
static std::optional< std::array< std::pair< std::size_t, int >, 2 > > getBHEBottomDirichletBCNodesAndComponents(std::size_t const, int const, int const)
Definition BHE_1P.cpp:163
double thermalResistance(int const unknown_index) const
Definition BHE_1P.h:106
PipeConfiguration1PType const _pipe
Definition BHE_1P.h:132
static constexpr std::pair< int, int > inflow_outflow_bc_component_ids[]
Definition BHE_1P.h:111
static constexpr int number_of_unknowns
Definition BHE_1P.h:49
static constexpr int number_of_grout_zones
Definition BHE_1P.h:50
std::array< double, number_of_unknowns > pipeHeatCapacities() const
Definition BHE_1P.cpp:47
BHE_1P(BoreholeGeometry const &borehole, RefrigerantProperties const &refrigerant, GroutParameters const &grout, FlowAndTemperatureControl const &flowAndTemperatureControl, PipeConfiguration1PType const &pipes, bool const use_python_bcs)
Definition BHE_1P.cpp:25
std::array< double, number_of_unknowns > crossSectionAreas() const
Definition BHE_1P.cpp:171
static void assembleRMatrices(int const idx_bhe_unknowns, Eigen::MatrixBase< SingleUnknownMatrixType > const &matBHE_loc_R, Eigen::MatrixBase< RMatrixType > &R_matrix, Eigen::MatrixBase< RPiSMatrixType > &R_pi_s_matrix, Eigen::MatrixBase< RSMatrixType > &R_s_matrix)
Definition BHE_1P.h:64
double updateFlowRateAndTemperature(double T_out, double current_time)
Return the inflow temperature for the boundary condition.
Definition BHE_1P.cpp:177
std::array< Eigen::Vector3d, number_of_unknowns > pipeAdvectionVectors(Eigen::Vector3d const &elem_direction) const
Definition BHE_1P.cpp:83
static std::array< std::pair< std::size_t, int >, 2 > getBHEInflowDirichletBCNodesAndComponents(std::size_t const top_node_id, std::size_t const bottom_node_id, int const in_component_id)
Definition BHE_1P.cpp:152
std::variant< TemperatureCurveConstantFlow, TemperatureCurveFlowCurve, FixedPowerConstantFlow, FixedPowerFlowCurve, PowerCurveConstantFlow, PowerCurveFlowCurve, BuildingPowerCurveConstantFlow > FlowAndTemperatureControl
RefrigerantProperties const refrigerant
Definition BHECommon.h:42
FlowAndTemperatureControl const flowAndTemperatureControl
Definition BHECommon.h:44