OGS
ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim > Class Template Reference

Detailed Description

template<typename ShapeFunction, int GlobalDim>
class ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >

Definition at line 49 of file HeatConductionFEM.h.

#include <HeatConductionFEM.h>

Inheritance diagram for ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >:
[legend]
Collaboration diagram for ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >:
[legend]

Public Member Functions

 LocalAssemblerData (MeshLib::Element const &element, std::size_t const local_matrix_size, NumLib::GenericIntegrationMethod const &integration_method, bool is_axially_symmetric, HeatConductionProcessData const &process_data)
 
void assemble (double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &, std::vector< double > &local_M_data, std::vector< double > &local_K_data, 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.
 
std::vector< double > const & getIntPtHeatFlux (const double t, std::vector< GlobalVector * > const &x, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_table, std::vector< double > &cache) const override
 
- Public Member Functions inherited from ProcessLib::HeatConduction::HeatConductionLocalAssemblerInterface
- 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.
 
- Public Member Functions inherited from NumLib::ExtrapolatableElement
virtual ~ExtrapolatableElement ()=default
 

Private Types

using ShapeMatricesType = ShapeMatrixPolicyType<ShapeFunction, GlobalDim>
 
using ShapeMatrices = typename ShapeMatricesType::ShapeMatrices
 
using LocalAssemblerTraits
 
using NodalMatrixType = typename LocalAssemblerTraits::LocalMatrix
 
using NodalVectorType = typename LocalAssemblerTraits::LocalVector
 
using GlobalDimVectorType = typename ShapeMatricesType::GlobalDimVectorType
 

Private Attributes

MeshLib::Element const & _element
 
HeatConductionProcessData const & _process_data
 
NumLib::GenericIntegrationMethod const & _integration_method
 
std::vector< ShapeMatrices, Eigen::aligned_allocator< ShapeMatrices > > _shape_matrices
 

Member Typedef Documentation

◆ GlobalDimVectorType

template<typename ShapeFunction , int GlobalDim>
using ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::GlobalDimVectorType = typename ShapeMatricesType::GlobalDimVectorType
private

Definition at line 59 of file HeatConductionFEM.h.

◆ LocalAssemblerTraits

template<typename ShapeFunction , int GlobalDim>
using ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::LocalAssemblerTraits
private
Initial value:

Definition at line 54 of file HeatConductionFEM.h.

◆ NodalMatrixType

template<typename ShapeFunction , int GlobalDim>
using ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::NodalMatrixType = typename LocalAssemblerTraits::LocalMatrix
private

Definition at line 57 of file HeatConductionFEM.h.

◆ NodalVectorType

template<typename ShapeFunction , int GlobalDim>
using ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::NodalVectorType = typename LocalAssemblerTraits::LocalVector
private

Definition at line 58 of file HeatConductionFEM.h.

◆ ShapeMatrices

template<typename ShapeFunction , int GlobalDim>
using ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::ShapeMatrices = typename ShapeMatricesType::ShapeMatrices
private

Definition at line 52 of file HeatConductionFEM.h.

◆ ShapeMatricesType

template<typename ShapeFunction , int GlobalDim>
using ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::ShapeMatricesType = ShapeMatrixPolicyType<ShapeFunction, GlobalDim>
private

Definition at line 51 of file HeatConductionFEM.h.

Constructor & Destructor Documentation

◆ LocalAssemblerData()

template<typename ShapeFunction , int GlobalDim>
ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::LocalAssemblerData ( MeshLib::Element const & element,
std::size_t const local_matrix_size,
NumLib::GenericIntegrationMethod const & integration_method,
bool is_axially_symmetric,
HeatConductionProcessData const & process_data )
inline

The thermal_conductivity factor is directly integrated into the local element matrix.

Definition at line 64 of file HeatConductionFEM.h.

70 : _element(element),
71 _process_data(process_data),
72 _integration_method(integration_method),
75 GlobalDim>(
76 element, is_axially_symmetric, _integration_method))
77 {
78 // This assertion is valid only if all nodal d.o.f. use the same shape
79 // matrices.
80 assert(local_matrix_size == ShapeFunction::NPOINTS * NUM_NODAL_DOF);
81 (void)local_matrix_size;
82 }
HeatConductionProcessData const & _process_data
std::vector< ShapeMatrices, Eigen::aligned_allocator< ShapeMatrices > > _shape_matrices
NumLib::GenericIntegrationMethod const & _integration_method
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)

References ProcessLib::HeatConduction::NUM_NODAL_DOF.

Member Function Documentation

◆ assemble()

template<typename ShapeFunction , int GlobalDim>
void ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble ( double const t,
double const dt,
std::vector< double > const & local_x,
std::vector< double > const & ,
std::vector< double > & local_M_data,
std::vector< double > & local_K_data,
std::vector< double > &  )
inlineoverridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 84 of file HeatConductionFEM.h.

90 {
91 auto const local_matrix_size = local_x.size();
92 // This assertion is valid only if all nodal d.o.f. use the same shape
93 // matrices.
94 assert(local_matrix_size == ShapeFunction::NPOINTS * NUM_NODAL_DOF);
95
97 local_M_data, local_matrix_size, local_matrix_size);
99 local_K_data, local_matrix_size, local_matrix_size);
100
101 unsigned const n_integration_points =
103
104 auto const& medium =
107
108 for (unsigned ip = 0; ip < n_integration_points; ip++)
109 {
110 auto const& sm = _shape_matrices[ip];
112 std::nullopt, _element.getID(), ip,
114 NumLib::interpolateCoordinates<ShapeFunction,
116 sm.N))};
117
118 auto const& wp = _integration_method.getWeightedPoint(ip);
119
120 // get the local temperature and put it in the variable array for
121 // access in MPL
122 double T_int_pt = 0.0;
123 NumLib::shapeFunctionInterpolate(local_x, sm.N, T_int_pt);
124 vars.temperature = T_int_pt;
125
127 medium
128 .property(
130 .value(vars, pos, t, dt));
131 auto const specific_heat_capacity =
132 medium
134 specific_heat_capacity)
135 .template value<double>(vars, pos, t, dt);
136 auto const density =
138 .template value<double>(vars, pos, t, dt);
139
140 local_K.noalias() += sm.dNdx.transpose() * k * sm.dNdx * sm.detJ *
141 wp.getWeight() * sm.integralMeasure;
142 local_M.noalias() += sm.N.transpose() * density *
143 specific_heat_capacity * sm.N * sm.detJ *
144 wp.getWeight() * sm.integralMeasure;
145 }
147 {
148 local_M = local_M.colwise().sum().eval().asDiagonal();
149 }
150 }
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89
MathLib::WeightedPoint const & getWeightedPoint(unsigned const igp) const
Eigen::Matrix< double, GlobalDim, GlobalDim > formEigenTensor(MaterialPropertyLib::PropertyDataType const &values)
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
void shapeFunctionInterpolate(const NodalValues &, const ShapeMatrix &)
std::array< double, 3 > interpolateCoordinates(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
MaterialPropertyLib::MaterialSpatialDistributionMap media_map
bool const mass_lumping
If set mass lumping will be applied to the equation.

References ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_element, ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_integration_method, ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_process_data, ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_shape_matrices, MathLib::createZeroedMatrix(), MaterialPropertyLib::density, MaterialPropertyLib::formEigenTensor(), MeshLib::Element::getID(), MaterialPropertyLib::MaterialSpatialDistributionMap::getMedium(), NumLib::GenericIntegrationMethod::getNumberOfPoints(), NumLib::GenericIntegrationMethod::getWeightedPoint(), NumLib::interpolateCoordinates(), ProcessLib::HeatConduction::HeatConductionProcessData::mass_lumping, ProcessLib::HeatConduction::HeatConductionProcessData::media_map, ProcessLib::HeatConduction::NUM_NODAL_DOF, NumLib::detail::shapeFunctionInterpolate(), MaterialPropertyLib::VariableArray::temperature, and MaterialPropertyLib::thermal_conductivity.

◆ assembleWithJacobian()

template<typename ShapeFunction , int GlobalDim>
void ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::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 )
inlineoverridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 152 of file HeatConductionFEM.h.

157 {
158 auto const local_matrix_size = local_x.size();
159 // This assertion is valid only if all nodal d.o.f. use the same shape
160 // matrices.
161 assert(local_matrix_size == ShapeFunction::NPOINTS * NUM_NODAL_DOF);
162
163 auto x = Eigen::Map<NodalVectorType const>(local_x.data(),
164 local_matrix_size);
165
166 auto x_prev = Eigen::Map<NodalVectorType const>(local_x_prev.data(),
167 local_matrix_size);
168
170 local_Jac_data, local_matrix_size, local_matrix_size);
172 local_rhs_data, local_matrix_size);
173
174 NodalMatrixType laplace =
175 NodalMatrixType::Zero(local_matrix_size, local_matrix_size);
177 NodalMatrixType::Zero(local_matrix_size, local_matrix_size);
178
179 unsigned const n_integration_points =
181
184
185 auto const& medium =
188
189 for (unsigned ip = 0; ip < n_integration_points; ip++)
190 {
191 pos.setIntegrationPoint(ip);
192 auto const& sm = _shape_matrices[ip];
193 double const w =
195 sm.integralMeasure;
196
197 // get the local temperature and put it in the variable array for
198 // access in MPL
199 double T_int_pt = 0.0;
200 NumLib::shapeFunctionInterpolate(local_x, sm.N, T_int_pt);
201 vars.temperature = T_int_pt;
202
204 medium
205 .property(
207 .value(vars, pos, t, dt));
208 auto const specific_heat_capacity =
209 medium
211 specific_heat_capacity)
212 .template value<double>(vars, pos, t, dt);
213 auto const density =
215 .template value<double>(vars, pos, t, dt);
216
217 laplace.noalias() += sm.dNdx.transpose() * k * sm.dNdx * w;
218 storage.noalias() +=
219 sm.N.transpose() * density * specific_heat_capacity * sm.N * w;
220 }
222 {
223 storage = storage.colwise().sum().eval().asDiagonal();
224 }
225
226 local_Jac.noalias() += laplace + storage / dt;
227 local_rhs.noalias() -= laplace * x + storage * (x - x_prev) / dt;
228 }
double getWeight() const
void setElementID(std::size_t element_id)
void setIntegrationPoint(unsigned integration_point)
typename LocalAssemblerTraits::LocalMatrix NodalMatrixType
Eigen::Map< Vector > createZeroedVector(std::vector< double > &data, Eigen::VectorXd::Index size)

References ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_element, ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_integration_method, ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_process_data, ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_shape_matrices, MathLib::createZeroedMatrix(), MathLib::createZeroedVector(), MaterialPropertyLib::density, MaterialPropertyLib::formEigenTensor(), MeshLib::Element::getID(), MaterialPropertyLib::MaterialSpatialDistributionMap::getMedium(), NumLib::GenericIntegrationMethod::getNumberOfPoints(), MathLib::WeightedPoint::getWeight(), NumLib::GenericIntegrationMethod::getWeightedPoint(), ProcessLib::HeatConduction::HeatConductionProcessData::mass_lumping, ProcessLib::HeatConduction::HeatConductionProcessData::media_map, ProcessLib::HeatConduction::NUM_NODAL_DOF, ParameterLib::SpatialPosition::setElementID(), ParameterLib::SpatialPosition::setIntegrationPoint(), NumLib::detail::shapeFunctionInterpolate(), MaterialPropertyLib::VariableArray::temperature, and MaterialPropertyLib::thermal_conductivity.

◆ getIntPtHeatFlux()

template<typename ShapeFunction , int GlobalDim>
std::vector< double > const & ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtHeatFlux ( const double t,
std::vector< GlobalVector * > const & x,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & dof_table,
std::vector< double > & cache ) const
inlineoverridevirtual

Implements ProcessLib::HeatConduction::HeatConductionLocalAssemblerInterface.

Definition at line 239 of file HeatConductionFEM.h.

244 {
245 int const process_id = 0; // monolithic case.
246 auto const indices =
247 NumLib::getIndices(_element.getID(), *dof_table[process_id]);
248 assert(!indices.empty());
249 auto const& local_x = x[process_id]->get(indices);
250
251 auto const T_nodal_values = Eigen::Map<const NodalVectorType>(
252 local_x.data(), ShapeFunction::NPOINTS);
253
254 unsigned const n_integration_points =
256
259
260 auto const& medium =
263
264 double const dt = std::numeric_limits<double>::quiet_NaN();
265 cache.clear();
266 auto cache_mat = MathLib::createZeroedMatrix<
267 Eigen::Matrix<double, GlobalDim, Eigen::Dynamic, Eigen::RowMajor>>(
268 cache, GlobalDim, n_integration_points);
269
270 for (unsigned ip = 0; ip < n_integration_points; ip++)
271 {
272 pos.setIntegrationPoint(ip);
273 auto const& sm = _shape_matrices[ip];
274 // get the local temperature and put it in the variable array for
275 // access in MPL
276 vars.temperature = sm.N.dot(T_nodal_values);
277
279 medium
280 .property(
282 .value(vars, pos, t, dt));
283
284 // heat flux only computed for output.
285 cache_mat.col(ip).noalias() = -k * sm.dNdx * T_nodal_values;
286 }
287
288 return cache;
289 }
std::vector< GlobalIndexType > getIndices(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)

References ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_element, ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_integration_method, ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_process_data, ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_shape_matrices, MathLib::createZeroedMatrix(), MaterialPropertyLib::formEigenTensor(), MeshLib::Element::getID(), NumLib::getIndices(), MaterialPropertyLib::MaterialSpatialDistributionMap::getMedium(), NumLib::GenericIntegrationMethod::getNumberOfPoints(), ProcessLib::HeatConduction::HeatConductionProcessData::media_map, ParameterLib::SpatialPosition::setElementID(), ParameterLib::SpatialPosition::setIntegrationPoint(), MaterialPropertyLib::VariableArray::temperature, and MaterialPropertyLib::thermal_conductivity.

◆ getShapeMatrix()

template<typename ShapeFunction , int GlobalDim>
Eigen::Map< const Eigen::RowVectorXd > ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::getShapeMatrix ( const unsigned integration_point) const
inlineoverridevirtual

Provides the shape matrix at the given integration point.

Implements NumLib::ExtrapolatableElement.

Definition at line 230 of file HeatConductionFEM.h.

232 {
233 auto const& N = _shape_matrices[integration_point].N;
234
235 // assumes N is stored contiguously in memory
236 return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size());
237 }

References ProcessLib::HeatConduction::LocalAssemblerData< ShapeFunction, GlobalDim >::_shape_matrices.

Member Data Documentation

◆ _element

◆ _integration_method

◆ _process_data

◆ _shape_matrices


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