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

Detailed Description

The BHE_1U class is the realization of 1U type of Borehole Heat Exchanger. In this class, the pipe heat capacity, pipe heat conduction, pipe 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)
BHE_1U withGeometry (BoreholeGeometry const &g) const
std::array< double, number_of_unknownspipeHeatCapacities () const
std::array< double, number_of_unknownspipeHeatConductions (int const section_index=0) const
std::array< Eigen::Vector3d, number_of_unknownspipeAdvectionVectors (Eigen::Vector3d const &, int const section_index=0) const
double updateFlowRateAndTemperature (double T_out, double current_time)
 Return the inflow temperature for the boundary condition.
std::array< double, number_of_unknownscrossSectionAreas (int const section_index=0) 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
 BHECommon (BoreholeGeometry const &borehole_geometry_, RefrigerantProperties const &refrigerant_, GroutParameters const &grout_, FlowAndTemperatureControl const &flowAndTemperatureControl_, bool const use_python_bcs_)
constexpr bool isPowerBC () const
int getNumberOfSections () const
 Get number of sections in the borehole geometry.
std::vector< double > const & getSectionBoundaries () const
 Get section boundaries (cumulative distance from wellhead).
double thermalResistanceAtSection (int const unknown_index, int const section_index) const
 Get thermal resistance for a specific section and unknown.

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::vector< double > calcThermalResistances (double const Nu, int const section_index=0) const

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 Member Functions inherited from ProcessLib::HeatTransportBHE::BHE::BHECommon
template<typename Fn>
void recomputeSectionalResistances (Fn &&calcForSection)
 Recompute _sectional_thermal_resistances for all sections.
double getClampedFlowVelocity (int const section_index) const
 Get velocity for a section, clamping to last section if index exceeds the number of velocity entries. Returns 0 when empty.
std::vector< double > const & getThermalResistancesAtSection (int const section_index) const
 Get the thermal resistance vector for a given section.
Protected Attributes inherited from ProcessLib::HeatTransportBHE::BHE::BHECommonUType
PipeConfigurationUType const _pipes
Protected Attributes inherited from ProcessLib::HeatTransportBHE::BHE::BHECommon
std::vector< double > _flow_velocities
std::vector< std::vector< double > > _sectional_thermal_resistances

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 // Initialize thermal resistances.
28 auto values = visit(
29 [&](auto const& control)
30 {
31 return control(refrigerant.reference_temperature,
32 0. /* initial time */);
33 },
35 updateHeatTransferCoefficients(values.flow_rate);
36}
BHECommonUType(BoreholeGeometry const &borehole, RefrigerantProperties const &refrigerant, GroutParameters const &grout, FlowAndTemperatureControl const &flowAndTemperatureControl, PipeConfigurationUType const &pipes, bool const use_python_bcs)
RefrigerantProperties const refrigerant
Definition BHECommon.h:72
FlowAndTemperatureControl const flowAndTemperatureControl
Definition BHECommon.h:74
void updateHeatTransferCoefficients(double const flow_rate)
Definition BHE_1U.cpp:133

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

Referenced by withGeometry().

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 69 of file BHE_1U.h.

75 {
76 switch (idx_bhe_unknowns)
77 {
78 case 0: // PHI_fig
79 R_matrix.block(0, 2 * NPoints, NPoints, NPoints) +=
80 -1.0 * matBHE_loc_R;
81 R_matrix.block(2 * NPoints, 0, NPoints, NPoints) +=
82 -1.0 * matBHE_loc_R;
83
84 R_matrix.block(0, 0, NPoints, NPoints) +=
85 1.0 * matBHE_loc_R; // K_i1
86 R_matrix.block(2 * NPoints, 2 * NPoints, NPoints, NPoints) +=
87 1.0 * matBHE_loc_R; // K_ig
88 return;
89 case 1: // PHI_fog
90 R_matrix.block(NPoints, 3 * NPoints, NPoints, NPoints) +=
91 -1.0 * matBHE_loc_R;
92 R_matrix.block(3 * NPoints, NPoints, NPoints, NPoints) +=
93 -1.0 * matBHE_loc_R;
94
95 R_matrix.block(NPoints, NPoints, NPoints, NPoints) +=
96 1.0 * matBHE_loc_R; // K_o1
97 R_matrix.block(3 * NPoints, 3 * NPoints, NPoints, NPoints) +=
98 1.0 * matBHE_loc_R; // K_og
99 return;
100 case 2: // PHI_gg
101 R_matrix.block(2 * NPoints, 3 * NPoints, NPoints, NPoints) +=
102 -1.0 * matBHE_loc_R;
103 R_matrix.block(3 * NPoints, 2 * NPoints, NPoints, NPoints) +=
104 -1.0 * matBHE_loc_R;
105
106 R_matrix.block(2 * NPoints, 2 * NPoints, NPoints, NPoints) +=
107 1.0 * matBHE_loc_R; // K_ig // notice we only have
108 // 1 PHI_gg term here.
109 R_matrix.block(3 * NPoints, 3 * NPoints, NPoints, NPoints) +=
110 1.0 * matBHE_loc_R; // K_og // see Diersch 2013 FEFLOW
111 // book page 954 Table M.2
112 return;
113 case 3: // PHI_gs
114 R_s_matrix.template block<NPoints, NPoints>(0, 0).noalias() +=
115 1.0 * matBHE_loc_R;
116
117 R_pi_s_matrix.block(2 * NPoints, 0, NPoints, NPoints) +=
118 -1.0 * matBHE_loc_R;
119 R_pi_s_matrix.block(3 * NPoints, 0, NPoints, NPoints) +=
120 -1.0 * matBHE_loc_R;
121 R_matrix.block(2 * NPoints, 2 * NPoints, NPoints, NPoints) +=
122 1.0 * matBHE_loc_R; // K_ig
123 R_matrix.block(3 * NPoints, 3 * NPoints, NPoints, NPoints) +=
124 1.0 * matBHE_loc_R; // K_og
125 return;
126 default:
127 OGS_FATAL(
128 "BHE_1U::assembleRMatrices: unknown index {:d} "
129 "out of range.",
130 idx_bhe_unknowns);
131 }
132 }
#define OGS_FATAL(...)
Definition Error.h:19

References OGS_FATAL.

◆ calcThermalResistances()

std::vector< double > ProcessLib::HeatTransportBHE::BHE::BHE_1U::calcThermalResistances ( double const Nu,
int const section_index = 0 ) const
private

Nu is the Nusselt number. section_index is the borehole section index for depth-varying borehole diameter (default: 0).

Definition at line 148 of file BHE_1U.cpp.

150{
151 constexpr double pi = std::numbers::pi;
152
153 double const lambda_r = refrigerant.thermal_conductivity;
154 double const lambda_g = grout.lambda_g;
155 double const lambda_p = _pipes.inlet.wall_thermal_conductivity;
156
157 // thermal resistances due to advective flow of refrigerant in the _pipes
158 // Eq. 36 in Diersch_2011_CG
159 double const R_adv_i1 = 1.0 / (Nu * lambda_r * pi);
160 double const R_adv_o1 = 1.0 / (Nu * lambda_r * pi);
161
162 // thermal resistance due to thermal conductivity of the pipe wall material
163 // Eq. 49
164 double const inlet_diameter = _pipes.inlet.diameter;
165 double const inlet_outside_diameter = _pipes.inlet.outsideDiameter();
166 double const R_con_a = std::log(inlet_outside_diameter / inlet_diameter) /
167 (2.0 * pi * lambda_p);
168
169 // the average outer diameter of the _pipes
170 double const d0 = inlet_outside_diameter;
171 double const D =
172 borehole_geometry.sections.diameterAtSection(section_index);
173 // Eq. 51
174 double const chi = std::log(std::sqrt(D * D + 2 * d0 * d0) / 2 / d0) /
175 std::log(D / std::sqrt(2) / d0);
176 // Eq. 52
177 // thermal resistances of the grout
178 double const R_g =
179 std::acosh((D * D + d0 * d0 - _pipes.distance * _pipes.distance) /
180 (2 * D * d0)) /
181 (2 * pi * lambda_g) * (1.601 - 0.888 * _pipes.distance / D);
182
183 // thermal resistance due to inter-grout exchange
184 double const R_ar =
185 std::acosh((2.0 * _pipes.distance * _pipes.distance - d0 * d0) / d0 /
186 d0) /
187 (2.0 * pi * lambda_g);
188
189 auto const [chi_new, R_gg, R_gs] =
190 thermalResistancesGroutSoil(chi, R_ar, R_g);
191
192 // thermal resistance due to the grout transition.
193 double const R_con_b = chi_new * R_g;
194 // Eq. 29 and 30
195 double const R_fig = R_adv_i1 + R_con_a + R_con_b;
196 double const R_fog = R_adv_o1 + R_con_a + R_con_b;
197
198 return {R_fig, R_fog, R_gg, R_gs};
199}
std::array< double, 3 > thermalResistancesGroutSoil(double const chi, double const R_ar, double const R_g)
Definition BHE_1U.cpp:101

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 ( int const section_index = 0) const

Definition at line 222 of file BHE_1U.cpp.

224{
225 double const half_borehole_area =
226 borehole_geometry.sections.areaAtSection(section_index) /
228 return {{_pipes.inlet.area(), _pipes.outlet.area(),
229 checkedGroutArea(half_borehole_area, _pipes.inlet.outsideArea(),
230 section_index),
231 checkedGroutArea(half_borehole_area, _pipes.outlet.outsideArea(),
232 section_index)}};
233}
static constexpr int number_of_grout_zones
Definition BHE_1U.h:53
double checkedGroutArea(double const borehole_area_fraction, double const pipe_outside_area, int const section_index)
Definition BHECommon.h:40

References ProcessLib::HeatTransportBHE::BHE::BHECommonUType::_pipes, ProcessLib::HeatTransportBHE::BHE::BHECommon::borehole_geometry, ProcessLib::HeatTransportBHE::BHE::checkedGroutArea(), and number_of_grout_zones.

◆ 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 213 of file BHE_1U.cpp.

217{
218 return {{std::make_pair(bottom_node_id, in_component_id),
219 std::make_pair(bottom_node_id, out_component_id)}};
220}

◆ 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 202 of file BHE_1U.cpp.

206{
207 return {std::make_pair(top_node_id, in_component_id),
208 std::make_pair(top_node_id, in_component_id + 1)};
209}

◆ pipeAdvectionVectors()

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

Definition at line 80 of file BHE_1U.cpp.

82{
83 double const& rho_r = refrigerant.density;
84 double const& Cp_r = refrigerant.specific_heat_capacity;
85
86 double const velocity = getClampedFlowVelocity(section_index);
87
88 Eigen::Vector3d const advection_downflow{0, 0, -rho_r * Cp_r * velocity};
89 Eigen::Vector3d const advection_upflow{0, 0, rho_r * Cp_r * velocity};
90 return {{advection_downflow, // i1
91 advection_upflow, // o1
92 {0, 0, 0}, // g1
93 {0, 0, 0}}}; // g2
94}
double getClampedFlowVelocity(int const section_index) const
Get velocity for a section, clamping to last section if index exceeds the number of velocity entries....
Definition BHECommon.h:133

References ProcessLib::HeatTransportBHE::BHE::BHECommon::getClampedFlowVelocity(), 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 38 of file BHE_1U.cpp.

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

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 ( int const section_index = 0) const

Definition at line 53 of file BHE_1U.cpp.

55{
56 double const lambda_r = refrigerant.thermal_conductivity;
57 double const rho_r = refrigerant.density;
58 double const Cp_r = refrigerant.specific_heat_capacity;
59 double const alpha_L = _pipes.longitudinal_dispersion_length;
60 double const porosity_g = grout.porosity_g;
61 double const lambda_g = grout.lambda_g;
62
63 double const velocity_norm =
64 std::abs(getClampedFlowVelocity(section_index));
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 auto const pipe_conduction =
71 lambda_r + rho_r * Cp_r * alpha_L * velocity_norm;
72 auto const grout_conduction = (1.0 - porosity_g) * lambda_g;
73 return {{pipe_conduction, // i1
74 pipe_conduction, // o1
75 grout_conduction, // g1
76 grout_conduction}}; // g2
77}

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

◆ 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 235 of file BHE_1U.cpp.

237{
238 auto values =
239 visit([&](auto const& control) { return control(T_out, current_time); },
241 updateHeatTransferCoefficients(values.flow_rate);
242 return values.temperature;
243}

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

◆ updateHeatTransferCoefficients()

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

Definition at line 133 of file BHE_1U.cpp.

134{
136 _pipes.inlet, borehole_geometry.length, refrigerant, flow_rate);
137
138 _flow_velocities = {tm_flow.velocity};
139
141 [&](int i)
142 { return calcThermalResistances(tm_flow.nusselt_number, i); });
143}
void recomputeSectionalResistances(Fn &&calcForSection)
Recompute _sectional_thermal_resistances for all sections.
Definition BHECommon.h:117
std::vector< double > calcThermalResistances(double const Nu, int const section_index=0) const
Definition BHE_1U.cpp:148
ThermoMechanicalFlowProperties calculateThermoMechanicalFlowPropertiesPipe(Pipe const &pipe, double const length, RefrigerantProperties const &fluid, double const flow_rate)

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

Referenced by BHE_1U(), and updateFlowRateAndTemperature().

◆ withGeometry()

Member Data Documentation

◆ 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 137 of file BHE_1U.h.

137 {
138 {0, 1}};

◆ number_of_grout_zones

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

Definition at line 53 of file BHE_1U.h.

Referenced by crossSectionAreas().

◆ number_of_unknowns

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

Definition at line 52 of file BHE_1U.h.


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