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 39 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_flow_legsflowLegs () const
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
std::vector< double > thermalResistances (ParameterLib::SpatialPosition const &pos) const
double updateFlowRateAndTemperature (double T_out, double current_time)
 Return the inflow temperature for the boundary condition.
std::array< double, number_of_unknownscrossSectionAreas (ParameterLib::SpatialPosition const &pos) 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

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 int number_of_flow_legs = 1
static constexpr std::pair< int, int > inflow_outflow_bc_component_ids []

Protected Attributes

PipeConfiguration1PType const _pipe

Private Member Functions

std::vector< double > calcThermalResistances (double const Nu, ParameterLib::SpatialPosition const &pos) const

Private Attributes

double flow_velocity_ = 0.0
double cached_nu_ = 0.0

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

29 _pipe(pipes)
30{
31 // Initialize thermal resistances.
32 auto values = visit(
33 [&](auto const& control)
34 {
35 return control(refrigerant.reference_temperature,
36 0. /* initial time */);
37 },
39 updateHeatTransferCoefficients(values.flow_rate);
40}
RefrigerantProperties const refrigerant
Definition BHECommon.h:51
BHECommon(BoreholeGeometry const &borehole_geometry_, RefrigerantProperties const &refrigerant_, GroutParameters const &grout_, FlowAndTemperatureControl const &flowAndTemperatureControl_, bool const use_python_bcs_)
Definition BHECommon.h:37
FlowAndTemperatureControl const flowAndTemperatureControl
Definition BHECommon.h:53
void updateHeatTransferCoefficients(double const flow_rate)
Definition BHE_1P.cpp:92
PipeConfiguration1PType const _pipe
Definition BHE_1P.h:142

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.

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

86 {
87 switch (idx_bhe_unknowns)
88 {
89 case 0: // PHI_fg
90 R_matrix.block(0, NPoints, NPoints, NPoints) +=
91 -1.0 * matBHE_loc_R;
92 R_matrix.block(NPoints, 0, NPoints, NPoints) +=
93 -1.0 * matBHE_loc_R;
94
95 R_matrix.block(0, 0, NPoints, NPoints) +=
96 matBHE_loc_R; // K_i/o
97 R_matrix.block(NPoints, NPoints, NPoints, NPoints) +=
98 matBHE_loc_R; // K_fg
99 return;
100 case 1: // PHI_gs
101 R_s_matrix += matBHE_loc_R;
102
103 R_pi_s_matrix.block(NPoints, 0, NPoints, NPoints) +=
104 -1.0 * matBHE_loc_R;
105
106 R_matrix.block(NPoints, NPoints, NPoints, NPoints) +=
107 matBHE_loc_R; // K_fg
108 return;
109 default:
110 OGS_FATAL(
111 "BHE_1P::assembleRMatrices: unknown index {:d} "
112 "out of range.",
113 idx_bhe_unknowns);
114 }
115 }
#define OGS_FATAL(...)
Definition Error.h:10

References OGS_FATAL.

◆ calcThermalResistances()

std::vector< double > ProcessLib::HeatTransportBHE::BHE::BHE_1P::calcThermalResistances ( double const Nu,
ParameterLib::SpatialPosition const & pos ) const
private

Definition at line 107 of file BHE_1P.cpp.

109{
110 constexpr double pi = std::numbers::pi;
111
112 double const lambda_r = refrigerant.thermal_conductivity;
113 double const lambda_g = grout.lambda_g;
114 // t=0.0: borehole properties are physically time-invariant (fixed at
115 // drilling/installation); genuinely time-varying parameter types are
116 // rejected in createPipe / createBoreholeGeometry.
117 double const lambda_p =
118 sampleStrictPositive(_pipe.single_pipe.wall_thermal_conductivity, 0.0,
119 pos, "wall_thermal_conductivity");
120
121 // thermal resistances due to advective flow of refrigerant in the pipe
122 double const R_adv_i1 = 1.0 / (Nu * lambda_r * pi);
123
124 // thermal resistance due to thermal conductivity of the pipe wall material
125 double const pipe_outside_diameter = _pipe.single_pipe.outsideDiameter();
126 double const R_con_a =
127 pipeWallThermalResistance(_pipe.single_pipe, lambda_p);
128
129 // thermal resistances of the grout
130 double const D = sampleStrictPositive(borehole_geometry.diameter, 0.0, pos,
131 "borehole_diameter");
132 checkBoreholeVsPipeDiameter(D, pipe_outside_diameter, pos,
133 "BHE 1P grout resistance");
134
135 double const chi = std::log(std::sqrt(D * D + pipe_outside_diameter *
136 pipe_outside_diameter) /
137 std::sqrt(2) / pipe_outside_diameter) /
138 std::log(D / pipe_outside_diameter);
139 double const R_g =
140 std::log(D / pipe_outside_diameter) / 2 / (pi * lambda_g);
141
142 double const R_con_b = chi * R_g;
143
144 // thermal resistances due to grout-soil exchange
145 double const R_gs = computeRgs(chi, R_g);
146
147 double const R_fg = R_adv_i1 + R_con_a + R_con_b;
148
149 return {R_fg, R_gs};
150}
double sampleStrictPositive(ParameterLib::Parameter< double > const &param, double const t, ParameterLib::SpatialPosition const &pos, std::string_view const param_role)
void checkBoreholeVsPipeDiameter(double const D, double const min_diameter, ParameterLib::SpatialPosition const &pos, std::string_view const context)
double computeRgs(double const chi, double const R_g)
Grout-soil thermal resistance: R_gs = (1 - chi) * R_g.
double pipeWallThermalResistance(Pipe const &pipe, double const wall_thermal_conductivity)

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

Referenced by thermalResistances().

◆ crossSectionAreas()

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

Definition at line 171 of file BHE_1P.cpp.

173{
174 double const D = sampleStrictPositive(borehole_geometry.diameter, 0.0, pos,
175 "borehole_diameter");
176 double const borehole_area = Pipe::circleArea(D);
177 return {{_pipe.single_pipe.area(),
178 checkedGroutArea(borehole_area, _pipe.single_pipe.outsideArea(),
179 pos)}};
180}
double checkedGroutArea(double const borehole_area_fraction, double const pipe_outside_area, ParameterLib::SpatialPosition const &pos)
static double circleArea(double const d)
Definition Pipe.h:46

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

◆ flowLegs()

std::array< double, number_of_flow_legs > ProcessLib::HeatTransportBHE::BHE::BHE_1P::flowLegs ( ) const
inline

Signed fluid velocity per flow leg. Positive = flow along +elem_direction; negative = against it. BHE_1P has a single leg whose direction follows the line element's elem_direction.

Definition at line 56 of file BHE_1P.h.

57 {
58 return {+flow_velocity_};
59 }

References flow_velocity_.

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

167{
168 return {};
169}

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

157{
158 return {std::make_pair(top_node_id, in_component_id),
159 std::make_pair(bottom_node_id, in_component_id)};
160}

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

79{
80 double const& rho_r = refrigerant.density;
81 double const& Cp_r = refrigerant.specific_heat_capacity;
82
83 double const velocity = flow_velocity_;
84 Eigen::Vector3d adv_vector = rho_r * Cp_r * velocity * elem_direction;
85
86 return {// pipe
87 adv_vector,
88 // grout
89 {0, 0, 0}};
90}

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

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

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

59{
60 double const lambda_r = refrigerant.thermal_conductivity;
61 double const rho_r = refrigerant.density;
62 double const Cp_r = refrigerant.specific_heat_capacity;
63 double const alpha_L = _pipe.longitudinal_dispersion_length;
64 double const porosity_g = grout.porosity_g;
65 double const lambda_g = grout.lambda_g;
66
67 double const velocity_norm = std::abs(flow_velocity_);
68
69 return {{
70 // pipe
71 (lambda_r + rho_r * Cp_r * alpha_L * velocity_norm),
72 // grout
73 (1.0 - porosity_g) * lambda_g,
74 }};
75}

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

◆ thermalResistances()

std::vector< double > ProcessLib::HeatTransportBHE::BHE::BHE_1P::thermalResistances ( ParameterLib::SpatialPosition const & pos) const

Return the full vector of thermal resistances for the element at pos, computed once using the cached Nusselt number. Intended to be called once per element by the assembler so that the resistance computation is not repeated per unknown and per integration point.

Definition at line 101 of file BHE_1P.cpp.

103{
105}
std::vector< double > calcThermalResistances(double const Nu, ParameterLib::SpatialPosition const &pos) const
Definition BHE_1P.cpp:107

References cached_nu_, and calcThermalResistances().

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

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

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

◆ updateHeatTransferCoefficients()

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

Definition at line 92 of file BHE_1P.cpp.

93{
95 _pipe.single_pipe, borehole_geometry.length, refrigerant, flow_rate);
96
97 flow_velocity_ = tm_flow.velocity;
98 cached_nu_ = tm_flow.nusselt_number;
99}
ThermoMechanicalFlowProperties calculateThermoMechanicalFlowPropertiesPipe(Pipe const &pipe, double const length, RefrigerantProperties const &fluid, double const flow_rate)

References _pipe, ProcessLib::HeatTransportBHE::BHE::BHECommon::borehole_geometry, cached_nu_, ProcessLib::HeatTransportBHE::BHE::calculateThermoMechanicalFlowPropertiesPipe(), flow_velocity_, and ProcessLib::HeatTransportBHE::BHE::BHECommon::refrigerant.

Referenced by BHE_1P(), and updateFlowRateAndTemperature().

Member Data Documentation

◆ _pipe

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

◆ cached_nu_

double ProcessLib::HeatTransportBHE::BHE::BHE_1P::cached_nu_ = 0.0
private

Definition at line 151 of file BHE_1P.h.

Referenced by thermalResistances(), and updateHeatTransferCoefficients().

◆ flow_velocity_

double ProcessLib::HeatTransportBHE::BHE::BHE_1P::flow_velocity_ = 0.0
private

Scalar fluid velocity in the single pipe, refreshed in updateHeatTransferCoefficients. Sign mirrors the leg-0 (forward elem_direction) velocity; the per-leg signed velocity is derived from it in BHE_1P::flowLegs.

Definition at line 149 of file BHE_1P.h.

Referenced by flowLegs(), pipeAdvectionVectors(), pipeHeatConductions(), 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 120 of file BHE_1P.h.

120 {
121 {0, 1}};

◆ number_of_flow_legs

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

Definition at line 51 of file BHE_1P.h.

◆ number_of_grout_zones

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

Definition at line 50 of file BHE_1P.h.

◆ number_of_unknowns

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

Definition at line 49 of file BHE_1P.h.


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