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

Detailed Description

The BHE_1P class is the realization of single-pipe 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 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 32 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)
std::array< double, number_of_unknownspipeHeatCapacities () const
std::array< double, number_of_unknownspipeHeatConductions () const
std::array< Eigen::Vector3d, number_of_unknownspipeAdvectionVectors (Eigen::Vector3d const &elem_direction) 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::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 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
double _flow_velocity = std::numeric_limits<double>::quiet_NaN()
 Flow velocity inside the pipes. Depends on the flow_rate.

Private Member Functions

std::array< double, number_of_unknownscalcThermalResistances (double const Nu)

Static Private Member Functions

static double compute_R_gs (double const chi, double const R_g)

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

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 18 of file BHE_1P.cpp.

24 : BHECommon{borehole, refrigerant, grout, flowAndTemperatureControl,
26 _pipe(pipes)
27{
28 _thermal_resistances.fill(std::numeric_limits<double>::quiet_NaN());
29
30 // Initialize thermal resistances.
31 auto values = visit(
32 [&](auto const& control) {
33 return control(refrigerant.reference_temperature,
34 0. /* initial time */);
35 },
37 updateHeatTransferCoefficients(values.flow_rate);
38}
void updateHeatTransferCoefficients(double const flow_rate)
Definition BHE_1P.cpp:93
std::array< double, number_of_unknowns > _thermal_resistances
Definition BHE_1P.h:140
PipeConfiguration1PType const _pipe
Definition BHE_1P.h:125
RefrigerantProperties const refrigerant
Definition BHECommon.h:36
FlowAndTemperatureControl const flowAndTemperatureControl
Definition BHECommon.h:38

References _pipe, _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_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 57 of file BHE_1P.h.

63 {
64 // Here we are looping over two resistance terms
65 // First PHI_fg is the resistance between pipe and grout
66 // Second PHI_gs is the resistance between grout and soil
67 switch (idx_bhe_unknowns)
68 {
69 case 0: // PHI_fg
70 R_matrix.block(0, NPoints, NPoints, NPoints) +=
71 -1.0 * matBHE_loc_R;
72 R_matrix.block(NPoints, 0, NPoints, NPoints) +=
73 -1.0 * matBHE_loc_R;
74
75 R_matrix.block(0, 0, NPoints, NPoints) +=
76 matBHE_loc_R; // K_i/o
77 R_matrix.block(NPoints, NPoints, NPoints, NPoints) +=
78 matBHE_loc_R; // K_fg
79 return;
80 case 1: // PHI_gs
81 R_s_matrix += matBHE_loc_R;
82
83 R_pi_s_matrix.block(NPoints, 0, NPoints, NPoints) +=
84 -1.0 * matBHE_loc_R;
85
86 R_matrix.block(NPoints, NPoints, NPoints, NPoints) +=
87 matBHE_loc_R; // K_fg
88 return;
89 default:
91 "Error!!! In the function BHE_1P::assembleRMatrices, "
92 "the index of bhe resistance term is out of range! ");
93 }
94 }
#define OGS_FATAL(...)
Definition Error.h:19

References OGS_FATAL.

◆ calcThermalResistances()

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

Definition at line 105 of file BHE_1P.cpp.

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

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

Referenced by updateHeatTransferCoefficients().

◆ compute_R_gs()

double ProcessLib::HeatTransportBHE::BHE::BHE_1P::compute_R_gs ( double const chi,
double const R_g )
staticprivate

Definition at line 88 of file BHE_1P.cpp.

89{
90 return (1 - chi) * R_g;
91}

Referenced by calcThermalResistances().

◆ crossSectionAreas()

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

Definition at line 164 of file BHE_1P.cpp.

165{
166 return {{_pipe.single_pipe.area(),
167 borehole_geometry.area() - _pipe.single_pipe.outsideArea()}};
168}

References _pipe, and ProcessLib::HeatTransportBHE::BHE::BHECommon::borehole_geometry.

◆ 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 156 of file BHE_1P.cpp.

160{
161 return {};
162}

◆ 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 145 of file BHE_1P.cpp.

149{
150 return {std::make_pair(top_node_id, in_component_id),
151 std::make_pair(bottom_node_id, in_component_id)};
152}

◆ pipeAdvectionVectors()

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

Definition at line 76 of file BHE_1P.cpp.

77{
78 double const& rho_r = refrigerant.density;
79 double const& Cp_r = refrigerant.specific_heat_capacity;
80 Eigen::Vector3d adv_vector = rho_r * Cp_r * _flow_velocity * elem_direction;
81
82 return {// pipe, Eq. 19
83 adv_vector,
84 // grout, Eq. 21
85 {0, 0, 0}};
86}
double _flow_velocity
Flow velocity inside the pipes. Depends on the flow_rate.
Definition BHE_1P.h:128

References _flow_velocity, 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 ( ) 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 // Here we calculate the laplace coefficients in the governing
66 // equations of the BHE.
67 return {{
68 // pipe, Eq. 19
69 (lambda_r + rho_r * Cp_r * alpha_L * _flow_velocity),
70 // grout, Eq. 21
71 (1.0 - porosity_g) * lambda_g,
72 }};
73}

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

◆ thermalResistance()

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

Definition at line 99 of file BHE_1P.h.

100 {
101 return _thermal_resistances[unknown_index];
102 }

References _thermal_resistances.

◆ 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 170 of file BHE_1P.cpp.

172{
173 auto values =
174 visit([&](auto const& control) { return control(T_out, current_time); },
176 updateHeatTransferCoefficients(values.flow_rate);
177 return values.temperature;
178}

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

◆ updateHeatTransferCoefficients()

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

Definition at line 93 of file BHE_1P.cpp.

95{
96 auto const tm_flow_properties = calculateThermoMechanicalFlowPropertiesPipe(
97 _pipe.single_pipe, borehole_geometry.length, refrigerant, flow_rate);
98
99 _flow_velocity = tm_flow_properties.velocity;
101 calcThermalResistances(tm_flow_properties.nusselt_number);
102}
std::array< double, number_of_unknowns > calcThermalResistances(double const Nu)
Definition BHE_1P.cpp:105
ThermoMechanicalFlowProperties calculateThermoMechanicalFlowPropertiesPipe(Pipe const &pipe, double const length, RefrigerantProperties const &fluid, double const flow_rate)

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

Referenced by BHE_1P(), and updateFlowRateAndTemperature().

Member Data Documentation

◆ _flow_velocity

double ProcessLib::HeatTransportBHE::BHE::BHE_1P::_flow_velocity = std::numeric_limits<double>::quiet_NaN()
protected

Flow velocity inside the pipes. Depends on the flow_rate.

Definition at line 128 of file BHE_1P.h.

Referenced by pipeAdvectionVectors(), pipeHeatConductions(), and updateHeatTransferCoefficients().

◆ _pipe

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

◆ _thermal_resistances

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

PHI_fg, PHI_gs; Here we store the thermal resistances needed for computation of the heat exchange coefficients in the governing equations of BHE.

Definition at line 140 of file BHE_1P.h.

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

◆ 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 104 of file BHE_1P.h.

104 {
105 {0, 1}};

◆ number_of_grout_zones

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

Definition at line 43 of file BHE_1P.h.

◆ number_of_unknowns

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

Definition at line 42 of file BHE_1P.h.


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