OGS
PythonBoundaryConditionLocalAssembler.h
Go to the documentation of this file.
1
11#pragma once
12
16
17namespace ProcessLib
18{
19template <typename ShapeFunction, typename LowerOrderShapeFunction,
20 typename IntegrationMethod, int GlobalDim>
23{
24 using LocAsmImpl = ProcessLib::BoundaryConditionAndSourceTerm::Python::
25 BcAndStLocalAssemblerImpl<PythonBcData, ShapeFunction,
26 LowerOrderShapeFunction, IntegrationMethod,
27 GlobalDim>;
28 using Traits = typename LocAsmImpl::Traits;
29
30public:
32 MeshLib::Element const& e,
33 std::size_t const /*local_matrix_size*/,
34 bool is_axially_symmetric,
35 unsigned const integration_order,
36 PythonBcData const& data)
37 : impl_{e, is_axially_symmetric, integration_order, data}
38 {
39 }
40
41 void assemble(std::size_t const boundary_element_id,
42 NumLib::LocalToGlobalIndexMap const& dof_table_boundary,
43 double const t, std::vector<GlobalVector*> const& xs,
44 int const process_id, GlobalMatrix& /*K*/, GlobalVector& b,
45 GlobalMatrix* const Jac) override
46 {
47 impl_.assemble(boundary_element_id, dof_table_boundary, t,
48 *xs[process_id], b, Jac);
49 }
50
51 double interpolate(unsigned const local_node_id,
52 NumLib::LocalToGlobalIndexMap const& dof_table_boundary,
53 GlobalVector const& x, int const var,
54 int const comp) const override
55 {
56 if constexpr (ShapeFunction::ORDER < 2 ||
57 LowerOrderShapeFunction::ORDER > 1)
58 {
59 return std::numeric_limits<double>::quiet_NaN();
60 }
61 else
62 {
63 auto const N = computeLowerOrderShapeMatrix(local_node_id);
64
65 auto const nodal_values_base_node =
70 dof_table_boundary, x, var, comp);
71
72 return N * nodal_values_base_node;
73 }
74 }
75
76private:
77 typename Traits::LowerOrderShapeMatrix computeLowerOrderShapeMatrix(
78 unsigned const local_node_id) const
79 {
80 using HigherOrderMeshElement = typename ShapeFunction::MeshElement;
81
82 assert(local_node_id < impl_.element.getNumberOfNodes());
83
84 std::array natural_coordss{MathLib::Point3d{NumLib::NaturalCoordinates<
85 HigherOrderMeshElement>::coordinates[local_node_id]}};
86
87 bool const is_axially_symmetric = false; // does not matter for N
88 auto const shape_matrices = NumLib::computeShapeMatrices<
89 LowerOrderShapeFunction,
90 typename Traits::LowerOrderShapeMatrixPolicy, GlobalDim,
91 NumLib::ShapeMatrixType::N>(impl_.element, is_axially_symmetric,
92 natural_coordss);
93 return shape_matrices.front().N;
94 }
95
97};
98
99} // namespace ProcessLib
Global vector based on Eigen vector.
Definition: EigenVector.h:28
virtual unsigned getNumberOfNodes() const =0
std::size_t getID() const
Get id of the mesh.
Definition: Mesh.h:110
Traits::LowerOrderShapeMatrix computeLowerOrderShapeMatrix(unsigned const local_node_id) const
void assemble(std::size_t const boundary_element_id, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, double const t, std::vector< GlobalVector * > const &xs, int const process_id, GlobalMatrix &, GlobalVector &b, GlobalMatrix *const Jac) override
double interpolate(unsigned const local_node_id, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, GlobalVector const &x, int const var, int const comp) const override
PythonBoundaryConditionLocalAssembler(MeshLib::Element const &e, std::size_t const, bool is_axially_symmetric, unsigned const integration_order, PythonBcData const &data)
static const double t
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > computeShapeMatrices(MeshLib::Element const &e, bool const is_axially_symmetric, PointContainer const &points)
Eigen::VectorXd collectDofsToMatrixOnBaseNodesSingleComponent(MeshLib::Element const &element, std::size_t const mesh_id, NumLib::LocalToGlobalIndexMap const &dof_table, GlobalVector const &x, int const variable, int const component)
NsAndWeightsTraits< ShapeFunction, LowerOrderShapeFunction, GlobalDim > Traits
void assemble(std::size_t const boundary_element_id, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, double const t, GlobalVector const &x, GlobalVector &b, GlobalMatrix *const Jac) const
MeshLib::Mesh const & bc_or_st_mesh
The domain, where this BC or ST will be applied.
Definition: BcOrStData.h:46