OGS
ProcessLib::HeatTransportBHE::BHE::BHE_1U Class Referencefinal

Detailed Description

The BHE_1U class is the realization of 1U type of Borehole Heate Exchanger. In this class, the pipe heat capacity, pipe heat conductiion, pie advection vectors are initialized according to the geometry of 1U type of BHE. For 1U type of BHE, 4 primary unknowns are assigned on the 1D BHE elements. They are the temperature in inflow pipe T_in, temperature in outflow pipe T_out temperature of the two grout zones surrounding the inflow and outflow pipe T_g1 and T_g2. These primary variables are solved according to heat convection and conduction equations on the pipes and also in the grout zones. The interaction of the 1U type of BHE and the surrounding soil is regulated through the thermal resistance values, which are calculated specifically during the initialization of the class.

Definition at line 34 of file BHE_1U.h.

#include <BHE_1U.h>

Inheritance diagram for ProcessLib::HeatTransportBHE::BHE::BHE_1U:
[legend]
Collaboration diagram for ProcessLib::HeatTransportBHE::BHE::BHE_1U:
[legend]

Public Member Functions

 BHE_1U (BoreholeGeometry const &borehole, RefrigerantProperties const &refrigerant, GroutParameters const &grout, FlowAndTemperatureControl const &flowAndTemperatureControl, PipeConfigurationUType const &pipes, bool const use_python_bcs)
std::array< double, number_of_unknownspipeHeatCapacities () const
std::array< double, number_of_unknownspipeHeatConductions () const
std::array< Eigen::Vector3d, number_of_unknownspipeAdvectionVectors (Eigen::Vector3d const &) const
double updateFlowRateAndTemperature (double T_out, double current_time)
 Return the inflow temperature for the boundary condition.
double thermalResistance (int const unknown_index) const
std::array< double, number_of_unknownscrossSectionAreas () const
void updateHeatTransferCoefficients (double const flow_rate)
Public Member Functions inherited from ProcessLib::HeatTransportBHE::BHE::BHECommonUType
 BHECommonUType (BoreholeGeometry const &borehole, RefrigerantProperties const &refrigerant, GroutParameters const &grout, FlowAndTemperatureControl const &flowAndTemperatureControl, PipeConfigurationUType const &pipes, bool const use_python_bcs)
Public Member Functions inherited from ProcessLib::HeatTransportBHE::BHE::BHECommon
constexpr bool isPowerBC () const

Static Public Member Functions

template<int NPoints, typename SingleUnknownMatrixType, typename RMatrixType, typename RPiSMatrixType, typename RSMatrixType>
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)
static std::array< std::pair< std::size_t, int >, 2 > getBHEInflowDirichletBCNodesAndComponents (std::size_t const top_node_id, std::size_t const, int const in_component_id)
static std::optional< std::array< std::pair< std::size_t, int >, 2 > > getBHEBottomDirichletBCNodesAndComponents (std::size_t const bottom_node_id, int const in_component_id, int const out_component_id)

Static Public Attributes

static constexpr int number_of_unknowns = 4
static constexpr int number_of_grout_zones = 2
static constexpr std::pair< int, int > inflow_outflow_bc_component_ids []

Private Member Functions

std::array< double, number_of_unknownscalcThermalResistances (double const Nu)
 Nu is the Nusselt number.

Private Attributes

std::array< double, number_of_unknowns_thermal_resistances

Additional Inherited Members

Public Attributes inherited from ProcessLib::HeatTransportBHE::BHE::BHECommon
BoreholeGeometry const borehole_geometry
RefrigerantProperties const refrigerant
GroutParameters const grout
FlowAndTemperatureControl const flowAndTemperatureControl
bool const use_python_bcs
Protected Attributes inherited from ProcessLib::HeatTransportBHE::BHE::BHECommonUType
PipeConfigurationUType const _pipes
double _flow_velocity = std::numeric_limits<double>::quiet_NaN()
 Flow velocity inside the pipes. Depends on the flow_rate.

Constructor & Destructor Documentation

◆ BHE_1U()

ProcessLib::HeatTransportBHE::BHE::BHE_1U::BHE_1U ( BoreholeGeometry const & borehole,
RefrigerantProperties const & refrigerant,
GroutParameters const & grout,
FlowAndTemperatureControl const & flowAndTemperatureControl,
PipeConfigurationUType const & pipes,
bool const use_python_bcs )

Definition at line 18 of file BHE_1U.cpp.

25 pipes, use_python_bcs}
26{
27 _thermal_resistances.fill(std::numeric_limits<double>::quiet_NaN());
28
29 // Initialize thermal resistances.
30 auto values = visit(
31 [&](auto const& control) {
32 return control(refrigerant.reference_temperature,
33 0. /* initial time */);
34 },
36 updateHeatTransferCoefficients(values.flow_rate);
37}
BHECommonUType(BoreholeGeometry const &borehole, RefrigerantProperties const &refrigerant, GroutParameters const &grout, FlowAndTemperatureControl const &flowAndTemperatureControl, PipeConfigurationUType const &pipes, bool const use_python_bcs)
std::array< double, number_of_unknowns > _thermal_resistances
Definition BHE_1U.h:161
void updateHeatTransferCoefficients(double const flow_rate)
Definition BHE_1U.cpp:154
RefrigerantProperties const refrigerant
Definition BHECommon.h:36
FlowAndTemperatureControl const flowAndTemperatureControl
Definition BHECommon.h:38

References ProcessLib::HeatTransportBHE::BHE::BHECommonUType::BHECommonUType(), _thermal_resistances, ProcessLib::HeatTransportBHE::BHE::BHECommon::flowAndTemperatureControl, ProcessLib::HeatTransportBHE::BHE::BHECommon::grout, ProcessLib::HeatTransportBHE::BHE::BHECommon::refrigerant, updateHeatTransferCoefficients(), and ProcessLib::HeatTransportBHE::BHE::BHECommon::use_python_bcs.

Member Function Documentation

◆ assembleRMatrices()

template<int NPoints, typename SingleUnknownMatrixType, typename RMatrixType, typename RPiSMatrixType, typename RSMatrixType>
void ProcessLib::HeatTransportBHE::BHE::BHE_1U::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 )
inlinestatic

Definition at line 59 of file BHE_1U.h.

65 {
66 switch (idx_bhe_unknowns)
67 {
68 case 0: // PHI_fig
69 R_matrix.block(0, 2 * NPoints, NPoints, NPoints) +=
70 -1.0 * matBHE_loc_R;
71 R_matrix.block(2 * NPoints, 0, NPoints, NPoints) +=
72 -1.0 * matBHE_loc_R;
73
74 R_matrix.block(0, 0, NPoints, NPoints) +=
75 1.0 * matBHE_loc_R; // K_i1
76 R_matrix.block(2 * NPoints, 2 * NPoints, NPoints, NPoints) +=
77 1.0 * matBHE_loc_R; // K_ig
78 return;
79 case 1: // PHI_fog
80 R_matrix.block(NPoints, 3 * NPoints, NPoints, NPoints) +=
81 -1.0 * matBHE_loc_R;
82 R_matrix.block(3 * NPoints, NPoints, NPoints, NPoints) +=
83 -1.0 * matBHE_loc_R;
84
85 R_matrix.block(NPoints, NPoints, NPoints, NPoints) +=
86 1.0 * matBHE_loc_R; // K_o1
87 R_matrix.block(3 * NPoints, 3 * NPoints, NPoints, NPoints) +=
88 1.0 * matBHE_loc_R; // K_og
89 return;
90 case 2: // PHI_gg
91 R_matrix.block(2 * NPoints, 3 * NPoints, NPoints, NPoints) +=
92 -1.0 * matBHE_loc_R;
93 R_matrix.block(3 * NPoints, 2 * NPoints, NPoints, NPoints) +=
94 -1.0 * matBHE_loc_R;
95
96 R_matrix.block(2 * NPoints, 2 * NPoints, NPoints, NPoints) +=
97 1.0 * matBHE_loc_R; // K_ig // notice we only have
98 // 1 PHI_gg term here.
99 R_matrix.block(3 * NPoints, 3 * NPoints, NPoints, NPoints) +=
100 1.0 * matBHE_loc_R; // K_og // see Diersch 2013 FEFLOW
101 // book page 954 Table M.2
102 return;
103 case 3: // PHI_gs
104 R_s_matrix.template block<NPoints, NPoints>(0, 0).noalias() +=
105 1.0 * matBHE_loc_R;
106
107 R_pi_s_matrix.block(2 * NPoints, 0, NPoints, NPoints) +=
108 -1.0 * matBHE_loc_R;
109 R_pi_s_matrix.block(3 * NPoints, 0, NPoints, NPoints) +=
110 -1.0 * matBHE_loc_R;
111 R_matrix.block(2 * NPoints, 2 * NPoints, NPoints, NPoints) +=
112 1.0 * matBHE_loc_R; // K_ig
113 R_matrix.block(3 * NPoints, 3 * NPoints, NPoints, NPoints) +=
114 1.0 * matBHE_loc_R; // K_og
115 return;
116 default:
117 OGS_FATAL(
118 "Error!!! In the function BHE_1U::assembleRMatrices, "
119 "the index of bhe unknowns is out of range! ");
120 }
121 }
#define OGS_FATAL(...)
Definition Error.h:19

References OGS_FATAL.

◆ calcThermalResistances()

std::array< double, BHE_1U::number_of_unknowns > ProcessLib::HeatTransportBHE::BHE::BHE_1U::calcThermalResistances ( double const Nu)
private

Nu is the Nusselt number.

Definition at line 166 of file BHE_1U.cpp.

168{
169 constexpr double pi = std::numbers::pi;
170
171 double const lambda_r = refrigerant.thermal_conductivity;
172 double const lambda_g = grout.lambda_g;
173 double const lambda_p = _pipes.inlet.wall_thermal_conductivity;
174
175 // thermal resistances due to advective flow of refrigerant in the _pipes
176 // Eq. 36 in Diersch_2011_CG
177 double const R_adv_i1 = 1.0 / (Nu * lambda_r * pi);
178 double const R_adv_o1 = 1.0 / (Nu * lambda_r * pi);
179
180 // thermal resistance due to thermal conductivity of the pipe wall material
181 // Eq. 49
182 double const R_con_a =
183 std::log(_pipes.inlet.outsideDiameter() / _pipes.inlet.diameter) /
184 (2.0 * pi * lambda_p);
185
186 // the average outer diameter of the _pipes
187 double const d0 = _pipes.inlet.outsideDiameter();
188 double const D = borehole_geometry.diameter;
189 // Eq. 51
190 double const chi = std::log(std::sqrt(D * D + 2 * d0 * d0) / 2 / d0) /
191 std::log(D / std::sqrt(2) / d0);
192 // Eq. 52
193 // thermal resistances of the grout
194 double const R_g =
195 std::acosh((D * D + d0 * d0 - _pipes.distance * _pipes.distance) /
196 (2 * D * d0)) /
197 (2 * pi * lambda_g) * (1.601 - 0.888 * _pipes.distance / D);
198
199 // thermal resistance due to inter-grout exchange
200 double const R_ar =
201 std::acosh((2.0 * _pipes.distance * _pipes.distance - d0 * d0) / d0 /
202 d0) /
203 (2.0 * pi * lambda_g);
204
205 auto const [chi_new, R_gg, R_gs] =
206 thermalResistancesGroutSoil(chi, R_ar, R_g);
207
208 // thermal resistance due to the grout transition.
209 double const R_con_b = chi_new * R_g;
210 // Eq. 29 and 30
211 double const R_fig = R_adv_i1 + R_con_a + R_con_b;
212 double const R_fog = R_adv_o1 + R_con_a + R_con_b;
213
214 return {{R_fig, R_fog, R_gg, R_gs}};
215
216 // keep the following lines------------------------------------------------
217 // when debugging the code, printing the R and phi values are needed--------
218 // std::cout << "Rfig =" << R_fig << " Rfog =" << R_fog << " Rgg =" <<
219 // R_gg << " Rgs =" << R_gs << "\n"; double phi_fig = 1.0 / (R_fig *
220 // S_i); double phi_fog = 1.0 / (R_fog * S_o); double phi_gg = 1.0 / (R_gg
221 // * S_g1); double phi_gs = 1.0 / (R_gs * S_gs); std::cout << "phi_fig ="
222 // << phi_fig << " phi_fog =" << phi_fog << " phi_gg =" << phi_gg << "
223 // phi_gs =" << phi_gs << "\n";
224 // -------------------------------------------------------------------------
225}
std::array< double, 3 > thermalResistancesGroutSoil(double const chi, double const R_ar, double const R_g)
Definition BHE_1U.cpp:121

References ProcessLib::HeatTransportBHE::BHE::BHECommonUType::_pipes, ProcessLib::HeatTransportBHE::BHE::BHECommon::borehole_geometry, ProcessLib::HeatTransportBHE::BHE::BHECommon::grout, ProcessLib::HeatTransportBHE::BHE::BHECommon::refrigerant, and ProcessLib::HeatTransportBHE::BHE::thermalResistancesGroutSoil().

Referenced by updateHeatTransferCoefficients().

◆ crossSectionAreas()

std::array< double, BHE_1U::number_of_unknowns > ProcessLib::HeatTransportBHE::BHE::BHE_1U::crossSectionAreas ( ) const

Definition at line 248 of file BHE_1U.cpp.

249{
250 return {{_pipes.inlet.area(), _pipes.outlet.area(),
251 borehole_geometry.area() / 2 - _pipes.inlet.outsideArea(),
252 borehole_geometry.area() / 2 - _pipes.outlet.outsideArea()}};
253}

References ProcessLib::HeatTransportBHE::BHE::BHECommonUType::_pipes, and ProcessLib::HeatTransportBHE::BHE::BHECommon::borehole_geometry.

◆ getBHEBottomDirichletBCNodesAndComponents()

std::optional< std::array< std::pair< std::size_t, int >, 2 > > ProcessLib::HeatTransportBHE::BHE::BHE_1U::getBHEBottomDirichletBCNodesAndComponents ( std::size_t const bottom_node_id,
int const in_component_id,
int const out_component_id )
static

Definition at line 239 of file BHE_1U.cpp.

243{
244 return {{std::make_pair(bottom_node_id, in_component_id),
245 std::make_pair(bottom_node_id, out_component_id)}};
246}

◆ getBHEInflowDirichletBCNodesAndComponents()

std::array< std::pair< std::size_t, int >, 2 > ProcessLib::HeatTransportBHE::BHE::BHE_1U::getBHEInflowDirichletBCNodesAndComponents ( std::size_t const top_node_id,
std::size_t const ,
int const in_component_id )
static

Definition at line 228 of file BHE_1U.cpp.

232{
233 return {std::make_pair(top_node_id, in_component_id),
234 std::make_pair(top_node_id, in_component_id + 1)};
235}

◆ pipeAdvectionVectors()

std::array< Eigen::Vector3d, BHE_1U::number_of_unknowns > ProcessLib::HeatTransportBHE::BHE::BHE_1U::pipeAdvectionVectors ( Eigen::Vector3d const & ) const

Definition at line 81 of file BHE_1U.cpp.

82{
83 double const& rho_r = refrigerant.density;
84 double const& Cp_r = refrigerant.specific_heat_capacity;
85
86 return {{// pipe i1, Eq. 19
87 {0, 0, -rho_r * Cp_r * _flow_velocity},
88 // pipe o1, Eq. 20
89 {0, 0, rho_r * Cp_r * _flow_velocity},
90 // grout g1, Eq. 21
91 {0, 0, 0},
92 // grout g2, Eq. 22
93 {0, 0, 0}}};
94}
double _flow_velocity
Flow velocity inside the pipes. Depends on the flow_rate.

References ProcessLib::HeatTransportBHE::BHE::BHECommonUType::_flow_velocity, and ProcessLib::HeatTransportBHE::BHE::BHECommon::refrigerant.

◆ pipeHeatCapacities()

std::array< double, BHE_1U::number_of_unknowns > ProcessLib::HeatTransportBHE::BHE::BHE_1U::pipeHeatCapacities ( ) const

Definition at line 39 of file BHE_1U.cpp.

41{
42 double const rho_r = refrigerant.density;
43 double const specific_heat_capacity = refrigerant.specific_heat_capacity;
44 double const rho_g = grout.rho_g;
45 double const porosity_g = grout.porosity_g;
46 double const heat_cap_g = grout.heat_cap_g;
47
48 return {{/*i1*/ rho_r * specific_heat_capacity,
49 /*o1*/ rho_r * specific_heat_capacity,
50 /*g1*/ (1.0 - porosity_g) * rho_g * heat_cap_g,
51 /*g2*/ (1.0 - porosity_g) * rho_g * heat_cap_g}};
52}

References ProcessLib::HeatTransportBHE::BHE::BHECommon::grout, and ProcessLib::HeatTransportBHE::BHE::BHECommon::refrigerant.

◆ pipeHeatConductions()

std::array< double, BHE_1U::number_of_unknowns > ProcessLib::HeatTransportBHE::BHE::BHE_1U::pipeHeatConductions ( ) const

Definition at line 54 of file BHE_1U.cpp.

56{
57 double const lambda_r = refrigerant.thermal_conductivity;
58 double const rho_r = refrigerant.density;
59 double const Cp_r = refrigerant.specific_heat_capacity;
60 double const alpha_L = _pipes.longitudinal_dispersion_length;
61 double const porosity_g = grout.porosity_g;
62 double const lambda_g = grout.lambda_g;
63
64 double const velocity_norm = std::abs(_flow_velocity);
65
66 // Here we calculate the laplace coefficients in the governing
67 // equations of BHE. These governing equations can be found in
68 // 1) Diersch (2013) FEFLOW book on page 952, M.120-122, or
69 // 2) Diersch (2011) Comp & Geosci 37:1122-1135, Eq. 19-22.
70 return {{// pipe i1, Eq. 19
71 (lambda_r + rho_r * Cp_r * alpha_L * velocity_norm),
72 // pipe o1, Eq. 20
73 (lambda_r + rho_r * Cp_r * alpha_L * velocity_norm),
74 // pipe g1, Eq. 21
75 (1.0 - porosity_g) * lambda_g,
76 // pipe g2, Eq. 22
77 (1.0 - porosity_g) * lambda_g}};
78}

References ProcessLib::HeatTransportBHE::BHE::BHECommonUType::_flow_velocity, ProcessLib::HeatTransportBHE::BHE::BHECommonUType::_pipes, ProcessLib::HeatTransportBHE::BHE::BHECommon::grout, and ProcessLib::HeatTransportBHE::BHE::BHECommon::refrigerant.

◆ thermalResistance()

double ProcessLib::HeatTransportBHE::BHE::BHE_1U::thermalResistance ( int const unknown_index) const
inline

Definition at line 126 of file BHE_1U.h.

127 {
128 return _thermal_resistances[unknown_index];
129 }

References _thermal_resistances.

◆ updateFlowRateAndTemperature()

double ProcessLib::HeatTransportBHE::BHE::BHE_1U::updateFlowRateAndTemperature ( double T_out,
double current_time )

Return the inflow temperature for the boundary condition.

Definition at line 255 of file BHE_1U.cpp.

257{
258 auto values =
259 visit([&](auto const& control) { return control(T_out, current_time); },
261 updateHeatTransferCoefficients(values.flow_rate);
262 return values.temperature;
263}

References ProcessLib::HeatTransportBHE::BHE::BHECommon::flowAndTemperatureControl, and updateHeatTransferCoefficients().

◆ updateHeatTransferCoefficients()

void ProcessLib::HeatTransportBHE::BHE::BHE_1U::updateHeatTransferCoefficients ( double const flow_rate)

Definition at line 154 of file BHE_1U.cpp.

156{
157 auto const tm_flow_properties = calculateThermoMechanicalFlowPropertiesPipe(
158 _pipes.inlet, borehole_geometry.length, refrigerant, flow_rate);
159
160 _flow_velocity = tm_flow_properties.velocity;
162 calcThermalResistances(tm_flow_properties.nusselt_number);
163}
std::array< double, number_of_unknowns > calcThermalResistances(double const Nu)
Nu is the Nusselt number.
Definition BHE_1U.cpp:166
ThermoMechanicalFlowProperties calculateThermoMechanicalFlowPropertiesPipe(Pipe const &pipe, double const length, RefrigerantProperties const &fluid, double const flow_rate)

References ProcessLib::HeatTransportBHE::BHE::BHECommonUType::_flow_velocity, ProcessLib::HeatTransportBHE::BHE::BHECommonUType::_pipes, _thermal_resistances, ProcessLib::HeatTransportBHE::BHE::BHECommon::borehole_geometry, calcThermalResistances(), ProcessLib::HeatTransportBHE::BHE::calculateThermoMechanicalFlowPropertiesPipe(), and ProcessLib::HeatTransportBHE::BHE::BHECommon::refrigerant.

Referenced by BHE_1U(), and updateFlowRateAndTemperature().

Member Data Documentation

◆ _thermal_resistances

std::array<double, number_of_unknowns> ProcessLib::HeatTransportBHE::BHE::BHE_1U::_thermal_resistances
private

PHI_fig, PHI_fog, PHI_gg, PHI_gs; Here we store the thermal resistances needed for computation of the heat exchange coefficients in the governing equations of BHE. These governing equations can be found in 1) Diersch (2013) FEFLOW book on page 958, M.3, or 2) Diersch (2011) Comp & Geosci 37:1122-1135, Eq. 90-97.

Definition at line 161 of file BHE_1U.h.

Referenced by BHE_1U(), thermalResistance(), and updateHeatTransferCoefficients().

◆ inflow_outflow_bc_component_ids

std::pair<int, int> ProcessLib::HeatTransportBHE::BHE::BHE_1U::inflow_outflow_bc_component_ids[]
staticconstexpr
Initial value:
= {
{0, 1}}

Definition at line 131 of file BHE_1U.h.

131 {
132 {0, 1}};

◆ number_of_grout_zones

int ProcessLib::HeatTransportBHE::BHE::BHE_1U::number_of_grout_zones = 2
staticconstexpr

Definition at line 45 of file BHE_1U.h.

◆ number_of_unknowns

int ProcessLib::HeatTransportBHE::BHE::BHE_1U::number_of_unknowns = 4
staticconstexpr

Definition at line 44 of file BHE_1U.h.


The documentation for this class was generated from the following files: