21namespace HeatTransportBHE
30 bool const use_python_bcs)
31 :
BHECommonUType{borehole, refrigerant, grout, flowAndTemperatureControl,
32 pipes, use_python_bcs}
38 [&](
auto const& control) {
55 return {{ rho_r * specific_heat_capacity,
56 rho_r * specific_heat_capacity,
57 rho_r * specific_heat_capacity,
58 rho_r * specific_heat_capacity,
59 (1.0 - porosity_g) * rho_g * heat_cap_g,
60 (1.0 - porosity_g) * rho_g * heat_cap_g,
61 (1.0 - porosity_g) * rho_g * heat_cap_g,
62 (1.0 - porosity_g) * rho_g * heat_cap_g}};
88 (1.0 - porosity_g) * lambda_g,
90 (1.0 - porosity_g) * lambda_g,
92 (1.0 - porosity_g) * lambda_g,
94 (1.0 - porosity_g) * lambda_g}};
97std::array<Eigen::Vector3d, BHE_2U::number_of_unknowns>
123 return (1 - chi) * R_g;
129 double const R_gg = 2.0 * R_gs * (R_ar - 2.0 * chi * R_g) /
130 (2.0 * R_gs - R_ar + 2.0 * chi * R_g);
131 if (!std::isfinite(R_gg))
134 "Error!!! Grout Thermal Resistance is an infinite number! The "
135 "simulation will be stopped!");
155 double chi_new = chi;
157 auto constraint = [&]()
158 {
return 1.0 / ((1.0 / R_gg_1) + (1.0 / (2.0 * R_gs))); };
160 std::array<double, 3>
const multiplier{chi * 2.0 / 3.0, chi * 1.0 / 3.0,
162 for (
double m_chi : multiplier)
164 if (constraint() >= 0)
169 "Warning! Correction procedure was applied due to negative thermal "
170 "resistance! Chi = {:f}.\n",
178 return {chi_new, R_gg_1, R_gg_2, R_gs};
196 constexpr double pi = std::numbers::pi;
204 double const R_adv_i = 1.0 / (Nu * lambda_r * pi);
205 double const R_adv_o = 1.0 / (Nu * lambda_r * pi);
209 double const R_con_a =
211 (2.0 * pi * lambda_p);
218 std::log(std::sqrt(D * D + 4 * d0 * d0) / 2 / std::sqrt(2) / d0) /
219 std::log(D / 2 / d0);
225 (2 * pi * lambda_g) *
230 double const R_ar_1 =
233 (2.0 * pi * lambda_g);
235 double const R_ar_2 =
238 (2.0 * pi * lambda_g);
240 auto const [chi_new, R_gg_1, R_gg_2, R_gs] =
244 double const R_con_b = chi_new * R_g;
247 double const R_fig = R_adv_i + R_con_a + R_con_b;
248 double const R_fog = R_adv_o + R_con_a + R_con_b;
250 return {{R_fig, R_fog, R_gg_1, R_gg_2, R_gs}};
263std::array<std::pair<std::size_t ,
int >, 2>
265 std::size_t
const top_node_id,
267 int const in_component_id)
269 return {std::make_pair(top_node_id, in_component_id),
270 std::make_pair(top_node_id, in_component_id + 2)};
274 std::array<std::pair<std::size_t ,
int >, 2>>
276 std::size_t
const bottom_node_id,
277 int const in_component_id,
278 int const out_component_id)
280 return {{std::make_pair(bottom_node_id, in_component_id),
281 std::make_pair(bottom_node_id, out_component_id)}};
299 double const current_time)
302 visit([&](
auto const& control) {
return control(T_out, current_time); },
305 return values.temperature;
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
PipeConfigurationUType const _pipes
double _flow_velocity
Flow velocity inside the pipes. Depends on the flow_rate.
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 > calcThermalResistances(double const Nu)
Nu is the Nusselt number.
void updateHeatTransferCoefficients(double const flow_rate)
std::array< double, number_of_unknowns > _thermal_resistances
std::array< double, number_of_unknowns > pipeHeatConductions() const
std::array< Eigen::Vector3d, number_of_unknowns > pipeAdvectionVectors(Eigen::Vector3d const &) const
double updateFlowRateAndTemperature(double T_out, double current_time)
Return the inflow temperature for the boundary condition.
std::array< double, number_of_unknowns > pipeHeatCapacities() const
BHE_2U(BoreholeGeometry const &borehole, RefrigerantProperties const &refrigerant, GroutParameters const &grout, FlowAndTemperatureControl const &flowAndTemperatureControl, PipeConfigurationUType const &pipes, bool const use_python_bcs)
std::array< double, number_of_unknowns > crossSectionAreas() 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)
std::variant< TemperatureCurveConstantFlow, TemperatureCurveFlowCurve, FixedPowerConstantFlow, FixedPowerFlowCurve, PowerCurveConstantFlow, PowerCurveFlowCurve, BuildingPowerCurveConstantFlow > FlowAndTemperatureControl
double compute_R_gg_2U(double const chi, double const R_gs, double const R_ar, double const R_g)
double compute_R_gs_2U(double const chi, double const R_g)
ThermoMechanicalFlowProperties calculateThermoMechanicalFlowPropertiesPipe(Pipe const &pipe, double const length, RefrigerantProperties const &fluid, double const flow_rate)
std::array< double, 4 > thermalResistancesGroutSoil2U(double const chi, double const R_ar_1, double const R_ar_2, double const R_g)
RefrigerantProperties const refrigerant
GroutParameters const grout
FlowAndTemperatureControl const flowAndTemperatureControl
BoreholeGeometry const borehole_geometry
double const longitudinal_dispersion_length
double const distance
Distance between pipes.
double outsideArea() const
Area of the pipe's outside including the wall thickness.
double outsideDiameter() const
double const wall_thermal_conductivity
double area() const
Area of the pipe's inside without the wall.
double const thermal_conductivity
double const specific_heat_capacity
double const reference_temperature