OGS
BHECommonCoaxial.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "BHECommonCoaxial.h"
5
6#include "Physics.h"
9
10namespace ProcessLib
11{
12namespace HeatTransportBHE
13{
14namespace BHE
15{
17 BoreholeGeometry const& borehole,
21 PipeConfigurationCoaxial const& pipes,
22 bool const use_python_bcs)
25 _pipes(pipes)
26{
27 cross_section_area_inner_pipe = _pipes.inner_pipe.area();
29 _pipes.outer_pipe.area() - _pipes.inner_pipe.outsideArea();
31 borehole_geometry.area() - _pipes.outer_pipe.outsideArea();
32
33 _thermal_resistances.fill(std::numeric_limits<double>::quiet_NaN());
34}
35
36std::array<double, BHECommonCoaxial::number_of_unknowns>
38{
39 double const rho_r = refrigerant.density;
40 double const specific_heat_capacity = refrigerant.specific_heat_capacity;
41 double const rho_g = grout.rho_g;
42 double const porosity_g = grout.porosity_g;
43 double const heat_cap_g = grout.heat_cap_g;
44
45 return {{/*i*/ rho_r * specific_heat_capacity,
46 /*o*/ rho_r * specific_heat_capacity,
47 /*g*/ (1.0 - porosity_g) * rho_g * heat_cap_g}};
48}
49
51 double const current_time)
52{
53 auto values =
54 visit([&](auto const& control) { return control(T_out, current_time); },
56 updateHeatTransferCoefficients(values.flow_rate);
57 return values.temperature;
58}
59std::array<double, BHECommonCoaxial::number_of_unknowns>
61{
62 double const lambda_r = refrigerant.thermal_conductivity;
63 double const rho_r = refrigerant.density;
64 double const Cp_r = refrigerant.specific_heat_capacity;
65 double const alpha_L = _pipes.longitudinal_dispersion_length;
66 double const porosity_g = grout.porosity_g;
67 double const lambda_g = grout.lambda_g;
68
69 auto v = velocities();
70 // Here we calculate the laplace coefficients in the governing
71 // equations of BHE. These governing equations can be found in
72 // 1) Diersch (2013) FEFLOW book on page 952, M.120-122, or
73 // 2) Diersch (2011) Comp & Geosci 37:1122-1135, Eq. 26-28, 23-25
74 return {{// pipe i, Eq. 26 and Eq. 23
75 (lambda_r + rho_r * Cp_r * alpha_L * std::abs(v[0])),
76 // pipe o, Eq. 27 and Eq. 24
77 (lambda_r + rho_r * Cp_r * alpha_L * std::abs(v[1])),
78 // pipe g, Eq. 28 and Eq. 25
79 (1.0 - porosity_g) * lambda_g}};
80}
81
82std::array<Eigen::Vector3d, BHECommonCoaxial::number_of_unknowns>
84 Eigen::Vector3d const& elem_direction) const
85{
86 double const rho_r = refrigerant.density;
87 double const Cp_r = refrigerant.specific_heat_capacity;
88 auto const v = velocities();
89
90 return {// pipe i, Eq. 26 and Eq. 23
91 rho_r * Cp_r * std::abs(v[0]) * elem_direction,
92 // pipe o, Eq. 27 and Eq. 24
93 -rho_r * Cp_r * std::abs(v[1]) * elem_direction,
94 // grout g, Eq. 28 and Eq. 25
95 {0, 0, 0}};
96}
97
98std::array<double, BHECommonCoaxial::number_of_unknowns>
100 double const Nu_annulus_pipe) const
101{
102 // thermal resistances due to advective flow of refrigerant in the pipes
103 auto const R_advective = calculateAdvectiveThermalResistance(
104 _pipes.inner_pipe, _pipes.outer_pipe, refrigerant, Nu_inner_pipe,
105 Nu_annulus_pipe);
106
107 // thermal resistance due to thermal conductivity of the pipe wall material
108 auto const R_conductive = calculatePipeWallThermalResistance(
109 _pipes.inner_pipe, _pipes.outer_pipe);
110
111 // thermal resistance due to the grout transition and grout-soil exchange.
113 _pipes.outer_pipe, grout, borehole_geometry.diameter);
114
115 // thermal resistance due to grout-soil exchange
116 double const R_gs = R.grout_soil;
117
118 // Eq. 56 and 57
119 double const R_ff = R_advective.inner_pipe_coaxial + R_advective.a_annulus +
120 R_conductive.inner_pipe_coaxial;
121 double const R_fg =
122 R_advective.b_annulus + R_conductive.annulus + R.conductive_b;
123
124 return getThermalResistances(R_gs, R_ff, R_fg);
125}
126
127std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>
129 std::size_t const top_node_id,
130 std::size_t const /*bottom_node_id*/,
131 int const in_component_id)
132{
133 return {std::make_pair(top_node_id, in_component_id),
134 std::make_pair(top_node_id, in_component_id + 1)};
135}
136
137std::optional<
138 std::array<std::pair<std::size_t /*node_id*/, int /*component*/>, 2>>
140 std::size_t const bottom_node_id, int const in_component_id,
141 int const out_component_id)
142{
143 return {{std::make_pair(bottom_node_id, in_component_id),
144 std::make_pair(bottom_node_id, out_component_id)}};
145}
146
148{
149 auto const tm_flow_properties_annulus =
151 _pipes.outer_pipe,
152 borehole_geometry.length,
154 flow_rate);
155
156 _flow_velocity_annulus = tm_flow_properties_annulus.velocity;
157
158 auto const tm_flow_properties = calculateThermoMechanicalFlowPropertiesPipe(
159 _pipes.inner_pipe, borehole_geometry.length, refrigerant, flow_rate);
160
161 _flow_velocity_inner = tm_flow_properties.velocity;
162
164 calcThermalResistances(tm_flow_properties.nusselt_number,
165 tm_flow_properties_annulus.nusselt_number);
166}
167} // namespace BHE
168} // namespace HeatTransportBHE
169} // 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, BuildingPowerCurveHotWaterCurveActiveCoolingCurveFlowCurve, BuildingPowerCurveHotWaterCurvePassiveCoolingCurveFlowCurve, BuildingPowerCurveHotWaterCurveFlowCurve, BuildingPowerCurveActiveCoolingCurveFlowCurve, BuildingPowerCurvePassiveCoolingCurveFlowCurve, BuildingPowerCurveFlowCurve, ActiveCoolingCurveFlowCurve > 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:36
FlowAndTemperatureControl const flowAndTemperatureControl
Definition BHECommon.h:38