49 template<std::
size_t TDim, std::
size_t TNumNodes>
105 WallLawDataContainer wall_law_data;
106 wall_law_data.Initialize(*pCondition);
112 const double w_gauss_lobatto = r_geom.
DomainSize() / TNumNodes;
113 for (
IndexType i_node = 0; i_node < TNumNodes; ++i_node) {
115 const auto& r_aux_v = wall_law_data.NodalWallVelocities[i_node];
116 const double wall_vel_norm =
norm_2(r_aux_v);
119 if (wall_vel_norm > ZeroTol) {
121 const double u_tau = wall_law_data.CalculateFrictionVelocity(wall_vel_norm, wall_law_data.NodalYWallValues[i_node]);
124 const double tmp = w_gauss_lobatto * std::pow(u_tau,2) * wall_law_data.Density / wall_vel_norm;
146 WallLawDataContainer wall_law_data;
147 wall_law_data.Initialize(*pCondition);
153 const double w_gauss_lobatto = r_geom.
DomainSize() / TNumNodes;
154 for (
IndexType i_node = 0; i_node < TNumNodes; ++i_node) {
156 const auto& r_aux_v = wall_law_data.NodalWallVelocities[i_node];
157 const double wall_vel_norm =
norm_2(r_aux_v);
160 if (wall_vel_norm > ZeroTol) {
162 const double u_tau = wall_law_data.CalculateFrictionVelocity(wall_vel_norm, wall_law_data.NodalYWallValues[i_node]);
165 const double tmp = w_gauss_lobatto * std::pow(u_tau,2) * wall_law_data.Density / wall_vel_norm;
186 WallLawDataContainer wall_law_data;
187 wall_law_data.Initialize(*pCondition);
193 const double w_gauss_lobatto = r_geom.
DomainSize() / TNumNodes;
194 for (
IndexType i_node = 0; i_node < TNumNodes; ++i_node) {
196 const auto& r_aux_v = wall_law_data.NodalWallVelocities[i_node];
197 const double wall_vel_norm =
norm_2(r_aux_v);
200 if (wall_vel_norm > ZeroTol) {
202 const double u_tau = wall_law_data.CalculateFrictionVelocity(wall_vel_norm, wall_law_data.NodalYWallValues[i_node]);
205 const double tmp = w_gauss_lobatto * std::pow(u_tau,2) * wall_law_data.Density / wall_vel_norm;
244 std::stringstream buffer;
245 buffer <<
"LinearLogWallLaw";
252 rOStream <<
"LinearLogWallLaw";
268 static constexpr
double BPlus = 5.2;
269 static constexpr
double InvKappa = 1.0/0.41;
270 static constexpr
double YPlusLimit = 10.9931899;
271 static constexpr
double ZeroTol = 1.0e-12;
280 struct WallLawDataContainer
283 double KinematicViscosity;
287 void Initialize(
const Condition& rCondition)
291 const auto& r_parent_element = rCondition.
GetValue(NEIGHBOUR_ELEMENTS)[0];
292 Density = r_parent_element.GetProperties().GetValue(DENSITY);
293 KinematicViscosity = r_parent_element.GetProperties().GetValue(DYNAMIC_VISCOSITY) / Density;
297 for (std::size_t i_node = 0; i_node < TNumNodes; ++i_node) {
298 const auto& r_node = r_geom[i_node];
299 const double aux_y_wall = r_node.
GetValue(Y_WALL);
300 KRATOS_ERROR_IF(aux_y_wall < ZeroTol) <<
"Negative or zero 'Y_WALL' in condition " << rCondition.
Id() <<
"." << std::endl;
301 NodalYWallValues[i_node] = aux_y_wall;
302 noalias(NodalWallVelocities[i_node]) = r_node.FastGetSolutionStepValue(VELOCITY) - r_node.FastGetSolutionStepValue(MESH_VELOCITY);
306 double CalculateFrictionVelocity(
307 const double WallVelocityNorm,
312 if (WallVelocityNorm > ZeroTol) {
314 u_tau = sqrt(WallVelocityNorm * KinematicViscosity / YWall);
315 double y_plus = YWall * u_tau / KinematicViscosity;
318 if (y_plus > YPlusLimit) {
321 const double rel_tol = 1
e-6;
322 const std::size_t max_it = 100;
323 double u_plus = InvKappa * log(y_plus) + BPlus;
326 while (it < 100 && std::abs(dx) > rel_tol * u_tau) {
328 double f = u_tau * u_plus - WallVelocityNorm;
329 double df = u_plus + InvKappa;
334 y_plus = YWall * u_tau / KinematicViscosity;
335 u_plus = InvKappa * log(y_plus) + BPlus;
338 KRATOS_WARNING_IF(
"LinearLogWallLaw", it == max_it) <<
"Wall condition Newton-Raphson did not converge. Residual is " << dx <<
"." << std::endl;
Base class for all Conditions.
Definition: condition.h:59
std::size_t SizeType
Definition: condition.h:94
std::size_t IndexType
Definition: condition.h:92
Matrix MatrixType
Definition: condition.h:90
Vector VectorType
Definition: condition.h:88
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: geometrical_object.h:248
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: geometry.h:627
virtual double DomainSize() const
This method calculate and return length, area or volume of this geometry depending to it's dimension.
Definition: geometry.h:1371
IndexType Id() const
Definition: indexed_object.h:107
Linear-log law LHS and RHS contribution implementation This class implements the LHS and RHS Gauss po...
Definition: linear_log_wall_law.h:51
static constexpr std::size_t BlockSize
Definition: linear_log_wall_law.h:59
LinearLogWallLaw(LinearLogWallLaw const &rOther)=delete
Copy constructor.
static void AddWallModelLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const Condition *pCondition, const ProcessInfo &rCurrentProcessInfo)
Add the LHS and RHS Navier-slip contributions This method adds the Navier-slip LHS and RHS Gauss poin...
Definition: linear_log_wall_law.h:98
void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: linear_log_wall_law.h:250
static void AddWallModelRightHandSide(VectorType &rRightHandSideVector, const Condition *pCondition, const ProcessInfo &rCurrentProcessInfo)
Add the RHS Navier-slip contribution This method adds the Navier-slip RHS Gauss point contribution to...
Definition: linear_log_wall_law.h:180
KRATOS_CLASS_POINTER_DEFINITION(LinearLogWallLaw)
Pointer definition of LinearLogWallLaw.
Condition::SizeType SizeType
Definition: linear_log_wall_law.h:63
static int Check(const Condition *pCondition, const ProcessInfo &rCurrentProcessInfo)
Check function This function checks the current wall law input parameters.
Definition: linear_log_wall_law.h:220
LinearLogWallLaw()=delete
Default constructor.
~LinearLogWallLaw()=default
Destructor.
void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: linear_log_wall_law.h:256
static void AddWallModelLeftHandSide(MatrixType &rLeftHandSideMatrix, const Condition *pCondition, const ProcessInfo &rCurrentProcessInfo)
Add the LHS Navier-slip contribution This method adds the Navier-slip LHS Gauss point contribution to...
Definition: linear_log_wall_law.h:140
static constexpr std::size_t LocalSize
Definition: linear_log_wall_law.h:61
Condition::IndexType IndexType
Definition: linear_log_wall_law.h:65
std::string Info() const
Turn back information as a string.
Definition: linear_log_wall_law.h:242
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
f
Definition: generate_convection_diffusion_explicit_element.py:112
tuple tmp
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:98
int d
Definition: ode_solve.py:397
e
Definition: run_cpp_mpi_tests.py:31