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.
rans_calculation_utilities.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Suneth Warnakulasuriya
11 //
12 
13 #if !defined(KRATOS_RANS_APPLICATION_CALCULATION_UTILITIES_H_INCLUDED)
14 #define KRATOS_RANS_APPLICATION_CALCULATION_UTILITIES_H_INCLUDED
15 
16 // System includes
17 #include <cmath>
18 #include <tuple>
19 
20 // Project includes
21 #include "geometries/geometry.h"
23 #include "includes/model_part.h"
25 
26 namespace Kratos
27 {
30 
31 namespace RansCalculationUtilities
32 {
39 
40 template<class TDataType>
41 using RefVariablePair = std::tuple<TDataType&, const Variable<TDataType>&>;
42 
43 inline long double SoftMax(
44  const long double value_1,
45  const long double value_2)
46 {
47  return std::max(value_1, value_2);
48 }
49 
50 inline long double SoftPositive(
51  const long double value)
52 {
53  return SoftMax(value, 0.0);
54 }
55 
56 // TODO: Move this to core GeometryUtils
58  const GeometryType& rGeometry,
59  const GeometryData::IntegrationMethod& rIntegrationMethod,
60  Vector& rGaussWeights,
61  Matrix& rNContainer,
63 
64 // TODO: Move this to core GeometryUtils
66  const GeometryType& rGeometry,
67  const GeometryData::IntegrationMethod& rIntegrationMethod,
68  Vector& rGaussWeights,
69  Matrix& rNContainer);
70 
72  const GeometryType& rGeometry,
73  const GeometryData::IntegrationMethod& rIntegrationMethod);
74 
75 template <std::size_t TDim>
78  const ShapeParameter& rShapeDerivative,
79  const Matrix& rDnDe,
80  const Matrix& rDeDx);
81 
82 template <unsigned int TDim>
84  const BoundedMatrix<double, TDim, TDim>& rMatrix);
85 
86 template <unsigned int TNumNodes>
88  BoundedVector<double, TNumNodes>& rGaussSensitivities,
89  const BoundedVector<double, TNumNodes>& rNodalSensitivities,
90  const Vector& rGaussShapeFunctions);
91 
92 double KRATOS_API(RANS_APPLICATION) CalculateLogarithmicYPlusLimit(
93  const double Kappa,
94  const double Beta,
95  const int MaxIterations = 20,
96  const double Tolerance = 1e-6);
97 
99  double& rYPlus,
100  double& rUTau,
101  const double WallVelocity,
102  const double WallHeight,
103  const double KinematicViscosity,
104  const double Kappa,
105  const double Beta,
106  const int MaxIterations = 20,
107  const double Tolerance = 1e-6);
108 
109 double CalculateWallHeight(
110  const ConditionType& rCondition,
111  const array_1d<double, 3>& rNormal);
112 
114  const ConditionType& rCondition);
115 
117  const ConditionType& rCondition);
118 
119 bool IsInlet(
120  const ConditionType& rCondition);
121 
122 template <class TContainerType>
123 TContainerType& GetContainer(ModelPart& rModelPart);
124 
135 template<class TContainerType>
137  ModelPart& rModelPart,
138  const Variable<double>& rOutputVariable);
139 
140 } // namespace RansCalculationUtilities
141 
143 
144 } // namespace Kratos
145 
146 #endif // KRATOS_RANS_APPLICATION_CALCULATION_UTILITIES_H_INCLUDED defined
Base class for all Conditions.
Definition: condition.h:59
Base class for all Elements.
Definition: element.h:60
IntegrationMethod
Definition: geometry_data.h:76
Geometry base class.
Definition: geometry.h:71
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Element ElementType
Definition: model_part.h:120
Node NodeType
Definition: model_part.h:117
Condition ConditionType
Definition: model_part.h:121
This class defines the node.
Definition: node.h:65
#define KRATOS_API(...)
Definition: kratos_export_api.h:40
static double max(double a, double b)
Definition: GeometryFunctions.h:79
double CalculateMatrixTrace(const BoundedMatrix< double, TDim, TDim > &rMatrix)
Definition: rans_calculation_utilities.cpp:92
bool IsWallFunctionActive(const ConditionType &rCondition)
Definition: rans_calculation_utilities.cpp:292
bool IsInlet(const ConditionType &rCondition)
Definition: rans_calculation_utilities.cpp:298
void CalculateGeometryParameterDerivativesShapeSensitivity(BoundedMatrix< double, TDim, TDim > &rOutput, const ShapeParameter &rShapeDerivative, const Matrix &rDnDe, const Matrix &rDeDx)
Definition: rans_calculation_utilities.cpp:138
void CalculateConditionGeometryData(const GeometryType &rGeometry, const GeometryData::IntegrationMethod &rIntegrationMethod, Vector &rGaussWeights, Matrix &rNContainer)
Definition: rans_calculation_utilities.cpp:62
void CalculateNumberOfNeighbourEntities(ModelPart &rModelPart, const Variable< double > &rOutputVariable)
Calculates number of neighbours.
Definition: rans_calculation_utilities.cpp:326
std::tuple< TDataType &, const Variable< TDataType > & > RefVariablePair
Definition: rans_calculation_utilities.h:41
long double SoftPositive(const long double value)
Definition: rans_calculation_utilities.h:50
array_1d< double, 3 > CalculateWallVelocity(const ConditionType &rCondition)
Definition: rans_calculation_utilities.cpp:218
double CalculateWallHeight(const ConditionType &rCondition, const array_1d< double, 3 > &rNormal)
Definition: rans_calculation_utilities.cpp:195
ModelPart::NodesContainerType & GetContainer(ModelPart &rModelPart)
Definition: rans_calculation_utilities.cpp:305
void CalculateGaussSensitivities(BoundedVector< double, TNumNodes > &rGaussSensitivities, const BoundedVector< double, TNumNodes > &rNodalSensitivities, const Vector &rGaussShapeFunctions)
Definition: rans_calculation_utilities.cpp:156
long double SoftMax(const long double value_1, const long double value_2)
Definition: rans_calculation_utilities.h:43
void CalculateGeometryData(const GeometryType &rGeometry, const GeometryData::IntegrationMethod &rIntegrationMethod, Vector &rGaussWeights, Matrix &rNContainer, GeometryType::ShapeFunctionsGradientsType &rDN_DX)
Definition: rans_calculation_utilities.cpp:31
double CalculateLogarithmicYPlusLimit(const double Kappa, const double Beta, const int MaxIterations, const double Tolerance)
Definition: rans_calculation_utilities.cpp:168
void CalculateYPlusAndUtau(double &rYPlus, double &rUTau, const double WallVelocity, const double WallHeight, const double KinematicViscosity, const double Kappa, const double Beta, const int MaxIterations, const double Tolerance)
Definition: rans_calculation_utilities.cpp:247
GeometryType::ShapeFunctionsGradientsType CalculateGeometryParameterDerivatives(const GeometryType &rGeometry, const GeometryData::IntegrationMethod &rIntegrationMethod)
Definition: rans_calculation_utilities.cpp:103
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Kappa
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:11
def Beta(n, j)
Definition: quadrature.py:104
e
Definition: run_cpp_mpi_tests.py:31
Definition: geometrical_sensitivity_utility.h:33