OGS
ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType > Class Template Reference

Detailed Description

template<typename ShapeFunction, typename BHEType>
class ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >

Definition at line 21 of file HeatTransportBHELocalAssemblerBHE.h.

#include <HeatTransportBHELocalAssemblerBHE.h>

Inheritance diagram for ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >:
[legend]
Collaboration diagram for ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >:
[legend]

Public Types

using ShapeMatricesType
using ShapeMatrices = typename ShapeMatricesType::ShapeMatrices
using NodalMatrixType = typename ShapeMatricesType::NodalMatrixType
using NodalVectorType = typename ShapeMatricesType::NodalVectorType
using BheLocalMatrixType
using BheLocalVectorType

Public Member Functions

 HeatTransportBHELocalAssemblerBHE (HeatTransportBHELocalAssemblerBHE const &)=delete
 HeatTransportBHELocalAssemblerBHE (HeatTransportBHELocalAssemblerBHE &&)=delete
 HeatTransportBHELocalAssemblerBHE (MeshLib::Element const &e, NumLib::GenericIntegrationMethod const &integration_method, BHEType const &bhe, bool const is_axially_symmetric, HeatTransportBHEProcessData &process_data, BHEMeshData const &bhe_mesh_data)
void assemble (double const, double const, std::vector< double > const &, std::vector< double > const &, std::vector< double > &, std::vector< double > &, std::vector< double > &) override
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
Eigen::Map< const Eigen::RowVectorXd > getShapeMatrix (const unsigned integration_point) const override
 Provides the shape matrix at the given integration point.
Public Member Functions inherited from ProcessLib::LocalAssemblerInterface
virtual ~LocalAssemblerInterface ()=default
virtual void setInitialConditions (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t, int const process_id)
virtual void initialize (std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
virtual void preAssemble (double const, double const, std::vector< double > const &)
virtual void assembleForStaggeredScheme (double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data)
virtual void assembleWithJacobianForStaggeredScheme (double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
virtual void computeSecondaryVariable (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_prev, int const process_id)
virtual void preTimestep (std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table, GlobalVector const &x, double const t, double const delta_t)
virtual void postTimestep (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
void postNonLinearSolver (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
virtual Eigen::Vector3d getFlux (MathLib::Point3d const &, double const, std::vector< double > const &) const
virtual Eigen::Vector3d getFlux (MathLib::Point3d const &, double const, std::vector< std::vector< double > > const &) const
 Fits to staggered scheme.
virtual int getNumberOfVectorElementsForDeformation () const
Public Member Functions inherited from NumLib::ExtrapolatableElement
virtual ~ExtrapolatableElement ()=default

Private Attributes

HeatTransportBHEProcessData_process_data
std::vector< IntegrationPointDataBHE< ShapeMatricesType >, Eigen::aligned_allocator< IntegrationPointDataBHE< ShapeMatricesType > > > _ip_data
NumLib::GenericIntegrationMethod const & _integration_method
BHEType const & _bhe
std::size_t const _element_id
BHEMeshData const & _bhe_mesh_data
SecondaryData< typename ShapeMatrices::ShapeType > _secondary_data
Eigen::Vector3d _element_direction
int _section_index = 0
ShapeMatricesType::template MatrixType< bhe_unknowns_size, bhe_unknowns_size_R_matrix
ShapeMatricesType::template MatrixType< soil_temperature_size, soil_temperature_size_R_s_matrix
ShapeMatricesType::template MatrixType< bhe_unknowns_size, soil_temperature_size_R_pi_s_matrix

Static Private Attributes

static constexpr int bhe_unknowns = BHEType::number_of_unknowns
static constexpr int single_bhe_unknowns_size = ShapeFunction::NPOINTS
static constexpr int soil_temperature_size = ShapeFunction::NPOINTS
static constexpr int soil_temperature_index = 0
static constexpr int bhe_unknowns_size
static constexpr int bhe_unknowns_index = ShapeFunction::NPOINTS
static constexpr int local_matrix_size

Member Typedef Documentation

◆ BheLocalMatrixType

template<typename ShapeFunction, typename BHEType>
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::BheLocalMatrixType
Initial value:
typename ShapeMatricesType::template MatrixType<local_matrix_size,

Definition at line 42 of file HeatTransportBHELocalAssemblerBHE.h.

◆ BheLocalVectorType

template<typename ShapeFunction, typename BHEType>
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::BheLocalVectorType
Initial value:
typename ShapeMatricesType::template VectorType<local_matrix_size>

Definition at line 45 of file HeatTransportBHELocalAssemblerBHE.h.

◆ NodalMatrixType

template<typename ShapeFunction, typename BHEType>
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::NodalMatrixType = typename ShapeMatricesType::NodalMatrixType

Definition at line 38 of file HeatTransportBHELocalAssemblerBHE.h.

◆ NodalVectorType

template<typename ShapeFunction, typename BHEType>
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::NodalVectorType = typename ShapeMatricesType::NodalVectorType

Definition at line 39 of file HeatTransportBHELocalAssemblerBHE.h.

◆ ShapeMatrices

template<typename ShapeFunction, typename BHEType>
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::ShapeMatrices = typename ShapeMatricesType::ShapeMatrices

Definition at line 37 of file HeatTransportBHELocalAssemblerBHE.h.

◆ ShapeMatricesType

template<typename ShapeFunction, typename BHEType>
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::ShapeMatricesType
Initial value:
EigenFixedShapeMatrixPolicy< ShapeFunction, GlobalDim > ShapeMatrixPolicyType

Definition at line 35 of file HeatTransportBHELocalAssemblerBHE.h.

Constructor & Destructor Documentation

◆ HeatTransportBHELocalAssemblerBHE() [1/3]

◆ HeatTransportBHELocalAssemblerBHE() [2/3]

template<typename ShapeFunction, typename BHEType>
ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::HeatTransportBHELocalAssemblerBHE ( HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType > && )
delete

◆ HeatTransportBHELocalAssemblerBHE() [3/3]

template<typename ShapeFunction, typename BHEType>
ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::HeatTransportBHELocalAssemblerBHE ( MeshLib::Element const & e,
NumLib::GenericIntegrationMethod const & integration_method,
BHEType const & bhe,
bool const is_axially_symmetric,
HeatTransportBHEProcessData & process_data,
BHEMeshData const & bhe_mesh_data )

Definition at line 18 of file HeatTransportBHELocalAssemblerBHE-impl.h.

28 _bhe(bhe),
29 _element_id(e.getID()),
31{
32 // need to make sure that the BHE elements are one-dimensional
33 assert(e.getDimension() == 1);
34
35 unsigned const n_integration_points =
36 _integration_method.getNumberOfPoints();
37
40
41 auto const shape_matrices =
43 3 /* GlobalDim */>(e, is_axially_symmetric,
45
46 // ip data initialization
47 for (unsigned ip = 0; ip < n_integration_points; ip++)
48 {
49 auto const& sm = shape_matrices[ip];
50 // create the class IntegrationPointDataBHE in place
51 _ip_data.push_back(
52 {sm.N, sm.dNdx,
53 _integration_method.getWeightedPoint(ip).getWeight() *
54 sm.integralMeasure * sm.detJ});
55
56 _secondary_data.N[ip] = sm.N;
57 }
58
59 // calculate the element direction vector
60 auto const& p0 = e.getNode(0)->asEigenVector3d();
61 auto const& p1 = e.getNode(1)->asEigenVector3d();
62
64
65 auto const section_it =
66 _bhe_mesh_data.BHE_element_section_indices.find(_element_id);
67 if (section_it == _bhe_mesh_data.BHE_element_section_indices.end())
68 {
70 "Could not read BHE element section index for element id "
71 "{:d}.",
73 }
74
75 _section_index = section_it->second;
76 if (_section_index < 0)
77 {
79 "Invalid BHE section index for element id {:d}. Check BHE mesh "
80 "data initialisation.",
82 }
83
87 static constexpr int max_num_thermal_exchange_terms = 5;
88 // Formulate the local BHE R matrix.
89 // Only unknowns with thermal exchange terms need resistance assembly.
90 // In CXA/CXC there are 3 exchange terms (= number of unknowns),
91 // in 1U there are 4 (= number of unknowns),
92 // in 2U there are 5 but 8 unknowns — unknowns 5-7 (extra grout zones)
93 // have no exchange terms. See Diersch (2013) FEFLOW, M.127-M.128.
94 for (int idx_bhe_unknowns = 0;
98 {
105 // Loop over Gauss points
106 for (unsigned ip = 0; ip < n_integration_points; ip++)
107 {
108 auto const& N = _ip_data[ip].N;
109 auto const& w = _ip_data[ip].integration_weight;
110
111 // Get thermal resistance for this element's section
112 auto const& R = _bhe.thermalResistanceAtSection(idx_bhe_unknowns,
114 // calculate mass matrix for current unknown
115 matBHE_loc_R += N.transpose() * N * (1 / R) * w;
116 } // end of loop over integration point
117
121 } // end of loop over BHE unknowns
122}
#define OGS_FATAL(...)
Definition Error.h:19
ShapeMatricesType::template MatrixType< bhe_unknowns_size, bhe_unknowns_size > _R_matrix
ShapeMatricesType::template MatrixType< soil_temperature_size, soil_temperature_size > _R_s_matrix
std::vector< IntegrationPointDataBHE< ShapeMatricesType >, Eigen::aligned_allocator< IntegrationPointDataBHE< ShapeMatricesType > > > _ip_data
ShapeMatricesType::template MatrixType< bhe_unknowns_size, soil_temperature_size > _R_pi_s_matrix

References _bhe, _bhe_mesh_data, _element_direction, _element_id, _integration_method, _ip_data, _process_data, _R_matrix, _R_pi_s_matrix, _R_s_matrix, _secondary_data, _section_index, MathLib::Point3d::asEigenVector3d(), bhe_unknowns, bhe_unknowns_size, MeshLib::Element::getDimension(), MeshLib::Element::getNode(), NumLib::initShapeMatrices(), OGS_FATAL, single_bhe_unknowns_size, and soil_temperature_size.

Member Function Documentation

◆ assemble()

template<typename ShapeFunction, typename BHEType>
void ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::assemble ( double const ,
double const ,
std::vector< double > const & ,
std::vector< double > const & ,
std::vector< double > & local_M_data,
std::vector< double > & local_K_data,
std::vector< double > &  )
overridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 125 of file HeatTransportBHELocalAssemblerBHE-impl.h.

131{
136
137 unsigned const n_integration_points =
138 _integration_method.getNumberOfPoints();
139
140 auto const& pipe_heat_capacities = _bhe.pipeHeatCapacities();
141 auto const& pipe_heat_conductions =
142 _bhe.pipeHeatConductions(_section_index);
143 auto const& pipe_advection_vectors =
144 _bhe.pipeAdvectionVectors(_element_direction, _section_index);
145 auto const& cross_section_areas = _bhe.crossSectionAreas(_section_index);
146
147 // the mass and conductance matrix terms
148 for (unsigned ip = 0; ip < n_integration_points; ip++)
149 {
150 auto const& ip_data = _ip_data[ip];
151
152 auto const& w = ip_data.integration_weight;
153 auto const& N = ip_data.N;
154 auto const& dNdx = ip_data.dNdx;
155
156 // looping over all unknowns.
159 {
160 // get coefficient of mass from corresponding BHE.
163 auto const& advection_vector =
166
167 int const single_bhe_unknowns_index =
170 // local M
171 local_M
175 .noalias() += N.transpose() * N * mass_coeff * A * w;
176
177 // local K
178 // laplace part
179 local_K
183 .noalias() += dNdx.transpose() * dNdx * lambda * A * w;
184 // advection part
185 local_K
189 .noalias() +=
190 N.transpose() * advection_vector.transpose() * dNdx * A * w;
191 }
192 }
193
194 // add the R matrix to local_K
197
198 // add the R_pi_s matrix to local_K
199 local_K
202 .noalias() += _R_pi_s_matrix;
203 local_K
206 .noalias() += _R_pi_s_matrix.transpose();
207
208 // add the R_s matrix to local_K
209 local_K
212 .noalias() += _bhe.number_of_grout_zones * _R_s_matrix;
213}
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)

References _bhe, _element_direction, _integration_method, _ip_data, _R_matrix, _R_pi_s_matrix, _R_s_matrix, _section_index, bhe_unknowns, bhe_unknowns_index, MathLib::createZeroedMatrix(), local_matrix_size, single_bhe_unknowns_size, and soil_temperature_index.

Referenced by assembleWithJacobian().

◆ assembleWithJacobian()

template<typename ShapeFunction, typename BHEType>
void ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::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 )
overridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 216 of file HeatTransportBHELocalAssemblerBHE-impl.h.

222{
223 auto const local_matrix_size = local_x.size();
224 // initialize x and x_prev
225 auto x =
229 // initialize local_Jac and local_rhs
234
238 local_rhs_data /*not going to be used*/);
239
240 // convert to matrix
245
246 // Jac matrix and rhs vector operation
247 local_Jac.noalias() += local_K + local_M / dt;
248 local_rhs.noalias() -= local_K * x + local_M * (x - x_prev) / dt;
249
250 local_M.setZero();
251 local_K.setZero();
252}
void assemble(double const, double const, std::vector< double > const &, std::vector< double > const &, std::vector< double > &, std::vector< double > &, std::vector< double > &) override
Eigen::Map< Vector > createZeroedVector(std::vector< double > &data, Eigen::VectorXd::Index size)
Eigen::Map< const Matrix > toMatrix(std::vector< double > const &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)

References assemble(), MathLib::createZeroedMatrix(), MathLib::createZeroedVector(), local_matrix_size, and MathLib::toMatrix().

◆ getShapeMatrix()

template<typename ShapeFunction, typename BHEType>
Eigen::Map< const Eigen::RowVectorXd > ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::getShapeMatrix ( const unsigned integration_point) const
inlineoverridevirtual

Provides the shape matrix at the given integration point.

Implements NumLib::ExtrapolatableElement.

Definition at line 74 of file HeatTransportBHELocalAssemblerBHE.h.

76 {
77 auto const& N = _secondary_data.N[integration_point];
78
79 // assumes N is stored contiguously in memory
80 return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size());
81 }

References _secondary_data.

Member Data Documentation

◆ _bhe

template<typename ShapeFunction, typename BHEType>
BHEType const& ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::_bhe
private

◆ _bhe_mesh_data

template<typename ShapeFunction, typename BHEType>
BHEMeshData const& ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::_bhe_mesh_data
private

◆ _element_direction

template<typename ShapeFunction, typename BHEType>
Eigen::Vector3d ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::_element_direction
private

◆ _element_id

template<typename ShapeFunction, typename BHEType>
std::size_t const ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::_element_id
private

◆ _integration_method

template<typename ShapeFunction, typename BHEType>
NumLib::GenericIntegrationMethod const& ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::_integration_method
private

◆ _ip_data

template<typename ShapeFunction, typename BHEType>
std::vector< IntegrationPointDataBHE<ShapeMatricesType>, Eigen::aligned_allocator<IntegrationPointDataBHE<ShapeMatricesType> > > ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::_ip_data
private

◆ _process_data

◆ _R_matrix

template<typename ShapeFunction, typename BHEType>
ShapeMatricesType::template MatrixType<bhe_unknowns_size, bhe_unknowns_size> ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::_R_matrix
private

◆ _R_pi_s_matrix

template<typename ShapeFunction, typename BHEType>
ShapeMatricesType::template MatrixType<bhe_unknowns_size, soil_temperature_size> ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::_R_pi_s_matrix
private

◆ _R_s_matrix

template<typename ShapeFunction, typename BHEType>
ShapeMatricesType::template MatrixType<soil_temperature_size, soil_temperature_size> ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::_R_s_matrix
private

◆ _secondary_data

template<typename ShapeFunction, typename BHEType>
SecondaryData<typename ShapeMatrices::ShapeType> ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::_secondary_data
private

◆ _section_index

template<typename ShapeFunction, typename BHEType>
int ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::_section_index = 0
private

◆ bhe_unknowns

template<typename ShapeFunction, typename BHEType>
int ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::bhe_unknowns = BHEType::number_of_unknowns
staticconstexprprivate

◆ bhe_unknowns_index

template<typename ShapeFunction, typename BHEType>
int ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::bhe_unknowns_index = ShapeFunction::NPOINTS
staticconstexprprivate

Definition at line 30 of file HeatTransportBHELocalAssemblerBHE.h.

Referenced by assemble().

◆ bhe_unknowns_size

template<typename ShapeFunction, typename BHEType>
int ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::bhe_unknowns_size
staticconstexprprivate

◆ local_matrix_size

template<typename ShapeFunction, typename BHEType>
int ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::local_matrix_size
staticconstexprprivate
Initial value:

Definition at line 31 of file HeatTransportBHELocalAssemblerBHE.h.

Referenced by assemble(), and assembleWithJacobian().

◆ single_bhe_unknowns_size

template<typename ShapeFunction, typename BHEType>
int ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::single_bhe_unknowns_size = ShapeFunction::NPOINTS
staticconstexprprivate

◆ soil_temperature_index

template<typename ShapeFunction, typename BHEType>
int ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::soil_temperature_index = 0
staticconstexprprivate

Definition at line 27 of file HeatTransportBHELocalAssemblerBHE.h.

Referenced by assemble().

◆ soil_temperature_size

template<typename ShapeFunction, typename BHEType>
int ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerBHE< ShapeFunction, BHEType >::soil_temperature_size = ShapeFunction::NPOINTS
staticconstexprprivate

The documentation for this class was generated from the following files: