OGS
VolumetricSourceTermFEM.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <vector>
14
23
24namespace ProcessLib
25{
27{
28public:
29 virtual void integrate(
30 std::size_t const id,
31 NumLib::LocalToGlobalIndexMap const& source_term_dof_table,
32 double const t, GlobalVector& b) = 0;
34};
35
36template <typename ShapeFunction, int GlobalDim>
39{
40 static const unsigned NUM_NODAL_DOF = 1;
41
43
45 ShapeMatricesType, ShapeFunction::NPOINTS, NUM_NODAL_DOF, GlobalDim>;
46
49
50public:
52 MeshLib::Element const& element,
53 std::size_t const local_matrix_size,
54 NumLib::GenericIntegrationMethod const& integration_method,
55 bool const is_axially_symmetric,
56 ParameterLib::Parameter<double> const& volumetric_source_term)
57 : _volumetric_source_term(volumetric_source_term),
58 _integration_method(integration_method),
59 _element(element),
60 _local_rhs(local_matrix_size)
61 {
62 unsigned const n_integration_points =
64
65 auto const shape_matrices =
67 GlobalDim>(_element, is_axially_symmetric,
69
70 for (unsigned ip = 0; ip < n_integration_points; ip++)
71 {
72 _ip_data.emplace_back(
73 shape_matrices[ip].N,
75 shape_matrices[ip].integralMeasure *
76 shape_matrices[ip].detJ);
77 }
78 }
79
80 void integrate(std::size_t const id,
81 NumLib::LocalToGlobalIndexMap const& source_term_dof_table,
82 double const t, GlobalVector& b) override
83 {
84 _local_rhs.setZero();
85
86 unsigned const n_integration_points =
88
89 for (unsigned ip = 0; ip < n_integration_points; ip++)
90 {
91 auto const& N = _ip_data[ip].N;
92 auto const& w = _ip_data[ip].integration_weight;
93
95 std::nullopt, _element.getID(), ip,
99 N))};
100 auto const st_val = _volumetric_source_term(t, pos)[0];
101
102 _local_rhs.noalias() += N.transpose() * st_val * w;
103 }
104 auto const indices = NumLib::getIndices(id, source_term_dof_table);
105 b.add(indices, _local_rhs);
106 }
107
108private:
110
112 std::vector<SourceTermIntegrationPointData<NodalRowVectorType>,
113 Eigen::aligned_allocator<
118};
119
120} // namespace ProcessLib
Global vector based on Eigen vector.
Definition EigenVector.h:25
void add(IndexType rowId, double v)
add entry
Definition EigenVector.h:76
double getWeight() const
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:89
MathLib::WeightedPoint const & getWeightedPoint(unsigned const igp) const
virtual void integrate(std::size_t const id, NumLib::LocalToGlobalIndexMap const &source_term_dof_table, double const t, GlobalVector &b)=0
typename ShapeMatricesType::NodalRowVectorType NodalRowVectorType
typename LocalAssemblerTraits::LocalVector NodalVectorType
void integrate(std::size_t const id, NumLib::LocalToGlobalIndexMap const &source_term_dof_table, double const t, GlobalVector &b) override
ParameterLib::Parameter< double > const & _volumetric_source_term
std::vector< SourceTermIntegrationPointData< NodalRowVectorType >, Eigen::aligned_allocator< SourceTermIntegrationPointData< NodalRowVectorType > > > _ip_data
NumLib::GenericIntegrationMethod const & _integration_method
ShapeMatrixPolicyType< ShapeFunction, GlobalDim > ShapeMatricesType
VolumetricSourceTermLocalAssembler(MeshLib::Element const &element, std::size_t const local_matrix_size, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, ParameterLib::Parameter< double > const &volumetric_source_term)
std::vector< GlobalIndexType > getIndices(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
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)
std::array< double, 3 > interpolateCoordinates(MeshLib::Element const &e, typename ShapeMatricesType::ShapeMatrices::ShapeType const &N)
RowVectorType< ShapeFunction::NPOINTS > NodalRowVectorType