OGS
PythonBoundaryConditionLocalAssembler.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
9
10namespace ProcessLib
11{
12template <typename ShapeFunction, typename LowerOrderShapeFunction,
13 int GlobalDim>
16{
17 using LocAsmImpl = ProcessLib::BoundaryConditionAndSourceTerm::Python::
18 BcAndStLocalAssemblerImpl<PythonBcData, ShapeFunction,
19 LowerOrderShapeFunction, GlobalDim>;
20 using Traits = typename LocAsmImpl::Traits;
21
22public:
24 MeshLib::Element const& e,
25 std::size_t const /*local_matrix_size*/,
26 NumLib::GenericIntegrationMethod const& integration_method,
27 bool is_axially_symmetric,
28 PythonBcData const& data)
29 : impl_{e, integration_method, is_axially_symmetric, data}
30 {
31 }
32
33 void assemble(std::size_t const boundary_element_id,
34 NumLib::LocalToGlobalIndexMap const& dof_table_boundary,
35 double const t, std::vector<GlobalVector*> const& xs,
36 int const process_id, GlobalMatrix* /*K*/, GlobalVector& b,
37 GlobalMatrix* const Jac) override
38 {
39 impl_.assemble(boundary_element_id, dof_table_boundary, t,
40 *xs[process_id], b, Jac);
41 }
42
43 double interpolate(unsigned const local_node_id,
44 NumLib::LocalToGlobalIndexMap const& dof_table_boundary,
45 GlobalVector const& x, int const var,
46 int const comp) const override
47 {
48 if constexpr (ShapeFunction::ORDER < 2 ||
49 LowerOrderShapeFunction::ORDER > 1)
50 {
51 return std::numeric_limits<double>::quiet_NaN();
52 }
53 else
54 {
55 auto const N = computeLowerOrderShapeMatrix(local_node_id);
56
57 auto const nodal_values_base_node =
60 impl_.element,
61 impl_.bc_or_st_data.bc_or_st_mesh.getID(),
62 dof_table_boundary, x, var, comp);
63
64 return N * nodal_values_base_node;
65 }
66 }
67
68private:
69 typename Traits::LowerOrderShapeMatrix computeLowerOrderShapeMatrix(
70 unsigned const local_node_id) const
71 {
72 using HigherOrderMeshElement = typename ShapeFunction::MeshElement;
73
74 assert(local_node_id < impl_.element.getNumberOfNodes());
75
76 std::array natural_coordss{MathLib::Point3d{NumLib::NaturalCoordinates<
77 HigherOrderMeshElement>::coordinates[local_node_id]}};
78
79 bool const is_axially_symmetric = false; // does not matter for N
80 auto const shape_matrices = NumLib::computeShapeMatrices<
81 LowerOrderShapeFunction,
82 typename Traits::LowerOrderShapeMatrixPolicy, GlobalDim,
83 NumLib::ShapeMatrixType::N>(impl_.element, is_axially_symmetric,
84 natural_coordss);
85 return shape_matrices.front().N;
86 }
87
89};
90
91} // namespace ProcessLib
MathLib::EigenMatrix GlobalMatrix
MathLib::EigenVector GlobalVector
double interpolate(unsigned const local_node_id, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, GlobalVector const &x, int const var, int const comp) const override
ProcessLib::BoundaryConditionAndSourceTerm::Python:: BcAndStLocalAssemblerImpl< PythonBcData, ShapeFunction, LowerOrderShapeFunction, GlobalDim > LocAsmImpl
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
PythonBoundaryConditionLocalAssembler(MeshLib::Element const &e, std::size_t const, NumLib::GenericIntegrationMethod const &integration_method, bool is_axially_symmetric, PythonBcData const &data)
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)