OGS
ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction > Class Template Reference

Detailed Description

template<typename ShapeFunction>
class ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction >

Models the computation of natural coordinates inside a given mesh element for some given real coordinates as a root finding problem.

That root finding problem is designed such that it can be easily used/solved by the NumLib::NewtonRaphson solver.

Definition at line 28 of file ComputeNaturalCoordsRootFindingProblem.h.

#include <ComputeNaturalCoordsRootFindingProblem.h>

Collaboration diagram for ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction >:
[legend]

Public Types

using LocalJacobianMatrix
using LocalResidualVector = Eigen::Matrix<double, Dim, 1>

Public Member Functions

 ComputeNaturalCoordsRootFindingProblem (MeshLib::Element const &e, LocalResidualVector const &x_expected)
void updateJacobian (LocalJacobianMatrix &J) const
void updateResidual (LocalResidualVector &res) const
void updateSolution (LocalResidualVector const &delta_r)
LocalResidualVector const & getNaturalCoordinates () const

Private Types

using ShapeMatricesType = ShapeMatrixPolicyType<ShapeFunction, Dim>
using NodeCoordsMatrix

Private Member Functions

void updateShp ()

Static Private Member Functions

static NodeCoordsMatrix getNodeCoords (MeshLib::Element const &e)
static constexpr LocalResidualVector initialGuess ()

Private Attributes

MeshLib::Element const & e_
NodeCoordsMatrix const node_coords_
LocalResidualVector const x_expected_
ShapeMatricesType::ShapeMatrices sm_
LocalResidualVector r_ = initialGuess()

Static Private Attributes

static constexpr int Dim = ShapeFunction::DIM

Member Typedef Documentation

◆ LocalJacobianMatrix

Initial value:
Eigen::Matrix<double, Dim, Dim, Eigen::RowMajor>

Definition at line 34 of file ComputeNaturalCoordsRootFindingProblem.h.

◆ LocalResidualVector

template<typename ShapeFunction>
using ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction >::LocalResidualVector = Eigen::Matrix<double, Dim, 1>

Used for the residuum ("res"), the solution vector ("r", natural coordinates) and real coordinates ("x").

Definition at line 38 of file ComputeNaturalCoordsRootFindingProblem.h.

◆ NodeCoordsMatrix

template<typename ShapeFunction>
using ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction >::NodeCoordsMatrix
private
Initial value:
Eigen::Matrix<double, Dim, ShapeFunction::NPOINTS, Eigen::RowMajor>

Definition at line 79 of file ComputeNaturalCoordsRootFindingProblem.h.

◆ ShapeMatricesType

Constructor & Destructor Documentation

◆ ComputeNaturalCoordsRootFindingProblem()

template<typename ShapeFunction>
ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction >::ComputeNaturalCoordsRootFindingProblem ( MeshLib::Element const & e,
LocalResidualVector const & x_expected )
inline

Member Function Documentation

◆ getNaturalCoordinates()

◆ getNodeCoords()

template<typename ShapeFunction>
NodeCoordsMatrix ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction >::getNodeCoords ( MeshLib::Element const & e)
inlinestaticprivate

Definition at line 93 of file ComputeNaturalCoordsRootFindingProblem.h.

94 {
96
97 for (std::size_t n = 0; n < ShapeFunction::NPOINTS; ++n)
98 {
100 e.getNode(n)->data());
101 }
102
103 return node_coords;
104 }
Eigen::Matrix< double, Dim, ShapeFunction::NPOINTS, Eigen::RowMajor > NodeCoordsMatrix

References MeshLib::Element::getNode().

Referenced by ComputeNaturalCoordsRootFindingProblem().

◆ initialGuess()

template<typename ShapeFunction>
constexpr LocalResidualVector ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction >::initialGuess ( )
inlinestaticconstexprprivate

Definition at line 106 of file ComputeNaturalCoordsRootFindingProblem.h.

107 {
109 }

◆ updateJacobian()

template<typename ShapeFunction>
void ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction >::updateJacobian ( LocalJacobianMatrix & J) const
inline

Definition at line 52 of file ComputeNaturalCoordsRootFindingProblem.h.

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 }

References Dim, node_coords_, and sm_.

◆ updateResidual()

template<typename ShapeFunction>
void ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction >::updateResidual ( LocalResidualVector & res) const
inline

Definition at line 62 of file ComputeNaturalCoordsRootFindingProblem.h.

63 {
64 res = node_coords_ * sm_.N.transpose() - x_expected_;
65 }

References node_coords_, sm_, and x_expected_.

◆ updateShp()

◆ updateSolution()

template<typename ShapeFunction>
void ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction >::updateSolution ( LocalResidualVector const & delta_r)
inline

Updates the current guess.

Parameters
delta_rthe solution increment (natural coordinates)

Definition at line 70 of file ComputeNaturalCoordsRootFindingProblem.h.

71 {
72 r_ += delta_r;
73 updateShp();
74 }

References r_, and updateShp().

Member Data Documentation

◆ Dim

template<typename ShapeFunction>
int ApplicationUtils::ComputeNaturalCoordsRootFindingProblem< ShapeFunction >::Dim = ShapeFunction::DIM
staticconstexprprivate

Definition at line 30 of file ComputeNaturalCoordsRootFindingProblem.h.

Referenced by updateJacobian(), and updateShp().

◆ e_

◆ node_coords_

◆ r_

◆ sm_

◆ x_expected_


The documentation for this class was generated from the following file: