Loading [MathJax]/extensions/tex2jax.js
OGS
ApplicationUtils::ComputeNaturalCoordsSolverImplementation< ShapeFunction > Class Template Reference

Detailed Description

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

Definition at line 42 of file ComputeNaturalCoordsSolver.h.

#include <ComputeNaturalCoordsSolver.h>

Inheritance diagram for ApplicationUtils::ComputeNaturalCoordsSolverImplementation< ShapeFunction >:
[legend]
Collaboration diagram for ApplicationUtils::ComputeNaturalCoordsSolverImplementation< ShapeFunction >:
[legend]

Public Member Functions

Eigen::Vector3d solve (MeshLib::Element const &e, Eigen::Vector3d const &real_coords, int const max_iter, double const real_coords_tolerance) const override
 
- Public Member Functions inherited from ApplicationUtils::ComputeNaturalCoordsSolverInterface
virtual ~ComputeNaturalCoordsSolverInterface ()=default
 

Private Types

using ShapeMatricesType = ShapeMatrixPolicyType<ShapeFunction, ElementDim>
 

Static Private Attributes

static constexpr int ElementDim = ShapeFunction::DIM
 

Member Typedef Documentation

◆ ShapeMatricesType

template<typename ShapeFunction >
using ApplicationUtils::ComputeNaturalCoordsSolverImplementation< ShapeFunction >::ShapeMatricesType = ShapeMatrixPolicyType<ShapeFunction, ElementDim>
private

Definition at line 46 of file ComputeNaturalCoordsSolver.h.

Member Function Documentation

◆ solve()

template<typename ShapeFunction >
Eigen::Vector3d ApplicationUtils::ComputeNaturalCoordsSolverImplementation< ShapeFunction >::solve ( MeshLib::Element const & e,
Eigen::Vector3d const & real_coords,
int const max_iter,
double const real_coords_tolerance ) const
inlineoverridevirtual

Implements ApplicationUtils::ComputeNaturalCoordsSolverInterface.

Definition at line 49 of file ComputeNaturalCoordsSolver.h.

53 {
54 using Problem = ComputeNaturalCoordsRootFindingProblem<ShapeFunction>;
55 using LJM = typename Problem::LocalJacobianMatrix;
56 using LRV = typename Problem::LocalResidualVector;
57
58 Problem problem(e, Eigen::Map<const LRV>(real_coords.data()));
59
60 Eigen::PartialPivLU<LJM> linear_solver(ElementDim);
61 LJM jacobian;
62
63 const double increment_tolerance = 0;
64 auto const newton_solver = NumLib::makeNewtonRaphson(
65 linear_solver,
66 [&problem](LJM& J) { problem.updateJacobian(J); },
67 [&problem](LRV& res) { problem.updateResidual(res); },
68 [&problem](auto& delta_r) { problem.updateSolution(delta_r); },
69 {max_iter, real_coords_tolerance, increment_tolerance});
70
71 auto const opt_iter = newton_solver.solve(jacobian);
72
73 if (opt_iter)
74 {
75 DBUG("Newton solver succeeded after {} iterations", *opt_iter);
76
77 Eigen::Vector3d natural_coords = Eigen::Vector3d::Zero();
78 natural_coords.head<ElementDim>() = problem.getNaturalCoordinates();
79 return natural_coords;
80 }
81
83 "Newton solver failed. Please consider increasing the error "
84 "tolerance or the max. number of Newton iterations.");
85 }
#define OGS_FATAL(...)
Definition Error.h:26
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
NewtonRaphson< LinearSolver, JacobianMatrixUpdate, ResidualUpdate, SolutionUpdate > makeNewtonRaphson(LinearSolver &linear_solver, JacobianMatrixUpdate &&jacobian_update, ResidualUpdate &&residual_update, SolutionUpdate &&solution_update, NewtonRaphsonSolverParameters const &solver_parameters)

References DBUG(), ApplicationUtils::ComputeNaturalCoordsSolverImplementation< ShapeFunction >::ElementDim, NumLib::makeNewtonRaphson(), and OGS_FATAL.

Member Data Documentation

◆ ElementDim

template<typename ShapeFunction >
int ApplicationUtils::ComputeNaturalCoordsSolverImplementation< ShapeFunction >::ElementDim = ShapeFunction::DIM
staticconstexprprivate

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