49#define VISCOUS_SUBLAYER_YPLUS 11.81
52#define ROUGHNESS_TRANSITION_YPLUS 2.25
55#define FULLY_ROUGH_YPLUS 90.0
58#define DAMPING_COEFFICIENT 19.0
94 double distance_reference,
double distance_boundary,
97 double normal_x,
double normal_y,
double normal_z)
100 double delta_u = velocity_reference.
x - velocity_wall.
x;
101 double delta_v = velocity_reference.
y - velocity_wall.
y;
102 double delta_w = velocity_reference.
z - velocity_wall.
z;
105 double interpolation_factor = distance_boundary / distance_reference;
108 (*velocity_boundary).x = interpolation_factor * delta_u;
109 (*velocity_boundary).y = interpolation_factor * delta_v;
110 (*velocity_boundary).z = interpolation_factor * delta_w;
113 (*velocity_boundary).x += velocity_wall.
x;
114 (*velocity_boundary).y += velocity_wall.
y;
115 (*velocity_boundary).z += velocity_wall.
z;
146 double distance_reference,
double distance_boundary,
148 Cmpnts *velocity_boundary,
149 double normal_x,
double normal_y,
double normal_z)
152 double wall_normal_velocity = velocity_wall.
x * normal_x +
153 velocity_wall.
y * normal_y +
154 velocity_wall.
z * normal_z;
156 double reference_normal_velocity = velocity_reference.
x * normal_x +
157 velocity_reference.
y * normal_y +
158 velocity_reference.
z * normal_z;
161 double boundary_normal_velocity = wall_normal_velocity +
162 (reference_normal_velocity - wall_normal_velocity) * (distance_boundary / distance_reference);
165 double tangential_u = velocity_reference.
x - reference_normal_velocity * normal_x;
166 double tangential_v = velocity_reference.
y - reference_normal_velocity * normal_y;
167 double tangential_w = velocity_reference.
z - reference_normal_velocity * normal_z;
170 (*velocity_boundary).x = tangential_u + boundary_normal_velocity * normal_x;
171 (*velocity_boundary).y = tangential_v + boundary_normal_velocity * normal_y;
172 (*velocity_boundary).z = tangential_w + boundary_normal_velocity * normal_z;
198double E_coeff(
double friction_velocity,
double roughness_height,
double kinematic_viscosity)
201 double roughness_reynolds = friction_velocity * roughness_height / kinematic_viscosity;
203 double roughness_correction;
207 roughness_correction = 0.0;
213 double max_correction =
LOGLAW_B - 8.5 + (1.0 /
KAPPA) * log(roughness_reynolds);
215 roughness_correction = max_correction *
216 sin(0.4258 * (log(roughness_reynolds) - 0.811));
220 roughness_correction =
LOGLAW_B - 8.5 + (1.0 /
KAPPA) * log(roughness_reynolds);
248 double friction_velocity,
double roughness_height)
251 double yplus = friction_velocity * wall_distance / kinematic_viscosity;
255 const double loglayer_limit = 300.0;
257 double tangential_velocity;
259 if (yplus <= viscous_limit) {
261 tangential_velocity = friction_velocity * yplus;
263 else if (yplus <= loglayer_limit) {
265 double E =
E_coeff(friction_velocity, roughness_height, kinematic_viscosity);
266 tangential_velocity = (friction_velocity /
KAPPA) * log(E * yplus);
270 tangential_velocity = -1.0;
273 return tangential_velocity;
294double f_hydset(
double kinematic_viscosity,
double known_velocity,
295 double wall_distance,
double friction_velocity_guess,
296 double roughness_height)
298 double yplus = friction_velocity_guess * wall_distance / kinematic_viscosity;
303 residual = friction_velocity_guess * yplus - known_velocity;
307 double E =
E_coeff(friction_velocity_guess, roughness_height, kinematic_viscosity);
308 residual = friction_velocity_guess * (1.0 /
KAPPA * log(E * yplus)) - known_velocity;
326double df_hydset(
double kinematic_viscosity,
double known_velocity,
327 double wall_distance,
double friction_velocity_guess,
328 double roughness_height)
330 const double perturbation = 1.e-7;
332 double f_plus =
f_hydset(kinematic_viscosity, known_velocity, wall_distance,
333 friction_velocity_guess + perturbation, roughness_height);
335 double f_minus =
f_hydset(kinematic_viscosity, known_velocity, wall_distance,
336 friction_velocity_guess - perturbation, roughness_height);
338 return (f_plus - f_minus) / (2.0 * perturbation);
363 double wall_distance,
double initial_guess,
364 double roughness_height)
366 double friction_velocity = initial_guess;
367 double friction_velocity_old = initial_guess;
369 const int max_iterations = 30;
370 const double convergence_tolerance = 1.e-7;
373 for (iteration = 0; iteration < max_iterations; iteration++) {
375 double residual =
f_hydset(kinematic_viscosity, known_velocity, wall_distance,
376 friction_velocity_old, roughness_height);
377 double derivative =
df_hydset(kinematic_viscosity, known_velocity, wall_distance,
378 friction_velocity_old, roughness_height);
380 friction_velocity = friction_velocity_old - residual / derivative;
383 if (fabs(friction_velocity - friction_velocity_old) < convergence_tolerance) {
387 friction_velocity_old = friction_velocity;
391 if (iteration == max_iterations) {
393 "WARNING: u_tau iteration did not converge after %d iterations. "
394 "Final difference: %le\n",
395 iteration, fabs(friction_velocity - friction_velocity_old));
398 return friction_velocity;
429 return KAPPA * yplus * damping_function * damping_function;
454double integrate_1(
double kinematic_viscosity,
double wall_distance,
455 double friction_velocity,
int integration_mode)
457 const int num_points = 30;
458 double step_size = wall_distance / (num_points - 1);
459 double integral_values[num_points];
462 for (
int i = 0; i < num_points; i++) {
463 double current_distance = i * step_size;
464 double yplus = current_distance * friction_velocity / kinematic_viscosity;
465 double eddy_viscosity_ratio =
nu_t(yplus);
467 if (integration_mode == 0) {
469 integral_values[i] = 1.0 / ((1.0 + eddy_viscosity_ratio) * kinematic_viscosity);
473 integral_values[i] = current_distance /
474 ((1.0 + eddy_viscosity_ratio) * kinematic_viscosity);
479 double integral_sum = 0.0;
482 for (
int i = 1; i < num_points - 1; i++) {
483 integral_sum += (integral_values[i-1] + 2.0 * integral_values[i] +
484 integral_values[i+1]) * 0.25 * step_size;
488 integral_sum += 0.1667 * step_size *
489 (2.0 * integral_values[0] + integral_values[1] +
490 2.0 * integral_values[num_points-1] + integral_values[num_points-2]);
517double taw(
double kinematic_viscosity,
double friction_velocity,
518 double wall_distance,
double velocity,
double pressure_gradient_tangent)
521 double F1 =
integrate_1(kinematic_viscosity, wall_distance, friction_velocity, 0);
522 double Fy =
integrate_1(kinematic_viscosity, wall_distance, friction_velocity, 1);
525 return (1.0 / F1) * (velocity - pressure_gradient_tangent * Fy);
541double u_Cabot(
double kinematic_viscosity,
double wall_distance,
542 double friction_velocity,
double pressure_gradient_tangent,
543 double wall_shear_stress)
545 double F1 =
integrate_1(kinematic_viscosity, wall_distance, friction_velocity, 0);
546 double Fy =
integrate_1(kinematic_viscosity, wall_distance, friction_velocity, 1);
548 return wall_shear_stress * F1 + pressure_gradient_tangent * Fy;
565double f_Cabot(
double kinematic_viscosity,
double velocity,
double wall_distance,
566 double friction_velocity_guess,
double pressure_gradient_tangent,
567 double pressure_gradient_normal)
569 double wall_shear =
taw(kinematic_viscosity, friction_velocity_guess,
570 wall_distance, velocity, pressure_gradient_tangent);
572 return friction_velocity_guess - sqrt(fabs(wall_shear));
578double df_Cabot(
double kinematic_viscosity,
double velocity,
double wall_distance,
579 double friction_velocity_guess,
double pressure_gradient_tangent,
580 double pressure_gradient_normal)
582 const double perturbation = 1.e-7;
584 double f_plus =
f_Cabot(kinematic_viscosity, velocity, wall_distance,
585 friction_velocity_guess + perturbation,
586 pressure_gradient_tangent, pressure_gradient_normal);
588 double f_minus =
f_Cabot(kinematic_viscosity, velocity, wall_distance,
589 friction_velocity_guess - perturbation,
590 pressure_gradient_tangent, pressure_gradient_normal);
592 return (f_plus - f_minus) / (2.0 * perturbation);
611void find_utau_Cabot(
double kinematic_viscosity,
double velocity,
double wall_distance,
612 double initial_guess,
double pressure_gradient_tangent,
613 double pressure_gradient_normal,
double *friction_velocity,
614 double *wall_shear_velocity,
double *wall_shear_normal)
616 double current_guess = initial_guess;
619 const int max_iterations = 30;
620 const double convergence_tolerance = 1.e-10;
623 for (iteration = 0; iteration < max_iterations; iteration++) {
624 double residual =
f_Cabot(kinematic_viscosity, velocity, wall_distance,
625 current_guess, pressure_gradient_tangent,
626 pressure_gradient_normal);
628 double derivative =
df_Cabot(kinematic_viscosity, velocity, wall_distance,
629 current_guess, pressure_gradient_tangent,
630 pressure_gradient_normal);
632 new_guess = fabs(current_guess - residual / derivative);
634 if (fabs(current_guess - new_guess) < convergence_tolerance) {
638 current_guess = new_guess;
641 if (fabs(current_guess - new_guess) > 1.e-5 && iteration >= 29) {
642 printf(
"\n!!!!!!!! Cabot Iteration Failed !!!!!!!!\n");
645 *friction_velocity = new_guess;
646 *wall_shear_velocity =
taw(kinematic_viscosity, new_guess, wall_distance,
647 velocity, pressure_gradient_tangent);
648 *wall_shear_normal =
taw(kinematic_viscosity, new_guess, wall_distance,
649 0.0, pressure_gradient_normal);
678double u_Werner(
double kinematic_viscosity,
double wall_distance,
679 double friction_velocity)
681 double yplus = friction_velocity * wall_distance / kinematic_viscosity;
684 const double power_law_coefficient = 8.3;
685 const double power_law_exponent = 1.0 / 7.0;
691 velocity = yplus * friction_velocity;
695 velocity = power_law_coefficient * pow(yplus, power_law_exponent) * friction_velocity;
713double f_Werner(
double kinematic_viscosity,
double velocity,
714 double wall_distance,
double friction_velocity)
716 const double power_law_coefficient = 8.3;
717 const double power_law_exponent = 1.0 / 7.0;
723 double transition_velocity = kinematic_viscosity / (2.0 * transition_distance) *
724 pow(power_law_coefficient, 2.0 / (1.0 - power_law_exponent));
728 if (fabs(velocity) <= transition_velocity) {
730 residual = friction_velocity * friction_velocity -
731 velocity / wall_distance * kinematic_viscosity;
735 double term1 = 0.5 * (1.0 - power_law_exponent) *
736 pow(power_law_coefficient, (1.0 + power_law_exponent) /
737 (1.0 - power_law_exponent)) *
738 pow(kinematic_viscosity / wall_distance, 1.0 + power_law_exponent);
740 double term2 = (1.0 + power_law_exponent) / power_law_coefficient *
741 pow(kinematic_viscosity / wall_distance, power_law_exponent) *
744 residual = friction_velocity * friction_velocity -
745 velocity / fabs(velocity) * pow(term1 + term2, 2.0 / (1.0 + power_law_exponent));
754double df_Werner(
double kinematic_viscosity,
double velocity,
755 double wall_distance,
double friction_velocity)
757 const double perturbation = 1.e-7;
759 double f_plus =
f_Werner(kinematic_viscosity, velocity, wall_distance,
760 friction_velocity + perturbation);
762 double f_minus =
f_Werner(kinematic_viscosity, velocity, wall_distance,
763 friction_velocity - perturbation);
765 return (f_plus - f_minus) / (2.0 * perturbation);
778 double wall_distance,
double initial_guess)
780 double current_guess = initial_guess;
783 const int max_iterations = 20;
784 const double convergence_tolerance = 1.e-7;
787 for (iteration = 0; iteration < max_iterations; iteration++) {
788 double residual =
f_Werner(kinematic_viscosity, velocity, wall_distance, current_guess);
789 double derivative =
df_Werner(kinematic_viscosity, velocity, wall_distance, current_guess);
791 new_guess = current_guess - residual / derivative;
793 if (fabs(current_guess - new_guess) < convergence_tolerance) {
797 current_guess = new_guess;
800 if (fabs(current_guess - new_guess) > 1.e-5 && iteration >= 19) {
801 printf(
"\n!!!!!!!! Werner-Wengle Iteration Failed !!!!!!!!\n");
825double u_loglaw(
double wall_distance,
double friction_velocity,
double roughness_length)
827 return friction_velocity * (1.0 /
KAPPA) * log((roughness_length + wall_distance) / roughness_length);
842 return KAPPA * velocity / log((wall_distance + roughness_length) / roughness_length);
855static double sign(
double value)
857 if (value > 0)
return 1.0;
858 else if (value < 0)
return -1.0;
888 Cmpnts *velocity_boundary, PetscReal *friction_velocity,
889 double normal_x,
double normal_y,
double normal_z)
892 double kinematic_viscosity = 1.0 / simCtx->
ren;
895 double delta_u = velocity_reference.
x - velocity_wall.
x;
896 double delta_v = velocity_reference.
y - velocity_wall.
y;
897 double delta_w = velocity_reference.
z - velocity_wall.
z;
899 double normal_velocity = delta_u * normal_x + delta_v * normal_y + delta_w * normal_z;
901 double tangential_u = delta_u - normal_velocity * normal_x;
902 double tangential_v = delta_v - normal_velocity * normal_y;
903 double tangential_w = delta_w - normal_velocity * normal_z;
905 double tangential_magnitude = sqrt(tangential_u * tangential_u +
906 tangential_v * tangential_v +
907 tangential_w * tangential_w);
910 double utau_guess = 0.05;
911 double tangential_modeled =
u_Werner(kinematic_viscosity, distance_boundary, utau_guess);
914 if (tangential_magnitude > 1.e-10) {
915 tangential_u *= tangential_modeled / tangential_magnitude;
916 tangential_v *= tangential_modeled / tangential_magnitude;
917 tangential_w *= tangential_modeled / tangential_magnitude;
920 tangential_u = tangential_v = tangential_w = 0.0;
924 (*velocity_boundary).x = tangential_u + (distance_boundary / distance_reference) * normal_velocity * normal_x;
925 (*velocity_boundary).y = tangential_v + (distance_boundary / distance_reference) * normal_velocity * normal_y;
926 (*velocity_boundary).z = tangential_w + (distance_boundary / distance_reference) * normal_velocity * normal_z;
929 (*velocity_boundary).x += velocity_wall.
x;
930 (*velocity_boundary).y += velocity_wall.
y;
931 (*velocity_boundary).z += velocity_wall.
z;
956 double distance_reference,
double distance_boundary,
958 Cmpnts *velocity_boundary, PetscReal *friction_velocity,
959 double normal_x,
double normal_y,
double normal_z)
962 double kinematic_viscosity = 1.0 / simCtx->
ren;
965 double delta_u = velocity_reference.
x - velocity_wall.
x;
966 double delta_v = velocity_reference.
y - velocity_wall.
y;
967 double delta_w = velocity_reference.
z - velocity_wall.
z;
969 double normal_velocity = delta_u * normal_x + delta_v * normal_y + delta_w * normal_z;
971 double tangential_u = delta_u - normal_velocity * normal_x;
972 double tangential_v = delta_v - normal_velocity * normal_y;
973 double tangential_w = delta_w - normal_velocity * normal_z;
975 double tangential_magnitude = sqrt(tangential_u * tangential_u +
976 tangential_v * tangential_v +
977 tangential_w * tangential_w);
980 *friction_velocity =
find_utau_hydset(kinematic_viscosity, tangential_magnitude,
981 distance_reference, 0.001, roughness_height);
984 double tangential_modeled =
u_hydset_roughness(kinematic_viscosity, distance_boundary,
985 *friction_velocity, roughness_height);
988 if (tangential_modeled < 0.0) {
989 tangential_modeled = tangential_magnitude;
993 if (tangential_magnitude > 1.e-10) {
994 tangential_u *= tangential_modeled / tangential_magnitude;
995 tangential_v *= tangential_modeled / tangential_magnitude;
996 tangential_w *= tangential_modeled / tangential_magnitude;
999 tangential_u = tangential_v = tangential_w = 0.0;
1003 (*velocity_boundary).x = tangential_u + (distance_boundary / distance_reference) * normal_velocity * normal_x;
1004 (*velocity_boundary).y = tangential_v + (distance_boundary / distance_reference) * normal_velocity * normal_y;
1005 (*velocity_boundary).z = tangential_w + (distance_boundary / distance_reference) * normal_velocity * normal_z;
1008 (*velocity_boundary).x += velocity_wall.
x;
1009 (*velocity_boundary).y += velocity_wall.
y;
1010 (*velocity_boundary).z += velocity_wall.
z;
1039 double distance_reference,
double distance_boundary,
1041 Cmpnts *velocity_boundary, PetscReal *friction_velocity,
1042 double normal_x,
double normal_y,
double normal_z,
1043 double pressure_gradient_x,
double pressure_gradient_y,
1044 double pressure_gradient_z,
int iteration_count)
1047 double kinematic_viscosity = 1.0 / simCtx->
ren;
1050 double delta_u = velocity_reference.
x - velocity_wall.
x;
1051 double delta_v = velocity_reference.
y - velocity_wall.
y;
1052 double delta_w = velocity_reference.
z - velocity_wall.
z;
1054 double normal_velocity = delta_u * normal_x + delta_v * normal_y + delta_w * normal_z;
1056 double tangential_u = delta_u - normal_velocity * normal_x;
1057 double tangential_v = delta_v - normal_velocity * normal_y;
1058 double tangential_w = delta_w - normal_velocity * normal_z;
1060 double tangential_magnitude = sqrt(tangential_u * tangential_u +
1061 tangential_v * tangential_v +
1062 tangential_w * tangential_w);
1065 double pressure_gradient_tangent = 0.0;
1066 if (tangential_magnitude > 1.e-10) {
1067 pressure_gradient_tangent = (pressure_gradient_x * tangential_u +
1068 pressure_gradient_y * tangential_v +
1069 pressure_gradient_z * tangential_w) / tangential_magnitude;
1073 double pressure_gradient_normal = 0.0;
1076 if (iteration_count == 0 || iteration_count > 4) {
1077 double utau, wall_shear1, wall_shear2;
1078 find_utau_Cabot(kinematic_viscosity, tangential_magnitude, distance_reference,
1079 0.01, pressure_gradient_tangent, pressure_gradient_normal,
1080 &utau, &wall_shear1, &wall_shear2);
1081 *friction_velocity = utau;
1085 double tangential_modeled =
u_Cabot(kinematic_viscosity, distance_boundary,
1086 *friction_velocity, pressure_gradient_tangent,
1087 taw(kinematic_viscosity, *friction_velocity,
1088 distance_reference, tangential_magnitude,
1089 pressure_gradient_tangent));
1092 if (tangential_magnitude > 1.e-10) {
1093 tangential_u *= tangential_modeled / tangential_magnitude;
1094 tangential_v *= tangential_modeled / tangential_magnitude;
1095 tangential_w *= tangential_modeled / tangential_magnitude;
1098 tangential_u = tangential_v = tangential_w = 0.0;
1102 (*velocity_boundary).x = tangential_u + (distance_boundary / distance_reference) * normal_velocity * normal_x;
1103 (*velocity_boundary).y = tangential_v + (distance_boundary / distance_reference) * normal_velocity * normal_y;
1104 (*velocity_boundary).z = tangential_w + (distance_boundary / distance_reference) * normal_velocity * normal_z;
1107 (*velocity_boundary).x += velocity_wall.
x;
1108 (*velocity_boundary).y += velocity_wall.
y;
1109 (*velocity_boundary).z += velocity_wall.
z;
#define LOCAL
Logging scope definitions for controlling message output.
#define LOG_ALLOW(scope, level, fmt,...)
Logging macro that checks both the log level and whether the calling function is in the allowed-funct...
@ LOG_DEBUG
Detailed debugging information.
SimCtx * simCtx
Back-pointer to the master simulation context.
A 3D point or vector with PetscScalar components.
The master context for the entire simulation.
User-defined context containing data specific to a single computational grid level.
double df_Cabot(double kinematic_viscosity, double velocity, double wall_distance, double friction_velocity_guess, double pressure_gradient_tangent, double pressure_gradient_normal)
Numerical derivative for Cabot wall function.
double f_Cabot(double kinematic_viscosity, double velocity, double wall_distance, double friction_velocity_guess, double pressure_gradient_tangent, double pressure_gradient_normal)
Residual function for Cabot wall function.
void wall_function_loglaw(UserCtx *user, double roughness_height, double distance_reference, double distance_boundary, Cmpnts velocity_wall, Cmpnts velocity_reference, Cmpnts *velocity_boundary, PetscReal *friction_velocity, double normal_x, double normal_y, double normal_z)
Applies log-law wall function with roughness correction.
double find_utau_loglaw(double velocity, double wall_distance, double roughness_length)
Solves for friction velocity using simple log-law (explicit formula)
double u_Werner(double kinematic_viscosity, double wall_distance, double friction_velocity)
Computes velocity using Werner-Wengle wall function.
double u_hydset_roughness(double kinematic_viscosity, double wall_distance, double friction_velocity, double roughness_height)
Computes velocity from log-law for rough walls.
static double sign(double value)
Returns the sign of a number.
void wall_function(UserCtx *user, double distance_reference, double distance_boundary, Cmpnts velocity_wall, Cmpnts velocity_reference, Cmpnts *velocity_boundary, PetscReal *friction_velocity, double normal_x, double normal_y, double normal_z)
Applies standard wall function with Werner-Wengle model.
#define DAMPING_COEFFICIENT
Eddy viscosity damping coefficient (van Driest damping)
double taw(double kinematic_viscosity, double friction_velocity, double wall_distance, double velocity, double pressure_gradient_tangent)
Computes wall shear stress with pressure gradient effects.
double find_utau_hydset(double kinematic_viscosity, double known_velocity, double wall_distance, double initial_guess, double roughness_height)
Solves for friction velocity using Newton-Raphson iteration.
double u_Cabot(double kinematic_viscosity, double wall_distance, double friction_velocity, double pressure_gradient_tangent, double wall_shear_stress)
Computes velocity using Cabot wall function.
#define ROUGHNESS_TRANSITION_YPLUS
Smooth-to-rough transition y+ threshold.
double df_Werner(double kinematic_viscosity, double velocity, double wall_distance, double friction_velocity)
Numerical derivative for Werner-Wengle iteration.
double f_Werner(double kinematic_viscosity, double velocity, double wall_distance, double friction_velocity)
Residual function for Werner-Wengle iteration.
#define VISCOUS_SUBLAYER_YPLUS
Viscous sublayer thickness y+ threshold.
double u_loglaw(double wall_distance, double friction_velocity, double roughness_length)
Computes velocity using simple log-law (smooth wall with roughness offset)
void wall_function_Cabot(UserCtx *user, double roughness_height, double distance_reference, double distance_boundary, Cmpnts velocity_wall, Cmpnts velocity_reference, Cmpnts *velocity_boundary, PetscReal *friction_velocity, double normal_x, double normal_y, double normal_z, double pressure_gradient_x, double pressure_gradient_y, double pressure_gradient_z, int iteration_count)
Applies Cabot non-equilibrium wall function with pressure gradients.
#define LOGLAW_B
Log-law intercept constant B for smooth walls.
void noslip(UserCtx *user, double distance_reference, double distance_boundary, Cmpnts velocity_wall, Cmpnts velocity_reference, Cmpnts *velocity_boundary, double normal_x, double normal_y, double normal_z)
Applies no-slip wall boundary condition with linear interpolation.
void find_utau_Cabot(double kinematic_viscosity, double velocity, double wall_distance, double initial_guess, double pressure_gradient_tangent, double pressure_gradient_normal, double *friction_velocity, double *wall_shear_velocity, double *wall_shear_normal)
Solves for friction velocity using Cabot wall function.
double integrate_1(double kinematic_viscosity, double wall_distance, double friction_velocity, int integration_mode)
Integrates eddy viscosity profile from wall to distance y.
#define FULLY_ROUGH_YPLUS
Fully rough regime y+ threshold.
double f_hydset(double kinematic_viscosity, double known_velocity, double wall_distance, double friction_velocity_guess, double roughness_height)
Residual function for friction velocity equation (log-law with roughness)
double E_coeff(double friction_velocity, double roughness_height, double kinematic_viscosity)
Computes roughness-modified log-law coefficient E.
#define KAPPA
von Karman constant (universal turbulence constant)
double nu_t(double yplus)
Computes turbulent eddy viscosity ratio (ν_t / ν)
double df_hydset(double kinematic_viscosity, double known_velocity, double wall_distance, double friction_velocity_guess, double roughness_height)
Numerical derivative of residual function.
double find_utau_Werner(double kinematic_viscosity, double velocity, double wall_distance, double initial_guess)
Solves for friction velocity using Werner-Wengle wall function.
void freeslip(UserCtx *user, double distance_reference, double distance_boundary, Cmpnts velocity_wall, Cmpnts velocity_reference, Cmpnts *velocity_boundary, double normal_x, double normal_y, double normal_z)
Applies free-slip wall boundary condition.