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 41 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)
 

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

32 pipes, use_python_bcs}
33{
34 _thermal_resistances.fill(std::numeric_limits<double>::quiet_NaN());
35
36 // Initialize thermal resistances.
37 auto values = visit(
38 [&](auto const& control) {
40 0. /* initial time */);
41 },
43 updateHeatTransferCoefficients(values.flow_rate);
44}
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:168
void updateHeatTransferCoefficients(double const flow_rate)
Definition BHE_1U.cpp:161
RefrigerantProperties const refrigerant
Definition BHECommon.h:42
FlowAndTemperatureControl const flowAndTemperatureControl
Definition BHECommon.h:44

References _thermal_resistances, ProcessLib::HeatTransportBHE::BHE::BHECommon::flowAndTemperatureControl, ProcessLib::HeatTransportBHE::BHE::RefrigerantProperties::reference_temperature, ProcessLib::HeatTransportBHE::BHE::BHECommon::refrigerant, and updateHeatTransferCoefficients().

Member Function Documentation

◆ assembleRMatrices()

template<int NPoints, typename SingleUnknownMatrixType , typename RMatrixType , typename RPiSMatrixType , typename RSMatrixType >
static 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 66 of file BHE_1U.h.

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

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

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

References ProcessLib::HeatTransportBHE::BHE::BHECommonUType::_pipes, ProcessLib::HeatTransportBHE::BHE::BHECommon::borehole_geometry, ProcessLib::HeatTransportBHE::BHE::BoreholeGeometry::diameter, ProcessLib::HeatTransportBHE::BHE::Pipe::diameter, ProcessLib::HeatTransportBHE::BHE::PipeConfigurationUType::distance, ProcessLib::HeatTransportBHE::BHE::BHECommon::grout, ProcessLib::HeatTransportBHE::BHE::PipeConfigurationUType::inlet, ProcessLib::HeatTransportBHE::BHE::GroutParameters::lambda_g, ProcessLib::HeatTransportBHE::BHE::Pipe::outsideDiameter(), ProcessLib::HeatTransportBHE::BHE::BHECommon::refrigerant, ProcessLib::HeatTransportBHE::BHE::RefrigerantProperties::thermal_conductivity, ProcessLib::HeatTransportBHE::BHE::thermalResistancesGroutSoil(), and ProcessLib::HeatTransportBHE::BHE::Pipe::wall_thermal_conductivity.

Referenced by updateHeatTransferCoefficients().

◆ crossSectionAreas()

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

250{
251 return {{std::make_pair(bottom_node_id, in_component_id),
252 std::make_pair(bottom_node_id, out_component_id)}};
253}

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

239{
240 return {std::make_pair(top_node_id, in_component_id),
241 std::make_pair(top_node_id, in_component_id + 1)};
242}

◆ pipeAdvectionVectors()

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

Definition at line 88 of file BHE_1U.cpp.

89{
90 double const& rho_r = refrigerant.density;
91 double const& Cp_r = refrigerant.specific_heat_capacity;
92
93 return {{// pipe i1, Eq. 19
94 {0, 0, -rho_r * Cp_r * _flow_velocity},
95 // pipe o1, Eq. 20
96 {0, 0, rho_r * Cp_r * _flow_velocity},
97 // grout g1, Eq. 21
98 {0, 0, 0},
99 // grout g2, Eq. 22
100 {0, 0, 0}}};
101}
double _flow_velocity
Flow velocity inside the pipes. Depends on the flow_rate.

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

◆ pipeHeatCapacities()

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

◆ pipeHeatConductions()

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

Definition at line 61 of file BHE_1U.cpp.

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

References ProcessLib::HeatTransportBHE::BHE::BHECommonUType::_flow_velocity, ProcessLib::HeatTransportBHE::BHE::BHECommonUType::_pipes, ProcessLib::HeatTransportBHE::BHE::RefrigerantProperties::density, ProcessLib::HeatTransportBHE::BHE::BHECommon::grout, ProcessLib::HeatTransportBHE::BHE::GroutParameters::lambda_g, ProcessLib::HeatTransportBHE::BHE::PipeConfigurationUType::longitudinal_dispersion_length, ProcessLib::HeatTransportBHE::BHE::GroutParameters::porosity_g, ProcessLib::HeatTransportBHE::BHE::BHECommon::refrigerant, ProcessLib::HeatTransportBHE::BHE::RefrigerantProperties::specific_heat_capacity, and ProcessLib::HeatTransportBHE::BHE::RefrigerantProperties::thermal_conductivity.

◆ thermalResistance()

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

Definition at line 133 of file BHE_1U.h.

134 {
135 return _thermal_resistances[unknown_index];
136 }

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

264{
265 auto values =
266 visit([&](auto const& control) { return control(T_out, current_time); },
268 updateHeatTransferCoefficients(values.flow_rate);
269 return values.temperature;
270}

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

◆ updateHeatTransferCoefficients()

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

Definition at line 161 of file BHE_1U.cpp.

163{
164 auto const tm_flow_properties = calculateThermoMechanicalFlowPropertiesPipe(
166
167 _flow_velocity = tm_flow_properties.velocity;
169 calcThermalResistances(tm_flow_properties.nusselt_number);
170}
std::array< double, number_of_unknowns > calcThermalResistances(double const Nu)
Nu is the Nusselt number.
Definition BHE_1U.cpp:173
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(), ProcessLib::HeatTransportBHE::BHE::PipeConfigurationUType::inlet, ProcessLib::HeatTransportBHE::BHE::BoreholeGeometry::length, 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 168 of file BHE_1U.h.

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

◆ inflow_outflow_bc_component_ids

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

Definition at line 138 of file BHE_1U.h.

138 {
139 {0, 1}};

◆ number_of_grout_zones

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

Definition at line 52 of file BHE_1U.h.

◆ number_of_unknowns

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

Definition at line 51 of file BHE_1U.h.


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