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.
Public Member Functions | List of all members
Kratos::NormalCalculationUtils Class Reference

#include <normal_calculation_utils.h>

Collaboration diagram for Kratos::NormalCalculationUtils:

Public Types

Type Definitions
typedef std::size_t IndexType
 The index type definition. More...
 
typedef std::size_t SizeType
 The size type definition. More...
 
typedef Node NodeType
 
typedef Geometry< NodeTypeGeometryType
 Definition of geometries. More...
 
typedef ModelPart::ConditionType ConditionType
 Condition type definition. More...
 
typedef ModelPart::ConditionsContainerType ConditionsArrayType
 Conditions array definition. More...
 
using NormalVariableType = Variable< array_1d< double, 3 > >
 Normal variable definition. More...
 

Public Member Functions

template<class TContainerType >
void CalculateNormalsInContainer (ModelPart &rModelPart, const Variable< array_1d< double, 3 >> &rNormalVariable)
 
template<class TContainerType , bool TIsHistorical>
void InitializeNormals (ModelPart &rModelPart, const Variable< array_1d< double, 3 >> &rNormalVariable)
 
template<class TContainerType , bool TIsHistorical>
void CalculateUnitNormals (ModelPart &rModelPart, const bool EnforceGenericGeometryAlgorithm, const Variable< array_1d< double, 3 >> &rNormalVariable)
 
template<class TContainerType , bool TIsHistorical>
void ComputeUnitNormalsFromAreaNormals (ModelPart &rModelPart, const Variable< array_1d< double, 3 >> &rNormalVariable)
 
template<>
ModelPart::ConditionsContainerTypeGetContainer (ModelPart &rModelPart)
 
Operations
template<class TContainerType >
void CalculateNormalsInContainer (ModelPart &rModelPart, const NormalVariableType &rNormalVariable=NORMAL)
 It computes the normal in the conditions. More...
 
template<class TContainerType , bool TIsHistorical = true>
void CalculateNormals (ModelPart &rModelPart, const bool EnforceGenericGeometryAlgorithm=false, const bool ConsiderUnitNormal=false, const NormalVariableType &rNormalVariable=NORMAL)
 It computes the mean of the normal in the entities and in all the nodes. More...
 
template<class TContainerType , bool TIsHistorical = true>
void CalculateUnitNormals (ModelPart &rModelPart, const bool EnforceGenericGeometryAlgorithm=false, const NormalVariableType &rNormalVariable=NORMAL)
 It computes the mean of the normal in the entities and in all the nodes (unit normal version) More...
 
void CalculateOnSimplex (ConditionsArrayType &rConditions, const std::size_t Dimension, const NormalVariableType &rNormalVariable=NORMAL)
 Calculates the "area normal" (vector oriented as the normal with a dimension proportional to the area). More...
 
void CalculateOnSimplexNonHistorical (ConditionsArrayType &rConditions, const std::size_t Dimension, const NormalVariableType &rNormalVariable=NORMAL)
 Calculates the "area normal" in the non-historical database (vector oriented as the normal with a dimension proportional to the area). More...
 
void CalculateNormalShapeDerivativesOnSimplex (ConditionsArrayType &rConditions, const std::size_t Dimension)
 Calculates nodal area normal shape sensitivities w.r.t. nodal coordinates of the condition. More...
 
void CalculateOnSimplex (ModelPart &rModelPart, const std::size_t Dimension, const NormalVariableType &rNormalVariable=NORMAL)
 Calculates the area normal (vector oriented as the normal with a dimension proportional to the area). More...
 
void CalculateOnSimplexNonHistorical (ModelPart &rModelPart, const std::size_t Dimension, const NormalVariableType &rNormalVariable=NORMAL)
 Calculates the area normal in the non-historical database (vector oriented as the normal with a dimension proportional to the area). More...
 
void CalculateOnSimplex (ModelPart &rModelPart, const NormalVariableType &rNormalVariable=NORMAL)
 Calculates the area normal (vector oriented as the normal with a dimension proportional to the area). More...
 
void CalculateOnSimplexNonHistorical (ModelPart &rModelPart, const NormalVariableType &rNormalVariable=NORMAL)
 Calculates the area normal in the non-historical database (vector oriented as the normal with a dimension proportional to the area). More...
 
void SwapNormals (ModelPart &rModelPart)
 This function swaps the normal of all of the conditions in a model part. More...
 
template<class TValueType >
void CalculateOnSimplex (ModelPart &rModelPart, const std::size_t Dimension, const Variable< TValueType > &rVariable, const TValueType Zero, const NormalVariableType &rNormalVariable=NORMAL)
 Calculates the area normal (vector oriented as the normal with a dimension proportional to the area) using only nodes marked with a flag variable. More...
 
template<class TValueType >
void CalculateOnSimplex (ModelPart &rModelPart, const std::size_t Dimension, const Variable< TValueType > &rVariable)
 Calculates the area normal (vector oriented as the normal with a dimension proportional to the area) using only nodes marked with a flag variable. More...
 
template<class TValueType >
void CalculateOnSimplex (ModelPart &rModelPart, const std::size_t Dimension, const Variable< TValueType > &rVariable, const TValueType Zero, const double rAlpha, const NormalVariableType &rNormalVariable=NORMAL)
 Calculates the area normal (vector oriented as the normal with a dimension proportional to the area) using only nodes marked with a flag variable and detecting corners. Corners are defined as nodes that recieves more than 2 normals from their neighbor conditions with a difference in angle greater than Alpha . More...
 
template<class TValueType >
void CalculateOnSimplexLowMemory (ModelPart &rModelPart, int Dimension, const Variable< TValueType > &rVariable, const TValueType Zero, const double rAlpha, const NormalVariableType &rNormalVariable=NORMAL)
 Calculates the area normal (vector oriented as the normal with a dimension proportional to the area) using only nodes marked with a flag variable and detecting corners. Corners are defined as nodes that recieves more than 2 normals from their neighbor conditions with a difference in angle greater than Alpha . (Low memory version) More...
 

Member Typedef Documentation

◆ ConditionsArrayType

Conditions array definition.

◆ ConditionType

Condition type definition.

◆ GeometryType

Definition of geometries.

◆ IndexType

The index type definition.

◆ NodeType

◆ NormalVariableType

Normal variable definition.

◆ SizeType

The size type definition.

Member Function Documentation

◆ CalculateNormals()

template<class TContainerType , bool TIsHistorical = true>
void Kratos::NormalCalculationUtils::CalculateNormals ( ModelPart rModelPart,
const bool  EnforceGenericGeometryAlgorithm = false,
const bool  ConsiderUnitNormal = false,
const NormalVariableType rNormalVariable = NORMAL 
)

It computes the mean of the normal in the entities and in all the nodes.

Parameters
rModelPartThe model part to compute
EnforceGenericGeometryAlgorithmIf enforce the generic algorithm for any kind of geometry
ConsiderUnitNormalIn order to consider directly the unit normal instead of the area normal multiplied with a coefficient
rNormalVariableComponent variable storing the normal value
Template Parameters
TEntityThe entity type considered
TIsHistoricalSpecifies if the historical or non-historical nodal database is used

◆ CalculateNormalShapeDerivativesOnSimplex()

void Kratos::NormalCalculationUtils::CalculateNormalShapeDerivativesOnSimplex ( ConditionsArrayType rConditions,
const std::size_t  Dimension 
)

Calculates nodal area normal shape sensitivities w.r.t. nodal coordinates of the condition.

Parameters
rConditionsList of conditions where shape sensitivities need to be calculated.
DimensionDimensionality of the conditions

◆ CalculateNormalsInContainer() [1/2]

template<class TContainerType >
void Kratos::NormalCalculationUtils::CalculateNormalsInContainer ( ModelPart rModelPart,
const NormalVariableType rNormalVariable = NORMAL 
)

It computes the normal in the conditions.

Parameters
rModelPartThe model part to compute
rNormalVariableComponent variable storing the normal value

◆ CalculateNormalsInContainer() [2/2]

template<class TContainerType >
void Kratos::NormalCalculationUtils::CalculateNormalsInContainer ( ModelPart rModelPart,
const Variable< array_1d< double, 3 >> &  rNormalVariable 
)

◆ CalculateOnSimplex() [1/6]

void Kratos::NormalCalculationUtils::CalculateOnSimplex ( ConditionsArrayType rConditions,
const std::size_t  Dimension,
const NormalVariableType rNormalVariable = NORMAL 
)

Calculates the "area normal" (vector oriented as the normal with a dimension proportional to the area).

This is done on the base of the Conditions provided which should be understood as the surface elements of the area of interest.

Parameters
rConditionsA set of conditions defining the "skin" of a model
DimensionSpatial dimension (2 or 3)
rNormalVariableComponent variable storing the normal value
Note
This function is not recommended for distributed (MPI) runs, as the user has to ensure that the calculated normals are assembled between processes. The overload of this function that takes a ModelPart is preferable in ths case, as it performs the required communication.

◆ CalculateOnSimplex() [2/6]

void Kratos::NormalCalculationUtils::CalculateOnSimplex ( ModelPart rModelPart,
const NormalVariableType rNormalVariable = NORMAL 
)

Calculates the area normal (vector oriented as the normal with a dimension proportional to the area).

This is done on the base of the Conditions provided which should be understood as the surface elements of the area of interest.

Parameters
rModelPartModelPart of the problem. Must have a set of conditions defining the "skin" of the domain
rNormalVariableComponent variable storing the normal value
Note
Use this fuction instead of its overload taking a Conditions array for MPI applications, as it will take care of communication between partitions.

◆ CalculateOnSimplex() [3/6]

void Kratos::NormalCalculationUtils::CalculateOnSimplex ( ModelPart rModelPart,
const std::size_t  Dimension,
const NormalVariableType rNormalVariable = NORMAL 
)

Calculates the area normal (vector oriented as the normal with a dimension proportional to the area).

This is done on the base of the Conditions provided which should be understood as the surface elements of the area of interest.

Parameters
rModelPartModelPart of the problem. Must have a set of conditions defining the "skin" of the domain
DimensionSpatial dimension (2 or 3)
rNormalVariableComponent variable storing the normal value
Note
Use this fuction instead of its overload taking a Conditions array for MPI applications, as it will take care of communication between partitions.

◆ CalculateOnSimplex() [4/6]

template<class TValueType >
void Kratos::NormalCalculationUtils::CalculateOnSimplex ( ModelPart rModelPart,
const std::size_t  Dimension,
const Variable< TValueType > &  rVariable 
)
inline

Calculates the area normal (vector oriented as the normal with a dimension proportional to the area) using only nodes marked with a flag variable.

This function is equivalent to other implementations of CalculateOnSimplex, but instead of using all conditions in the array, it only uses those that contain a value of rVariable != Zero. This is useful in problems where a part of the boundary is a slip condition, as it provides more reasonable values for the normals on the border between this area and other parts of the boundary. This function is safe to use in MPI.

Parameters
rModelPartModelPart of the problem. Must have a set of conditions defining the "skin" of the domain.
DimensionSpatial dimension (2 or 3).
rVariableThe Kratos::Variable used to indicate which parts of the boundary will be used to calculate the normals. Conditions where rVariable == Zero will be skipped.

◆ CalculateOnSimplex() [5/6]

template<class TValueType >
void Kratos::NormalCalculationUtils::CalculateOnSimplex ( ModelPart rModelPart,
const std::size_t  Dimension,
const Variable< TValueType > &  rVariable,
const TValueType  Zero,
const double  rAlpha,
const NormalVariableType rNormalVariable = NORMAL 
)
inline

Calculates the area normal (vector oriented as the normal with a dimension proportional to the area) using only nodes marked with a flag variable and detecting corners. Corners are defined as nodes that recieves more than 2 normals from their neighbor conditions with a difference in angle greater than Alpha .

This function is equivalent to other implementations of CalculateOnSimplex, but instead of using all conditions in the array, it only uses those that contain a value of rVariable != Zero. This is useful in problems where a part of the boundary is a slip condition, as it provides more reasonable values for the normals on the border between this area and other parts of the boundary. This function is safe to use in MPI.

Parameters
rModelPartModelPart of the problem. Must have a set of conditions defining the "skin" of the domain.
DimensionSpatial dimension (2 or 3).
rVariableThe Kratos::Variable used to indicate which parts of the boundary will be used to calculate the normals. Conditions where rVariable == Zero will be skipped.
rAlphathe maximum angle to distinguish normals.
rNormalVariableComponent variable storing the normal value

◆ CalculateOnSimplex() [6/6]

template<class TValueType >
void Kratos::NormalCalculationUtils::CalculateOnSimplex ( ModelPart rModelPart,
const std::size_t  Dimension,
const Variable< TValueType > &  rVariable,
const TValueType  Zero,
const NormalVariableType rNormalVariable = NORMAL 
)
inline

Calculates the area normal (vector oriented as the normal with a dimension proportional to the area) using only nodes marked with a flag variable.

This function is equivalent to other implementations of CalculateOnSimplex, but instead of using all conditions in the array, it only uses those that contain a value of rVariable != Zero. This is useful in problems where a part of the boundary is a slip condition, as it provides more reasonable values for the normals on the border between this area and other parts of the boundary. This function is safe to use in MPI.

Parameters
rModelPartModelPart of the problem. Must have a set of conditions defining the "skin" of the domain.
DimensionSpatial dimension (2 or 3).
rVariableThe Kratos::Variable used to indicate which parts of the boundary will be used to calculate the normals.
ZeroThe 'off' value for the flag. Conditions where rVariable == Zero will be skipped for normal calculation.
rNormalVariableComponent variable storing the normal value

◆ CalculateOnSimplexLowMemory()

template<class TValueType >
void Kratos::NormalCalculationUtils::CalculateOnSimplexLowMemory ( ModelPart rModelPart,
int  Dimension,
const Variable< TValueType > &  rVariable,
const TValueType  Zero,
const double  rAlpha,
const NormalVariableType rNormalVariable = NORMAL 
)
inline

Calculates the area normal (vector oriented as the normal with a dimension proportional to the area) using only nodes marked with a flag variable and detecting corners. Corners are defined as nodes that recieves more than 2 normals from their neighbor conditions with a difference in angle greater than Alpha . (Low memory version)

This function is equivalent to other implementations of CalculateOnSimplex, but instead of using all conditions in the array, it only uses those that contain a value of rVariable != Zero. This is useful in problems where a part of the boundary is a slip condition, as it provides more reasonable values for the normals on the border between this area and other parts of the boundary. This function is safe to use in MPI.

Parameters
rModelPartModelPart of the problem. Must have a set of conditions defining the "skin" of the domain.
DimensionSpatial dimension (2 or 3).
rVariableThe Kratos::Variable used to indicate which parts of the boundary will be used to calculate the normals. Conditions where rVariable == Zero will be skipped.
rAlphathe maximum angle to distinguish normals.
rNormalVariableComponent variable storing the normal value

◆ CalculateOnSimplexNonHistorical() [1/3]

void Kratos::NormalCalculationUtils::CalculateOnSimplexNonHistorical ( ConditionsArrayType rConditions,
const std::size_t  Dimension,
const NormalVariableType rNormalVariable = NORMAL 
)

Calculates the "area normal" in the non-historical database (vector oriented as the normal with a dimension proportional to the area).

This is done on the base of the Conditions provided which should be understood as the surface elements of the area of interest.

Parameters
rConditionsA set of conditions defining the "skin" of a model
DimensionSpatial dimension (2 or 3)
rNormalVariableComponent variable storing the normal value
Note
This function is not recommended for distributed (MPI) runs, as the user has to ensure that the calculated normals are assembled between processes. The overload of this function that takes a ModelPart is preferable in ths case, as it performs the required communication.

◆ CalculateOnSimplexNonHistorical() [2/3]

void Kratos::NormalCalculationUtils::CalculateOnSimplexNonHistorical ( ModelPart rModelPart,
const NormalVariableType rNormalVariable = NORMAL 
)

Calculates the area normal in the non-historical database (vector oriented as the normal with a dimension proportional to the area).

This is done on the base of the Conditions provided which should be understood as the surface elements of the area of interest.

Parameters
rModelPartModelPart of the problem. Must have a set of conditions defining the "skin" of the domain
rNormalVariableComponent variable storing the normal value
Note
Use this fuction instead of its overload taking a Conditions array for MPI applications, as it will take care of communication between partitions.

◆ CalculateOnSimplexNonHistorical() [3/3]

void Kratos::NormalCalculationUtils::CalculateOnSimplexNonHistorical ( ModelPart rModelPart,
const std::size_t  Dimension,
const NormalVariableType rNormalVariable = NORMAL 
)

Calculates the area normal in the non-historical database (vector oriented as the normal with a dimension proportional to the area).

This is done on the base of the Conditions provided which should be understood as the surface elements of the area of interest.

Parameters
rModelPartModelPart of the problem. Must have a set of conditions defining the "skin" of the domain
DimensionSpatial dimension (2 or 3)
rNormalVariableComponent variable storing the normal value
Note
Use this fuction instead of its overload taking a Conditions array for MPI applications, as it will take care of communication between partitions.

◆ CalculateUnitNormals() [1/2]

template<class TContainerType , bool TIsHistorical>
void Kratos::NormalCalculationUtils::CalculateUnitNormals ( ModelPart rModelPart,
const bool  EnforceGenericGeometryAlgorithm,
const Variable< array_1d< double, 3 >> &  rNormalVariable 
)

◆ CalculateUnitNormals() [2/2]

template<class TContainerType , bool TIsHistorical = true>
void Kratos::NormalCalculationUtils::CalculateUnitNormals ( ModelPart rModelPart,
const bool  EnforceGenericGeometryAlgorithm = false,
const NormalVariableType rNormalVariable = NORMAL 
)

It computes the mean of the normal in the entities and in all the nodes (unit normal version)

Parameters
rModelPartThe model part to compute
EnforceGenericGeometryAlgorithmIf enforce the generic algorithm for any kind of geometry
rNormalVariableComponent variable storing the normal value
Template Parameters
TEntityThe entity type considered
TIsHistoricalSpecifies if the historical or non-historical nodal database is used

◆ ComputeUnitNormalsFromAreaNormals()

template<class TContainerType , bool TIsHistorical>
void Kratos::NormalCalculationUtils::ComputeUnitNormalsFromAreaNormals ( ModelPart rModelPart,
const Variable< array_1d< double, 3 >> &  rNormalVariable 
)

◆ GetContainer()

template<>
ModelPart::ElementsContainerType & Kratos::NormalCalculationUtils::GetContainer ( ModelPart rModelPart)

◆ InitializeNormals()

template<class TContainerType , bool TIsHistorical>
void Kratos::NormalCalculationUtils::InitializeNormals ( ModelPart rModelPart,
const Variable< array_1d< double, 3 >> &  rNormalVariable 
)

◆ SwapNormals()

void Kratos::NormalCalculationUtils::SwapNormals ( ModelPart rModelPart)

This function swaps the normal of all of the conditions in a model part.

This is done by swapping the two first nodes in the geometry and is thus appropriate for simplicial elements

Parameters
rModelPartModelPart of the problem. Must have a set of conditions defining the "skin" of the domain

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