21template <
typename ShapeFunction,
typename BHEType>
27 bool const is_axially_symmetric,
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>(
121template <
typename ShapeFunction,
typename BHEType>
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>& )
134 unsigned const n_integration_points =
137 auto const& pipe_heat_capacities =
_bhe.pipeHeatCapacities();
138 auto const& pipe_heat_conductions =
_bhe.pipeHeatConductions();
139 auto const& pipe_advection_vectors =
141 auto const& cross_section_areas =
_bhe.crossSectionAreas();
144 for (
unsigned ip = 0; ip < n_integration_points; 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 =
170 single_bhe_unknowns_index, single_bhe_unknowns_index)
171 .noalias() += N.transpose() * N * mass_coeff * A * w;
178 single_bhe_unknowns_index, single_bhe_unknowns_index)
179 .noalias() += dNdx.transpose() * dNdx * lambda * A * w;
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>(
196 .template block<bhe_unknowns_size, soil_temperature_size>(
200 .template block<soil_temperature_size, bhe_unknowns_size>(
206 .template block<soil_temperature_size, soil_temperature_size>(
217template <
typename ShapeFunction,
typename BHEType>
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)
229 auto x_prev = Eigen::Map<BheLocalVectorType const>(local_x_prev.data(),
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,
249 local_Jac.noalias() += local_K + local_M / dt;
250 local_rhs.noalias() -= local_K * x + local_M * (x - x_prev) / dt;
Eigen::Vector3d const & asEigenVector3d() const
virtual const Node * getNode(unsigned idx) const =0
virtual constexpr unsigned getDimension() const =0
Get dimension of the mesh element.
ShapeMatricesType::template MatrixType< bhe_unknowns_size, bhe_unknowns_size > _R_matrix
ShapeMatricesType::template MatrixType< soil_temperature_size, soil_temperature_size > _R_s_matrix
Eigen::Vector3d _element_direction
SecondaryData< typename ShapeMatrices::ShapeType > _secondary_data
ShapeMatrixPolicyType< ShapeFunction, 3 > ShapeMatricesType
static constexpr int soil_temperature_size
std::vector< IntegrationPointDataBHE< ShapeMatricesType >, Eigen::aligned_allocator< IntegrationPointDataBHE< ShapeMatricesType > > > _ip_data
ShapeMatricesType::template MatrixType< bhe_unknowns_size, soil_temperature_size > _R_pi_s_matrix
void assemble(double const, double const, std::vector< double > const &, std::vector< double > const &, std::vector< double > &, std::vector< double > &, std::vector< double > &) override
static constexpr int bhe_unknowns_size
static constexpr int bhe_unknowns
static constexpr int bhe_unknowns_index
static constexpr int local_matrix_size
NumLib::GenericIntegrationMethod const & _integration_method
static constexpr int single_bhe_unknowns_size
void assembleWithJacobian(double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_x_prev, std::vector< double > &local_rhs_data, std::vector< double > &local_Jac_data) override
static constexpr int soil_temperature_index
HeatTransportBHELocalAssemblerBHE(HeatTransportBHELocalAssemblerBHE const &)=delete
std::size_t const _element_id
HeatTransportBHEProcessData & _process_data
Eigen::Map< Vector > createZeroedVector(std::vector< double > &data, Eigen::VectorXd::Index size)
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
Eigen::Map< const Matrix > toMatrix(std::vector< double > const &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > initShapeMatrices(MeshLib::Element const &e, bool const is_axially_symmetric, IntegrationMethod const &integration_method)