OGS
BHECommonCoaxial.cpp
Go to the documentation of this file.
1
11#include "BHECommonCoaxial.h"
12
13#include "Physics.h"
16
17namespace ProcessLib
18{
19namespace HeatTransportBHE
20{
21namespace BHE
22{
24 BoreholeGeometry const& borehole,
25 RefrigerantProperties const& refrigerant,
26 GroutParameters const& grout,
27 FlowAndTemperatureControl const& flowAndTemperatureControl,
28 PipeConfigurationCoaxial const& pipes,
29 bool const use_python_bcs)
30 : BHECommon{borehole, refrigerant, grout, flowAndTemperatureControl,
31 use_python_bcs},
32 _pipes(pipes)
33{
39
40 _thermal_resistances.fill(std::numeric_limits<double>::quiet_NaN());
41}
42
43std::array<double, BHECommonCoaxial::number_of_unknowns>
45{
46 double const rho_r = refrigerant.density;
47 double const specific_heat_capacity = refrigerant.specific_heat_capacity;
48 double const rho_g = grout.rho_g;
49 double const porosity_g = grout.porosity_g;
50 double const heat_cap_g = grout.heat_cap_g;
51
52 return {{/*i*/ rho_r * specific_heat_capacity,
53 /*o*/ rho_r * specific_heat_capacity,
54 /*g*/ (1.0 - porosity_g) * rho_g * heat_cap_g}};
55}
56
58 double const current_time)
59{
60 auto values =
61 visit([&](auto const& control) { return control(T_out, current_time); },
63 updateHeatTransferCoefficients(values.flow_rate);
64 return values.temperature;
65}
66std::array<double, BHECommonCoaxial::number_of_unknowns>
68{
69 double const lambda_r = refrigerant.thermal_conductivity;
70 double const rho_r = refrigerant.density;
71 double const Cp_r = refrigerant.specific_heat_capacity;
72 double const alpha_L = _pipes.longitudinal_dispersion_length;
73 double const porosity_g = grout.porosity_g;
74 double const lambda_g = grout.lambda_g;
75
76 auto v = velocities();
77 // Here we calculate the laplace coefficients in the governing
78 // equations of BHE. These governing equations can be found in
79 // 1) Diersch (2013) FEFLOW book on page 952, M.120-122, or
80 // 2) Diersch (2011) Comp & Geosci 37:1122-1135, Eq. 26-28, 23-25
81 return {{// pipe i, Eq. 26 and Eq. 23
82 (lambda_r + rho_r * Cp_r * alpha_L * std::abs(v[0])),
83 // pipe o, Eq. 27 and Eq. 24
84 (lambda_r + rho_r * Cp_r * alpha_L * std::abs(v[1])),
85 // pipe g, Eq. 28 and Eq. 25
86 (1.0 - porosity_g) * lambda_g}};
87}
88
89std::array<Eigen::Vector3d, BHECommonCoaxial::number_of_unknowns>
91 Eigen::Vector3d const& elem_direction) const
92{
93 double const rho_r = refrigerant.density;
94 double const Cp_r = refrigerant.specific_heat_capacity;
95 auto const v = velocities();
96
97 return {// pipe i, Eq. 26 and Eq. 23
98 rho_r * Cp_r * std::abs(v[0]) * elem_direction,
99 // pipe o, Eq. 27 and Eq. 24
100 -rho_r * Cp_r * std::abs(v[1]) * elem_direction,
101 // grout g, Eq. 28 and Eq. 25
102 {0, 0, 0}};
103}
104
105std::array<double, BHECommonCoaxial::number_of_unknowns>
107 double const Nu_annulus_pipe) const
108{
109 // thermal resistances due to advective flow of refrigerant in the pipes
110 auto const R_advective = calculateAdvectiveThermalResistance(
112 Nu_annulus_pipe);
113
114 // thermal resistance due to thermal conductivity of the pipe wall material
115 auto const R_conductive = calculatePipeWallThermalResistance(
117
118 // thermal resistance due to the grout transition and grout-soil exchange.
121
122 // thermal resistance due to grout-soil exchange
123 double const R_gs = R.grout_soil;
124
125 // Eq. 56 and 57
126 double const R_ff = R_advective.inner_pipe_coaxial + R_advective.a_annulus +
127 R_conductive.inner_pipe_coaxial;
128 double const R_fg =
129 R_advective.b_annulus + R_conductive.annulus + R.conductive_b;
130
131 return getThermalResistances(R_gs, R_ff, R_fg);
132}
133
134std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>
136 std::size_t const top_node_id,
137 std::size_t const /*bottom_node_id*/,
138 int const in_component_id)
139{
140 return {std::make_pair(top_node_id, in_component_id),
141 std::make_pair(top_node_id, in_component_id + 1)};
142}
143
144std::optional<
145 std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>>
147 std::size_t const bottom_node_id, int const in_component_id,
148 int const out_component_id)
149{
150 return {{std::make_pair(bottom_node_id, in_component_id),
151 std::make_pair(bottom_node_id, out_component_id)}};
152}
153
155{
156 auto const tm_flow_properties_annulus =
161 flow_rate);
162
163 _flow_velocity_annulus = tm_flow_properties_annulus.velocity;
164
165 auto const tm_flow_properties = calculateThermoMechanicalFlowPropertiesPipe(
167
168 _flow_velocity_inner = tm_flow_properties.velocity;
169
171 calcThermalResistances(tm_flow_properties.nusselt_number,
172 tm_flow_properties_annulus.nusselt_number);
173}
174} // namespace BHE
175} // namespace HeatTransportBHE
176} // namespace ProcessLib
virtual std::array< double, number_of_unknowns > getThermalResistances(double const &R_gs, double const &R_ff, double const &R_fg) const =0
virtual std::array< double, 2 > velocities() const =0
double updateFlowRateAndTemperature(double T_out, double current_time)
BHECommonCoaxial(BoreholeGeometry const &borehole, RefrigerantProperties const &refrigerant, GroutParameters const &grout, FlowAndTemperatureControl const &flowAndTemperatureControl, PipeConfigurationCoaxial const &pipes, bool const use_python_bcs)
std::array< double, number_of_unknowns > pipeHeatConductions() const
std::array< double, number_of_unknowns > pipeHeatCapacities() const
std::array< double, number_of_unknowns > calcThermalResistances(double const Nu_inner_pipe, double const Nu_annulus_pipe) const
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)
double _flow_velocity_inner
Flow velocity inside the pipes and annulus. Depends on the flow_rate.
std::array< Eigen::Vector3d, number_of_unknowns > pipeAdvectionVectors(Eigen::Vector3d const &) const
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)
std::array< double, number_of_unknowns > _thermal_resistances
PipeWallThermalResistanceCoaxial calculatePipeWallThermalResistance(Pipe const &inner_pipe, Pipe const &outer_pipe)
ThermoMechanicalFlowProperties calculateThermoMechanicalFlowPropertiesAnnulus(Pipe const &inner_pipe, Pipe const &outer_pipe, double const length, RefrigerantProperties const &fluid, double const flow_rate)
AdvectiveThermalResistanceCoaxial calculateAdvectiveThermalResistance(Pipe const &inner_pipe, Pipe const &outer_pipe, RefrigerantProperties const &fluid, double const Nu_inner_pipe, double const Nu_annulus)
std::variant< TemperatureCurveConstantFlow, TemperatureCurveFlowCurve, FixedPowerConstantFlow, FixedPowerFlowCurve, PowerCurveConstantFlow, PowerCurveFlowCurve, BuildingPowerCurveConstantFlow > FlowAndTemperatureControl
GroutAndGroutSoilExchangeThermalResistanceCoaxial calculateGroutAndGroutSoilExchangeThermalResistance(Pipe const &outer_pipe, GroutParameters const &grout_parameters, double const borehole_diameter)
ThermoMechanicalFlowProperties calculateThermoMechanicalFlowPropertiesPipe(Pipe const &pipe, double const length, RefrigerantProperties const &fluid, double const flow_rate)
RefrigerantProperties const refrigerant
Definition BHECommon.h:42
FlowAndTemperatureControl const flowAndTemperatureControl
Definition BHECommon.h:44
double outsideArea() const
Area of the pipe's outside including the wall thickness.
Definition Pipe.h:36
double area() const
Area of the pipe's inside without the wall.
Definition Pipe.h:33