Loading [MathJax]/extensions/MathMenu.js
OGS
ComputeNaturalCoordsRootFindingProblem.h
Go to the documentation of this file.
1
10#pragma once
11
14#include "MeshLib/Node.h"
17
18namespace ApplicationUtils
19{
27template <typename ShapeFunction>
29{
30 static constexpr int Dim = ShapeFunction::DIM;
32
33public:
35 Eigen::Matrix<double, Dim, Dim, Eigen::RowMajor>;
38 using LocalResidualVector = Eigen::Matrix<double, Dim, 1>;
39
41 MeshLib::Element const& e, LocalResidualVector const& x_expected)
42 : e_{e},
44 x_expected_{x_expected},
45 // TODO 2D elements with 3D coordinates etc.
46 // TODO check all dims
47 sm_{ShapeFunction::DIM, e.getDimension(), ShapeFunction::NPOINTS}
48 {
49 updateShp();
50 }
51
53 {
54 auto const& dNdr = sm_.dNdr;
55
56 for (int comp = 0; comp < Dim; ++comp)
57 {
58 J.row(comp) = node_coords_.row(comp) * dNdr.transpose();
59 }
60 }
61
63 {
64 res = node_coords_ * sm_.N.transpose() - x_expected_;
65 }
66
71 {
72 r_ += delta_r;
73 updateShp();
74 }
75
76 LocalResidualVector const& getNaturalCoordinates() const { return r_; }
77
78private:
80 Eigen::Matrix<double, Dim, ShapeFunction::NPOINTS, Eigen::RowMajor>;
81
82 void updateShp()
83 {
84 auto const fe =
87
88 constexpr auto GlobalDim = Dim;
89 fe.template computeShapeFunctions<NumLib::ShapeMatrixType::N_J>(
90 r_.data(), sm_, GlobalDim, false);
91 }
92
94 {
95 NodeCoordsMatrix node_coords;
96
97 for (std::size_t n = 0; n < ShapeFunction::NPOINTS; ++n)
98 {
99 node_coords.col(n) = Eigen::Map<const Eigen::Vector<double, Dim>>(
100 e.getNode(n)->data());
101 }
102
103 return node_coords;
104 }
105
107 {
108 return LocalResidualVector::Constant(0.5);
109 }
110
114
117};
118} // namespace ApplicationUtils
Definition of the Element class.
Definition of the Node class.
Eigen::Matrix< double, Dim, Dim, Eigen::RowMajor > LocalJacobianMatrix
Eigen::Matrix< double, Dim, ShapeFunction::NPOINTS, Eigen::RowMajor > NodeCoordsMatrix
ComputeNaturalCoordsRootFindingProblem(MeshLib::Element const &e, LocalResidualVector const &x_expected)
const double * data() const
Definition Point3d.h:60
virtual const Node * getNode(unsigned idx) const =0
NumLib::TemplateIsoparametric< ShapeFunction, ShapeMatricesType > createIsoparametricFiniteElement(MeshLib::Element const &e)
Coordinates mapping matrices at particular location.
ShapeType N
Vector of shape functions, N(r)