OGS
VariableDependentNeumannBoundaryConditionLocalAssembler.h
Go to the documentation of this file.
1
11#pragma once
12
18
19namespace ProcessLib
20{
31
32template <typename ShapeFunction, int GlobalDim>
35 GlobalDim>
36{
37 using Base =
41
42public:
46 MeshLib::Element const& e,
47 std::size_t const local_matrix_size,
48 NumLib::GenericIntegrationMethod const& integration_method,
49 bool const is_axially_symmetric,
51 : Base(e, is_axially_symmetric, integration_method),
52 _data(data),
53 _local_matrix_size(local_matrix_size)
54 {
55 }
56
57 void assemble(std::size_t const mesh_item_id,
58 NumLib::LocalToGlobalIndexMap const& dof_table_boundary,
59 double const t, std::vector<GlobalVector*> const& x,
60 int const process_id, GlobalMatrix& /*K*/, GlobalVector& b,
61 GlobalMatrix* /*Jac*/) override
62 {
64 _local_rhs.setZero();
65 // Get element nodes for the interpolation from nodes to
66 // integration point.
67 NodalVectorType const constant_node_values =
69 .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
70 NodalVectorType const coefficient_current_variable_node_values =
73 .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
74 NodalVectorType const coefficient_other_variable_node_values =
77 .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
78 NodalVectorType const coefficient_mixed_variables_node_values =
81 .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
82 unsigned const n_integration_points =
84
85 auto const indices_current_variable =
86 NumLib::getIndices(mesh_item_id, dof_table_boundary);
87 auto const indices_other_variable = NumLib::getIndices(
89 std::vector<double> const local_current_variable =
90 x[process_id]->get(indices_current_variable);
91 std::vector<double> const local_other_variable =
92 x[process_id]->get(indices_other_variable);
93
94 for (unsigned ip = 0; ip < n_integration_points; ip++)
95 {
96 auto const& n_and_weight = Base::_ns_and_weights[ip];
97 auto const& N = n_and_weight.N;
98 auto const& w = n_and_weight.weight;
99
100 double current_variable_int_pt = 0.0;
101 double other_variable_int_pt = 0.0;
102
103 NumLib::shapeFunctionInterpolate(local_current_variable, N,
104 current_variable_int_pt);
105 NumLib::shapeFunctionInterpolate(local_other_variable, N,
106 other_variable_int_pt);
107 NodalVectorType const neumann_node_values =
108 constant_node_values +
109 coefficient_current_variable_node_values *
110 current_variable_int_pt +
111 coefficient_other_variable_node_values * other_variable_int_pt +
112 coefficient_mixed_variables_node_values *
113 current_variable_int_pt * other_variable_int_pt;
114 _local_rhs.noalias() += N * neumann_node_values.dot(N) * w;
115 }
116
117 b.add(indices_current_variable, _local_rhs);
118 }
119
120private:
122 std::size_t const _local_matrix_size;
123};
124
125} // namespace ProcessLib
Global vector based on Eigen vector.
Definition EigenVector.h:25
void add(IndexType rowId, double v)
add entry
Definition EigenVector.h:76
std::vector< NAndWeight, Eigen::aligned_allocator< NAndWeight > > const _ns_and_weights
VariableDependentNeumannBoundaryConditionLocalAssembler(MeshLib::Element const &e, std::size_t const local_matrix_size, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, VariableDependentNeumannBoundaryConditionData const &data)
void assemble(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, double const t, std::vector< GlobalVector * > const &x, int const process_id, GlobalMatrix &, GlobalVector &b, GlobalMatrix *) override
void shapeFunctionInterpolate(const NodalValues &, const ShapeMatrix &)
std::vector< GlobalIndexType > getIndices(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
virtual Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > getNodalValuesOnElement(MeshLib::Element const &element, double const t) const
Returns a matrix of values for all nodes of the given element.
Definition Parameter.h:164