KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
|
This function provides basic routines for working with simplicial meshes. More...
#include <geometry_utilities.h>
Public Types | |
Type Definitions | |
using | SizeType = std::size_t |
The size type definition. More... | |
using | IndexType = std::size_t |
The index type definition. More... | |
using | GeometryType = Geometry< Node > |
Definition of the geometry. More... | |
Static Public Member Functions | |
template<> | |
void | EvaluateHistoricalVariableValueAtGaussPoint (double &rOutput, const GeometryType &rGeometry, const Variable< double > &rVariable, const Vector &rGaussPointShapeFunctionValues, const int Step) |
Operations | |
static std::string | GetGeometryName (const GeometryData::KratosGeometryType TypeOfGeometry) |
This function returns a string equivalent for the geometry type. More... | |
template<class TGeometryType > | |
static TGeometryType::CoordinatesArrayType & | PointLocalCoordinatesPlanarFaceTetrahedra (const TGeometryType &rGeometry, typename TGeometryType::CoordinatesArrayType &rResult, const typename TGeometryType::CoordinatesArrayType &rPoint) |
Returns the local coordinates of a given arbitrary point for a given linear tetrahedra. More... | |
static void | CalculateGeometryData (const GeometryType &rGeometry, BoundedMatrix< double, 4, 3 > &rDN_DX, array_1d< double, 4 > &rN, double &rVolume) |
This function is designed to compute the shape function derivatives, shape functions and volume in 3D. More... | |
static double | CalculateVolume3D (const GeometryType &rGeometry) |
This function computes the element's volume (with sign) More... | |
static void | CalculateGeometryData (const GeometryType &rGeometry, BoundedMatrix< double, 3, 2 > &DN_DX, array_1d< double, 3 > &N, double &rArea) |
This function is designed to compute the shape function derivatives, shape functions and area of a triangle. More... | |
static double | CalculateVolume2D (const GeometryType &rGeometry) |
This function computes the element's volume (with sign) More... | |
static void | SideLenghts2D (const GeometryType &rGeometry, double &hmin, double &hmax) |
This function compute the maximum and minimum edge lenghts. More... | |
static void | CalculateGeometryData (const GeometryType &rGeometry, BoundedMatrix< double, 2, 1 > &rDN_DX, array_1d< double, 2 > &rN, double &rLength) |
This function is designed to compute the shape function derivatives, shape functions and length. More... | |
template<std::size_t TSize> | |
static void | CalculateTetrahedraDistances (const GeometryType &rGeometry, array_1d< double, TSize > &rDistances) |
Calculate the exact distances to the interface TRIANGLE defined by a set of initial distances. More... | |
template<std::size_t TSize> | |
static void | CalculateTriangleDistances (const GeometryType &rGeometry, array_1d< double, TSize > &rDistances) |
Calculate the exact distances to the interface SEGMENT defined by a set of initial distances. More... | |
template<std::size_t TSize> | |
static void | CalculateExactDistancesToPlane (const GeometryType &rThisGeometry, array_1d< double, TSize > &rDistances) |
Calculate the exact distances to the plane interface defined by a set of initial distances. More... | |
template<std::size_t TSize1, std::size_t TSize2> | |
static int | CalculateTetrahedraIntersectionPoints (const GeometryType &rGeometry, array_1d< double, TSize1 > &rDistances, array_1d< Point, TSize2 > &rIntersectionPoints) |
This function calculates the coordinates of the intersecion points between edges of tetrahedra and a isosurface given by the distances in its corners. More... | |
static double | PointDistanceToLineSegment3D (const Point &rLinePoint1, const Point &rLinePoint2, const Point &rToPoint) |
This function calculates the distance of a 3D point to a 3D line segment. More... | |
static double | PointDistanceToTriangle3D (const Point &rTrianglePoint1, const Point &rTrianglePoint2, const Point &rTrianglePoint3, const Point &rPoint) |
This function calculates the distance of a 3D point to a 3D triangle. More... | |
static double | PointDistanceToTriangle3D (const Point &rTrianglePoint1, const Point &rTrianglePoint2, const Point &rTrianglePoint3, const Point &rTrianglePoint4, const Point &rTrianglePoint5, const Point &rTrianglePoint6, const Point &rPoint) |
This function calculates the distance of a 3D point to a 3D quadratic triangle. More... | |
static double | PointDistanceToQuadrilateral3D (const Point &rQuadrilateralPoint1, const Point &rQuadrilateralPoint2, const Point &rQuadrilateralPoint3, const Point &rQuadrilateralPoint4, const Point &rPoint) |
This function calculates the distance of a 3D point to a 3D quadrilateral. More... | |
template<class TMatrix1 , class TMatrix2 , class TMatrix3 > | |
static void | ShapeFunctionsGradients (TMatrix1 const &rDN_De, TMatrix2 const &rInvJ, TMatrix3 &rDN_DX) |
Calculate the gradients of shape functions. More... | |
template<class TMatrix1 , class TMatrix2 , class TMatrix3 > | |
static void | DeformationGradient (TMatrix1 const &rJ, TMatrix2 const &rInvJ0, TMatrix3 &rF) |
Calculate the deformation gradient. More... | |
static void | JacobianOnInitialConfiguration (GeometryType const &rGeom, GeometryType::CoordinatesArrayType const &rCoords, Matrix &rJ0) |
Calculate the Jacobian on the initial configuration. More... | |
template<class TMatrix > | |
static void | DirectJacobianOnCurrentConfiguration (GeometryType const &rGeometry, GeometryType::CoordinatesArrayType const &rCoords, TMatrix &rJ) |
Calculate the Jacobian on the initial configuration. More... | |
template<class TMatrix > | |
static void | DirectJacobianOnInitialConfiguration (GeometryType const &rGeometry, TMatrix &rJ0, const IndexType PointNumber, const GeometryType::IntegrationMethod &rIntegrationMethod) |
Calculate the Jacobian on the initial configuration. More... | |
template<class TDataType > | |
static void | EvaluateHistoricalVariableValueAtGaussPoint (TDataType &rOutput, const GeometryType &rGeometry, const Variable< TDataType > &rVariable, const Vector &rGaussPointShapeFunctionValues, const int Step=0) |
Evaluates variable value at gauss point. More... | |
static void | EvaluateHistoricalVariableGradientAtGaussPoint (array_1d< double, 3 > &rOutput, const GeometryType &rGeometry, const Variable< double > &rVariable, const Matrix &rGaussPointShapeFunctionDerivativeValues, const int Step=0) |
Evaluates gradient of scalar at gauss point. More... | |
static void | EvaluateHistoricalVariableGradientAtGaussPoint (BoundedMatrix< double, 3, 3 > &rOutput, const GeometryType &rGeometry, const Variable< array_1d< double, 3 >> &rVariable, const Matrix &rGaussPointShapeFunctionDerivativeValues, const int Step=0) |
Evaluates gradient of a 3d vector at gauss point. More... | |
static void | ShapeFunctionsSecondDerivativesTransformOnAllIntegrationPoints (DenseVector< DenseVector< Matrix >> &rResult, const GeometryType &rGeometry, const GeometryType::IntegrationMethod &rIntegrationMethod) |
This method gives the transform of shape functions second derivatives from isoparametric to natural coordinates evaluated in all integration points. More... | |
static void | ShapeFunctionsSecondDerivativesTransformOnIntegrationPoint (const Matrix &DN_DX, const GeometryType &rGeometry, const GeometryType::CoordinatesArrayType &rLocalIntegrationPointCoordinates, DenseVector< Matrix > &rResult) |
This method gives the transform of shape functions second derivatives from isoparametric to natural coordinates evaluated on an integration point. More... | |
static bool | ProjectedIsInside (const GeometryType &rGeometry, const GeometryType::CoordinatesArrayType &rPointGlobalCoordinates, GeometryType::CoordinatesArrayType &rResult, const double Tolerance=std::numeric_limits< double >::epsilon()) |
Checks if given point in global space coordinates is inside the geometry boundaries. More... | |
template<class TGeometryType > | |
static double | CalculateDistanceFrom3DGeometry (const TGeometryType &rGeometry, const typename TGeometryType::CoordinatesArrayType &rPointGlobalCoordinates, const double Tolerance=std::numeric_limits< double >::epsilon()) |
Computes the distance between an point in global coordinates and the closest point of this geometry. More... | |
This function provides basic routines for working with simplicial meshes.
It is faster than using Geometry as it is more specialized
Definition of the geometry.
using Kratos::GeometryUtils::IndexType = std::size_t |
The index type definition.
using Kratos::GeometryUtils::SizeType = std::size_t |
The size type definition.
|
inlinestatic |
Computes the distance between an point in global coordinates and the closest point of this geometry.
rGeometry | the geometry to compute the distance to. |
rPointGlobalCoordinates | the point to which the closest point has to be found. |
Tolerance | accepted orthogonal error. |
|
inlinestatic |
Calculate the exact distances to the plane interface defined by a set of initial distances.
Same argument is used to give the calculated exact distances back
rThisGeometry | Geometry can be either a triangle or a tetrahedra |
rDistances | The distances which define the isosurface as input. |
|
inlinestatic |
This function is designed to compute the shape function derivatives, shape functions and length.
rGeometry | it is the array of nodes. It is expected to be a line |
rDN_DX | a stack matrix of size 3*2 to store the shape function's derivatives |
rN | an array_1d to store the shape functions at the barycenter |
rLength | the volume of the element |
|
inlinestatic |
This function is designed to compute the shape function derivatives, shape functions and area of a triangle.
rGeometry | it is the array of nodes. It is expected to be a triangle |
DN_DX | a stack matrix of size 3*2 to store the shape function's derivatives |
N | an array_1d to store the shape functions at the barycenter |
Area | the volume of the element |
|
inlinestatic |
This function is designed to compute the shape function derivatives, shape functions and volume in 3D.
rGeometry | it is the array of nodes. It is expected to be a tetrahedra |
rDN_DX | a stack matrix of size 4*3 to store the shape function's derivatives |
rN | an array_1d to store the shape functions at the barycenter |
rVolume | the volume of the element |
|
inlinestatic |
Calculate the exact distances to the interface TRIANGLE defined by a set of initial distances.
rGeometry | The tetrahedra itself. Note: If the geometry is not a tetrahedra the result is undefined and may cause memory error. |
rDistances | The distances which define the isosurface as input and the same argument is used to give the calculated exact distance |
|
inlinestatic |
This function calculates the coordinates of the intersecion points between edges of tetrahedra and a isosurface given by the distances in its corners.
rGeometry | The tetrahedra itself. Note: If the geometry is not a tetrahedra the result is undefined and may cause memory error. |
rDistances | The distances of the 4 nodes of the tetrahedra to the iso surface. |
rIntersectionPoints | The result intersection points |
|
inlinestatic |
Calculate the exact distances to the interface SEGMENT defined by a set of initial distances.
rGeometry | The Triangle itself. Note: If the geometry is not a triangle the result is undefined and may cause memory error. |
rDistances | The distances which define the isosurface as input and the same argument is used to give the calculated exact distance |
|
inlinestatic |
This function computes the element's volume (with sign)
rGeometry | it is the array of nodes. It expects a triangle |
|
inlinestatic |
This function computes the element's volume (with sign)
rGeometry | it is the array of nodes. It expects a tetrahedra |
|
inlinestatic |
Calculate the deformation gradient.
See, e.g., P. Wriggers, Nonlinear Finite Element Methods, Springer, 2008.
rJ | element Jacobian. |
rInvJ0 | inverse of the element Jacobian of the initial configuration. |
rF | deformation gradient. |
|
inlinestatic |
Calculate the Jacobian on the initial configuration.
rGeom | element geometry. |
rCoords | local coordinates of the current integration point. |
rJ0 | Jacobian on the initial configuration. |
|
inlinestatic |
Calculate the Jacobian on the initial configuration.
rGeom | element geometry |
rJ0 | Jacobian on the initial configuration |
PointNumber | The integration point considered |
rIntegrationMethod | The integration method considered |
|
static |
Evaluates gradient of scalar at gauss point.
This method evaluates gradient of a scalar variable for given shape function derivative values. For 2D, it returns 3rd component as zero.
rOutput | Output 3d variable containing gradients at gauss point |
rGeometry | Geometry from which gauss point values are interpolated |
rVariable | Variable for value interpolation |
rGaussPointShapeFunctionDerivativeValues | Shape function derivatives evaluated at gauss point |
Step | Step to be used in historical variable value interpolation |
|
static |
Evaluates gradient of a 3d vector at gauss point.
This method evaluates gradient of a vector variable for given shape function derivative values. [ rOutput(i, j) = \frac{\partial u_i}{\partial x_j} ] Where $u_i$ is the component of 3D rVariable, and $x_j$ is the cartesian coordinate component. In 2D, it returns 3rd row and 3rd column with zeros.
rOutput | Output matrix containing gradients at gauss point |
rGeometry | Geometry from which gauss point values are interpolated |
rVariable | Variable for value interpolation |
rGaussPointShapeFunctionDerivativeValues | Shape function derivatives evaluated at gauss point |
Step | Step to be used in historical variable value interpolation |
|
static |
|
static |
Evaluates variable value at gauss point.
This method evaluates variable value at gauss point given by gauss point shape function values.
TDataType | Data type |
|
static |
This function returns a string equivalent for the geometry type.
TypeOfGeometry | The geometry type |
|
inlinestatic |
Calculate the Jacobian on the initial configuration.
rGeom | element geometry. |
rCoords | local coordinates of the current integration point. |
rJ0 | Jacobian on the initial configuration. |
|
static |
This function calculates the distance of a 3D point to a 3D line segment.
rLinePoint1 | First point of the line segment |
rLinePoint2 | End point of the line segment |
rToPoint | The point which distance is required |
|
static |
This function calculates the distance of a 3D point to a 3D quadrilateral.
The implementation is done by decomposing the quadrilateral into 2 triangles and calling PointDistanceToTriangle3D
rQuadrilateralPoint1 | First point of quadrilateral |
rQuadrilateralPoint2 | Second point of quadrilateral |
rQuadrilateralPoint3 | Third point of quadrilateral |
rQuadrilateralPoint4 | Third point of quadrilateral |
rPoint | The point which distance is required |
|
static |
This function calculates the distance of a 3D point to a 3D triangle.
The implementation is done using following reference: http://www.geometrictools.com/Documentation/DistancePoint3Triangle3.pdf
rTrianglePoint1 | First point of triangle |
rTrianglePoint2 | Second point of triangle |
rTrianglePoint3 | Third point of triangle |
rPoint | The point which distance is required |
|
static |
This function calculates the distance of a 3D point to a 3D quadratic triangle.
The implementation is done by decomposing the quadratic triangle into 3 triangles and calling PointDistanceToTriangle3D
rTrianglePoint1 | First point of triangle |
rTrianglePoint2 | Second point of triangle |
rTrianglePoint3 | Third point of triangle |
rTrianglePoint4 | Fourth point of triangle |
rTrianglePoint5 | Fifth point of triangle |
rTrianglePoint6 | Sixth point of triangle |
rPoint | The point which distance is required |
|
inlinestatic |
Returns the local coordinates of a given arbitrary point for a given linear tetrahedra.
Based on https://www.colorado.edu/engineering/CAS/courses.d/AFEM.d/AFEM.Ch09.d/AFEM.Ch09.pdf. Section 9.1.6
rGeometry | The geometry to be considered |
rResult | The vector containing the local coordinates of the point |
rPoint | The point in global coordinates |
|
static |
Checks if given point in global space coordinates is inside the geometry boundaries.
This function computes the local coordinates and checks then if this point lays within the boundaries after projecting the points.
rPointGlobalCoordinates | the global coordinates of the external point. |
rResult | the local coordinates of the point. |
Tolerance | the tolerance to the boundary. |
|
inlinestatic |
Calculate the gradients of shape functions.
rDN_De | local gradient of shape functions. |
rInvJ | inverse of the element Jacobian. |
rDN_DX | gradient of shape functions. |
|
static |
This method gives the transform of shape functions second derivatives from isoparametric to natural coordinates evaluated in all integration points.
rResult | the transform of the second derivative of the shape function on the integration point |
|
static |
This method gives the transform of shape functions second derivatives from isoparametric to natural coordinates evaluated on an integration point.
The method used can be found here. https://scicomp.stackexchange.com/questions/25196/implementing-higher-order-derivatives-for-finite-element
rLocalIntegrationPointCoordinates | the local coordinates of the integration point |
rResult | the transform of the second derivative of the shape function on the integration point |
|
inlinestatic |
This function compute the maximum and minimum edge lenghts.
It assumes that it is a triangle
rGeometry | it is the array of nodes. It expects a triangle |
hmin | The minimum length |
hmax | The maximum length |