27 bool const is_axially_symmetric,
29 : _process_data(process_data),
30 _integration_method(integration_method),
32 _element_id(e.getID())
37 unsigned const n_integration_points =
40 _ip_data.reserve(n_integration_points);
43 auto const shape_matrices =
45 3 >(e, is_axially_symmetric,
49 for (
unsigned ip = 0; ip < n_integration_points; ip++)
51 auto const& sm = shape_matrices[ip];
56 sm.integralMeasure * sm.detJ});
70 static constexpr int max_num_thermal_exchange_terms = 5;
72 for (
int idx_bhe_unknowns = 0; idx_bhe_unknowns <
bhe_unknowns;
75 typename ShapeMatricesType::template MatrixType<
77 matBHE_loc_R = ShapeMatricesType::template MatrixType<
82 for (
unsigned ip = 0; ip < n_integration_points; ip++)
85 auto const& w =
_ip_data[ip].integration_weight;
87 auto const& R =
_bhe.thermalResistance(idx_bhe_unknowns);
89 matBHE_loc_R += N.transpose() * N * (1 / R) * w;
101 if (idx_bhe_unknowns < max_num_thermal_exchange_terms)
103 _bhe.template assembleRMatrices<ShapeFunction::NPOINTS>(
123 double const ,
double const ,
124 std::vector<double>
const& ,
125 std::vector<double>
const& ,
126 std::vector<double>& local_M_data, std::vector<double>& local_K_data,
127 std::vector<double>& )
130 local_M_data, local_matrix_size, local_matrix_size);
132 local_K_data, local_matrix_size, local_matrix_size);
134 unsigned const n_integration_points =
135 _integration_method.getNumberOfPoints();
137 auto const& pipe_heat_capacities = _bhe.pipeHeatCapacities();
138 auto const& pipe_heat_conductions = _bhe.pipeHeatConductions();
139 auto const& pipe_advection_vectors =
140 _bhe.pipeAdvectionVectors(_element_direction);
141 auto const& cross_section_areas = _bhe.crossSectionAreas();
144 for (
unsigned ip = 0; ip < n_integration_points; ip++)
146 auto& ip_data = _ip_data[ip];
148 auto const& w = ip_data.integration_weight;
149 auto const& N = ip_data.N;
150 auto const& dNdx = ip_data.dNdx;
153 for (
int idx_bhe_unknowns = 0; idx_bhe_unknowns < bhe_unknowns;
157 auto const& mass_coeff = pipe_heat_capacities[idx_bhe_unknowns];
158 auto const& lambda = pipe_heat_conductions[idx_bhe_unknowns];
159 auto const& advection_vector =
160 pipe_advection_vectors[idx_bhe_unknowns];
161 auto const& A = cross_section_areas[idx_bhe_unknowns];
163 int const single_bhe_unknowns_index =
165 single_bhe_unknowns_size * idx_bhe_unknowns;
168 .template block<single_bhe_unknowns_size,
169 single_bhe_unknowns_size>(
170 single_bhe_unknowns_index, single_bhe_unknowns_index)
171 .noalias() += N.transpose() * N * mass_coeff * A * w;
176 .template block<single_bhe_unknowns_size,
177 single_bhe_unknowns_size>(
178 single_bhe_unknowns_index, single_bhe_unknowns_index)
179 .noalias() += dNdx.transpose() * dNdx * lambda * A * w;
182 .template block<single_bhe_unknowns_size,
183 single_bhe_unknowns_size>(
184 single_bhe_unknowns_index, single_bhe_unknowns_index)
186 N.transpose() * advection_vector.transpose() * dNdx * A * w;
191 local_K.template block<bhe_unknowns_size, bhe_unknowns_size>(
192 bhe_unknowns_index, bhe_unknowns_index) += _R_matrix;
196 .template block<bhe_unknowns_size, soil_temperature_size>(
197 bhe_unknowns_index, soil_temperature_index)
198 .noalias() += _R_pi_s_matrix;
200 .template block<soil_temperature_size, bhe_unknowns_size>(
201 soil_temperature_index, bhe_unknowns_index)
202 .noalias() += _R_pi_s_matrix.transpose();
206 .template block<soil_temperature_size, soil_temperature_size>(
207 soil_temperature_index, soil_temperature_index)
208 .noalias() += _bhe.number_of_grout_zones * _R_s_matrix;
220 std::vector<double>
const& local_x,
221 std::vector<double>
const& local_x_prev,
222 std::vector<double>& local_rhs_data,
223 std::vector<double>& local_Jac_data)
225 auto const local_matrix_size = local_x.size();
228 Eigen::Map<BheLocalVectorType const>(local_x.data(), local_matrix_size);
229 auto x_prev = Eigen::Map<BheLocalVectorType const>(local_x_prev.data(),
233 local_Jac_data, local_matrix_size, local_matrix_size);
235 local_rhs_data, local_matrix_size);
237 std::vector<double> local_M_data;
238 std::vector<double> local_K_data;
239 assemble(t, dt, local_x, local_x_prev, local_M_data, local_K_data,
244 local_M_data, local_matrix_size, local_matrix_size);
246 local_K_data, local_matrix_size, local_matrix_size);
249 local_Jac.noalias() += local_K + local_M / dt;
250 local_rhs.noalias() -= local_K * x + local_M * (x - x_prev) / dt;