OGS
ProcessLib::HeatTransportBHE::BHE::BHE_1P Class Referencefinal

Detailed Description

The BHE_1P class is the realization of single-pipe 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 the single-pipe type of BHE. For this type of BHE, 2 primary unknowns are assigned on the 1D BHE elements. They are the temperature in the pipe T_p, and temperature of the grout zone surrounding the single pipe T_g. These two primary variables are solved according to heat convection and conduction equations on the pipes and also in the grout zones. The interaction of the 1P 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_1P.h.

#include <BHE_1P.h>

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

Public Member Functions

 BHE_1P (BoreholeGeometry const &borehole, RefrigerantProperties const &refrigerant, GroutParameters const &grout, FlowAndTemperatureControl const &flowAndTemperatureControl, PipeConfiguration1PType const &pipes, bool const use_python_bcs)
BHE_1P 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 &elem_direction, 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::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 bottom_node_id, int const in_component_id)
static std::optional< std::array< std::pair< std::size_t, int >, 2 > > getBHEBottomDirichletBCNodesAndComponents (std::size_t const, int const, int const)

Static Public Attributes

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

Protected Attributes

PipeConfiguration1PType const _pipe
Protected Attributes inherited from ProcessLib::HeatTransportBHE::BHE::BHECommon
std::vector< double > _flow_velocities
std::vector< std::vector< double > > _sectional_thermal_resistances

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.

Constructor & Destructor Documentation

◆ BHE_1P()

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

Definition at line 19 of file BHE_1P.cpp.

27 _pipe(pipes)
28{
29 // Initialize thermal resistances.
30 auto values = visit(
31 [&](auto const& control)
32 {
33 return control(refrigerant.reference_temperature,
34 0. /* initial time */);
35 },
37 updateHeatTransferCoefficients(values.flow_rate);
38}
RefrigerantProperties const refrigerant
Definition BHECommon.h:72
BHECommon(BoreholeGeometry const &borehole_geometry_, RefrigerantProperties const &refrigerant_, GroutParameters const &grout_, FlowAndTemperatureControl const &flowAndTemperatureControl_, bool const use_python_bcs_)
Definition BHECommon.h:58
FlowAndTemperatureControl const flowAndTemperatureControl
Definition BHECommon.h:74
void updateHeatTransferCoefficients(double const flow_rate)
Definition BHE_1P.cpp:94
PipeConfiguration1PType const _pipe
Definition BHE_1P.h:134

References ProcessLib::HeatTransportBHE::BHE::BHECommon::BHECommon(), _pipe, 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_1P::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_1P.h.

75 {
76 // Here we are looping over two resistance terms
77 // First PHI_fg is the resistance between pipe and grout
78 // Second PHI_gs is the resistance between grout and soil
79 switch (idx_bhe_unknowns)
80 {
81 case 0: // PHI_fg
82 R_matrix.block(0, NPoints, NPoints, NPoints) +=
83 -1.0 * matBHE_loc_R;
84 R_matrix.block(NPoints, 0, NPoints, NPoints) +=
85 -1.0 * matBHE_loc_R;
86
87 R_matrix.block(0, 0, NPoints, NPoints) +=
88 matBHE_loc_R; // K_i/o
89 R_matrix.block(NPoints, NPoints, NPoints, NPoints) +=
90 matBHE_loc_R; // K_fg
91 return;
92 case 1: // PHI_gs
93 R_s_matrix += matBHE_loc_R;
94
95 R_pi_s_matrix.block(NPoints, 0, NPoints, NPoints) +=
96 -1.0 * matBHE_loc_R;
97
98 R_matrix.block(NPoints, NPoints, NPoints, NPoints) +=
99 matBHE_loc_R; // K_fg
100 return;
101 default:
102 OGS_FATAL(
103 "BHE_1P::assembleRMatrices: unknown index {:d} "
104 "out of range.",
105 idx_bhe_unknowns);
106 }
107 }
#define OGS_FATAL(...)
Definition Error.h:19

References OGS_FATAL.

◆ calcThermalResistances()

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

Definition at line 109 of file BHE_1P.cpp.

111{
112 constexpr double pi = std::numbers::pi;
113
114 double const lambda_r = refrigerant.thermal_conductivity;
115 double const lambda_g = grout.lambda_g;
116 double const lambda_p = _pipe.single_pipe.wall_thermal_conductivity;
117
118 // thermal resistances due to advective flow of refrigerant in the pipe
119 double const R_adv_i1 = 1.0 / (Nu * lambda_r * pi);
120
121 // thermal resistance due to thermal conductivity of the pipe wall material
122 double const pipe_diameter = _pipe.single_pipe.diameter;
123 double const pipe_outside_diameter = _pipe.single_pipe.outsideDiameter();
124 double const R_con_a =
125 std::log(pipe_outside_diameter / pipe_diameter) / (2.0 * pi * lambda_p);
126
127 // thermal resistances of the grout
128 double const D =
129 borehole_geometry.sections.diameterAtSection(section_index);
130
131 double const chi = std::log(std::sqrt(D * D + pipe_outside_diameter *
132 pipe_outside_diameter) /
133 std::sqrt(2) / pipe_outside_diameter) /
134 std::log(D / pipe_outside_diameter);
135 double const R_g =
136 std::log(D / pipe_outside_diameter) / 2 / (pi * lambda_g);
137
138 double const R_con_b = chi * R_g;
139
140 // thermal resistances due to grout-soil exchange
141 double const R_gs = computeRgs(chi, R_g);
142
143 // Eq. 29 and 30
144 double const R_fg = R_adv_i1 + R_con_a + R_con_b;
145
146 return {R_fg, R_gs};
147}
double computeRgs(double const chi, double const R_g)
Grout-soil thermal resistance: R_gs = (1 - chi) * R_g.

References _pipe, ProcessLib::HeatTransportBHE::BHE::BHECommon::borehole_geometry, ProcessLib::HeatTransportBHE::BHE::computeRgs(), ProcessLib::HeatTransportBHE::BHE::BHECommon::grout, and ProcessLib::HeatTransportBHE::BHE::BHECommon::refrigerant.

Referenced by updateHeatTransferCoefficients().

◆ crossSectionAreas()

std::array< double, BHE_1P::number_of_unknowns > ProcessLib::HeatTransportBHE::BHE::BHE_1P::crossSectionAreas ( int const section_index = 0) const

Definition at line 169 of file BHE_1P.cpp.

171{
172 return {{_pipe.single_pipe.area(),
174 borehole_geometry.sections.areaAtSection(section_index),
175 _pipe.single_pipe.outsideArea(), section_index)}};
176}
double checkedGroutArea(double const borehole_area_fraction, double const pipe_outside_area, int const section_index)
Definition BHECommon.h:40

References _pipe, ProcessLib::HeatTransportBHE::BHE::BHECommon::borehole_geometry, and ProcessLib::HeatTransportBHE::BHE::checkedGroutArea().

◆ getBHEBottomDirichletBCNodesAndComponents()

std::optional< std::array< std::pair< std::size_t, int >, 2 > > ProcessLib::HeatTransportBHE::BHE::BHE_1P::getBHEBottomDirichletBCNodesAndComponents ( std::size_t const ,
int const ,
int const  )
static

Definition at line 161 of file BHE_1P.cpp.

165{
166 return {};
167}

◆ getBHEInflowDirichletBCNodesAndComponents()

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

Definition at line 150 of file BHE_1P.cpp.

154{
155 return {std::make_pair(top_node_id, in_component_id),
156 std::make_pair(bottom_node_id, in_component_id)};
157}

◆ pipeAdvectionVectors()

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

Definition at line 79 of file BHE_1P.cpp.

81{
82 double const& rho_r = refrigerant.density;
83 double const& Cp_r = refrigerant.specific_heat_capacity;
84
85 double const velocity = getClampedFlowVelocity(section_index);
86 Eigen::Vector3d adv_vector = rho_r * Cp_r * velocity * elem_direction;
87
88 return {// pipe, Eq. 19
89 adv_vector,
90 // grout, Eq. 21
91 {0, 0, 0}};
92}
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_1P::number_of_unknowns > ProcessLib::HeatTransportBHE::BHE::BHE_1P::pipeHeatCapacities ( ) const

Definition at line 40 of file BHE_1P.cpp.

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

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

◆ pipeHeatConductions()

std::array< double, BHE_1P::number_of_unknowns > ProcessLib::HeatTransportBHE::BHE::BHE_1P::pipeHeatConductions ( int const section_index = 0) const

Definition at line 55 of file BHE_1P.cpp.

57{
58 double const lambda_r = refrigerant.thermal_conductivity;
59 double const rho_r = refrigerant.density;
60 double const Cp_r = refrigerant.specific_heat_capacity;
61 double const alpha_L = _pipe.longitudinal_dispersion_length;
62 double const porosity_g = grout.porosity_g;
63 double const lambda_g = grout.lambda_g;
64
65 double const velocity_norm =
66 std::abs(getClampedFlowVelocity(section_index));
67
68 // Here we calculate the laplace coefficients in the governing
69 // equations of the BHE.
70 return {{
71 // pipe, Eq. 19
72 (lambda_r + rho_r * Cp_r * alpha_L * velocity_norm),
73 // grout, Eq. 21
74 (1.0 - porosity_g) * lambda_g,
75 }};
76}

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

◆ updateFlowRateAndTemperature()

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

Return the inflow temperature for the boundary condition.

Definition at line 178 of file BHE_1P.cpp.

180{
181 auto values =
182 visit([&](auto const& control) { return control(T_out, current_time); },
184 updateHeatTransferCoefficients(values.flow_rate);
185 return values.temperature;
186}

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

◆ updateHeatTransferCoefficients()

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

Definition at line 94 of file BHE_1P.cpp.

95{
97 _pipe.single_pipe, borehole_geometry.length, refrigerant, flow_rate);
98
99 _flow_velocities = {tm_flow.velocity};
100
102 [&](int i)
103 { return calcThermalResistances(tm_flow.nusselt_number, i); });
104}
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_1P.cpp:109
ThermoMechanicalFlowProperties calculateThermoMechanicalFlowPropertiesPipe(Pipe const &pipe, double const length, RefrigerantProperties const &fluid, double const flow_rate)

References ProcessLib::HeatTransportBHE::BHE::BHECommon::_flow_velocities, _pipe, 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_1P(), and updateFlowRateAndTemperature().

◆ withGeometry()

BHE_1P ProcessLib::HeatTransportBHE::BHE::BHE_1P::withGeometry ( BoreholeGeometry const & g) const
inline

Member Data Documentation

◆ _pipe

PipeConfiguration1PType const ProcessLib::HeatTransportBHE::BHE::BHE_1P::_pipe
protected

◆ inflow_outflow_bc_component_ids

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

Definition at line 112 of file BHE_1P.h.

112 {
113 {0, 1}};

◆ number_of_grout_zones

int ProcessLib::HeatTransportBHE::BHE::BHE_1P::number_of_grout_zones = 1
staticconstexpr

Definition at line 53 of file BHE_1P.h.

◆ number_of_unknowns

int ProcessLib::HeatTransportBHE::BHE::BHE_1P::number_of_unknowns = 2
staticconstexpr

Definition at line 52 of file BHE_1P.h.


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