OGS
HCNonAdvectiveFreeComponentFlowBoundaryConditionLocalAssembler.h
Go to the documentation of this file.
1
11#pragma once
12
19#include "ProcessLib/Process.h"
20
21namespace ProcessLib
22{
30
31template <typename ShapeFunction, int GlobalDim>
34 GlobalDim>
35{
36 using Base =
40
41public:
45 MeshLib::Element const& e,
46 std::size_t const local_matrix_size,
47 NumLib::GenericIntegrationMethod const& integration_method,
48 bool const is_axially_symmetric,
50 : Base(e, is_axially_symmetric, integration_method),
51 _data(data),
52 _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 {
63 NodalVectorType _local_rhs = NodalVectorType::Zero(_local_matrix_size);
64 // Get element nodes for the interpolation from nodes to
65 // integration point.
66 NodalVectorType const boundary_permeability_node_values =
68 t);
69 unsigned const n_integration_points =
71
72 auto const indices =
73 NumLib::getIndices(mesh_item_id, dof_table_boundary);
74 std::vector<double> const local_values = x[process_id]->get(indices);
75 std::size_t const bulk_element_id =
77 std::size_t const bulk_face_id =
79 auto const& bulk_element =
80 *_data.process.getMesh().getElement(bulk_element_id);
81
82 for (unsigned ip = 0; ip < n_integration_points; ip++)
83 {
84 auto const& n_and_weight = Base::_ns_and_weights[ip];
85 auto const& N = n_and_weight.N;
86 auto const& w = n_and_weight.weight;
88
89 auto const bulk_element_point =
90 MeshLib::getBulkElementPoint(bulk_element, bulk_face_id, wp);
91
92 double int_pt_value = 0.0;
93 NumLib::shapeFunctionInterpolate(local_values, N, int_pt_value);
94
95 NodalVectorType const neumann_node_values =
96 -boundary_permeability_node_values * int_pt_value *
97 _data.process.getFlux(bulk_element_id, bulk_element_point, t, x)
98 .dot(_surface_normal);
99 _local_rhs.noalias() += N * neumann_node_values.dot(N) * w;
100 }
101
102 b.add(indices, _local_rhs);
103 }
104
105private:
106 Eigen::Vector3d getOrientedSurfaceNormal(MeshLib::Element const& e) const
107 {
108 // At the moment (2016-09-28) the surface normal is not oriented
109 // according to the right hand rule
110 // for correct results it is necessary to multiply the normal with -1
111 Eigen::Vector3d surface_normal =
113 auto const zeros_size = 3 - _data.process.getMesh().getDimension();
114 surface_normal.tail(zeros_size).setZero();
115 return surface_normal;
116 }
117
119 std::size_t const _local_matrix_size;
120 Eigen::Vector3d const _surface_normal;
121};
122
123} // 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::size_t getID() const
Returns the ID of the element.
Definition Element.h:89
static Eigen::Vector3d getSurfaceNormal(Element const &e)
Returns the surface normal of a 2D element.
Definition FaceRule.cpp:40
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
Definition Mesh.h:88
const Element * getElement(std::size_t idx) const
Get the element with the given index.
Definition Mesh.h:94
MathLib::WeightedPoint const & getWeightedPoint(unsigned const igp) const
std::vector< NAndWeight, Eigen::aligned_allocator< NAndWeight > > const _ns_and_weights
HCNonAdvectiveFreeComponentFlowBoundaryConditionLocalAssembler(MeshLib::Element const &e, std::size_t const local_matrix_size, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, HCNonAdvectiveFreeComponentFlowBoundaryConditionData 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
MeshLib::Mesh & getMesh() const
Definition Process.h:153
virtual Eigen::Vector3d getFlux(std::size_t, MathLib::Point3d const &, double const, std::vector< GlobalVector * > const &) const
Definition Process.h:185
MathLib::Point3d getBulkElementPoint(MeshLib::CellType const bulk_element_cell_type, std::size_t const bulk_face_id, MathLib::WeightedPoint const &point_on_face)
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